diff --git a/other-notations/YARSpg.ebnf b/other-notations/YARSpg.ebnf index d814d56..2ecafc5 100644 --- a/other-notations/YARSpg.ebnf +++ b/other-notations/YARSpg.ebnf @@ -7,7 +7,7 @@ https://github.com/lszeremeta/antlr-yarspg [The "BSD licence"] - Copyright (c) 2018-2020, Łukasz Szeremeta (@ University of Bialystok, https://lukasz.science) + Copyright (c) 2018-2021, Łukasz Szeremeta (@ University of Bialystok, https://github.com/lszeremeta) Copyright (c) 2018-2019, Dominik Tomaszuk (@ University of Bialystok, http://www.uwb.edu.pl/) All rights reserved. @@ -52,10 +52,10 @@ var_declaration ::= var '=' prop ( ',' prop )* var_declaration_schema ::= var '=' prop_schema ( ',' prop_schema )* -var_name ::= ALNUM_PLUS +var_name ::= ID graph_id ::= 'default' - | ALNUM_PLUS + | ID local_metadata ::= '+' prop_list prop_list @@ -74,11 +74,11 @@ section ::= '%' SECTION_NAME directed ::= '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '->' '(' node_id ')' graphs_list? local_metadata? undirected ::= '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '-' '(' node_id ')' graphs_list? local_metadata? -node_id ::= ALNUM_PLUS +node_id ::= ID node_label ::= STRING prop ::= key ':' value meta_prop* -edge_id ::= ALNUM_PLUS +edge_id ::= ID edge_label ::= STRING graph_label @@ -98,7 +98,7 @@ struct ::= '{' key ':' ( primitive_value | struct ) meta_prop* ( ',' key ':' ( node_schema ::= 'S' '(' node_id_schema ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list_schema? ')' graphs_list? local_metadata? node_id_schema - ::= ALNUM_PLUS + ::= ID prop_list_schema ::= '[' ( ( prop_schema | var ) ( ',' ( prop_schema | var ) )* )? ']' prop_schema @@ -159,14 +159,6 @@ COMMENT ::= '#' [^#xd#xa#xc]* STRING ::= '"' ([^"\#xd#xa] | "'" | '\"')* '"' UNSIGNED_INT ::= [0-9]* -ALNUM_PLUS - ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)? -PN_CHARS ::= PN_CHARS_U - | [-0-9#xB7#x0300-#x036F#x203F-#x2040] -PN_CHARS_U - ::= PN_CHARS_BASE - | '_' -PN_CHARS_BASE - ::= [A-Za-z0-9#xC0-#xD6#xD8-#xF6#xF8-#x2FF#x370-#x37D#x37F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD] +ID ::= [a-zA-Z_][a-zA-Z0-9_]* HEX ::= [0-9A-Fa-f] WS ::= ([#x20#x9#xa])+ \ No newline at end of file diff --git a/yarspg/YARSpg.g4 b/yarspg/YARSpg.g4 index a44cbc9..21aaf49 100644 --- a/yarspg/YARSpg.g4 +++ b/yarspg/YARSpg.g4 @@ -1,6 +1,6 @@ /* [The "BSD licence"] - Copyright (c) 2018-2020, Łukasz Szeremeta (@ University of Bialystok, https://lukasz.science) + Copyright (c) 2018-2021, Łukasz Szeremeta (@ University of Bialystok, https://github.com/lszeremeta) Copyright (c) 2018, Dominik Tomaszuk (@ University of Bialystok, http://www.uwb.edu.pl/) Copyright (c) 2018, Karol Litman (@ University of Bialystok, http://www.uwb.edu.pl/) All rights reserved. @@ -60,12 +60,12 @@ var_declaration_schema ; var_name - : ALNUM_PLUS + : ID ; graph_id : 'default' - | ALNUM_PLUS + | ID ; local_metadata @@ -110,7 +110,7 @@ undirected ; node_id - : ALNUM_PLUS + : ID ; node_label @@ -122,7 +122,7 @@ prop ; edge_id - : ALNUM_PLUS + : ID ; edge_label @@ -169,7 +169,7 @@ node_schema ; node_id_schema - : ALNUM_PLUS + : ID ; prop_list_schema @@ -281,20 +281,8 @@ UNSIGNED_INT : [0-9]+ ; -ALNUM_PLUS - : PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)? - ; - -PN_CHARS - : PN_CHARS_U | '-' | [0-9] | '\u00B7' | [\u0300-\u036F] | [\u203F-\u2040] - ; - -PN_CHARS_U - : PN_CHARS_BASE | '_' - ; - -PN_CHARS_BASE - : 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '\u00C0' .. '\u00D6' | '\u00D8' .. '\u00F6' | '\u00F8' .. '\u02FF' | '\u0370' .. '\u037D' | '\u037F' .. '\u1FFF' | '\u200C' .. '\u200D' | '\u2070' .. '\u218F' | '\u2C00' .. '\u2FEF' | '\u3001' .. '\uD7FF' | '\uF900' .. '\uFDCF' | '\uFDF0' .. '\uFFFD' +ID + : [a-zA-Z_][a-zA-Z0-9_]* ; HEX diff --git a/yarspg/examples/test-example.yarspg b/yarspg/examples/test-example.yarspg index 1dbe3ab..c3d854e 100644 --- a/yarspg/examples/test-example.yarspg +++ b/yarspg/examples/test-example.yarspg @@ -73,9 +73,9 @@ S(NS9 {"label"}["keyword": Struct(String)@"ok": Integer]) S(NS92 {"label"}["keyword": Struct(String)@"ok": Integer OPTIONAL]) (i {"label"}["keyword": {"name": "abc"@"info": "ok", "title": "xyz"}@"ok": "1"]) S(NS10 {"2label4"}["keyword2": Struct(Struct(String))]) -(2i44 {"2label4"}["keyword2": {"names": {"name": "abc", "title": "xyz"}, "names2": {"name2": "abc2", "title2": "xyz2"}, "names3": {"name3": "abc3", "title3": "xyz3"}}]) +(a2i44 {"2label4"}["keyword2": {"names": {"name": "abc", "title": "xyz"}, "names2": {"name2": "abc2", "title2": "xyz2"}, "names3": {"name3": "abc3", "title3": "xyz3"}}]) S(NS11 {"2label4"}["keyword2": Struct(Struct(String)@"struct": String)@"struct": String @"ok": Bool]) -(2i44 {"2label4"}["keyword2": {"names": {"name": "abc", "title": "xyz"}@"rating": "5", "names2": {"name2": "abc2"@"more": "ok", "title2": "xyz2"}, "names3": {"name3": "abc3", "title3": "xyz3"}@"struct": "inside"}@"struct": "outside" @"ok": "true"]) +(a2i44 {"2label4"}["keyword2": {"names": {"name": "abc", "title": "xyz"}@"rating": "5", "names2": {"name2": "abc2"@"more": "ok", "title2": "xyz2"}, "names3": {"name3": "abc3", "title3": "xyz3"}@"struct": "inside"}@"struct": "outside" @"ok": "true"]) (i2 {"label"}["keyword": {"name": "abc", "title": {"name2": "abc2", "title2": "xyz2"}}]) S(NS12 {"432f"}["set": Set(String)])/graphname/ (z {"432f"}["set": {"name", "title"}])/graphname/ @@ -83,16 +83,17 @@ S(NS12 {"432f"}["set": Set(String)])/graphname/ S(NS13 {"432f2"}["set": Set(Set(String))]) (z2 {"432f2"}["set": {{"set2", "title"}}]) S(NS14 {"3432f2"}["set": Set(Set(String))]) -(3z2 {"3432f2"}["set": {{"set2", "title"}, {"set3", "title3"}}]) +(z3z2 {"3432f2"}["set": {{"set2", "title"}, {"set3", "title3"}}]) S(NS15 {"1ad32"}["list": List(String)]) -(1dsc {"1ad32"}["list": ["name55", "name3"]]) +(c1dsc {"1ad32"}["list": ["name55", "name3"]]) S(NS16 {"1ad32"}["list": List(String NULL)]) S(NS163 {"1ad32"}["list": List(String MAX 3)]) S(NS164 {"1ad32"}["list": List(String MIN 1)]) S(NS165 {"1ad32"}["list": List(String MAX 1)]) -(1dsc {"1ad32"}["list": ["name55", "null"]]) +(c1dsc {"1ad32"}["list": ["name55", "null"]]) S(NS17 {"1ad32"}["list": List(String) NULL]) -(1dsc {"1ad32"}["list": "null"]) +(c1dsc {"1ad32"}["list": "null"]) +(_test {"1ad32"}["list": "null"]) S(NS18 {"ad3"}["list": List(List(String))]) (ds {"ad3"}["list": [["name55", "name3"]]]) S(NS19 {"ad32"}["list": List(List(String))])