aboutsummaryrefslogtreecommitdiff
path: root/src/grammar.json
diff options
context:
space:
mode:
Diffstat (limited to 'src/grammar.json')
-rw-r--r--src/grammar.json431
1 files changed, 431 insertions, 0 deletions
diff --git a/src/grammar.json b/src/grammar.json
new file mode 100644
index 0000000..1d2d121
--- /dev/null
+++ b/src/grammar.json
@@ -0,0 +1,431 @@
+{
+ "name": "apinotation",
+ "rules": {
+ "source_file": {
+ "type": "REPEAT",
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "definition"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "comment"
+ }
+ ]
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "SYMBOL",
+ "name": "_newline"
+ }
+ }
+ ]
+ }
+ },
+ "definition": {
+ "type": "PREC_RIGHT",
+ "value": 0,
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "entry"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_newline"
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "member"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "comment"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ "entry": {
+ "type": "PREC_RIGHT",
+ "value": 0,
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "identifier"
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "TOKEN",
+ "content": {
+ "type": "STRING",
+ "value": "."
+ }
+ },
+ {
+ "type": "SYMBOL",
+ "name": "identifier"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ "member": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "member_type"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_label"
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "type_annotation"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "parameter_list"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "return_statement"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "throw_statement"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_newline"
+ }
+ ]
+ },
+ "member_type": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "::"
+ },
+ {
+ "type": "STRING",
+ "value": "->"
+ },
+ {
+ "type": "STRING",
+ "value": "<-"
+ },
+ {
+ "type": "STRING",
+ "value": "~>"
+ },
+ {
+ "type": "STRING",
+ "value": "<~"
+ },
+ {
+ "type": "STRING",
+ "value": "+>"
+ },
+ {
+ "type": "STRING",
+ "value": "<+"
+ },
+ {
+ "type": "STRING",
+ "value": "#"
+ },
+ {
+ "type": "STRING",
+ "value": "+"
+ },
+ {
+ "type": "STRING",
+ "value": "-"
+ }
+ ]
+ },
+ "parameter_list": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "("
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_identifier_list"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "STRING",
+ "value": ")"
+ }
+ ]
+ },
+ "return_statement": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "=>"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "entry"
+ }
+ ]
+ },
+ "throw_statement": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "#>"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_entry_list"
+ }
+ ]
+ },
+ "_entry_list": {
+ "type": "PREC_LEFT",
+ "value": 0,
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "entry"
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": ","
+ },
+ {
+ "type": "SYMBOL",
+ "name": "entry"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ "_identifier_list": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "identifier"
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": ","
+ },
+ {
+ "type": "SYMBOL",
+ "name": "identifier"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "identifier": {
+ "type": "PREC_LEFT",
+ "value": 0,
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_label"
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "type_annotation"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "parameter_list"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "return_statement"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "throw_statement"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ "type_annotation": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "<"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_entry_list"
+ },
+ {
+ "type": "STRING",
+ "value": ">"
+ }
+ ]
+ },
+ "comment": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "//"
+ },
+ {
+ "type": "PATTERN",
+ "value": "[^\\n]*"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_newline"
+ }
+ ]
+ },
+ "_label": {
+ "type": "PATTERN",
+ "value": "[a-zA-Z0-9][a-zA-Z0-9_-]*"
+ },
+ "_newline": {
+ "type": "TOKEN",
+ "content": {
+ "type": "STRING",
+ "value": "\n"
+ }
+ }
+ },
+ "extras": [
+ {
+ "type": "PATTERN",
+ "value": "\\s"
+ }
+ ],
+ "conflicts": [],
+ "precedences": [],
+ "externals": [],
+ "inline": [],
+ "supertypes": []
+}
+