2017-07-14 19:28:54 +00:00
|
|
|
{
|
|
|
|
"name": "bash",
|
|
|
|
"rules": {
|
|
|
|
"program": {
|
|
|
|
"type": "REPEAT",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "command"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"command": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "simple_command"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "pipeline"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "list"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "control_operator"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"simple_command": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "REPEAT",
|
|
|
|
"content": {
|
2017-07-14 19:43:42 +00:00
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "environment_variable_assignment"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "file_redirect"
|
|
|
|
}
|
|
|
|
]
|
2017-07-14 19:28:54 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "leading_word"
|
|
|
|
},
|
|
|
|
"value": "command_name"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "PATTERN",
|
|
|
|
"value": "\\s+"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "REPEAT",
|
|
|
|
"content": {
|
2017-07-14 20:00:41 +00:00
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "word"
|
|
|
|
},
|
|
|
|
"value": "argument"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "expansion"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "operator_expansion"
|
|
|
|
}
|
|
|
|
]
|
2017-07-14 19:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "BLANK"
|
|
|
|
}
|
|
|
|
]
|
2017-07-14 19:43:42 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "REPEAT",
|
|
|
|
"content": {
|
2017-07-14 20:54:05 +00:00
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "file_redirect"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "heredoc_redirect"
|
|
|
|
}
|
|
|
|
]
|
2017-07-14 19:43:42 +00:00
|
|
|
}
|
2017-07-14 19:28:54 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"pipeline": {
|
|
|
|
"type": "PREC_LEFT",
|
|
|
|
"value": 0,
|
|
|
|
"content": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "simple_command"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "|"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "|&"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "simple_command"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"list": {
|
|
|
|
"type": "PREC_LEFT",
|
|
|
|
"value": 0,
|
|
|
|
"content": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "simple_command"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "list"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "pipeline"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "&&"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": ";"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "simple_command"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "pipeline"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"environment_variable_assignment": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "leading_word"
|
|
|
|
},
|
|
|
|
"value": "variable_name"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "="
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "word"
|
|
|
|
},
|
|
|
|
"value": "argument"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-07-14 20:00:41 +00:00
|
|
|
"expansion": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "$"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "word"
|
|
|
|
},
|
|
|
|
"value": "variable_name"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"operator_expansion": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "${"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "leading_word"
|
|
|
|
},
|
|
|
|
"value": "variable_name"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": ":"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": ":?"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "="
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "word"
|
|
|
|
},
|
|
|
|
"value": "argument"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "BLANK"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "}"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-07-14 19:43:42 +00:00
|
|
|
"file_redirect": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "file_descriptor"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "BLANK"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "<"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": ">"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "<&"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": ">&"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "file_descriptor"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "RENAME",
|
|
|
|
"content": {
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "word"
|
|
|
|
},
|
|
|
|
"value": "file_name"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-07-14 20:54:05 +00:00
|
|
|
"heredoc_redirect": {
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "<<"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "<<-"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "heredoc"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-07-14 21:27:13 +00:00
|
|
|
"heredoc": {
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_simple_heredoc"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SEQ",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_heredoc_beginning"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "REPEAT",
|
|
|
|
"content": {
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "expansion"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "operator_expansion"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_heredoc_middle"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_heredoc_end"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-07-14 19:43:42 +00:00
|
|
|
"file_descriptor": {
|
|
|
|
"type": "TOKEN",
|
|
|
|
"content": {
|
|
|
|
"type": "PREC",
|
|
|
|
"value": 1,
|
|
|
|
"content": {
|
|
|
|
"type": "PATTERN",
|
|
|
|
"value": "\\d+"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2017-07-14 19:28:54 +00:00
|
|
|
"leading_word": {
|
|
|
|
"type": "PATTERN",
|
2017-07-14 20:00:41 +00:00
|
|
|
"value": "[^\\s=|;:{}]+"
|
2017-07-14 19:28:54 +00:00
|
|
|
},
|
|
|
|
"word": {
|
|
|
|
"type": "PATTERN",
|
2017-07-14 20:00:41 +00:00
|
|
|
"value": "[^\\s$<>{}&]+"
|
2017-07-14 19:28:54 +00:00
|
|
|
},
|
|
|
|
"control_operator": {
|
|
|
|
"type": "CHOICE",
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": "\n"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "STRING",
|
|
|
|
"value": ";;"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"extras": [
|
|
|
|
{
|
|
|
|
"type": "PATTERN",
|
|
|
|
"value": "\\s"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"conflicts": [],
|
2017-07-14 20:54:05 +00:00
|
|
|
"externals": [
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
2017-07-14 21:27:13 +00:00
|
|
|
"name": "_simple_heredoc"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_heredoc_beginning"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_heredoc_middle"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "SYMBOL",
|
|
|
|
"name": "_heredoc_end"
|
2017-07-14 20:54:05 +00:00
|
|
|
}
|
|
|
|
],
|
2017-07-14 19:28:54 +00:00
|
|
|
"inline": [
|
|
|
|
"control_operator"
|
|
|
|
]
|
|
|
|
}
|