318 lines
6.3 KiB
JSON
318 lines
6.3 KiB
JSON
{
|
|
"name": "minizinc",
|
|
"word": "identifier",
|
|
"rules": {
|
|
"source_file": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_items"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ";"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_items"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ";"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"_items": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "assignment_item"
|
|
}
|
|
]
|
|
},
|
|
"assignment_item": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "FIELD",
|
|
"name": "name",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "="
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "expr",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"_expression": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_literal"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
]
|
|
},
|
|
"_literal": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "absent"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "boolean_literal"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "float_literal"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "integer_literal"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "string_literal"
|
|
}
|
|
]
|
|
},
|
|
"absent": {
|
|
"type": "STRING",
|
|
"value": "<>"
|
|
},
|
|
"boolean_literal": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "true"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "false"
|
|
}
|
|
]
|
|
},
|
|
"float_literal": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "\\d+\\.\\d+"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "\\d+(\\.\\d+)?[Ee][+-]?\\d+"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"integer_literal": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[0-9]+"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "0x[0-9a-fA-F]+"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "0b[01]+"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "0o[0-7]+"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"string_literal": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "\""
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "IMMEDIATE_TOKEN",
|
|
"content": {
|
|
"type": "PREC",
|
|
"value": 1,
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "[^\"\\n\\\\]+"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "escape_sequence"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "\""
|
|
}
|
|
]
|
|
},
|
|
"escape_sequence": {
|
|
"type": "IMMEDIATE_TOKEN",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "\\"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[^xuU]"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "\\d{2,3}"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "x[0-9a-fA-F]{2,}"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "u[0-9a-fA-F]{4}"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "U[0-9a-fA-F]{8}"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"identifier": {
|
|
"type": "PATTERN",
|
|
"value": "[A-Za-z][A-Za-z0-9_]*"
|
|
},
|
|
"line_comment": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "%"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": ".*"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"block_comment": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "/*"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "([^*]|\\*[^\\/]|\\n)*?\\*?"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "*/"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"extras": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "\\s"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "line_comment"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_comment"
|
|
}
|
|
],
|
|
"conflicts": [],
|
|
"externals": [],
|
|
"inline": [],
|
|
"supertypes": []
|
|
}
|
|
|