Skip to content

Commit d061184

Browse files
committed
simplified associations by removing the optional interstitial attributes that could appear between |attributes|
1 parent 00b954b commit d061184

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

gram.ne

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PatternElement -> (Annotation _):* (Subject | Path | Reference)
1212
Subject -> "[" _ Attributes _ Association:? "]"
1313
{% () => `(subject)` %}
1414

15-
Association -> "|" (Labels:? Record:? _ "|"):? _ Pattern
15+
Association -> "|" _ Pattern
1616

1717
Reference -> Identity
1818
{% () => `(reference)` %}

src/lib/generated-grammar.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,7 @@ const grammar: Grammar = {
7070
{"name": "Subject$ebnf$1", "symbols": ["Association"], "postprocess": id},
7171
{"name": "Subject$ebnf$1", "symbols": [], "postprocess": () => null},
7272
{"name": "Subject", "symbols": [{"literal":"["}, "_", "Attributes", "_", "Subject$ebnf$1", {"literal":"]"}], "postprocess": () => `(subject)`},
73-
{"name": "Association$ebnf$1$subexpression$1$ebnf$1", "symbols": ["Labels"], "postprocess": id},
74-
{"name": "Association$ebnf$1$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null},
75-
{"name": "Association$ebnf$1$subexpression$1$ebnf$2", "symbols": ["Record"], "postprocess": id},
76-
{"name": "Association$ebnf$1$subexpression$1$ebnf$2", "symbols": [], "postprocess": () => null},
77-
{"name": "Association$ebnf$1$subexpression$1", "symbols": ["Association$ebnf$1$subexpression$1$ebnf$1", "Association$ebnf$1$subexpression$1$ebnf$2", "_", {"literal":"|"}]},
78-
{"name": "Association$ebnf$1", "symbols": ["Association$ebnf$1$subexpression$1"], "postprocess": id},
79-
{"name": "Association$ebnf$1", "symbols": [], "postprocess": () => null},
80-
{"name": "Association", "symbols": [{"literal":"|"}, "Association$ebnf$1", "_", "Pattern"]},
73+
{"name": "Association", "symbols": [{"literal":"|"}, "_", "Pattern"]},
8174
{"name": "Reference", "symbols": ["Identity"], "postprocess": () => `(reference)`},
8275
{"name": "Path", "symbols": ["Node"], "postprocess": () => `(node)`},
8376
{"name": "Path", "symbols": ["Relationship"], "postprocess": () => `(relationship)`},

src/lib/gram-relationships.spec.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ describe('relationship patterns', () => {
2323
expect(Either.isRight(result)).toBeTruthy();
2424
})
2525
})
26-
describe('relationship attributes', () => {
26+
describe('relationship identifiers', () => {
2727
test.each([
2828
'()-[a]->()',
29-
'()-["a"]->()'
29+
'()-["a"]->()',
30+
'()-[2]->()'
3031
])
3132
('can be: %s', async (gram) => {
3233
const task = parse(gram);

0 commit comments

Comments
 (0)