Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 private void throwParserException(LexedToken token, string v)
 {
     throw new ParseException($"{v} Token: {token.TokenType}. At Row: {token.LineNumber} , Position: {token.Position}");
 }
Exemplo n.º 4
0
        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);
        }