Esempio n. 1
0
        Token AddToken(string value, TokenType tokentype, bool resolved, string originalvalue)
        {
            CurrentToken      = new Token(value, tokentype, CurrentToken, resolved);
            CurrentToken.Line = Assembler.currentLine;
            tokens.Add(CurrentToken);
            TokenizerEventArgs e = new TokenizerEventArgs(CurrentChar, CurrentToken);

            TokenFound?.Invoke(this, e);
            CurrentChar                = e.CurrentChar;
            CurrentToken.Row           = row;
            CurrentToken.Col           = CurrentChar - originalvalue.Length;
            CurrentToken.OriginalValue = originalvalue;
            return(CurrentToken);
        }
Esempio n. 2
0
        Token AddToken(string value, TokenType tokentype)
        {
            if (value == "\r")
            {
                value = "";
            }
            CurrentToken      = new Token(value, tokentype, CurrentToken);
            CurrentToken.Line = Assembler.currentLine;
            tokens.Add(CurrentToken);
            TokenizerEventArgs e = new TokenizerEventArgs(CurrentChar, CurrentToken);

            TokenFound?.Invoke(this, e);
            CurrentChar                = e.CurrentChar;
            CurrentToken               = e.Token;
            CurrentToken.Row           = row;
            CurrentToken.Col           = CurrentChar - value.Length;
            CurrentToken.OriginalValue = value;

            return(CurrentToken);
        }
Esempio n. 3
0
 protected virtual void OnTokenFound(TToken token)
 {
     TokenFound?.Invoke(token);
 }