Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code accepted by dmd but not libdparse #7

Closed
Hackerpilot opened this issue Jul 31, 2014 · 1 comment
Closed

Code accepted by dmd but not libdparse #7

Hackerpilot opened this issue Jul 31, 2014 · 1 comment

Comments

@Hackerpilot
Copy link
Collaborator

Hi,

I get a lot of errors when trying to run dscanner on my code (snippet shown further down). First thing it triggers on below is the immutable in the foreach:

src/boss/core/boss.d(255:14)[error]: Expected ; instead of immutable
src/boss/core/boss.d(255:58)[error]: Expected ; instead of )
src/boss/core/boss.d(255:58)[error]: Primary expression expected
src/boss/core/boss.d(255:60)[error]: Expected ; instead of {

void showHelp() {
    //First accumulate options
    string procHelp[][];
    foreach (immutable(ProcType) procType; ProcType.types) {
      immutable string[] helpPrim = procType.helpPrim;
      for (int i=0; i<helpPrim.length; i+=2) {
    procHelp ~= [[helpPrim[i+0], helpPrim[i+1]]];
      }
    }
    if (m_options.helpall) {
      foreach (procType; ProcType.types) {
    immutable string[] helpExtra = procType.helpExtra;
    for (int i=0; i<helpExtra.length; i+=2) {
      procHelp ~= [[helpExtra[i+0], helpExtra[i+1]]];
    }
      }
    }
}

It also complains about the code further down, with the first error being on the line indexing into 'img'.. Image has an index operator:

src/cv/image/borderlinedet.d(432:19)[error]: Expected ] instead of ,
src/cv/image/borderlinedet.d(432:32)[error]: Expected identifier instead of ]
src/cv/image/borderlinedet.d(432:34)[error]: Primary expression expected
src/cv/image/borderlinedet.d(433:2)[error]: Expected ; instead of }

BorderLineDet!Mono8.Data imgFromStr(string str) {
      string[] lines = str.split("|");
      auto img = Image!Mono8(cast(int) lines[0].length, cast(int) lines.length);
      foreach (y, l; lines) {
    foreach (x, p; l) {
      img[cast(int) x, cast(int) y] = p == '1' ? 0 : Mono8.Chan.max;
    }
      }
      return BorderLineDet!Mono8.Data(img);
    }
}
@Hackerpilot
Copy link
Collaborator Author

Moved from dlang-community/D-Scanner#193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant