示例#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);
        }
示例#2
0
        private SpecNode ParseSpecNode()
        {
            var res = new SpecNode();

            res.Func = SkipToken().Substring(1);
            if (IsSymbol("("))
            {
                bool was = false;
                NextToken();
                while (!IsSymbol(")"))
                {
                    if (was)
                    {
                        SkipSymbol(",");
                    }
                    if (Current == TokenType.LowerCaseIdent || Current == TokenType.UpperCaseIdent || Current == TokenType.StringSingle)
                    {
                        res.Args.Add(SkipToken());
                    }
                    else
                    {
                        throw CreateParseError("DAE-00356 identifier expected");
                    }
                    was = true;
                }
                SkipSymbol(")");
            }
            return(res);
        }
示例#3
0
        private RuleItem ParseRuleItem()
        {
            SpecNode nodeid = ParseSpecNode("nodeid");
            RuleItem res    = ParseRuleItemCore();

            if (nodeid != null)
            {
                res.CodeId = nodeid.Args[0];
            }
            return(res);
        }