fetchedEOF property

bool fetchedEOF
getter/setter pair

Indicates whether the Token.EOF token has been fetched from tokenSource and added to tokens. This field improves performance for the following cases:

  • {@link #consume}: The lookahead check in {@link #consume} to prevent consuming the EOF symbol is optimized by checking the values of {@link #fetchedEOF} and {@link #p} instead of calling {@link #LA}.
  • {@link #fetch}: The check to prevent adding multiple EOF symbols into [{@link #]tokens} is trivial with this field.

    Implementation

    bool fetchedEOF = false;