--- 
name: OCamlyacc
fileTypes: 
- mly
scopeName: source.ocamlyacc
repository: 
  declaration-matches: 
    patterns: 
    - name: meta.token.declaration.ocamlyacc
      begin: (%)(token)
      beginCaptures: 
        "1": 
          name: keyword.other.decorator.token.ocamlyacc
        "2": 
          name: keyword.other.token.ocamlyacc
      end: ^\s*($|(^\s*(?=%)))
      patterns: 
      - include: "#symbol-types"
      - name: entity.name.type.token.ocamlyacc
        match: "[A-Z][A-Za-z0-9_]*"
      - include: "#comments"
    - name: meta.token.associativity.ocamlyacc
      begin: (%)(left|right|nonassoc)
      beginCaptures: 
        "1": 
          name: keyword.other.decorator.token.associativity.ocamlyacc
        "2": 
          name: keyword.other.token.associativity.ocamlyacc
      end: (^\s*$)|(^\s*(?=%))
      patterns: 
      - name: entity.name.type.token.ocamlyacc
        match: "[A-Z][A-Za-z0-9_]*"
      - name: entity.name.function.non-terminal.reference.ocamlyacc
        match: "[a-z][A-Za-z0-9_]*"
      - include: "#comments"
    - name: meta.start-symbol.ocamlyacc
      begin: (%)(start)
      beginCaptures: 
        "1": 
          name: keyword.other.decorator.start-symbol.ocamlyacc
        "2": 
          name: keyword.other.start-symbol.ocamlyacc
      end: (^\s*$)|(^\s*(?=%))
      patterns: 
      - name: entity.name.function.non-terminal.reference.ocamlyacc
        match: "[a-z][A-Za-z0-9_]*"
      - include: "#comments"
    - name: meta.symbol-type.ocamlyacc
      begin: (%)(type)
      beginCaptures: 
        "1": 
          name: keyword.other.decorator.symbol-type.ocamlyacc
        "2": 
          name: keyword.other.symbol-type.ocamlyacc
      end: $\s*(?!%)
      patterns: 
      - include: "#symbol-types"
      - name: entity.name.type.token.reference.ocamlyacc
        match: "[A-Z][A-Za-z0-9_]*"
      - name: entity.name.function.non-terminal.reference.ocamlyacc
        match: "[a-z][A-Za-z0-9_]*"
      - include: "#comments"
  references: 
    patterns: 
    - name: entity.name.function.non-terminal.reference.ocamlyacc
      match: "[a-z][a-zA-Z0-9_]*"
    - name: entity.name.type.token.reference.ocamlyacc
      match: "[A-Z][a-zA-Z0-9_]*"
  precs: 
    patterns: 
    - name: meta.precidence.declaration
      captures: 
        "1": 
          name: keyword.other.decorator.precedence.ocamlyacc
        "2": 
          name: keyword.other.precedence.ocamlyacc
        "4": 
          name: entity.name.function.non-terminal.reference.ocamlyacc
        "5": 
          name: entity.name.type.token.reference.ocamlyacc
      match: (%)(prec)\s+(([a-z][a-zA-Z0-9_]*)|(([A-Z][a-zA-Z0-9_]*)))
  comments: 
    patterns: 
    - name: comment.block.ocamlyacc
      begin: /\*
      end: \*/
      patterns: 
      - include: "#comments"
    - name: comment.block.string.quoted.double.ocamlyacc
      begin: (?=[^\\])(")
      end: "\""
      patterns: 
      - name: comment.block.string.constant.character.escape.ocamlyacc
        match: \\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt'"\\])
  semantic-actions: 
    patterns: 
    - name: meta.action.semantic.ocamlyacc
      endCaptures: 
        "1": 
          name: punctuation.definition.action.semantic.ocamlyacc
      begin: "[^\\']({)"
      beginCaptures: 
        "1": 
          name: punctuation.definition.action.semantic.ocamlyacc
      end: (})
      patterns: 
      - include: source.ocaml
  rules: 
    patterns: 
    - name: meta.non-terminal.ocamlyacc
      endCaptures: 
        "0": 
          name: punctuation.separator.rule.ocamlyacc
      begin: "[a-z][a-zA-Z_]*"
      beginCaptures: 
        "0": 
          name: entity.name.function.non-terminal.ocamlyacc
      end: ;
      patterns: 
      - include: "#rule-patterns"
  symbol-types: 
    patterns: 
    - name: meta.token.type-declaration.ocamlyacc
      endCaptures: 
        "0": 
          name: punctuation.definition.type-declaration.end.ocamlyacc
      begin: <
      beginCaptures: 
        "0": 
          name: punctuation.definition.type-declaration.begin.ocamlyacc
      end: ">"
      patterns: 
      - include: source.ocaml
  rule-patterns: 
    patterns: 
    - name: meta.rule-match.ocaml
      begin: ((?<!\||:)(\||:)(?!\||:))
      beginCaptures: 
        "0": 
          name: punctuation.separator.rule.ocamlyacc
      end: \s*(?=\||;)
      patterns: 
      - include: "#precs"
      - include: "#semantic-actions"
      - include: "#references"
      - include: "#comments"
uuid: 1B59327E-9B82-4B78-9411-BC02067DBDF9
foldingStartMarker: "%{|%%"
patterns: 
- name: meta.header.ocamlyacc
  endCaptures: 
    "1": 
      name: punctuation.section.header.end.ocamlyacc
  begin: (%{)\s*$
  beginCaptures: 
    "1": 
      name: punctuation.section.header.begin.ocamlyacc
  end: ^\s*(%})
  patterns: 
  - include: source.ocaml
- name: meta.declarations.ocamlyacc
  begin: (?<=%})\s*$
  end: (?:^)(?=%%)
  patterns: 
  - include: "#comments"
  - include: "#declaration-matches"
- name: meta.rules.ocamlyacc
  endCaptures: 
    "1": 
      name: punctuation.section.rules.end.ocamlyacc
  begin: (%%)\s*$
  beginCaptures: 
    "1": 
      name: punctuation.section.rules.begin.ocamlyacc
  end: ^\s*(%%)
  patterns: 
  - include: "#comments"
  - include: "#rules"
- include: source.ocaml
- include: "#comments"
- name: invalid.illegal.unrecognized-character.ocaml
  match: "(\xE2\x80\x99|\xE2\x80\x98|\xE2\x80\x9C|\xE2\x80\x9D)"
foldingStopMarker: "%}|%%"
keyEquivalent: ^~O
