public void Visit(TokenNumber tok) { if (tok.Line < FromLine || tok.Line > ToLine) { return; } //Npp.StyleText((int)TextStyle.Default, tok.StartPosition, tok.EndPosition); }
public Token NextToken() { Token token = null; if (ptr >= Text.Length) { token = new Token(TokenType.END_OF_STREAM); goto done; } char currentChar = Text[ptr++]; switch (currentChar) { case '+': token = new Token(TokenType.PLUS); break; default: if (char.IsDigit(currentChar)) { string numStr = ""; numStr += currentChar; while (ptr < Text.Length && char.IsDigit(Text[ptr])) { numStr += Text[ptr]; ptr++; } double value = double.Parse(numStr); token = new TokenNumber(value); } else if (char.IsLetter(currentChar) || currentChar == '_') { string ident = ""; ident += currentChar; while (ptr < Text.Length && char.IsDigit(Text[ptr]) || currentChar == '_') { ident += Text[ptr]; ptr++; } token = new TokenIdentifier(ident); } break; } if (token == null) { token = new Token(TokenType.UNKNOWN); } done: return(token); }
public void Visit(TokenNumber tok) { AppendEverything(tok); NbItems++; }
public override string ToString() { return(TokenNumber.ToString()); }
public void Visit(TokenNumber tok) { SetStyling(tok.EndPosition - tok.StartPosition, SciStyleId.Number); }