public override void InitializeFromParseStream(ParseProcessState state) { switch (state.Current().Value.TokenType) { case LexedTokenType.PLUS: { this.QuantifierSymbol = '+'; break; } case LexedTokenType.STAR: { this.QuantifierSymbol = '*'; break; } case LexedTokenType.QUESTIONMARK: { this.QuantifierSymbol = '?'; break; } default: throw new Exception($"Internal Error: A non valid symbol '{state.Current().Value.TokenType.ToString()}' was passed as SymbolQuantifier. This is a bug"); } }
public override void InitializeFromParseStream(ParseProcessState state) { while (state.MoveNext() != null) { //move a token - this wll cause the next item in the steream to be created //if we are at EOF then return if (state.Current().Value.TokenType == LexedTokenType.EOF) { return; } var newElement = (StatementElement)state.CreateCurrent(); if (newElement != null) { //if this was a group closing token then don't add it and just return if (newElement.ContainedElement is GroupCloserPlaceHolderElement) { return; } //else add it and continue //a element was created - at this level it would be a statement Statements.Add(newElement.ContainedElement); } } }
public override void InitializeFromParseStream(ParseProcessState state) { this.EventName = state.Current().Value.TokenText; if (this.EventName == ".") { IsDotWildcard = true; } }
public override void InitializeFromParseStream(ParseProcessState state) { while (state.MoveNext(MyTransitions[state.State], false) != null) { var curr = state.Current().Value; switch (state.State) { case StatementState.NumericQuantifierStart: { if (curr.TokenType == LexedTokenType.NUMBER) { if (state.Peek(1).Value.TokenType == LexedTokenType.CLOSECURLY) { var parseval = int.Parse(curr.TokenText); this.MinOccours = parseval; this.MaxOccours = parseval; state.State = StatementState.NumericQuantifierMax; break; } MinOccours = int.Parse(curr.TokenText); state.State = StatementState.NumericQuantifierMin; } else { state.State = StatementState.NumericQuantifierComma; } break; } case StatementState.NumericQuantifierMin: { state.State = StatementState.NumericQuantifierComma; break; } case StatementState.NumericQuantifierComma: { if (curr.TokenType == LexedTokenType.NUMBER) { MaxOccours = int.Parse(curr.TokenText); state.State = StatementState.NumericQuantifierMax; } else { state.State = StatementState.NumericQuantifierEnd; return; } break; } case StatementState.NumericQuantifierMax: { state.State = StatementState.NumericQuantifierEnd; return; } case StatementState.NumericQuantifierEnd: return; default: throw new Exception("Invalid State '" + state.State.ToString() + " in NumericQuantifier , this is caused by an internal bug"); } } }
public override void InitializeFromParseStream(ParseProcessState state) { this.MatchPattern = state.Current().Value.TokenText; }