Skip to content

Commit

Permalink
simplified associations by removing the optional interstitial attribu…
Browse files Browse the repository at this point in the history
…tes that could appear between |attributes|
  • Loading branch information
akollegger committed Nov 21, 2024
1 parent 00b954b commit d061184
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gram.ne
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PatternElement -> (Annotation _):* (Subject | Path | Reference)
Subject -> "[" _ Attributes _ Association:? "]"
{% () => `(subject)` %}

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

Reference -> Identity
{% () => `(reference)` %}
Expand Down
9 changes: 1 addition & 8 deletions src/lib/generated-grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ const grammar: Grammar = {
{"name": "Subject$ebnf$1", "symbols": ["Association"], "postprocess": id},
{"name": "Subject$ebnf$1", "symbols": [], "postprocess": () => null},
{"name": "Subject", "symbols": [{"literal":"["}, "_", "Attributes", "_", "Subject$ebnf$1", {"literal":"]"}], "postprocess": () => `(subject)`},
{"name": "Association$ebnf$1$subexpression$1$ebnf$1", "symbols": ["Labels"], "postprocess": id},
{"name": "Association$ebnf$1$subexpression$1$ebnf$1", "symbols": [], "postprocess": () => null},
{"name": "Association$ebnf$1$subexpression$1$ebnf$2", "symbols": ["Record"], "postprocess": id},
{"name": "Association$ebnf$1$subexpression$1$ebnf$2", "symbols": [], "postprocess": () => null},
{"name": "Association$ebnf$1$subexpression$1", "symbols": ["Association$ebnf$1$subexpression$1$ebnf$1", "Association$ebnf$1$subexpression$1$ebnf$2", "_", {"literal":"|"}]},
{"name": "Association$ebnf$1", "symbols": ["Association$ebnf$1$subexpression$1"], "postprocess": id},
{"name": "Association$ebnf$1", "symbols": [], "postprocess": () => null},
{"name": "Association", "symbols": [{"literal":"|"}, "Association$ebnf$1", "_", "Pattern"]},
{"name": "Association", "symbols": [{"literal":"|"}, "_", "Pattern"]},
{"name": "Reference", "symbols": ["Identity"], "postprocess": () => `(reference)`},
{"name": "Path", "symbols": ["Node"], "postprocess": () => `(node)`},
{"name": "Path", "symbols": ["Relationship"], "postprocess": () => `(relationship)`},
Expand Down
5 changes: 3 additions & 2 deletions src/lib/gram-relationships.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ describe('relationship patterns', () => {
expect(Either.isRight(result)).toBeTruthy();
})
})
describe('relationship attributes', () => {
describe('relationship identifiers', () => {
test.each([
'()-[a]->()',
'()-["a"]->()'
'()-["a"]->()',
'()-[2]->()'
])
('can be: %s', async (gram) => {
const task = parse(gram);
Expand Down

0 comments on commit d061184

Please sign in to comment.