Skip to content
Snippets Groups Projects
Commit 51cd7cee authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: improvements for token methods

- direct check of punctuation.
  For example,

      while (!tok.isPunctuation(token::BEGIN_LIST)) ..

  instead of

  while (!(tok.isPunctuation() && tok.pToken() == token::BEGIN_LIST)) ..

  Using direct comparison (tok != token::BEGIN_LIST) can be fragile
  when comparing int values:

      int c = readChar(is);
      while (tok != c) ..  // Danger, uses LABEL comparison!

- direct check of word.
  For example,

      if (tok.isWord("uniform")) ..

  instead of

      if (tok.isWord() && tok.wordToken() == "uniform") ..

- make token lineNumber() a setter method

ENH: adjust internal compound method empty() -> moved()

- support named compound tokens

STYLE: setter method for stream indentation
parent ce45a129
Branches
Tags
No related merge requests found
Showing
with 202 additions and 290 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment