Ejemplo n.º 1
0
        public override Exp Parse()
        {
            var           wordTree  = this.ExpContext.ExpWordDictionary;
            WordSegmenter segmenter = new WordSegmenter(wordTree);
            List <Token>  tokens    = new List <Token>();

            foreach (var tok in RawTokens)
            {
                if (tok.Kind == TokenKind.Ident)
                {
                    Token[] newTokens = segmenter.Split(tok);
                    tokens.AddRange(newTokens);
                }
                else if (tok.Kind != TokenKind.NewLine)
                {
                    tokens.Add(tok);
                }
            }
            ExpParser parser = new ExpParser();
            Exp       exp    = parser.Parse(tokens, this.FileContext);

            //exp.ParentExp = this.ParentExp;
            exp.SetContext(this.ExpContext);
            return(exp);
        }
Ejemplo n.º 2
0
        private ParseResult ParseNameBySegmenter(Token token, IWordDictionary collection)
        {
            //WordCollection nameManager = this.procContext.ClassContext.FileContext.GetNameDimWordManger();
            WordSegmenter segmenter = new WordSegmenter(collection);

            Token[] newTokens = segmenter.Split(token);
            if (newTokens.Length == 2)
            {
                string argTypeName = newTokens[0].GetText();
                var    ArgType     = ZTypeManager.GetByMarkName(argTypeName)[0] as ZType;
                var    result      = new ParseResult()
                {
                    TypeName = argTypeName, ZType = ArgType, VarName = newTokens[1].GetText()
                };
                return(result);
            }
            else
            {
                return(null);
            }
        }