public DfaLexeme(IDfaLexerRule dfaLexerRule, int position) { LexerRule = dfaLexerRule; Position = position; _stringBuilder = SharedPools.Default <StringBuilder>().AllocateAndClear(); _currentState = dfaLexerRule.Start; }
private static void AssertLexerRuleMatches(IDfaLexerRule lexerRule, string input) { var lexeme = _factory.Create(lexerRule); for (int i = 0; i < input.Length; i++) Assert.IsTrue(lexeme.Scan(input[i]), $"character '{input[i]}' not recognized at position {i}."); Assert.IsTrue(lexeme.IsAccepted(), $"input {input} not accepted."); }
public void Reset(IDfaLexerRule dfaLexerRule) { _capture = null; if(IsStringBuilderAllocated()) _stringBuilder.Clear(); _currentState = dfaLexerRule.Start; LexerRule = dfaLexerRule; }
private static void AssertLexerRuleMatches(IDfaLexerRule lexerRule, string input) { var lexeme = _factory.Create(lexerRule, 0); for (int i = 0; i < input.Length; i++) { Assert.IsTrue(lexeme.Scan(input[i]), $"character '{input[i]}' not recognized at position {i}."); } Assert.IsTrue(lexeme.IsAccepted(), $"input {input} not accepted."); }
public void Reset(IDfaLexerRule dfaLexerRule) { _capture = null; if (IsStringBuilderAllocated()) { _stringBuilder.Clear(); } _currentState = dfaLexerRule.Start; LexerRule = dfaLexerRule; }
public DfaLexeme(IDfaLexerRule dfaLexerRule) { LexerRule = dfaLexerRule; _stringBuilder = SharedPools.Default<StringBuilder>().AllocateAndClear(); _currentState = dfaLexerRule.Start; }