Skip to content

Commit

Permalink
Update modeline patterns to use github-linguist/linguist#5271
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Mar 12, 2021
1 parent d72bdc4 commit 2b8e0d6
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 46 deletions.
16 changes: 9 additions & 7 deletions grammars/abnf.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: "Augmented Backus-Naur Form"
scopeName: "source.abnf"
fileTypes: ["abnf"]
patterns: [include: "#main"]
firstLineMatch: """(?ix)
firstLineMatch: """(?x)
# Emacs modeline
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
abnf
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:abnf)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
|
# Vim modeline
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
abnf
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:abnf)
(?=$|\\s|:)
"""

repository:
Expand Down
16 changes: 9 additions & 7 deletions grammars/bnf.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: "Backus-Naur Form"
scopeName: "source.bnf"
fileTypes: ["bnf"]
patterns: [include: "#main"]
firstLineMatch: """(?ix)
firstLineMatch: """(?x)
# Emacs modeline
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
bnf
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:bnf)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
|
# Vim modeline
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
bnf
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:bnf)
(?=$|\\s|:)
"""

repository:
Expand Down
16 changes: 9 additions & 7 deletions grammars/ebnf.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: "Extended Backus-Naur Form"
scopeName: "source.ebnf"
fileTypes: ["ebnf"]
patterns: [include: "#main"]
firstLineMatch: """(?ix)
firstLineMatch: """(?x)
# Emacs modeline
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
ebnf
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:ebnf)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
|
# Vim modeline
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
ebnf
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:ebnf)
(?=$|\\s|:)
"""

repository:
Expand Down
22 changes: 11 additions & 11 deletions grammars/lark.cson
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ patterns: [{
beginCaptures:
0: name: "punctuation.definition.comment.shebang.lark"
}, include: "#main"]
firstLineMatch: """(?ix)
firstLineMatch: """(?x)
# Hashbang
^\\#!.*(?:\\s|\\/|(?<=!)\\b)
(?-i:lark)
lark
(?:$|\\s)
|
# Emacs modeline
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
lark
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:lark)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
|
# Vim modeline
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))
(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:]
(?:filetype|ft|syntax)\\s*=
lark
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:lark)
(?=$|\\s|:)
"""

repository:
Expand Down
16 changes: 9 additions & 7 deletions grammars/lex.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: "Lex"
scopeName: "source.lex"
fileTypes: ["l", "lex", "flex"]
patterns: [include: "#main"]
firstLineMatch: """(?ix)
firstLineMatch: """(?x)
# Emacs modeline
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
f?lex
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:f?lex)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
|
# Vim modeline
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
f?lex
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:f?lex)
(?=$|\\s|:)
"""

repository:
Expand Down
16 changes: 9 additions & 7 deletions grammars/yacc.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: "Yacc/Bison"
scopeName: "source.yacc"
fileTypes: ["bison", "y", "yy", "yacc"]
patterns: [include: "#main"]
firstLineMatch: """(?ix)
firstLineMatch: """(?x)
# Emacs modeline
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
(?:yacc|bison)
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
-\\*-(?i:[ \\t]*(?=[^:;\\s]+[ \\t]*-\\*-)|(?:.*?[ \\t;]|(?<=-\\*-))[ \\t]*mode[ \\t]*:[ \\t]*)
(?i:yacc|bison)
(?=[ \\t;]|(?<![-*])-\\*-).*?-\\*-
|
# Vim modeline
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
(?:yacc|bison)
(?=\\s|:|$)
(?:(?:^|[ \\t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \\t]ex)(?=:(?=[ \\t]*set?[ \\t][^\\r\\n:]+:)|:(?![ \\t]*set?[ \\t]))
(?:(?:[ \\t]*:[ \\t]*|[ \\t])\\w*(?:[ \\t]*=(?:[^\\\\\\s]|\\\\.)*)?)*[ \\t:]
(?:filetype|ft|syntax)[ \\t]*=
(?i:yacc|bison)
(?=$|\\s|:)
"""

repository:
Expand Down

0 comments on commit 2b8e0d6

Please sign in to comment.