Skip to content

Commit

Permalink
Clean up RelationVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
ronenh committed Nov 30, 2023
1 parent eebca7c commit 7841cdd
Show file tree
Hide file tree
Showing 8 changed files with 535 additions and 839 deletions.
32 changes: 14 additions & 18 deletions parser/Azm.g4
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
grammar Azm;

relation
: unionRel EOF
: rel ('|' rel)* EOF
;

permission
: unionPerm EOF # ToUnionPerm
| intersectionPerm EOF # ToIntersectionPerm
| exclusionPerm EOF # ToExclusionPerm
;

unionRel
: rel ('|' rel)*
: unionPerm EOF
| intersectionPerm EOF
| exclusionPerm EOF
;

unionPerm
Expand All @@ -27,30 +23,30 @@ exclusionPerm
;

rel
: singleRel # ToSingleRel
| wildcardRel # ToWildcardRel
| subjectRel # ToSubjectRel
| arrowRel # ToArrowRel
: single #SingleRel
| wildcard #WildcardRel
| subject #SubjectRel
| arrow #ArrowRel
;

perm
: singleRel # ToSinglePerm
| arrowRel # ToArrowPerm
: single #SinglePerm
| arrow #ArrowPerm
;

singleRel
single
: ID
;

subjectRel
subject
: ID HASH ID
;

wildcardRel
wildcard
: ID COLON ASTERISK
;

arrowRel
arrow
: ID ARROW ID
;

Expand Down
11 changes: 5 additions & 6 deletions parser/Azm.interp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ WS
rule names:
relation
permission
unionRel
unionPerm
intersectionPerm
exclusionPerm
rel
perm
singleRel
subjectRel
wildcardRel
arrowRel
single
subject
wildcard
arrow


atn:
[4, 1, 9, 91, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,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1, 0, 0, 0, 44, 5, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 46, 51, 3, 14, 7, 0, 47, 48, 5, 1, 0, 0, 48, 50, 3, 14, 7, 0, 49, 47, 1, 0, 0, 0, 50, 53, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 7, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 54, 59, 3, 14, 7, 0, 55, 56, 5, 2, 0, 0, 56, 58, 3, 14, 7, 0, 57, 55, 1, 0, 0, 0, 58, 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 9, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 63, 3, 14, 7, 0, 63, 64, 5, 3, 0, 0, 64, 65, 3, 14, 7, 0, 65, 11, 1, 0, 0, 0, 66, 71, 3, 16, 8, 0, 67, 71, 3, 20, 10, 0, 68, 71, 3, 18, 9, 0, 69, 71, 3, 22, 11, 0, 70, 66, 1, 0, 0, 0, 70, 67, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 70, 69, 1, 0, 0, 0, 71, 13, 1, 0, 0, 0, 72, 75, 3, 16, 8, 0, 73, 75, 3, 22, 11, 0, 74, 72, 1, 0, 0, 0, 74, 73, 1, 0, 0, 0, 75, 15, 1, 0, 0, 0, 76, 77, 5, 8, 0, 0, 77, 17, 1, 0, 0, 0, 78, 79, 5, 8, 0, 0, 79, 80, 5, 5, 0, 0, 80, 81, 5, 8, 0, 0, 81, 19, 1, 0, 0, 0, 82, 83, 5, 8, 0, 0, 83, 84, 5, 6, 0, 0, 84, 85, 5, 7, 0, 0, 85, 21, 1, 0, 0, 0, 86, 87, 5, 8, 0, 0, 87, 88, 5, 4, 0, 0, 88, 89, 5, 8, 0, 0, 89, 23, 1, 0, 0, 0, 6, 36, 43, 51, 59, 70, 74]
[4, 1, 9, 88, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 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, 3, 0, 36, 37, 5, 0, 0, 1, 37, 42, 1, 0, 0, 0, 38, 39, 3, 8, 4, 0, 39, 40, 5, 0, 0, 1, 40, 42, 1, 0, 0, 0, 41, 32, 1, 0, 0, 0, 41, 35, 1, 0, 0, 0, 41, 38, 1, 0, 0, 0, 42, 3, 1, 0, 0, 0, 43, 48, 3, 12, 6, 0, 44, 45, 5, 1, 0, 0, 45, 47, 3, 12, 6, 0, 46, 44, 1, 0, 0, 0, 47, 50, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 5, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 51, 56, 3, 12, 6, 0, 52, 53, 5, 2, 0, 0, 53, 55, 3, 12, 6, 0, 54, 52, 1, 0, 0, 0, 55, 58, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 7, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 59, 60, 3, 12, 6, 0, 60, 61, 5, 3, 0, 0, 61, 62, 3, 12, 6, 0, 62, 9, 1, 0, 0, 0, 63, 68, 3, 14, 7, 0, 64, 68, 3, 18, 9, 0, 65, 68, 3, 16, 8, 0, 66, 68, 3, 20, 10, 0, 67, 63, 1, 0, 0, 0, 67, 64, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 66, 1, 0, 0, 0, 68, 11, 1, 0, 0, 0, 69, 72, 3, 14, 7, 0, 70, 72, 3, 20, 10, 0, 71, 69, 1, 0, 0, 0, 71, 70, 1, 0, 0, 0, 72, 13, 1, 0, 0, 0, 73, 74, 5, 8, 0, 0, 74, 15, 1, 0, 0, 0, 75, 76, 5, 8, 0, 0, 76, 77, 5, 5, 0, 0, 77, 78, 5, 8, 0, 0, 78, 17, 1, 0, 0, 0, 79, 80, 5, 8, 0, 0, 80, 81, 5, 6, 0, 0, 81, 82, 5, 7, 0, 0, 82, 19, 1, 0, 0, 0, 83, 84, 5, 8, 0, 0, 84, 85, 5, 4, 0, 0, 85, 86, 5, 8, 0, 0, 86, 21, 1, 0, 0, 0, 6, 27, 41, 48, 56, 67, 71]
106 changes: 44 additions & 62 deletions parser/azm_base_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 11 additions & 23 deletions parser/azm_base_visitor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7841cdd

Please sign in to comment.