{
  "name": "Jison Lex",
  "scopeName": "source.jisonlex",
  "fileTypes": [
    "jisonlex"
  ],
  "patterns": [
    {
      "begin": "%%",
      "beginCaptures": {
        "0": {
          "name": "meta.separator.section.jisonlex"
        }
      },
      "patterns": [
        {
          "begin": "^%%",
          "beginCaptures": {
            "0": {
              "name": "meta.separator.section.jisonlex"
            }
          },
          "patterns": [
            {
              "name": "meta.section.user-code.jisonlex",
              "begin": "\\G",
              "contentName": "source.js.embedded.jison",
              "patterns": [
                {
                  "include": "#user_code_section"
                }
              ]
            }
          ]
        },
        {
          "name": "meta.section.rules.jisonlex",
          "begin": "\\G",
          "end": "(?=^%%)",
          "patterns": [
            {
              "include": "#rules_section"
            }
          ]
        }
      ]
    },
    {
      "name": "meta.section.definitions.jisonlex",
      "begin": "^",
      "end": "(?=%%)",
      "patterns": [
        {
          "include": "#definitions_section"
        }
      ]
    }
  ],
  "repository": {
    "definitions_section": {
      "patterns": [
        {
          "include": "source.jison#comments"
        },
        {
          "include": "source.jison#include_declarations"
        },
        {
          "name": "meta.definition.jisonlex",
          "begin": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b",
          "end": "$",
          "beginCaptures": {
            "0": {
              "name": "entity.name.other.definition.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "source.jison#comments"
            },
            {
              "name": "string.regexp.jisonlex",
              "begin": "(?=\\S)",
              "end": "(?=\\s)",
              "patterns": [
                {
                  "include": "#regexp"
                }
              ]
            }
          ]
        },
        {
          "name": "meta.start-condition.jisonlex",
          "begin": "%[sx]\\b",
          "end": "$",
          "beginCaptures": {
            "0": {
              "name": "keyword.other.start-condition.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "source.jison#comments"
            },
            {
              "name": "entity.name.function.jisonlex",
              "match": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b"
            },
            {
              "name": "invalid.illegal.jisonlex",
              "match": "\\S"
            }
          ]
        },
        {
          "include": "source.jison#options_declarations"
        },
        {
          "name": "invalid.unimplemented.jisonlex",
          "match": "%(?:array|pointer)"
        },
        {
          "include": "source.jison#user_code_blocks"
        }
      ]
    },
    "rules_section": {
      "patterns": [
        {
          "include": "source.jison#comments"
        },
        {
          "name": "meta.start-conditions.jisonlex",
          "begin": "(?:^|(?<=%\\}))<(?!<EOF>>)",
          "end": ">",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.start-conditions.begin.jisonlex"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.start-conditions.end.jisonlex"
            }
          },
          "patterns": [
            {
              "name": "keyword.other.jisonlex",
              "match": "\\bINITIAL\\b"
            },
            {
              "name": "entity.name.function.jisonlex",
              "match": "\\b[[:alpha:]_](?:[\\w-]*\\w)?\\b"
            },
            {
              "name": "punctuation.separator.start-condition.jisonlex",
              "match": ","
            },
            {
              "name": "keyword.other.any-start-condition.jisonlex",
              "match": "(?<=<)\\*(?=>)"
            },
            {
              "name": "invalid.illegal.jisonlex",
              "match": "."
            }
          ]
        },
        {
          "name": "meta.rule.action.jisonlex",
          "begin": "(?=%\\{)",
          "end": "(?<=%\\})",
          "patterns": [
            {
              "include": "source.jison#user_code_blocks"
            }
          ]
        },
        {
          "name": "string.regexp.jisonlex",
          "begin": "(?:^|(?<=>|%\\}))(?=\\S)",
          "end": "(?=\\s|%\\{)",
          "patterns": [
            {
              "include": "#regexp"
            }
          ]
        },
        {
          "name": "meta.rule.action.jisonlex",
          "begin": "(?=\\S)",
          "end": "$",
          "contentName": "source.js.embedded.jison",
          "patterns": [
            {
              "include": "source.jison#include_declarations"
            },
            {
              "include": "source.js"
            }
          ]
        }
      ]
    },
    "user_code_section": {
      "patterns": [
        {
          "include": "source.jison#user_code_include_declarations"
        },
        {
          "include": "source.js"
        }
      ]
    },
    "name_uses": {
      "patterns": [
        {
          "name": "constant.other.name-use.jisonlex",
          "match": "(\\{)[[:alpha:]_](?:[\\w-]*\\w)?(\\})",
          "captures": {
            "1": {
              "name": "punctuation.definition.name-use.begin.jisonlex"
            },
            "2": {
              "name": "punctuation.definition.name-use.end.jisonlex"
            }
          }
        }
      ]
    },
    "regexp": {
      "patterns": [
        {
          "include": "source.jison#comments"
        },
        {
          "name": "keyword.other.character-class.any.regexp.jisonlex",
          "match": "\\."
        },
        {
          "name": "keyword.other.anchor.word-boundary.regexp.jisonlex",
          "match": "\\\\b"
        },
        {
          "name": "keyword.other.anchor.non-word-boundary.regexp.jisonlex",
          "match": "\\\\B"
        },
        {
          "name": "keyword.other.anchor.start-of-input.regexp.jisonlex",
          "match": "\\^"
        },
        {
          "name": "keyword.other.anchor.end-of-input.regexp.jisonlex",
          "match": "\\$"
        },
        {
          "name": "keyword.other.back-reference.regexp.jisonlex",
          "match": "\\\\[1-9]\\d*"
        },
        {
          "name": "keyword.operator.quantifier.regexp.jisonlex",
          "match": "(?:[+*?]|\\{(?:\\d+(?:,(?:\\d+)?)?|,\\d+)\\})\\??"
        },
        {
          "name": "keyword.operator.alternation.regexp.jisonlex",
          "match": "\\|"
        },
        {
          "name": "meta.non-capturing.group.regexp.jisonlex",
          "begin": "\\(\\?:",
          "end": "\\)",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.group.begin.regexp.jisonlex"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.group.end.regexp.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "#regexp"
            }
          ]
        },
        {
          "name": "meta.lookahead.assertion.regexp.jisonlex",
          "begin": "\\(\\?=",
          "end": "\\)",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.group.begin.regexp.jisonlex"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.group.end.regexp.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "#regexp"
            }
          ]
        },
        {
          "name": "meta.negative.lookahead.assertion.regexp.jisonlex",
          "begin": "\\(\\?!",
          "end": "\\)",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.group.begin.regexp.jisonlex"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.group.end.regexp.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "#regexp"
            }
          ]
        },
        {
          "name": "meta.group.regexp.jisonlex",
          "begin": "\\(",
          "end": "\\)",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.group.begin.regexp.jisonlex"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.group.end.regexp.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "#regexp"
            }
          ]
        },
        {
          "name": "constant.other.character-class.set.regexp.jisonlex",
          "begin": "(\\[)(\\^)?",
          "end": "\\]",
          "beginCaptures": {
            "1": {
              "name": "punctuation.definition.character-class.begin.regexp.jisonlex"
            },
            "2": {
              "name": "keyword.operator.negation.regexp.jisonlex"
            }
          },
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.character-class.end.regexp.jisonlex"
            }
          },
          "patterns": [
            {
              "include": "#name_uses"
            },
            {
              "include": "#regexp_character_class"
            }
          ]
        },
        {
          "include": "#regexp_character_class"
        },
        {
          "include": "#name_uses"
        },
        {
          "include": "source.jison#quoted_strings"
        },
        {
          "name": "keyword.other.eof.regexp.jisonlex",
          "match": "<<EOF>>"
        },
        {
          "name": "keyword.operator.negative.lookahead.regexp.jisonlex",
          "match": "/!"
        },
        {
          "name": "keyword.operator.lookahead.regexp.jisonlex",
          "match": "/"
        }
      ]
    },
    "regexp_character_class": {
      "patterns": [
        {
          "name": "constant.character.escape.character-class.word.regexp.jisonlex",
          "match": "\\\\w"
        },
        {
          "name": "constant.character.escape.character-class.non-word.regexp.jisonlex",
          "match": "\\\\W"
        },
        {
          "name": "constant.character.escape.character-class.space.regexp.jisonlex",
          "match": "\\\\s"
        },
        {
          "name": "constant.character.escape.character-class.non-space.regexp.jisonlex",
          "match": "\\\\S"
        },
        {
          "name": "constant.character.escape.character-class.digit.regexp.jisonlex",
          "match": "\\\\d"
        },
        {
          "name": "constant.character.escape.character-class.non-digit.regexp.jisonlex",
          "match": "\\\\D"
        },
        {
          "name": "constant.character.escape.character-class.control.regexp.jisonlex",
          "match": "\\\\c[A-Z]"
        },
        {
          "include": "source.js#string_escapes"
        }
      ]
    }
  }
}