private static bool IsMultiplier(StyleSyntaxToken token) { StyleSyntaxTokenType type = token.type; StyleSyntaxTokenType styleSyntaxTokenType = type; return(styleSyntaxTokenType - StyleSyntaxTokenType.Asterisk <= 4 || styleSyntaxTokenType == StyleSyntaxTokenType.OpenBrace); }
private static bool IsExpressionEnd(StyleSyntaxToken token) { StyleSyntaxTokenType type = token.type; StyleSyntaxTokenType styleSyntaxTokenType = type; return(styleSyntaxTokenType == StyleSyntaxTokenType.CloseBracket || styleSyntaxTokenType == StyleSyntaxTokenType.End); }
private static bool IsCombinator(StyleSyntaxToken token) { StyleSyntaxTokenType type = token.type; StyleSyntaxTokenType styleSyntaxTokenType = type; return(styleSyntaxTokenType - StyleSyntaxTokenType.Space <= 3); }
private void ParseRanges(StyleSyntaxTokenizer tokenizer, out int min, out int max) { min = -1; max = -1; StyleSyntaxToken styleSyntaxToken = tokenizer.current; bool flag = false; while (styleSyntaxToken.type != StyleSyntaxTokenType.CloseBrace) { StyleSyntaxTokenType type = styleSyntaxToken.type; StyleSyntaxTokenType styleSyntaxTokenType = type; if (styleSyntaxTokenType != StyleSyntaxTokenType.Number) { if (styleSyntaxTokenType != StyleSyntaxTokenType.Comma) { throw new Exception(string.Format("Unexpected token '{0}' in expression. Expected ranges token", styleSyntaxToken.type)); } flag = true; } else { bool flag2 = !flag; if (flag2) { min = styleSyntaxToken.number; } else { max = styleSyntaxToken.number; } } styleSyntaxToken = tokenizer.MoveNext(); } tokenizer.MoveNext(); }
private Expression ParseDataType(StyleSyntaxTokenizer tokenizer) { StyleSyntaxToken styleSyntaxToken = tokenizer.current; bool flag = styleSyntaxToken.type != StyleSyntaxTokenType.LessThan; if (flag) { throw new Exception(string.Format("Unexpected token '{0}' in data type expression. Expected '<' token", styleSyntaxToken.type)); } styleSyntaxToken = tokenizer.MoveNext(); StyleSyntaxTokenType type = styleSyntaxToken.type; StyleSyntaxTokenType styleSyntaxTokenType = type; Expression expression; if (styleSyntaxTokenType != StyleSyntaxTokenType.String) { if (styleSyntaxTokenType != StyleSyntaxTokenType.SingleQuote) { throw new Exception(string.Format("Unexpected token '{0}' in data type expression", styleSyntaxToken.type)); } expression = this.ParseProperty(tokenizer); } else { DataType dataType = DataType.None; try { object obj = Enum.Parse(typeof(DataType), styleSyntaxToken.text, true); bool flag2 = obj != null; if (flag2) { dataType = (DataType)obj; } } catch (Exception) { throw new Exception("Unknown data type '" + styleSyntaxToken.text + "'"); } expression = new Expression(ExpressionType.Data); expression.dataType = dataType; tokenizer.MoveNext(); } styleSyntaxToken = tokenizer.current; bool flag3 = styleSyntaxToken.type != StyleSyntaxTokenType.GreaterThan; if (flag3) { throw new Exception(string.Format("Unexpected token '{0}' in data type expression. Expected '>' token", styleSyntaxToken.type)); } tokenizer.MoveNext(); return(expression); }
public StyleSyntaxToken(StyleSyntaxTokenType type, int number) { this.type = type; this.text = null; this.number = number; }
public StyleSyntaxToken(StyleSyntaxTokenType type, string text) { this.type = type; this.text = text; this.number = 0; }
public StyleSyntaxToken(StyleSyntaxTokenType t) { type = t; text = null; this.number = 0; }