public IToken PublishCurrentTokenString() { IToken tokenToReturn = null; switch (currentStringTokenType) { case TokenType.number: tokenToReturn = new NumberToken(tokenString); break; case TokenType.infixOperator: tokenToReturn = new OperatorToken(tokenString, TokenType.infixOperator); break; case TokenType.suffixOperator: tokenToReturn = new OperatorToken(tokenString, TokenType.suffixOperator); break; case TokenType.charString: tokenString = tokenString.ToUpper(); if (FunctionToken.Library.Contains(tokenString)) { tokenToReturn = new FunctionToken(tokenString); } else if (VariableToken.VariableLibrary.Contains(tokenString)) { tokenToReturn = new VariableToken(tokenString); } else if (UnitToken.Units.Contains(tokenString)) { tokenToReturn = new UnitToken(tokenString); } else if (KeywordToken.Keywords.Contains(tokenString)) { tokenToReturn = new KeywordToken(tokenString); } break; case TokenType.openBrace: tokenToReturn = new SyntaxToken(tokenString, TokenType.openBrace); break; case TokenType.closedBrace: tokenToReturn = new SyntaxToken(tokenString, TokenType.closedBrace); break; case TokenType.argSeperator: tokenToReturn = new SyntaxToken(tokenString, TokenType.argSeperator); break; } return(tokenToReturn); }
internal void AppendNumber(NumberToken token) { Complex tokenVal = token.TokenNumValue; TreeNode child = new TreeNode(); child.type = nodeType.number; child.val = tokenVal; child.name = tokenVal.ToString(); child.numericalEvaluation = true; children.Insert(0, child); //clear the static visualization output string: output = string.Empty; }
public IToken PublishCurrentTokenString() { IToken tokenToReturn = null ; switch (currentStringTokenType) { case TokenType.number: tokenToReturn = new NumberToken(tokenString); break; case TokenType.infixOperator: tokenToReturn = new OperatorToken(tokenString, TokenType.infixOperator); break; case TokenType.suffixOperator: tokenToReturn = new OperatorToken(tokenString, TokenType.suffixOperator); break; case TokenType.charString: tokenString = tokenString.ToUpper(); if (FunctionToken.Library.Contains(tokenString)) { tokenToReturn = new FunctionToken(tokenString); } else if (VariableToken.VariableLibrary.Contains(tokenString)) { tokenToReturn = new VariableToken(tokenString); } else if(UnitToken.Units.Contains(tokenString)){ tokenToReturn = new UnitToken(tokenString); } else if (KeywordToken.Keywords.Contains(tokenString)) { tokenToReturn = new KeywordToken(tokenString); } break; case TokenType.openBrace: tokenToReturn = new SyntaxToken(tokenString, TokenType.openBrace); break; case TokenType.closedBrace: tokenToReturn = new SyntaxToken(tokenString, TokenType.closedBrace); break; case TokenType.argSeperator: tokenToReturn = new SyntaxToken(tokenString, TokenType.argSeperator); break; } return tokenToReturn; }