295 lines
5.8 KiB
JSON
295 lines
5.8 KiB
JSON
{
|
|
"name": "d2",
|
|
"rules": {
|
|
"source_file": {
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_definition"
|
|
}
|
|
},
|
|
"_definition": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "connection"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "shape"
|
|
}
|
|
]
|
|
},
|
|
"_end": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ";"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "\n"
|
|
}
|
|
]
|
|
},
|
|
"connection": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "FIELD",
|
|
"name": "left",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "arrow"
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "right",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_end"
|
|
}
|
|
]
|
|
},
|
|
"shape": {
|
|
"type": "PREC_LEFT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "FIELD",
|
|
"name": "id",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "label",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "label"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_end"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"label": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "string"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[^\\n{]+"
|
|
}
|
|
]
|
|
},
|
|
"identifier": {
|
|
"type": "SYMBOL",
|
|
"name": "_identifier"
|
|
},
|
|
"arrow": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "--"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "STRING",
|
|
"value": "-"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "<-"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "STRING",
|
|
"value": "-"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "<-"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "STRING",
|
|
"value": "-"
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "STRING",
|
|
"value": "-"
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "->"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"string": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "'"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "[^'\\n]+"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "'"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "\""
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "[^'\\n]+"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "\""
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "`"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "[^'\\n]+"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "`"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"extras": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "\\s"
|
|
}
|
|
],
|
|
"conflicts": [],
|
|
"precedences": [],
|
|
"externals": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_identifier"
|
|
}
|
|
],
|
|
"inline": [],
|
|
"supertypes": []
|
|
}
|
|
|