public void getLookAhead() { if (next <= tokenCount) { lookAheadToken = tokenList[next]; curTokenType = lookAheadToken.getType(); next++; } }
public void Match(ref Token retToken, TokenType expectedTokenType) { if (lookAheadToken.getType() == expectedTokenType) { retToken = lookAheadToken; getLookAhead(); } else { Expect(expectedTokenType, retToken); } }
public void Expect(TokenType expectedTokenType, Token gotToken) { outputStream.WriteLine("Expected: " + expectedTokenType.ToString()); outputStream.WriteLine("Got: " + gotToken.getValue()); throw new DivideByZeroException(); // :) }