private Token PeekToken2() { if (_lookahead2.Token == null) { _lookahead2 = new TokenWithSpan(_tokenizer.GetNextToken(), _tokenizer.TokenSpan); _lookahead2WhiteSpace = _tokenizer.PreceedingWhiteSpace; } return _lookahead2.Token; }
private void FetchLookahead() { if (_lookahead2.Token != null) { _lookahead = _lookahead2; _lookaheadWhiteSpace = _lookahead2WhiteSpace; _lookahead2 = TokenWithSpan.Empty; _lookahead2WhiteSpace = null; } else { _lookahead = new TokenWithSpan(_tokenizer.GetNextToken(), _tokenizer.TokenSpan); _lookaheadWhiteSpace = _tokenizer.PreceedingWhiteSpace; } }
private Token NextToken() { _token = _lookahead; _tokenWhiteSpace = _lookaheadWhiteSpace; FetchLookahead(); return _token.Token; }
private void ReportSyntaxError(TokenWithSpan t, int errorCode) { ReportSyntaxError(t.Token, t.Span, errorCode, true); }
private void CheckSuiteEofError(TokenWithSpan cur) { if (MaybeEatEof()) { // for interactive parsing we allow the user to continue in this case ReportSyntaxError(_lookahead.Token, cur.Span, ErrorCodes.SyntaxError, true); } }
private void ReportSyntaxError(TokenWithSpan t) { ReportSyntaxError(t, ErrorCodes.SyntaxError); }
public void Reset(FutureOptions languageFeatures) { _languageFeatures = languageFeatures; _token = new TokenWithSpan(); _lookahead = new TokenWithSpan(); _fromFutureAllowed = true; _classDepth = 0; _functions = null; _privatePrefix = null; _parsingStarted = false; _errorCode = 0; }