Exemple #1
0
        protected void beginParse()
        {
            while (true)
            {
                if (charSrc.isEnd())
                {
                    return;
                }
                if (charSrc.isBlockEnd())
                {
                    int step = 13 + this.sbname.Length;
                    charSrc.move(step);
                    return;
                }

                VarLabelParsed objVar = VarLabel.GetVarLabelValue(charSrc);
                if (objVar != null)
                {
                    Token token = new VarBlockParser(objVar, this.charSrc).getToken();
                    _tokens.Add(token);
                    continue;
                }
                // block
                else if (charSrc.isBlock())
                {
                    BlockParser p = new BlockParser(this.charSrc);
                    p.parse();

                    Token token = p.getToken();
                    _tokens.Add(token);
                    continue;
                }
                else if (charSrc.isCode())
                {
                    CodeParser p = new CodeParser(this.charSrc);
                    p.parse();

                    Token token = p.getToken();
                    _tokens.Add(token);
                    continue;
                }
                else if (charSrc.isFunction())
                {
                    FunctionParser p = new FunctionParser(this.charSrc);
                    p.parse();

                    Token token = p.getToken();
                    _tokens.Add(token);
                    continue;
                }

                // string
                Token stoken = new StringBlockParser(this.charSrc).getToken();
                _tokens.Add(stoken);

                // 再次检查
                if (charSrc.isEnd())
                {
                    return;
                }


                charSrc.move();

                // 如果是区块结束,也 return
                if (charSrc.isBlockEnd())
                {
                    int step = 13 + this.sbname.Length;
                    charSrc.move(step);
                    return;
                }
            }
        }