Example #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);
        }
Example #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);
        }
Example #3
0
 protected virtual void OnTokenFound(TToken token)
 {
     TokenFound?.Invoke(token);
 }