clarity-pattern-parser 9.2.2 → 9.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/grammar/Grammar.test.ts +14 -1
- package/src/grammar/patterns/body.ts +2 -2
package/package.json
CHANGED
|
@@ -380,7 +380,9 @@ describe("Grammar", () => {
|
|
|
380
380
|
`;
|
|
381
381
|
const expression = `
|
|
382
382
|
import { first-name } from "first-name.cpat"
|
|
383
|
-
import { space } from "space.cpat" with params {
|
|
383
|
+
import { space } from "space.cpat" with params {
|
|
384
|
+
custom-space = " "
|
|
385
|
+
}
|
|
384
386
|
last-name = "Doe"
|
|
385
387
|
full-name = first-name + space + last-name
|
|
386
388
|
`;
|
|
@@ -497,4 +499,15 @@ describe("Grammar", () => {
|
|
|
497
499
|
|
|
498
500
|
expect(arePatternsEqual(patterns["complex-expression"], expected)).toBeTruthy();
|
|
499
501
|
});
|
|
502
|
+
|
|
503
|
+
test("Grammar With Spaces", ()=>{
|
|
504
|
+
const expression = `
|
|
505
|
+
john = "John"
|
|
506
|
+
|
|
507
|
+
jane = "Jane"
|
|
508
|
+
`;
|
|
509
|
+
const patterns = Grammar.parseString(expression);
|
|
510
|
+
expect(patterns.john).not.toBeNull();
|
|
511
|
+
expect(patterns.jane).not.toBeNull();
|
|
512
|
+
});
|
|
500
513
|
});
|
|
@@ -15,8 +15,8 @@ const optionalLineSpaces = new Optional("optional-line-spaces", lineSpaces);
|
|
|
15
15
|
|
|
16
16
|
const bodyLine = new Sequence("body-line", [
|
|
17
17
|
optionalLineSpaces,
|
|
18
|
-
bodyLineContent,
|
|
18
|
+
new Optional("optional-body-line-content", bodyLineContent),
|
|
19
19
|
optionalLineSpaces,
|
|
20
20
|
]);
|
|
21
21
|
|
|
22
|
-
export const body = new Optional("optional-body", new Repeat("body", bodyLine, {divider: newLine}));
|
|
22
|
+
export const body = new Optional("optional-body", new Repeat("body", bodyLine, { divider: newLine }));
|