Exemple #1
0
        public Rule ParseRule()
        {
            string name = ParseIdent();

            SkipSymbol(":=");

            SpecNode call = ParseSpecNode("call");

            if (call != null)
            {
                var res = new CallRule();
                res.Name     = name;
                res.FuncName = call.Args[0];
                res.TypeName = call.Args[1];
                SpecNode args = ParseSpecNode("args");
                if (args != null)
                {
                    res.CallArgs = args.Args;
                }
                SkipSymbol(";");
                return(res);
            }

            var      cres     = new ChainRule();
            SpecNode spec_cls = ParseSpecNode("class");

            if (spec_cls != null)
            {
                cres.ClassName = spec_cls.Args[0];
            }
            cres.Name  = name;
            cres.Chain = ParseRuleChain();
            SkipSymbol(";");
            return(cres);
        }
Exemple #2
0
 public RuleCompiler(ParserCompiler pc, ChainRule rule)
 {
     Rule = rule;
     PC   = pc;
 }