From 811570b9e19f1686c643306fca02f2c61520fdfe Mon Sep 17 00:00:00 2001 From: Alan Wang Date: Wed, 18 Jun 2025 11:40:03 -0400 Subject: [PATCH 1/2] updated grammar for Cedar Schema Signed-off-by: Alan Wang --- docs/collections/_schema/human-readable-schema-grammar.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/collections/_schema/human-readable-schema-grammar.md b/docs/collections/_schema/human-readable-schema-grammar.md index b88dd5d..82d2722 100644 --- a/docs/collections/_schema/human-readable-schema-grammar.md +++ b/docs/collections/_schema/human-readable-schema-grammar.md @@ -57,11 +57,12 @@ Name := IDENT | STR Names := Name {',' Name} Idents := IDENT {',' IDENT} -IDENT := ['_''a'-'z''A'-'Z']['_''a'-'z''A'-'Z''0'-'9']* -TYPENAME := IDENT - RESERVED +IDENT := ['_''a'-'z''A'-'Z']['_''a'-'z''A'-'Z''0'-'9']* - RESERVED +RESERVED := 'true' | 'false' | 'if' | 'then' | 'else' | 'in' | 'like' | 'has' | 'is' | '__cedar' +TYPENAME := IDENT - TYPERESERVED STR := Fully-escaped Unicode surrounded by '"'s PRIMTYPE := 'Long' | 'String' | 'Bool' WHITESPC := Unicode whitespace COMMENT := '//' ~NEWLINE* NEWLINE -RESERVED := 'Bool' | 'Boolean' | 'Entity' | 'Extension' | 'Long' | 'Record' | 'Set' | 'String' +TYPERESERVED := 'Bool' | 'Boolean' | 'Entity' | 'Extension' | 'Long' | 'Record' | 'Set' | 'String' ``` From ee092abd567811480832ba757531d5aeb2976f7e Mon Sep 17 00:00:00 2001 From: Alan Wang <33503035+alanwang67@users.noreply.github.com> Date: Fri, 20 Jun 2025 15:55:31 -0400 Subject: [PATCH 2/2] Change annotations to reflect that any identifier can be used --- docs/collections/_schema/human-readable-schema-grammar.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/collections/_schema/human-readable-schema-grammar.md b/docs/collections/_schema/human-readable-schema-grammar.md index 82d2722..1573be7 100644 --- a/docs/collections/_schema/human-readable-schema-grammar.md +++ b/docs/collections/_schema/human-readable-schema-grammar.md @@ -32,7 +32,7 @@ Tokens are defined using regular expressions: The grammar adopts the same string escaping rules as the [Cedar policy grammar](../policies/syntax-grammar.html). ``` -Annotation := '@' IDENT '(' STR ')' +Annotation := '@' ANYIDENT '(' STR ')' Annotations := {Annotations} Schema := {Namespace} Namespace := (Annotations 'namespace' Path '{' {Decl} '}') | Decl @@ -57,7 +57,8 @@ Name := IDENT | STR Names := Name {',' Name} Idents := IDENT {',' IDENT} -IDENT := ['_''a'-'z''A'-'Z']['_''a'-'z''A'-'Z''0'-'9']* - RESERVED +ANYIDENT := ['_''a'-'z''A'-'Z']['_''a'-'z''A'-'Z''0'-'9']* +IDENT := ANYIDENT - RESERVED RESERVED := 'true' | 'false' | 'if' | 'then' | 'else' | 'in' | 'like' | 'has' | 'is' | '__cedar' TYPENAME := IDENT - TYPERESERVED STR := Fully-escaped Unicode surrounded by '"'s