예제 #1
0
 void add(Synt synt,const Element *base)
  {
   Element T(synt);
   ulen K=synt.getIndex();
   
   collector.append_fill(K,N,T);
   collector.append_fill(K,N,Range(base+K,1));
  }
예제 #2
0
ulen TopLang::makeRules(Collector<RuleRec> &collector,const CondLangBase::RuleDesc &rule)
 {
  ulen ret=0;
  
  DynArray<ElementRecExt> temp(DoCast(rule.args.len),rule.args.ptr);
  
  {
   ulen index=0; 
    
   for(auto &rec : temp ) rec.element_index=index++;
  }
  
  auto args=Range(temp);
  
  do
    {
     if( TestCond(Range_const(args),rule.cond) )
       {
        collector.append_fill(makeRuleName(rule.name,Range_const(args)),rule.index,Range_const(args));
      
        ret++;
       }
    }
  while( Next(args) );
  
  return ret;
 }
예제 #3
0
 void add(Rule rule)
  {
   ulen K=rule.getRet().getIndex();
   
   PtrLen<const Element> args=rule.getArgs();
  
   if( +args )
     {
      Vertex cur(K);
      
      Element E=*args;
      
      ++args;
      
      E.applyForSynt( [=] (Synt synt) { collector.append_fill(cur,synt.getIndex(),args); } );
      
      if( +args )
        for(;;)
          {
           collector.append_fill(cur,N,E,args);
           
           Element F=*args;
           
           ++args;
           
           F.applyForSynt( [=] (Synt synt) { collector.append_fill(cur,synt.getIndex(),E,args); } );
            
           if( !args ) break;
            
           Vertex v=extra.get();
            
           collector.append_fill(cur,v,E);
            
           cur=v;
           E=F;
          }
     }
  }