name: Lex/Flex fileTypes:

scopeName: source.lex repository:

csource: 
  patterns: 
  - name: support.function.c.lex
    match: \b(?:ECHO|BEGIN|REJECT|YY_FLUSH_BUFFER|YY_BREAK|yy(?:more|less|unput|input|terminate|text|leng|restart|_(?:push|pop|top)_state|_(?:create|switch_to|flush|delete)_buffer|_scan_(?:string|bytes|buffer)|_set_(?:bol|interactive))(?=\(|$))\b
  - include: source.c
subregexp: 
  patterns: 
  - include: "#re_escape"
  - name: constant.other.character-class.set.lex
    endCaptures: 
      "1": 
        name: punctuation.terminator.character-class.set.lex
    begin: (\[)(\^)?-?
    beginCaptures: 
      "1": 
        name: punctuation.definition.character-class.set.lex
      "2": 
        name: keyword.operator.negation.regexp.lex
    end: -?(\])
    patterns: 
    - include: "#re_escape"
    - name: constant.other.character-class.set.lex
      captures: 
        "1": 
          name: invalid.illegal.regexp.lex
      match: \[:(?:(?:alnum|alpha|blank|cntrl|x?digit|graph|lower|print|punct|space|upper)|(.*?)):\]
  - name: variable.other.lex
    match: (?i){[a-z_][a-z0-9_-]*}
  - name: keyword.operator.quantifier.regexp.lex
    begin: \{
    end: \}
    patterns: 
    - match: (?<=\{)[0-9]*(?:,[0-9]*)?(?=\})
    - name: invalid.illegal.regexp.lex
      match: "[^}]"
      comment: "{3} counts should only have digit[,digit]"
  - name: string.quoted.double.regexp.lex
    begin: "\""
    end: "\""
    patterns: 
    - include: "#re_escape"
  - begin: ([*+?])(?=[*+?])
    beginCaptures: 
      "1": 
        name: keyword.operator.quantifier.regexp.lex
    end: (?=[^*+?])
    patterns: 
    - name: invalid.illegal.regexp.lex
      match: .
    comment: make ** or +? or other combinations illegal
  - name: keyword.operator.quantifier.regexp.lex
    match: "[*+?]"
  - name: invalid.illegal.regexp.lex
    match: <<EOF>>
    comment: <<EOF>> is handled in the rule pattern
  - name: meta.group.regexp.lex
    endCaptures: 
      "1": 
        name: punctuation.terminator.group.regexp.lex
    begin: (\()
    beginCaptures: 
      "1": 
        name: punctuation.definition.group.regexp.lex
    end: (\))|(?=\s)|$(?#end on whitespace because regex does)
    patterns: 
    - name: invalid.illegal.regexp.lex
      match: /
    - include: "#subregexp"
  - begin: (/)
    beginCaptures: 
      "1": 
        name: keyword.operator.trailing-match.regexp.lex
    end: (?=\s)|$
    patterns: 
    - name: invalid.illegal.regexp.lex
      match: /|\$(?!\S)
    - include: "#subregexp"
    comment: detection of multiple trailing contexts
regexp: 
  name: string.regexp.lex
  captures: 
    "1": 
      name: keyword.control.anchor.regexp.lex
  begin: \G(?=\S)(\^)?
  end: (\$)?(?:(?=\s)|$)
  patterns: 
  - include: "#subregexp"
re_escape: 
  name: constant.character.escape.lex
  match: \\(?i:[0-9]{1,3}|x[0-9a-f]{1,2}|.)
includes: 
  patterns: 
  - name: meta.embedded.source.c.lex
    begin: ^%\{$
    end: ^%\}$
    patterns: 
    - include: source.c
    comment: "TODO: $} should override the embedded scopes"
  - name: meta.embedded.source.c.lex
    begin: ^[ \t]+
    end: $
    patterns: 
    - include: source.c
    comment: "TODO: eol should override the embedded scopes"
rec_csource: 
  begin: \{
  end: \}
  patterns: 
  - include: source.c
  - include: "#csource"

uuid: 92E842A0-9DE6-4D31-A6AC-1CDE0F9547C5 foldingStartMarker: /**|{s*$ patterns:

foldingStopMarker: **/|^s*} keyEquivalent: ^~L