public static void IsFalseTest(string value, bool expectedResult) { var result = StringValidator.IsFalse(value); Assert.AreEqual(expectedResult, result); }
public Token NextToken() { var stream = this.Stream; var peek = stream.Peek(); switch (peek.Value) { case '$': return(Lexer.ReadAliasIdentifierToken(stream)); case ']': return(Lexer.ReadAttributeCloseToken(stream)); case '[': return(Lexer.ReadAttributeOpenToken(stream)); case '}': return(Lexer.ReadBlockCloseToken(stream)); case '{': return(Lexer.ReadBlockOpenToken(stream)); case ':': return(Lexer.ReadColonToken(stream)); case ',': return(Lexer.ReadCommaToken(stream)); case '/': return(Lexer.ReadCommentToken(stream)); case '=': return(Lexer.ReadEqualsOperatorToken(stream)); case ')': return(Lexer.ReadParenthesesCloseToken(stream)); case '(': return(Lexer.ReadParenthesesOpenToken(stream)); case '#': return(Lexer.ReadPragmaToken(stream)); case ';': return(Lexer.ReadStatementEndToken(stream)); case '"': return(Lexer.ReadStringLiteralToken(stream)); default: if (StringValidator.IsWhitespace(peek.Value)) { return(Lexer.ReadWhitespaceToken(stream)); } else if (StringValidator.IsFirstIdentifierChar(peek.Value)) { var identifier = Lexer.ReadIdentifierToken(stream); if (StringValidator.IsFalse(identifier.Name)) { /// A.17.6 Boolean value /// /// booleanValue = TRUE / FALSE /// /// FALSE = "false" ; keyword: case insensitive /// TRUE = "true" ; keyword: case insensitive return(new BooleanLiteralToken(identifier.Extent, false)); } else if (StringValidator.IsTrue(identifier.Name)) { /// A.17.6 Boolean value /// /// booleanValue = TRUE / FALSE /// /// FALSE = "false" ; keyword: case insensitive /// TRUE = "true" ; keyword: case insensitive return(new BooleanLiteralToken(identifier.Extent, true)); } else if (StringValidator.IsNull(identifier.Name)) { /// A.17.7 Null value /// /// nullValue = NULL /// /// NULL = "null" ; keyword: case insensitive /// ; second return(new NullLiteralToken(identifier.Extent)); } else { return(identifier); } } else if ((peek.Value == '+') || (peek.Value == '-') || (StringValidator.IsDecimalDigit(peek.Value))) { return(Lexer.ReadNumericLiteralToken(stream)); } else { throw new UnexpectedCharacterException(peek); } } }