Beispiel #1
0
 private TokenWord ExpectWord(Token token)
 {
     if (!(token is TokenWord)) {
         throw new ParserException(
             string.Format("Unexpected {0} at ({1}:{2})",
                 token.GetType().Name,
                 token.Line,
                 token.Column)
         );
     }
     return token as TokenWord;
 }
Beispiel #2
0
 private Token ExpectIndexOrString(Token token)
 {
     if (!((token is TokenIndex) || (token is TokenString))) {
         throw new ParserException(
             string.Format("Unexpected {0} at ({1}:{2})",
                 token.GetType().Name,
                 token.Line,
                 token.Column)
         );
     }
     return token;
 }