public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { if (context.IsInSheetName || context.IsInSheetName) { return(false); } if (tokenSeparator.TokenTypeIsSet(TokenType.OpeningBracket)) { context.AppendToCurrentToken(c); context.BracketCount++; return(true); } if (tokenSeparator.TokenTypeIsSet(TokenType.ClosingBracket)) { context.AppendToCurrentToken(c); context.BracketCount--; return(true); } if (context.BracketCount > 0) { context.AppendToCurrentToken(c); return(true); } return(false); }
public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { if (context.IsInSheetName) { if (IsDoubleQuote(tokenSeparator, tokenIndexProvider.Index, context)) { tokenIndexProvider.MoveIndexPointerForward(); context.AppendToCurrentToken(c); return true; } if (tokenSeparator.TokenType != TokenType.WorksheetName) { context.AppendToCurrentToken(c); return true; } } if (tokenSeparator.TokenType == TokenType.WorksheetName) { if (context.LastToken != null && context.LastToken.TokenType == TokenType.WorksheetName) { context.AddToken(!context.CurrentTokenHasValue ? new Token(string.Empty, TokenType.WorksheetNameContent) : new Token(context.CurrentToken, TokenType.WorksheetNameContent)); } context.AddToken(new Token("'", TokenType.WorksheetName)); context.ToggleIsInSheetName(); context.NewToken(); return true; } return false; }
private static void TryConsumeComment(TokenizerContext context) { if (context.ptr + 1 >= context.input.Length) { return; } if (!(context.input[context.ptr] == '/' && context.input[context.ptr + 1] == '/')) { return; } while (context.HasMore()) { char current = context.input[context.ptr]; if (current == '\n') { TryConsumeWhiteSpace(context); TryConsumeComment(context); return; } context.Advance(); } }
public ParserContext(ParserRules rules, TokenizerContext reader) { this.rules = rules; this.reader = reader; reader.Next(); }
public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { if (context.IsInSheetName) { if (IsDoubleQuote(tokenSeparator, tokenIndexProvider.Index, context)) { tokenIndexProvider.MoveIndexPointerForward(); context.AppendToCurrentToken(c); return(true); } if (tokenSeparator.TokenType != TokenType.WorksheetQuote) { context.AppendToCurrentToken(c); return(true); } } if (tokenSeparator.TokenType == TokenType.WorksheetQuote) { if (context.LastToken != null && context.LastToken.TokenType == TokenType.WorksheetQuote) { context.AddToken(!context.CurrentTokenHasValue ? new Token(string.Empty, TokenType.WorksheetName) : new Token(context.CurrentToken, TokenType.WorksheetName)); } context.AddToken(new Token("'", TokenType.WorksheetQuote)); context.ToggleIsInSheetName(); context.NewToken(); return(true); } return(false); }
private void InitHandler(TokenizerContext context) { var parsingContext = ParsingContext.Create(); var tokenFactory = new TokenFactory(parsingContext.Configuration.FunctionRepository, null); _handler = new TokenHandler(_tokenizerContext, tokenFactory, new TokenSeparatorProvider()); }
private bool IsPartOfMultipleCharSeparator(TokenizerContext context, char c) { var lastToken = context.LastToken != null ? context.LastToken.Value : string.Empty; return _tokenSeparatorProvider.IsOperator(lastToken) && _tokenSeparatorProvider.IsPossibleLastPartOfMultipleCharOperator(c.ToString(CultureInfo.InvariantCulture)) && !context.CurrentTokenHasValue; }
public void Init() { var parsingContext = ParsingContext.Create(); var tokenFactory = new TokenFactory(parsingContext.Configuration.FunctionRepository, null); _tokenizerContext = new TokenizerContext("test", null, tokenFactory); _handler = _tokenizerContext.CreateHandler(); }
private bool IsPartOfMultipleCharSeparator(TokenizerContext context, char c) { var lastToken = context.LastToken != null ? context.LastToken.Value : string.Empty; return(_tokenSeparatorProvider.IsOperator(lastToken) && _tokenSeparatorProvider.IsPossibleLastPartOfMultipleCharOperator(c.ToString()) && !context.CurrentTokenHasValue); }
/// <summary> /// Handles a tokenseparator. /// </summary> /// <param name="c"></param> /// <param name="tokenSeparator"></param> /// <param name="context"></param> /// <param name="tokenIndexProvider"></param> /// <returns>Returns true if the tokenseparator was handled.</returns> public static bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { foreach(var handler in _handlers) { if(handler.Handle(c, tokenSeparator, context, tokenIndexProvider)) { return true; } } return false; }
public TokenizerContext Tokenize(HeaderDefinition header) { _context = new TokenizerContext(); NamespaceTreeNode namespaceTree = HeaderNamespaceTree.GetTree(header); IToken namespaceToken = TokenizeNamespace(namespaceTree); _context.Add(namespaceToken); return(_context); }
/// <summary> /// Handles a tokenseparator. /// </summary> /// <param name="c"></param> /// <param name="tokenSeparator"></param> /// <param name="context"></param> /// <param name="tokenIndexProvider"></param> /// <returns>Returns true if the tokenseparator was handled.</returns> public static bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { foreach (var handler in _handlers) { if (handler.Handle(c, tokenSeparator, context, tokenIndexProvider)) { return(true); } } return(false); }
private static void TryConsumeWhiteSpace(TokenizerContext context) { if (context.IsConsumed()) { return; } while (context.HasMore() && char.IsWhiteSpace(context.input[context.ptr])) { context.Advance(); } }
public void Write(string fullPath, TokenizerContext context) { _writerContext = context; using (var stream = File.Create(fullPath)) { using (_writer = new StreamWriter(stream)) { WriteTokens(); } } }
private static void TryReadDigit(TokenizerContext context, List <StyleToken> output) { if (context.IsConsumed()) { return; } bool foundDot = false; int startIndex = context.ptr; context.Save(); if (context.input[context.ptr] == '-') { context.Advance(); } if (!char.IsDigit(context.input[context.ptr])) { context.Restore(); return; } // 1 // 1.4 // 1.4f while (context.HasMore() && (char.IsDigit(context.input[context.ptr]) || (!foundDot && context.input[context.ptr] == '.'))) { if (context.input[context.ptr] == '.') { foundDot = true; } context.Advance(); } int length = context.ptr - startIndex; string digit = context.input.Substring(startIndex, length); context.Restore(); output.Add(new StyleToken(StyleTokenType.Number, digit, context.line, context.column)); context.Advance(length); // a trailing f should be considered part of a float, except the f is followed by more characters like in a unit '2fr' // we don't want it to appear in the value, though. If it's ever used to differentiate something we should add a // more specific type like StyleTokenType.Float? Also what about 'm' and 'd' postfixes? if (context.HasMore() && context.input[context.ptr] == 'f' && context.HasMuchMore(1) && !char.IsLetter(context.input[context.ptr + 1])) { context.Advance(); } TryConsumeWhiteSpace(context); }
static Result ReadNumber(ref TokenizerContext x) { for (int i = 1; i < x.Span.Length; i++) { if (!IsNumeric(x.Span[i])) { x.Emit(Token.Number, 0, i); return(Ok(i, x.Pop())); } } return(Underrun); }
public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { // two operators in sequence could be "<=" or ">=" if (IsPartOfMultipleCharSeparator(context, c)) { var sOp = context.LastToken.Value + c.ToString(); var op = _tokenSeparatorProvider.Tokens[sOp]; context.ReplaceLastToken(op); context.NewToken(); return(true); } return(false); }
public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { // two operators in sequence could be "<=" or ">=" if (IsPartOfMultipleCharSeparator(context, c)) { var sOp = context.LastToken.Value + c.ToString(CultureInfo.InvariantCulture); var op = _tokenSeparatorProvider.Tokens[sOp]; context.ReplaceLastToken(op); context.NewToken(); return true; } return false; }
private void WriteHeader(HeaderDefinition header) { if (header.Nodes.Count == 0) { return; } var fileWriter = new CSharpFileTokenizer(); TokenizerContext context = fileWriter.Tokenize(header); var tokenWriter = new TokenWriter(); tokenWriter.Write(header.FullPath, context); }
static Result SkipWhitespace(ref TokenizerContext x) { int i = 0; for (; i < x.Span.Length; i++) { if (!IsWhitespace(x.Span[i])) { break; } } return(Ok(i, x.Mode)); }
private bool IsPartOfMultipleCharSeparator(TokenizerContext context, char c) { var lastTokenVal = string.Empty; if (!context.LastToken.HasValue) { return(false); } var lastToken = context.LastToken.Value; lastTokenVal = lastToken.Value ?? string.Empty; return(_tokenSeparatorProvider.IsOperator(lastTokenVal) && _tokenSeparatorProvider.IsPossibleLastPartOfMultipleCharOperator(c.ToString()) && !context.CurrentTokenHasValue); }
private static void TryReadCharacters(TokenizerContext context, string match, StyleTokenType styleTokenType, List <StyleToken> output) { if (context.ptr + match.Length > context.input.Length) { return; } for (int i = 0; i < match.Length; i++) { if (context.input[context.ptr + i] != match[i]) { return; } } output.Add(new StyleToken(styleTokenType, match, context.line, context.column)); TryConsumeWhiteSpace(context.Advance(match.Length)); }
private static void TryReadString(TokenizerContext context, List <StyleToken> output) { if (context.IsConsumed()) { return; } if (context.input[context.ptr] != '"') { return; } int start = context.ptr; context.Save(); context.Advance(); while (context.HasMore() && context.input[context.ptr] != '"') { context.Advance(); } if (context.IsConsumed()) { context.Restore(); return; } if (context.input[context.ptr] != '"') { context.Restore(); return; } context.Advance(); // strip the quotes // "abc" // 01234 int length = context.ptr - start; string substring = context.input.Substring(start + 1, length - 2); context.Restore(); output.Add(new StyleToken(StyleTokenType.String, substring, context.line, context.column)); context.Advance(length); TryConsumeWhiteSpace(context); }
private static void TryConsumeWhiteSpace(TokenizerContext context) { if (context.IsConsumed()) { return; } while (context.ptr < context.input.Length) { char c = context.input[context.ptr]; if (!(c == ' ' || c >= '\t' && c <= '\r' || (c == ' ' || c == '\x0085'))) { break; } context.Advance(); } }
static Result ReadString(ref TokenizerContext x) { int i = 0; for (; i < x.Span.Length; i++) { switch (x.Span[i]) { case '\\': //BUT! what about "\\", eh??? i++; break; case '"': x.Emit(Token.StringEnd, 0, i); return(Ok(i + 1, x.Pop())); } } x.Emit(Token.StringPart, 0, i); //but only if i > 1...! return(Underrun); }
public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { if (tokenSeparator.TokenType == TokenType.OpeningBracket) { context.AppendToCurrentToken(c); context.BracketCount++; return true; } if (tokenSeparator.TokenType == TokenType.ClosingBracket) { context.AppendToCurrentToken(c); context.BracketCount--; return true; } if (context.BracketCount > 0) { context.AppendToCurrentToken(c); return true; } return false; }
private static void TryReadCharacterSequence(TokenizerContext context, string match1, string match2, ExpressionTokenType expressionTokenType, StructList <ExpressionToken> output) { if (context.ptr + match1.Length > context.input.Length) { return; } int ptr = context.ptr; for (int i = 0; i < match1.Length; i++) { if (context.input[ptr++] != match1[i]) { return; } } while (ptr < context.input.Length) { if (char.IsWhiteSpace(context.input[ptr])) { ptr++; } else { break; } } for (int i = 0; i < match2.Length; i++) { if (context.input[ptr++] != match2[i]) { return; } } output.Add(new ExpressionToken(expressionTokenType, match1 + " " + match2, context.line, context.column)); TryConsumeWhiteSpace(context.Advance(ptr - context.ptr)); }
public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { if (context.IsInString) { if (IsDoubleQuote(tokenSeparator, tokenIndexProvider.Index, context)) { tokenIndexProvider.MoveIndexPointerForward(); context.AppendToCurrentToken(c); return(true); } if (!tokenSeparator.TokenTypeIsSet(TokenType.String)) { context.AppendToCurrentToken(c); return(true); } } if (tokenSeparator.TokenTypeIsSet(TokenType.String)) { if (context.LastToken != null && context.LastToken.Value.TokenTypeIsSet(TokenType.OpeningEnumerable)) { context.AppendToCurrentToken(c); context.ToggleIsInString(); return(true); } if (context.LastToken != null && context.LastToken.Value.TokenTypeIsSet(TokenType.String)) { context.AddToken(!context.CurrentTokenHasValue ? new Token(string.Empty, TokenType.StringContent) : new Token(context.CurrentToken, TokenType.StringContent)); } context.AddToken(new Token("\"", TokenType.String)); context.ToggleIsInString(); context.NewToken(); return(true); } return(false); }
private static void TryReadValue(TokenizerContext context, List <StyleToken> output) { if (context.IsConsumed()) { return; } if (context.input[context.ptr] != '=') { return; } context.Save(); context.Advance(); TryConsumeWhiteSpace(context); int start = context.ptr; while (context.HasMore() && context.input[context.ptr] != ';' && context.input[context.ptr] != '\n') { if (context.input[context.ptr] == '/' && context.ptr + 1 < context.input.Length && context.input[context.ptr + 1] == '/') { break; } context.Advance(); } if (context.IsConsumed()) { context.Restore(); return; } string value = context.input.Substring(start, context.ptr - start); output.Add(new StyleToken(StyleTokenType.Value, value, context.line, context.column)); TryConsumeWhiteSpace(context); }
private static ExpressionToken TransformIdentifierToTokenType(TokenizerContext context, string identifier) { switch (identifier) { case "var": return(new ExpressionToken(ExpressionTokenType.Var, identifier, context.line, context.column)); case "if": return(new ExpressionToken(ExpressionTokenType.If, identifier, context.line, context.column)); case "else": return(new ExpressionToken(ExpressionTokenType.Else, identifier, context.line, context.column)); case "for": return(new ExpressionToken(ExpressionTokenType.For, identifier, context.line, context.column)); case "while": return(new ExpressionToken(ExpressionTokenType.While, identifier, context.line, context.column)); case "return": return(new ExpressionToken(ExpressionTokenType.Return, identifier, context.line, context.column)); case "null": return(new ExpressionToken(ExpressionTokenType.Null, identifier, context.line, context.column)); case "true": return(new ExpressionToken(ExpressionTokenType.Boolean, identifier, context.line, context.column)); case "false": return(new ExpressionToken(ExpressionTokenType.Boolean, identifier, context.line, context.column)); case "as": return(new ExpressionToken(ExpressionTokenType.As, identifier, context.line, context.column)); case "is": return(new ExpressionToken(ExpressionTokenType.Is, identifier, context.line, context.column)); case "new": return(new ExpressionToken(ExpressionTokenType.New, identifier, context.line, context.column)); case "typeof": return(new ExpressionToken(ExpressionTokenType.TypeOf, identifier, context.line, context.column)); case "default": return(new ExpressionToken(ExpressionTokenType.Default, identifier, context.line, context.column)); default: { return(new ExpressionToken(ExpressionTokenType.Identifier, identifier, context.line, context.column)); } } }
private static void TryReadIdentifier(TokenizerContext context, List <StyleToken> output) { if (context.IsConsumed()) { return; } int start = context.ptr; char first = context.input[context.ptr]; if (!char.IsLetter(first) && first != '_' && first != '$') { return; } context.Save(); while (context.HasMore()) { char character = context.input[context.ptr]; if (!(char.IsLetterOrDigit(character) || character == '_' || character == '-' || character == '$')) { break; } context.Advance(); } int length = context.ptr - start; string identifier = context.input.Substring(start, length); context.Restore(); output.Add(TransformIdentifierToTokenType(context, identifier)); context.Advance(length); TryConsumeWhiteSpace(context); }
/// <summary> /// Handles the single-quote character for worksheet names. /// </summary> /// <param name="c">The character to handle.</param> /// <param name="tokenSeparator">The token separator to handle.</param> /// <param name="context">The tokenization context.</param> /// <param name="tokenIndexProvider">The <see cref="ITokenIndexProvider"/>.</param> /// <returns>True if the token separator was handled, false otherwise.</returns> public override bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider) { if (context.IsInSheetName) { if (base.IsDoubleQuote(tokenSeparator, tokenIndexProvider.Index, context)) { tokenIndexProvider.MoveIndexPointerForward(); context.AppendToCurrentToken(c); return(true); } if (tokenSeparator.TokenType != TokenType.WorksheetName) { context.AppendToCurrentToken(c); return(true); } } if (tokenSeparator.TokenType == TokenType.WorksheetName) { context.AppendToCurrentToken(c); context.ToggleIsInSheetName(); return(true); } return(false); }
private static void TryReadHashColor(TokenizerContext context, List <StyleToken> output) { if (context.IsConsumed()) { return; } if (context.input[context.ptr] != '#') { return; } int start = context.ptr; while (context.HasMore() && context.input[context.ptr] != ';' && !char.IsWhiteSpace(context.input[context.ptr])) { context.Advance(); } string colorHash = context.input.Substring(start, context.ptr - start); output.Add(new StyleToken(StyleTokenType.HashColor, colorHash, context.line, context.column)); TryConsumeWhiteSpace(context); }
protected VrmlTokenizerState(TokenizerContext context) { this.context = context; this.tokenizer = context.Tokenizer; }
public LineCommentState(TokenizerContext context) : base(context) { }
protected bool IsDoubleQuote(Token tokenSeparator, int formulaCharIndex, TokenizerContext context) { return tokenSeparator.TokenType == TokenType.String && formulaCharIndex + 1 < context.FormulaChars.Length && context.FormulaChars[formulaCharIndex + 1] == '\"'; }
public abstract bool Handle(char c, Token tokenSeparator, TokenizerContext context, ITokenIndexProvider tokenIndexProvider);
// todo take optional file / line number for error message public static List <StyleToken> Tokenize(string input, List <StyleToken> retn = null) { List <StyleToken> output = retn ?? new List <StyleToken>(); TokenizerContext context = new TokenizerContext(input); TryConsumeWhiteSpace(context); while (context.ptr < input.Length) { int start = context.ptr; TryConsumeComment(context); TryReadCharacters(context, "@", StyleTokenType.At, output); TryReadCharacters(context, ":", StyleTokenType.Colon, output); TryReadCharacters(context, "==", StyleTokenType.Equals, output); TryReadCharacters(context, "!=", StyleTokenType.NotEquals, output); TryReadCharacters(context, "!", StyleTokenType.BooleanNot, output); TryReadCharacters(context, "=", StyleTokenType.EqualSign, output); TryReadCharacters(context, ">", StyleTokenType.GreaterThan, output); TryReadCharacters(context, "<", StyleTokenType.LessThan, output); TryReadCharacters(context, "&&", StyleTokenType.BooleanAnd, output); TryReadCharacters(context, "||", StyleTokenType.BooleanOr, output); TryReadCharacters(context, "$", StyleTokenType.Dollar, output); TryReadCharacters(context, "+", StyleTokenType.Plus, output); // If the next character is a minus sign then we want to try to parse a single number token TryReadDigit(context, output); TryReadCharacters(context, "-", StyleTokenType.Minus, output); TryReadCharacters(context, "/", StyleTokenType.Divide, output); TryReadCharacters(context, "*", StyleTokenType.Times, output); TryReadCharacters(context, "%", StyleTokenType.Mod, output); TryReadCharacters(context, "?", StyleTokenType.QuestionMark, output); TryReadCharacters(context, ".", StyleTokenType.Dot, output); TryReadCharacters(context, ",", StyleTokenType.Comma, output); TryReadCharacters(context, "(", StyleTokenType.ParenOpen, output); TryReadCharacters(context, ")", StyleTokenType.ParenClose, output); TryReadCharacters(context, "[", StyleTokenType.BracketOpen, output); TryReadCharacters(context, "]", StyleTokenType.BracketClose, output); TryReadCharacters(context, "{", StyleTokenType.BracesOpen, output); TryReadCharacters(context, "}", StyleTokenType.BracesClose, output); TryReadHashColor(context, output); TryReadDigit(context, output); TryReadString(context, output); TryReadIdentifier(context, output); TryConsumeWhiteSpace(context); TryReadCharacters(context, ";\n", StyleTokenType.EndStatement, output); TryReadCharacters(context, ";", StyleTokenType.EndStatement, output); TryReadCharacters(context, "\n", StyleTokenType.EndStatement, output); if (context.ptr == start && context.ptr < input.Length) { int nextNewLine = input.IndexOf("\n", context.ptr + 1, input.Length - context.ptr - 1, StringComparison.Ordinal); nextNewLine = Mathf.Clamp(nextNewLine, context.ptr + 1, input.Length - 1); string errorLine = input.Substring(context.ptr, nextNewLine - context.ptr); throw new ParseException($"Tokenizer failed at line {context.line}, column {context.column}.\n" + $" Processed {input.Substring(0, context.ptr)}\n" + $" ...but then got stuck on {errorLine}.\n"); } } return(output); }
private static StyleToken TransformIdentifierToTokenType(TokenizerContext context, string identifier) { string identifierLowerCase = identifier.ToLower(); switch (identifierLowerCase) { case "use": return(new StyleToken(StyleTokenType.Use, identifierLowerCase, context.line, context.column)); case "and": return(new StyleToken(StyleTokenType.And, identifierLowerCase, context.line, context.column)); case "not": return(new StyleToken(StyleTokenType.Not, identifierLowerCase, context.line, context.column)); case "style": return(new StyleToken(StyleTokenType.Style, identifierLowerCase, context.line, context.column)); case "animation": return(new StyleToken(StyleTokenType.Animation, identifierLowerCase, context.line, context.column)); case "spritesheet": return(new StyleToken(StyleTokenType.SpriteSheet, identifierLowerCase, context.line, context.column)); case "texture": return(new StyleToken(StyleTokenType.Texture, identifierLowerCase, context.line, context.column)); case "sound": return(new StyleToken(StyleTokenType.Sound, identifierLowerCase, context.line, context.column)); case "cursor": return(new StyleToken(StyleTokenType.Cursor, identifierLowerCase, context.line, context.column)); case "export": return(new StyleToken(StyleTokenType.Export, identifierLowerCase, context.line, context.column)); case "const": return(new StyleToken(StyleTokenType.Const, identifierLowerCase, context.line, context.column)); case "import": return(new StyleToken(StyleTokenType.Import, identifierLowerCase, context.line, context.column)); case "attr": return(new StyleToken(StyleTokenType.AttributeSpecifier, identifierLowerCase, context.line, context.column)); case "true": return(new StyleToken(StyleTokenType.Boolean, identifierLowerCase, context.line, context.column)); case "false": return(new StyleToken(StyleTokenType.Boolean, identifierLowerCase, context.line, context.column)); case "from": return(new StyleToken(StyleTokenType.From, identifierLowerCase, context.line, context.column)); case "as": return(new StyleToken(StyleTokenType.As, identifierLowerCase, context.line, context.column)); case "rgba": return(new StyleToken(StyleTokenType.Rgba, identifierLowerCase, context.line, context.column)); case "rgb": return(new StyleToken(StyleTokenType.Rgb, identifierLowerCase, context.line, context.column)); case "url": return(new StyleToken(StyleTokenType.Url, identifierLowerCase, context.line, context.column)); case "enterexit": return(new StyleToken(StyleTokenType.EnterExit, identifierLowerCase, context.line, context.column)); case "exit": return(new StyleToken(StyleTokenType.Exit, identifierLowerCase, context.line, context.column)); case "enter": return(new StyleToken(StyleTokenType.Enter, identifierLowerCase, context.line, context.column)); case "run": return(new StyleToken(StyleTokenType.Run, identifierLowerCase, context.line, context.column)); case "pause": return(new StyleToken(StyleTokenType.Pause, identifierLowerCase, context.line, context.column)); case "stop": return(new StyleToken(StyleTokenType.Stop, identifierLowerCase, context.line, context.column)); default: { return(new StyleToken(StyleTokenType.Identifier, identifier, context.line, context.column)); } } }