Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10412


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

#2026 also support C++-style comments

Location:
branches/HeuristicLab.Problems.GPDL
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg

    r10067 r10412  
    3737  ident = letter {letter | digit}  .
    3838
    39 COMMENTS
    40   FROM "/*" TO "*/" NESTED
     39COMMENTS FROM "/*" TO "*/" NESTED
     40COMMENTS FROM "//" TO "\r"
    4141
    4242IGNORE '\t' + '\r' + '\n'
  • 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;
  • branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDef.atg

    r9842 r10412  
    2929  ident = letter {letter | digit} .
    3030
    31 COMMENTS
    32   FROM "/*" TO "*/" NESTED
     31COMMENTS FROM "/*" TO "*/" NESTED
     32COMMENTS FROM "//" TO "\r"
    3333
    3434IGNORE '\t' + '\r' + '\n'
  • branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/Scanner.cs

    r10067 r10412  
    306306    int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
    307307    NextCh();
     308    if (ch == '/') {
     309      NextCh();
     310      for(;;) {
     311        if (ch == 13) {
     312          level--;
     313          if (level == 0) { oldEols = line - line0; NextCh(); return true; }
     314          NextCh();
     315        } else if (ch == Buffer.EOF) return false;
     316        else NextCh();
     317      }
     318    } else {
     319      buffer.Pos = pos0; NextCh(); line = line0; col = col0; charPos = charPos0;
     320    }
     321    return false;
     322  }
     323
     324  bool Comment1() {
     325    int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
     326    NextCh();
    308327    if (ch == '*') {
    309328      NextCh();
     
    357376      ch >= 9 && ch <= 10 || ch == 13
    358377    ) NextCh();
    359     if (ch == '/' && Comment0()) return NextToken();
     378    if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken();
    360379    int recKind = noSym;
    361380    int recEnd = pos;
  • branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/SyntaxAnalyzer.csproj

    r10065 r10412  
    6262</PreBuildEvent>
    6363  </PropertyGroup>
     64  <PropertyGroup>
     65    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     66set ProjectDir=$(ProjectDir)
     67set SolutionDir=$(SolutionDir)
     68
     69call GenerateFromAtg.cmd
     70</PreBuildEvent>
     71  </PropertyGroup>
    6472  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    6573       Other similar extension points exist, see Microsoft.Common.targets.
Note: See TracChangeset for help on using the changeset viewer.