Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/28/14 17:09:30 (10 years ago)
Author:
gkronber
Message:

#2026 also support C++-style comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Scanner.cs

    r10067 r10412  
    300300    int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
    301301    NextCh();
     302    if (ch == '/') {
     303      NextCh();
     304      for(;;) {
     305        if (ch == 13) {
     306          level--;
     307          if (level == 0) { oldEols = line - line0; NextCh(); return true; }
     308          NextCh();
     309        } else if (ch == Buffer.EOF) return false;
     310        else NextCh();
     311      }
     312    } else {
     313      buffer.Pos = pos0; NextCh(); line = line0; col = col0; charPos = charPos0;
     314    }
     315    return false;
     316  }
     317
     318  bool Comment1() {
     319    int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
     320    NextCh();
    302321    if (ch == '*') {
    303322      NextCh();
     
    350369      ch >= 9 && ch <= 10 || ch == 13
    351370    ) NextCh();
    352     if (ch == '/' && Comment0()) return NextToken();
     371    if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken();
    353372    int recKind = noSym;
    354373    int recEnd = pos;
Note: See TracChangeset for help on using the changeset viewer.