Add assignment

This commit is contained in:
Bruno BELANYI 2024-04-07 21:37:52 +01:00
parent fc9f1467df
commit 38bf9532ad
5 changed files with 2184 additions and 47 deletions

68
src/grammar.json generated
View file

@ -2,14 +2,76 @@
"name": "blueprint",
"rules": {
"source_file": {
"type": "STRING",
"value": "hello"
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_definition"
}
},
"_definition": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "assignment"
}
]
},
"assignment": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "FIELD",
"name": "operator",
"content": {
"type": "STRING",
"value": "="
}
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "_expr"
}
}
]
},
"_expr": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "integer_literal"
}
]
},
"identifier": {
"type": "PATTERN",
"value": "[_\\p{XID_Start}][_\\p{XID_Continue}]*"
},
"integer_literal": {
"type": "PATTERN",
"value": "[0-9]+"
}
},
"extras": [
{
"type": "PATTERN",
"value": "\\s"
"value": "\\s+"
}
],
"conflicts": [],