Skip to content

Commit

Permalink
fix(eclcc): Syntax Error Parse Issue
Browse files Browse the repository at this point in the history
Error parsing fails when there is a space in the path.

Signed-off-by: Gordon Smith <gordonjsmith@gmail.com>
  • Loading branch information
GordonSmith committed Sep 6, 2019
1 parent 8fa4ad7 commit ca6eb65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/comms/src/clienttools/eclcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class EclccErrors extends Errors {
super(checked);
if (stdErr && stdErr.length) {
for (const errLine of stdErr.split(os.EOL)) {
let match = /([a-z,A-Z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\): ?(error|warning|info) C(\d*): ?(.*)/.exec(errLine);
let match = /([a-zA-Z]:\\(?:[- \w\.\d]+\\)*(?:[- \w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\) ?: ?(error|warning|info) C(\d*) ?: ?(.*)/.exec(errLine);
if (match) {
const [, filePath, row, _col, severity, code, _msg] = match;
const line: number = +row;
Expand Down
13 changes: 12 additions & 1 deletion tests/test-comms/src/clienttools/eclcc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";

import { locateClientTools, Version, Workunit } from "@hpcc-js/comms";
import { EclccErrors, locateClientTools, Version, Workunit } from "@hpcc-js/comms";
import { isBrowser } from "@hpcc-js/util";
import { ESP_URL, isTravis } from "../testLib";

Expand All @@ -17,6 +17,11 @@ function logVersion(build: string): Promise<void> {
});
}

function hasError(errStr: string): boolean {
const err = new EclccErrors(errStr, []);
return err.hasError();
}

describe("eclcc", function () {
this.timeout(30000);
if (!isBrowser) {
Expand Down Expand Up @@ -81,6 +86,12 @@ describe("eclcc", function () {
logVersion("comms_5.0.0")
]);
});

it("Syntax Error", function () {
expect(hasError(`c:\\Users\\gordon\\Downloads\\VS\\SomeFolder\\VS\\BWR\\BWR_welcome.ecl(1,7): error C3002: syntax error near "'Welcome'" : expected ANY, ASCII, ASSERT, BIG_ENDIAN, CONST, DATASET, DICTIONARY, EBCDIC, GROUPED, IF, LITTLE_ENDIAN, NOCONST, OPT, OUT, PACKED, PATTERN, RECORD, ROW, RULE, SET, type-name, TOKEN, TYPEOF, UNSIGNED, VIRTUAL, <?>, <??>, dataset, identifier, identifier, type name, type name, type name, type name, datarow, function-name, function-name, action, pattern, event, transform-name, '^', '$'`)).to.be.true;
expect(hasError(`c:\\Users\\gordon\\Down-loads\\VS\\Some Folder\\VS\\BWR\\BWR_welcome.ecl(1,7): error C3002: syntax error near "'Welcome'" : expected ANY, ASCII, ASSERT, BIG_ENDIAN, CONST, DATASET, DICTIONARY, EBCDIC, GROUPED, IF, LITTLE_ENDIAN, NOCONST, OPT, OUT, PACKED, PATTERN, RECORD, ROW, RULE, SET, type-name, TOKEN, TYPEOF, UNSIGNED, VIRTUAL, <?>, <??>, dataset, identifier, identifier, type name, type name, type name, type name, datarow, function-name, function-name, action, pattern, event, transform-name, '^', '$'`)).to.be.true;
expect(hasError("c:\\temp\\test.ecl(7,13) : error C007 : Hello and Welcome")).to.be.true;
});
}
}
});

0 comments on commit ca6eb65

Please sign in to comment.