public ParserStateException(StatementState state, LexedToken curTok, AllowedTransition transitionRecord) : base($"Invalid token {curTok.TokenType.ToString()} in {state.ToString()}") { this.state = state; this.curTok = curTok; this.transitionRecord = transitionRecord; }
/// <summary> /// /// </summary> /// <param name="TokenType"></param> //Captures whatever is in the buffer into a new token which is placed on the token stream //reset the buffer; protected void CaptureToken(LexedTokenType TokenType) { var tkn = new LexedToken(TokenType, buffer.ToString(), CurLinePos, CurLineNum); resetBuffer(); returnlist.Add(tkn); }
private void throwParserException(LexedToken token, string v) { throw new ParseException($"{v} Token: {token.TokenType}. At Row: {token.LineNumber} , Position: {token.Position}"); }
private ElementBase AddTempElemToCurrentElement(ElementBase ParentElement, ElementBase tempElem, LexedToken t) { switch (ParentElement) { case ContainerElement c: { c.ContainedElement = tempElem; return(c); } case null: { return(tempElem); } } throwParserException(t, "Unexpected token"); return(null); }