Пример #1
0
        public ExitCode Analyzing()
        {
            CharStream_.Reset();
            CurrentLine_ = 1;
            var Tokens = new List <Token>();

            while (!CharStream_.IsEnd())
            {
                var Tok = ParseToken();
                if (Tok.Type == TokenType.None)
                {
                    continue;
                }
                if (Tok.Type == TokenType.Error)
                {
                    return(new ExitUnexpectedSymbolCode(Tok));
                }
                Tokens.Add(Tok);
            }

            TokenStream_ = new TokenStream(Tokens.ToArray());
            return(ExitCode.Successful);
        }
Пример #2
0
        public bool Analyzing()
        {
            CharsStream_.Reset();
            CurrentLine_      = 1;
            CurrentLineIndex_ = 0;
            var Tokens = new List <Token>();

            while (!CharsStream_.IsEnd())
            {
                var Tok = ParseToken();
                if (Tok.Type_ == TokenType.None)
                {
                    continue;
                }
                if (Tok.Type_ == TokenType.Error)
                {
                    return(false);
                }
                Tokens.Add(Tok);
            }

            TokensStream_ = new TokenStream(Tokens.ToArray());
            return(true);
        }