public T Parse(ITokenScanner tokenScanner, ITokenMatcher tokenMatcher) { tokenMatcher.Reset(); astBuilder.Reset(); var context = new ParserContext { TokenScanner = tokenScanner, TokenMatcher = tokenMatcher, TokenQueue = new Queue <Token>(), Errors = new List <ParserException>() }; StartRule(context, RuleType.CucumberExpression); int state = 0; Token token; do { token = ReadToken(context); state = MatchToken(state, token, context); } while(!token.IsEOF); EndRule(context, RuleType.CucumberExpression); if (context.Errors.Count > 0) { throw new CompositeParserException(context.Errors.ToArray()); } return(GetResult(context)); }
public ITokenMatcher AddDoubleQuoteStrings() { ITokenMatcher item = StringTokenMatcher2.DoubleQuoteStringMatcher(); this.m.Add(item); return(item); }
public ITokenMatcher AddExponentNumbers() { ITokenMatcher item = NumberTokenMatcher.ExponentNumberTokenMatcher(); this.m.Add(item); return(item); }
public ITokenMatcher AddSimpleNumbers() { ITokenMatcher item = NumberTokenMatcher.DefaultNumberTokenMatcher(); this.m.Add(item); return(item); }
public ITokenMatcher AddWhiteSpace() { ITokenMatcher item = WhiteSpaceTokenMatcher.DefaultWhiteSpaceTokenMatcher(); this.m.Add(item); return(item); }
public ITokenMatcher AddIdentifiers() { ITokenMatcher item = IdentifierTokenMatcher.BasicIndetifierMatcher(); this.m.Add(item); return(item); }
public ITokenMatcher AddHashComments() { ITokenMatcher item = CommentTokenMatcher.HashCommentMatcher(); this.m.Add(item); return(item); }
public TemplateTokenMatcher(ITokenMatcher tokenMatcher, TemplateTokenType tokenType, bool removeEmptyLine, string tokenId) { _tokenMatcher = tokenMatcher; _removeEmptyLine = removeEmptyLine; _tokenId = tokenId; _tokenType = tokenType; }
public IValueNode <TwisterPrimitive> ParseArithmeticExpression(ITokenMatcher matcher, IScopeManager scopeManager, Func <IValueNode <TwisterPrimitive> > assignmentCallback) { _matcher = matcher; _scopeManager = scopeManager; _assignmentCallback = assignmentCallback; return(Evaluate()); }
public ExpressionTokenMatcher(ITokenMatcher matcher, TokenType tokenType, int precedence, OperatorAssociativity associativity, TokenEvaluator tokenEvaluator) { _matcher = matcher; _tokenType = tokenType; _tokenEvaluator = tokenEvaluator; _precedence = precedence; _associativity = associativity; }
public override ExpressionToken CreateToken(ITokenMatcher tokenMatcher, string token) { ExpressionToken t = new ExpressionToken((ExpressionTokenMatcher)tokenMatcher, token); return(t); }
public void AddTokenMatcher(ITokenMatcher tokenMatcher, TokenType tokenType, int precedence, OperatorAssociativity associativity, TokenEvaluator tokenEvaluator, int?numTerms = null) { var matcher = new ExpressionTokenMatcher(tokenMatcher, tokenType, precedence, associativity, tokenEvaluator); if (numTerms != null) { matcher.NumTerms = numTerms; } AddTokenMatcher(matcher); }
private void SetupParser(IEnumerable <IToken> tokens) { if (tokens == null) { throw new InvalidProgramException("Source text is empty"); } _matcher = _createTokenMatcher(tokens); _scopeManager = new ScopeManager(); _hasMain = false; }
public void AddTernaryTokenMatcher(ITokenMatcher matcher1, ITokenMatcher matcher2, int precedence, OperatorAssociativity associativity, TokenEvaluator tokenEvaluator) { ExpressionTokenMatcher root = new ExpressionTokenMatcher(null, TokenType.TernaryOperator, tokenEvaluator); ExpressionTokenMatcher partial1 = new ExpressionTokenMatcher(matcher1, TokenType.TernaryOperator1, precedence, associativity, null); ExpressionTokenMatcher partial2 = new ExpressionTokenMatcher(matcher2, TokenType.TernaryOperator1, precedence, associativity, null); partial1.Root = root; partial2.Root = root; AddTokenMatcher(partial1); AddTokenMatcher(partial2); }
public override TemplateToken CreateToken(ITokenMatcher tokenMatcher, string token) { TemplateTokenMatcher matcher = (TemplateTokenMatcher)tokenMatcher; if (matcher != null && matcher.TokenType == TemplateTokenType.ForEach) { string[] pieces = token.Split('\0'); return(new ForeachTemplateToken(matcher, pieces[0], pieces[1])); } else { return(new TemplateToken(matcher, token)); } }
public void AddTokenMatcher(ITokenMatcher tokenMatcher, TokenType tokenType) { AddTokenMatcher(tokenMatcher, tokenType, 0, OperatorAssociativity.Left, null); }
public void AddTokenMatcher(ITokenMatcher tokenMatcher, TokenType tokenType, int precedence, TokenEvaluator tokenEvaluator) { AddTokenMatcher(tokenMatcher, tokenType, precedence, OperatorAssociativity.Left, tokenEvaluator); }
public void AddTokenMatcher(TemplateTokenType templateTokenType, ITokenMatcher tokenMatcher, bool removeEmptyLine, string tokenId) { AddTokenMatcher(new TemplateTokenMatcher(tokenMatcher, templateTokenType, removeEmptyLine, tokenId)); }
public TokenMatcher(ITokenMatcher tokenMatcher) { _tokenProcessor = tokenMatcher.CreateTokenProcessor(); _tokenMatcher = tokenMatcher; }
public MatchProcessor(ITokenMatcher matcher) { _processor = matcher.CreateTokenProcessor(); }
public ExpressionTokenMatcher(ITokenMatcher matcher, TokenType tokenType, TokenEvaluator tokenEvaluator) { _matcher = matcher; _tokenType = tokenType; _tokenEvaluator = tokenEvaluator; }
public ITokenMatcher AddTokenMatcher(ITokenMatcher tm) { this.m.Add(tm); return(tm); }
public WhiteSpacePaddedMatcher(ITokenMatcher matcher) { _matcher = matcher; }
/// <summary> /// Initializes a new instance of the <see cref="SafetyDataSheetSection"/> class. /// </summary> /// <param name="start">The start.</param> /// <param name="end">The end.</param> public SafetyDataSheetSection(ITokenMatcher start, ITokenMatcher end) { _start = start ?? throw new ArgumentNullException(nameof(start)); _end = end ?? throw new ArgumentNullException(nameof(end)); }
protected Token(ITokenMatcher tokenMatcher) { _tokenMatcher = tokenMatcher; }
public void AddTokenMatcher(TemplateTokenType templateTokenType, ITokenMatcher tokenMatcher) { AddTokenMatcher(new TemplateTokenMatcher(tokenMatcher, templateTokenType, false, null)); }
public void AddTokenMatcher(TemplateTokenType templateTokenType, ITokenMatcher tokenMatcher, bool removeEmptyLine) { AddTokenMatcher(new TemplateTokenMatcher(tokenMatcher, templateTokenType, removeEmptyLine, null)); }
public void AddTokenMatcher(ITokenMatcher tokenMatcher, TokenType tokenType, int precedence, OperatorAssociativity associativity, TokenEvaluator tokenEvaluator) { AddTokenMatcher(new ExpressionTokenMatcher(tokenMatcher, tokenType, precedence, associativity, tokenEvaluator)); }
public void AddTokenMatcher(TemplateTokenType templateTokenType, ITokenMatcher tokenMatcher, string tokenId) { AddTokenMatcher(new TemplateTokenMatcher(tokenMatcher, templateTokenType, false, tokenId)); }
protected Token(ITokenMatcher tokenMatcher, string text) { _tokenMatcher = tokenMatcher; _token = text; }
public Terminal(string?name, ITokenMatcher matcher) { Name = name; _matcher = matcher; _defaultDisplayText = $"T<{_matcher.Name}>"; }