Example #1
0
 public Token(Scorpio.Compiler.TokenType tokenType, object lexeme, int sourceLine, int sourceChar)
 {
     this.Type       = tokenType;
     this.Lexeme     = lexeme;
     this.SourceLine = sourceLine + 1;
     this.SourceChar = sourceChar;
 }
Example #2
0
        private ScriptExecutable ParseStatementBlock(Executable_Block block, bool readLeftBrace, Scorpio.Compiler.TokenType finished)
        {
            this.BeginExecutable(block);
            if (readLeftBrace && (this.PeekToken().Type != Scorpio.Compiler.TokenType.LeftBrace))
            {
                this.ParseStatement();
                if (this.PeekToken().Type == Scorpio.Compiler.TokenType.SemiColon)
                {
                    this.ReadToken();
                }
            }
            else
            {
                if (readLeftBrace)
                {
                    this.ReadLeftBrace();
                }
                while (this.HasMoreTokens())
                {
                    if (this.ReadToken().Type == finished)
                    {
                        break;
                    }
                    this.UndoToken();
                    this.ParseStatement();
                }
            }
            ScriptExecutable scriptExecutable = this.m_scriptExecutable;

            scriptExecutable.EndScriptInstruction();
            this.EndExecutable();
            return(scriptExecutable);
        }
Example #3
0
 private void AddToken(Scorpio.Compiler.TokenType type, object lexeme)
 {
     this.m_listTokens.Add(new Token(type, lexeme, this.m_iSourceLine, this.m_iSourceChar));
     this.lexState = LexState.None;
 }
Example #4
0
 private void AddToken(Scorpio.Compiler.TokenType type)
 {
     this.AddToken(type, this.ch);
 }