public override MatchResult?MatchStep(MatchStack stack, MatchFrame frame, TokenQueue q) { if (!frame.ProdMatched) { if (_prod == null) { _prod = SqliteGrammar.Prods[ProdName]; } stack.Push(_prod); frame.ProdMatched = true; return(null); } else { return(frame.SubResult); } }
public void Clear(bool all = true) { if (all) { ProdStartLoc = 0; Prod = null; TermIndex = 0; AstProd = null; } OptionalState = OptionalTermState.Start; OptionalStartLoc = 0; OrState = OrTermState.Start; OrProdIndex = 0; OrStartLoc = 0; ProdMatched = false; ListState = ListTermState.Start; ListCount = 0; ListSeparatorStartLoc = 0; SubResult.ErrorMessage = "Uninitialized result"; SubResult.IsMatch = false; }
public MatchFrame Push(SpecProd prod) { if (prod == null) { throw new ArgumentNullException("prod"); } _topIndex++; if (_topIndex == _frames.Count) { _frames.Add(new MatchFrame()); } _frames[_topIndex].Prod = prod; _frames[_topIndex].ProdStartLoc = Queue.GetLocation(); _frames[_topIndex].AstProd = new Ast.SqliteSyntaxProduction { Name = prod.Name }; return(_frames[_topIndex]); }