-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement parsing of partials syntax
- Loading branch information
1 parent
20d90b6
commit 4d072e8
Showing
16 changed files
with
374 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
pkg/composableschemadsl/dslshape/zz_generated.nodetype_string.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
pkg/composableschemadsl/parser/tests/nonsense_top_level_block.zed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
nonsense thing { | ||
relation: user | ||
permission view = user | ||
} |
11 changes: 11 additions & 0 deletions
11
pkg/composableschemadsl/parser/tests/nonsense_top_level_block.zed.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
NodeTypeFile | ||
end-rune = -1 | ||
input-source = top-level block with unrecognized keyword | ||
start-rune = 0 | ||
child-node => | ||
NodeTypeError | ||
end-rune = -1 | ||
error-message = Unexpected token at root level: TokenTypeIdentifier | ||
error-source = nonsense | ||
input-source = top-level block with unrecognized keyword | ||
start-rune = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
partial view_partial { | ||
relation user: user | ||
permission view = user | ||
} | ||
|
||
definition user {} | ||
|
||
definition resource { | ||
...view_partial | ||
} |
54 changes: 54 additions & 0 deletions
54
pkg/composableschemadsl/parser/tests/partials.zed.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
NodeTypeFile | ||
end-rune = 134 | ||
input-source = partials happy path | ||
start-rune = 0 | ||
child-node => | ||
NodeTypePartial | ||
end-rune = 70 | ||
input-source = partials happy path | ||
partial-name = view_partial | ||
start-rune = 0 | ||
child-node => | ||
NodeTypeRelation | ||
end-rune = 43 | ||
input-source = partials happy path | ||
relation-name = user | ||
start-rune = 25 | ||
allowed-types => | ||
NodeTypeTypeReference | ||
end-rune = 43 | ||
input-source = partials happy path | ||
start-rune = 40 | ||
type-ref-type => | ||
NodeTypeSpecificTypeReference | ||
end-rune = 43 | ||
input-source = partials happy path | ||
start-rune = 40 | ||
type-name = user | ||
NodeTypePermission | ||
end-rune = 68 | ||
input-source = partials happy path | ||
relation-name = view | ||
start-rune = 47 | ||
compute-expression => | ||
NodeTypeIdentifier | ||
end-rune = 68 | ||
identifier-value = user | ||
input-source = partials happy path | ||
start-rune = 65 | ||
NodeTypeDefinition | ||
definition-name = user | ||
end-rune = 90 | ||
input-source = partials happy path | ||
start-rune = 73 | ||
NodeTypeDefinition | ||
definition-name = resource | ||
end-rune = 133 | ||
input-source = partials happy path | ||
start-rune = 93 | ||
child-node => | ||
NodeTypePartialReference | ||
end-rune = 131 | ||
input-source = partials happy path | ||
partial-reference-name = view_partial | ||
start-rune = 117 |
10 changes: 10 additions & 0 deletions
10
pkg/composableschemadsl/parser/tests/partials_with_malformed_partial_block.zed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
partial view_partial { | ||
relation user: user | ||
permission view = user | ||
|
||
|
||
definition user {} | ||
|
||
definition resource { | ||
...view_partial | ||
} |
60 changes: 60 additions & 0 deletions
60
pkg/composableschemadsl/parser/tests/partials_with_malformed_partial_block.zed.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
NodeTypeFile | ||
end-rune = 133 | ||
input-source = partials with malformed partial block | ||
start-rune = 0 | ||
child-node => | ||
NodeTypePartial | ||
end-rune = 69 | ||
input-source = partials with malformed partial block | ||
partial-name = view_partial | ||
start-rune = 0 | ||
child-node => | ||
NodeTypeRelation | ||
end-rune = 43 | ||
input-source = partials with malformed partial block | ||
relation-name = user | ||
start-rune = 25 | ||
allowed-types => | ||
NodeTypeTypeReference | ||
end-rune = 43 | ||
input-source = partials with malformed partial block | ||
start-rune = 40 | ||
type-ref-type => | ||
NodeTypeSpecificTypeReference | ||
end-rune = 43 | ||
input-source = partials with malformed partial block | ||
start-rune = 40 | ||
type-name = user | ||
NodeTypePermission | ||
end-rune = 68 | ||
input-source = partials with malformed partial block | ||
relation-name = view | ||
start-rune = 47 | ||
compute-expression => | ||
NodeTypeIdentifier | ||
end-rune = 68 | ||
identifier-value = user | ||
input-source = partials with malformed partial block | ||
start-rune = 65 | ||
NodeTypeError | ||
end-rune = 69 | ||
error-message = Expected end of statement or definition, found: TokenTypeKeyword | ||
error-source = definition | ||
input-source = partials with malformed partial block | ||
start-rune = 72 | ||
NodeTypeDefinition | ||
definition-name = user | ||
end-rune = 89 | ||
input-source = partials with malformed partial block | ||
start-rune = 72 | ||
NodeTypeDefinition | ||
definition-name = resource | ||
end-rune = 132 | ||
input-source = partials with malformed partial block | ||
start-rune = 92 | ||
child-node => | ||
NodeTypePartialReference | ||
end-rune = 130 | ||
input-source = partials with malformed partial block | ||
partial-reference-name = view_partial | ||
start-rune = 116 |
10 changes: 10 additions & 0 deletions
10
pkg/composableschemadsl/parser/tests/partials_with_malformed_partial_reference.zed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
partial view_partial { | ||
relation user: user | ||
permission view = user | ||
} | ||
|
||
definition user {} | ||
|
||
definition resource { | ||
...view_partial and_something_else | ||
} |
Oops, something went wrong.