Skip to content
  • Mark OLESEN's avatar
    ENH: improvements for token methods · 51cd7cee
    Mark OLESEN authored
    - 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
    51cd7cee