name: OCamlyacc fileTypes:

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:

foldingStopMarker: “%}|%%” keyEquivalent: ^~O