{
  "name": "Jison",
  "scopeName": "source.jison",
  "patterns": [
    {
      "begin": "%%",
      "end": "\\z",
      "patterns": [
        {
          "begin": "%%",
          "end": "\\z",
          "patterns": [
            {
              "name": "meta.section.epilogue.jison",
              "contentName": "source.js.embedded.jison",
              "begin": "\\G",
              "end": "\\z",
              "patterns": [
                {
                  "include": "#epilogue_section"
                }
              ]
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "meta.separator.section.jison"
            }
          }
        },
        {
          "name": "meta.section.rules.jison",
          "begin": "\\G",
          "end": "(?=%%)",
          "patterns": [
            {
              "include": "#rules_section"
            }
          ]
        }
      ],
      "beginCaptures": {
        "0": {
          "name": "meta.separator.section.jison"
        }
      }
    },
    {
      "name": "meta.section.declarations.jison",
      "begin": "^",
      "end": "(?=%%)",
      "patterns": [
        {
          "include": "#declarations_section"
        }
      ]
    }
  ],
  "repository": {
    "actions": {
      "patterns": [
        {
          "name": "meta.action.jison",
          "contentName": "source.js.embedded.jison",
          "begin": "\\{\\{",
          "end": "\\}\\}",
          "patterns": [
            {
              "include": "source.js"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.action.begin.jison"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.action.end.jison"
            }
          }
        },
        {
          "name": "meta.action.jison",
          "begin": "(?=%\\{)",
          "end": "(?\u003c=%\\})",
          "patterns": [
            {
              "include": "#user_code_blocks"
            }
          ]
        }
      ]
    },
    "comments": {
      "patterns": [
        {
          "name": "comment.line.double-slash.jison",
          "begin": "//",
          "end": "$",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.comment.jison"
            }
          }
        },
        {
          "name": "comment.block.jison",
          "begin": "/\\*",
          "end": "\\*/",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.comment.begin.jison"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.comment.end.jison"
            }
          }
        }
      ]
    },
    "declarations_section": {
      "patterns": [
        {
          "include": "#comments"
        },
        {
          "begin": "^\\s*(%lex)\\s*$",
          "end": "^\\s*(/lex)\\b",
          "patterns": [
            {
              "begin": "%%",
              "end": "(?=/lex)",
              "patterns": [
                {
                  "begin": "^%%",
                  "end": "(?=/lex)",
                  "patterns": [
                    {
                      "name": "meta.section.user-code.jisonlex",
                      "contentName": "source.js.embedded.jisonlex",
                      "begin": "\\G",
                      "end": "(?=/lex)",
                      "patterns": [
                        {
                          "include": "source.jisonlex#user_code_section"
                        }
                      ]
                    }
                  ],
                  "beginCaptures": {
                    "0": {
                      "name": "meta.separator.section.jisonlex"
                    }
                  }
                },
                {
                  "name": "meta.section.rules.jisonlex",
                  "begin": "\\G",
                  "end": "^(?=%%|/lex)",
                  "patterns": [
                    {
                      "include": "source.jisonlex#rules_section"
                    }
                  ]
                }
              ],
              "beginCaptures": {
                "0": {
                  "name": "meta.separator.section.jisonlex"
                }
              }
            },
            {
              "name": "meta.section.definitions.jisonlex",
              "begin": "^",
              "end": "(?=%%|/lex)",
              "patterns": [
                {
                  "include": "source.jisonlex#definitions_section"
                }
              ]
            }
          ],
          "beginCaptures": {
            "1": {
              "name": "entity.name.tag.lexer.begin.jison"
            }
          },
          "endCaptures": {
            "1": {
              "name": "entity.name.tag.lexer.end.jison"
            }
          }
        },
        {
          "name": "meta.section.prologue.jison",
          "begin": "(?=%\\{)",
          "end": "(?\u003c=%\\})",
          "patterns": [
            {
              "include": "#user_code_blocks"
            }
          ]
        },
        {
          "include": "#options_declarations"
        },
        {
          "name": "keyword.other.declaration.$1.jison",
          "match": "%(ebnf|left|nonassoc|parse-param|right|start)\\b"
        },
        {
          "include": "#include_declarations"
        },
        {
          "name": "meta.code.jison",
          "begin": "%(code)\\b",
          "end": "$",
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "include": "#rule_actions"
            },
            {
              "name": "keyword.other.code-qualifier.$1.jison",
              "match": "(init|required)"
            },
            {
              "include": "#quoted_strings"
            },
            {
              "name": "string.unquoted.jison",
              "match": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "keyword.other.declaration.$1.jison"
            }
          }
        },
        {
          "name": "meta.parser-type.jison",
          "begin": "%(parser-type)\\b",
          "end": "$",
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "include": "#quoted_strings"
            },
            {
              "name": "string.unquoted.jison",
              "match": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "keyword.other.declaration.$1.jison"
            }
          }
        },
        {
          "name": "meta.token.jison",
          "begin": "%(token)\\b",
          "end": "$|(%%|;)",
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "include": "#numbers"
            },
            {
              "include": "#quoted_strings"
            },
            {
              "name": "invalid.unimplemented.jison",
              "match": "\u003c[[:alpha:]_](?:[\\w-]*\\w)?\u003e"
            },
            {
              "name": "entity.other.token.jison",
              "match": "\\S+"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "keyword.other.declaration.$1.jison"
            }
          },
          "endCaptures": {
            "1": {
              "name": "punctuation.terminator.declaration.token.jison"
            }
          }
        },
        {
          "name": "keyword.other.declaration.$1.jison",
          "match": "%(debug|import)\\b"
        },
        {
          "name": "invalid.illegal.jison",
          "match": "%prec\\b"
        },
        {
          "name": "invalid.unimplemented.jison",
          "match": "%[[:alpha:]_](?:[\\w-]*\\w)?\\b"
        },
        {
          "include": "#numbers"
        },
        {
          "include": "#quoted_strings"
        }
      ]
    },
    "epilogue_section": {
      "patterns": [
        {
          "include": "#user_code_include_declarations"
        },
        {
          "include": "source.js"
        }
      ]
    },
    "include_declarations": {
      "patterns": [
        {
          "name": "meta.include.jison",
          "begin": "(%(include))\\s*",
          "end": "(?\u003c=['\"])|(?=\\s)",
          "patterns": [
            {
              "include": "#include_paths"
            }
          ],
          "beginCaptures": {
            "1": {
              "name": "keyword.other.declaration.$2.jison"
            }
          }
        }
      ]
    },
    "include_paths": {
      "patterns": [
        {
          "include": "#quoted_strings"
        },
        {
          "name": "string.unquoted.jison",
          "begin": "(?=\\S)",
          "end": "(?=\\s)",
          "patterns": [
            {
              "include": "source.js#string_escapes"
            }
          ]
        }
      ]
    },
    "numbers": {
      "patterns": [
        {
          "match": "(0[Xx])([0-9A-Fa-f]+)",
          "captures": {
            "1": {
              "name": "storage.type.number.jison"
            },
            "2": {
              "name": "constant.numeric.integer.hexadecimal.jison"
            }
          }
        },
        {
          "name": "constant.numeric.integer.decimal.jison",
          "match": "\\d+"
        }
      ]
    },
    "options_declarations": {
      "patterns": [
        {
          "name": "meta.options.jison",
          "begin": "%options\\b",
          "end": "^(?=\\S|\\s*$)",
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "name": "entity.name.constant.jison",
              "match": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b"
            },
            {
              "begin": "(=)\\s*",
              "end": "(?\u003c=['\"])|(?=\\s)",
              "patterns": [
                {
                  "include": "#comments"
                },
                {
                  "name": "constant.language.boolean.$1.jison",
                  "match": "\\b(true|false)\\b"
                },
                {
                  "include": "#numbers"
                },
                {
                  "include": "#quoted_strings"
                },
                {
                  "name": "string.unquoted.jison",
                  "match": "\\S+"
                }
              ],
              "beginCaptures": {
                "1": {
                  "name": "keyword.operator.option.assignment.jison"
                }
              }
            },
            {
              "include": "#quoted_strings"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "keyword.other.options.jison"
            }
          }
        }
      ]
    },
    "quoted_strings": {
      "patterns": [
        {
          "name": "string.quoted.double.jison",
          "begin": "\"",
          "end": "\"",
          "patterns": [
            {
              "include": "source.js#string_escapes"
            }
          ]
        },
        {
          "name": "string.quoted.single.jison",
          "begin": "'",
          "end": "'",
          "patterns": [
            {
              "include": "source.js#string_escapes"
            }
          ]
        }
      ]
    },
    "rule_actions": {
      "patterns": [
        {
          "include": "#actions"
        },
        {
          "name": "meta.action.jison",
          "contentName": "source.js.embedded.jison",
          "begin": "\\{",
          "end": "\\}",
          "patterns": [
            {
              "include": "source.js"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.action.begin.jison"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.action.end.jison"
            }
          }
        },
        {
          "include": "#include_declarations"
        },
        {
          "name": "meta.action.jison",
          "contentName": "source.js.embedded.jison",
          "begin": "-\u003e|→",
          "end": "$",
          "patterns": [
            {
              "include": "source.js"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.action.arrow.jison"
            }
          }
        }
      ]
    },
    "rules_section": {
      "patterns": [
        {
          "include": "#comments"
        },
        {
          "include": "#actions"
        },
        {
          "include": "#include_declarations"
        },
        {
          "name": "meta.rule.jison",
          "begin": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b",
          "end": ";",
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "name": "meta.rule-components.jison",
              "begin": ":",
              "end": "(?=;)",
              "patterns": [
                {
                  "include": "#comments"
                },
                {
                  "include": "#quoted_strings"
                },
                {
                  "match": "(\\[)([[:alpha:]_](?:[\\w-]*\\w)?)(\\])",
                  "captures": {
                    "1": {
                      "name": "punctuation.definition.named-reference.begin.jison"
                    },
                    "2": {
                      "name": "entity.name.other.reference.jison"
                    },
                    "3": {
                      "name": "punctuation.definition.named-reference.end.jison"
                    }
                  }
                },
                {
                  "name": "meta.prec.jison",
                  "begin": "(%(prec))\\s*",
                  "end": "(?\u003c=['\"])|(?=\\s)",
                  "patterns": [
                    {
                      "include": "#comments"
                    },
                    {
                      "include": "#quoted_strings"
                    },
                    {
                      "name": "constant.other.token.jison",
                      "begin": "(?=\\S)",
                      "end": "(?=\\s)"
                    }
                  ],
                  "beginCaptures": {
                    "1": {
                      "name": "keyword.other.$2.jison"
                    }
                  }
                },
                {
                  "name": "keyword.operator.rule-components.separator.jison",
                  "match": "\\|"
                },
                {
                  "name": "keyword.other.$0.jison",
                  "match": "\\b(?:EOF|error)\\b"
                },
                {
                  "name": "keyword.other.empty.jison",
                  "match": "(?:%(?:e(?:mpty|psilon))|\\b[Ɛɛεϵ])\\b"
                },
                {
                  "include": "#rule_actions"
                }
              ],
              "beginCaptures": {
                "0": {
                  "name": "keyword.operator.rule-components.assignment.jison"
                }
              }
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "entity.name.constant.rule-result.jison"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.terminator.rule.jison"
            }
          }
        }
      ]
    },
    "user_code_blocks": {
      "patterns": [
        {
          "name": "meta.user-code-block.jison",
          "contentName": "source.js.embedded.jison",
          "begin": "%\\{",
          "end": "%\\}",
          "patterns": [
            {
              "include": "source.js"
            }
          ],
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.user-code-block.begin.jison"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.user-code-block.end.jison"
            }
          }
        }
      ]
    },
    "user_code_include_declarations": {
      "patterns": [
        {
          "name": "meta.include.jison",
          "begin": "^(%(include))\\s*",
          "end": "(?\u003c=['\"])|(?=\\s)",
          "patterns": [
            {
              "include": "#include_paths"
            }
          ],
          "beginCaptures": {
            "1": {
              "name": "keyword.other.declaration.$2.jison"
            }
          }
        }
      ]
    }
  },
  "injections": {
    "L:(meta.action.jison - (comment | string)), source.js.embedded.jison - (comment | string), source.js.embedded.source - (comment | string.quoted.double | string.quoted.single)": {
      "patterns": [
        {
          "name": "variable.language.semantic-value.jison",
          "match": "\\${2}"
        },
        {
          "name": "variable.language.result-location.jison",
          "match": "@\\$"
        },
        {
          "name": "variable.language.stack-index-0.jison",
          "match": "##\\$|\\byysp\\b"
        },
        {
          "name": "support.variable.token-reference.jison",
          "match": "#\\S+#"
        },
        {
          "name": "variable.language.result-id.jison",
          "match": "#\\$"
        },
        {
          "name": "support.variable.token-value.jison",
          "match": "\\$(?:-?\\d+|[[:alpha:]_](?:[\\w-]*\\w)?)"
        },
        {
          "name": "support.variable.token-location.jison",
          "match": "@(?:-?\\d+|[[:alpha:]_](?:[\\w-]*\\w)?)"
        },
        {
          "name": "support.variable.stack-index.jison",
          "match": "##(?:-?\\d+|[[:alpha:]_](?:[\\w-]*\\w)?)"
        },
        {
          "name": "support.variable.token-id.jison",
          "match": "#(?:-?\\d+|[[:alpha:]_](?:[\\w-]*\\w)?)"
        },
        {
          "name": "variable.language.jison",
          "match": "\\byy(?:l(?:eng|ineno|oc|stack)|rulelength|s(?:tate|s?tack)|text|vstack)\\b"
        },
        {
          "name": "keyword.other.jison",
          "match": "\\byy(?:clearin|erro[kr])\\b"
        }
      ]
    }
  }
}