add operation expressions

This commit is contained in:
mhoffm
2021-06-13 09:17:52 +02:00
parent d04993a05a
commit 3bba72f836
4 changed files with 6257 additions and 3588 deletions

View File

@@ -135,6 +135,10 @@
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "SYMBOL",
"name": "operation"
},
{
"type": "SYMBOL",
"name": "conditional"
@@ -854,6 +858,234 @@
}
]
},
"operation": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "unary_operation"
},
{
"type": "SYMBOL",
"name": "binary_operation"
}
]
},
"unary_operation": {
"type": "PREC_LEFT",
"value": 7,
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "-"
},
{
"type": "STRING",
"value": "!"
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
},
"binary_operation": {
"type": "CHOICE",
"members": [
{
"type": "PREC_LEFT",
"value": 6,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "*"
},
{
"type": "STRING",
"value": "/"
},
{
"type": "STRING",
"value": "%"
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
},
{
"type": "PREC_LEFT",
"value": 5,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "+"
},
{
"type": "STRING",
"value": "-"
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
},
{
"type": "PREC_LEFT",
"value": 4,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ">"
},
{
"type": "STRING",
"value": ">="
},
{
"type": "STRING",
"value": "<"
},
{
"type": "STRING",
"value": "<="
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
},
{
"type": "PREC_LEFT",
"value": 3,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "=="
},
{
"type": "STRING",
"value": "!="
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
},
{
"type": "PREC_LEFT",
"value": 2,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "&&"
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
},
{
"type": "PREC_LEFT",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expr_term"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "||"
}
]
},
{
"type": "SYMBOL",
"name": "expr_term"
}
]
}
}
]
},
"comment": {
"type": "TOKEN",
"content": {