Skip to content

Commit 3629e8b

Browse files
authored
[Common] Add or update emacs mode patterns (sublimehq#2760)
* [Common] Add or update emacs mode patterns Fixes sublimehq#2759 This commit... 1. sorts main header keys according to sublimehq#2430 2. adds or update `first_line_match` patterns to all appropriate syntax definitions in order to support emacs mode tags. Examples: // -*-c-*- // -*- c -*- // -*- mode: c -*- // -*- mode: c++; -*- * [ActionScript] Fix first line pattern * [ASP] Fix first line pattern Moves `-*- asp -*-` to HTML (ASP).sublime-syntax * [JSP] Add missing first line pattern * [Java] Revert first line pattern JSP is html like syntax and probably doesn't need or never sees such mode comment. * [ASP] Revert first line pattern HTML (ASP) won't probably see any such comment, thus removing it. * [All] Allow anything in front of emacs mode tag comments Sync with PR sublimehq#2862 * [Haskell] Add shebang to first_line_match * [Lua] Add shebang to first_line_match * [ShellScript] Add DASH shebang * [PHP] Add minor version support in shebang Syncs modification from sublimehq#2915 to add support for php executables such as php php7 php71 php7.1 php7.1.3 to `first_line_match`'s shebang/editorconfig pattern. * [Batch File] Add "@echo on" to first_line_match
1 parent 543a822 commit 3629e8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+345
-84
lines changed

ASP/ASP.sublime-syntax

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
---
33
# http://www.sublimetext.com/docs/3/syntax.html
44
name: ASP
5+
scope: source.asp
6+
57
file_extensions:
68
- vbs # Visual Basic Script
7-
scope: source.asp
9+
10+
first_line_match: |-
11+
(?xi:
12+
^ \s* \' .*? -\*- .*? \b(vbs|vbscript)\b .*? -\*- # editorconfig
13+
)
14+
815
variables:
916
apostrophe_comment_begin: "'"
1017
rem_comment_begin: '\b(?i:REM)\b'

ActionScript/ActionScript.sublime-syntax

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
---
33
# http://www.sublimetext.com/docs/3/syntax.html
44
name: ActionScript
5+
scope: source.actionscript.2
6+
57
file_extensions:
68
- as
7-
scope: source.actionscript.2
9+
10+
first_line_match: |-
11+
(?xi:
12+
^ \s* // .*? -\*- .*? \baction-?script\b .*? -\*- # editorconfig
13+
)
14+
815
contexts:
916
main:
1017
- match: \b(R(ecordset|DBMSResolver|adioButton(Group)?)|X(ML(Socket|Node|Connector)?|UpdateResolverDataHolder)|M(M(Save|Execute)|icrophoneMicrophone|o(use|vieClip(Loader)?)|e(nu(Bar)?|dia(Controller|Display|Playback))|ath)|B(yName|inding|utton)|S(haredObject|ystem|crollPane|t(yleSheet|age|ream)|ound|e(ndEvent|rviceObject)|OAPCall|lide)|N(umericStepper|et(stream|S(tream|ervices)|Connection|Debug(Config)?))|C(heckBox|o(ntextMenu(Item)?|okie|lor|m(ponentMixins|boBox))|ustomActions|lient|amera)|T(ypedValue|ext(Snapshot|Input|F(ield|ormat)|Area)|ree|AB)|Object|D(ownload|elta(Item|Packet)?|at(e(Chooser|Field)?|a(G(lue|rid)|Set|Type)))|U(RL|TC|IScrollBar)|P(opUpManager|endingCall|r(intJob|o(duct|gressBar)))|E(ndPoint|rror)|Video|Key|F(RadioButton|GridColumn|MessageBox|BarChart|S(croll(Bar|Pane)|tyleFormat|plitView)|orm|C(heckbox|omboBox|alendar)|unction|T(icker|ooltip(Lite)?|ree(Node)?)|IconButton|D(ataGrid|raggablePane)|P(ieChart|ushButton|ro(gressBar|mptBox))|L(i(stBox|neChart)|oadingBox)|AdvancedMessageBox)|W(indow|SDLURL|ebService(Connector)?)|L(ist|o(calConnection|ad(er|Vars)|g)|a(unch|bel))|A(sBroadcaster|cc(ordion|essibility)|S(Set(Native|PropFlags)|N(ew|ative)|C(onstructor|lamp(2)?)|InstanceOf)|pplication|lert|rray))\b

AppleScript/AppleScript.sublime-syntax

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
---
33
# http://www.sublimetext.com/docs/3/syntax.html
44
name: AppleScript
5+
scope: source.applescript
6+
57
file_extensions:
68
- applescript
79
- script editor
8-
first_line_match: ^#!.*(osascript)
9-
scope: source.applescript
10+
11+
first_line_match: |-
12+
(?xi:
13+
^ \#! .* \bosascript\b # shebang
14+
| ^ \s* \# .*? -\*- .*? \bosascript\b .*? -\*- # editorconfig
15+
)
16+
1017
contexts:
1118
main:
1219
- include: blocks

Batch File/Batch File.sublime-syntax

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ file_extensions:
99
- bat
1010
- cmd
1111

12+
first_line_match: |-
13+
(?xi:
14+
^ \s* (?:\:|rem) .*? -\*- .*? \bbat\b .*? -\*- # editorconfig
15+
| ^ \s* @echo\s+(?:on|off)\b
16+
)
17+
1218
###############################################################################
1319

1420
variables:

C#/C#.sublime-syntax

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66
# MIT license: https://opensource.org/licenses/mit-license.php
77

88
name: C#
9+
scope: source.cs
10+
911
file_extensions:
1012
- cs
1113
- csx
12-
scope: source.cs
14+
15+
first_line_match: |-
16+
(?xi:
17+
^ \s* // .*? -\*- .*? \b(c\#|cs|csharp)\b .*? -\*- # editorconfig
18+
)
1319
1420
variables:
1521

C++/C++.sublime-syntax

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
---
33
# http://www.sublimetext.com/docs/3/syntax.html
44
name: C++
5-
comment: I don't think anyone uses .hp. .cp tends to be paired with .h. (I could be wrong. :) -- chris
5+
scope: source.c++
6+
67
file_extensions:
78
- cpp
89
- cc
@@ -17,8 +18,12 @@ file_extensions:
1718
- h++
1819
- inl
1920
- ipp
20-
first_line_match: '-\*- C\+\+ -\*-'
21-
scope: source.c++
21+
22+
first_line_match: |-
23+
(?xi:
24+
^ \s* // .*? -\*- .*? \b(c\+\+|cpp\b) .*? -\*- # editorconfig
25+
)
26+
2227
variables:
2328
# number digits
2429
bin_digit: '[01'']'
@@ -33,15 +38,15 @@ variables:
3338
hex_exponent: '(?:[pP][-+]?{{dec_digit}}*)'
3439

3540
# number suffixes
36-
# note: nearly everything can be defined as suffix
41+
# note: nearly everything can be defined as suffix
3742
# a) see user literals
3843
# https://en.cppreference.com/w/cpp/language/user_literal
3944
# b) see complex `operator` keyword
4045
# https://en.cppreference.com/w/cpp/numeric/complex/operator%22%22i
4146
bin_suffix: '[2-9a-zA-Z_][[:alnum:]_]*'
4247
oct_suffix: '[8-9g-zG-Z_][[:alnum:]_]*'
4348
dec_suffix: '[a-zA-Z_][[:alnum:]_]*'
44-
hex_suffix: '[g-zG-Z_][[:alnum:]_]*'
49+
hex_suffix: '[g-zG-Z_][[:alnum:]_]*'
4550
float_suffix: '[fF]'
4651

4752
identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase

C++/C.sublime-syntax

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
---
33
# http://www.sublimetext.com/docs/3/syntax.html
44
name: C
5+
scope: source.c
6+
57
file_extensions:
68
- c
79
- h
8-
first_line_match: "-[*]-( Mode:)? C -[*]-"
9-
scope: source.c
10+
11+
first_line_match: |-
12+
(?xi:
13+
^ \s* // .*? -\*- .*? \bc\b(?![#+]) .*? -\*- # editorconfig
14+
)
1015
1116
variables:
1217
# number digits

Clojure/Clojure.sublime-syntax

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
# http://www.sublimetext.com/docs/3/syntax.html
44

55
name: Clojure
6+
scope: source.clojure
7+
68
file_extensions:
79
- clj
810
- cljc
911
- edn
10-
scope: source.clojure
12+
13+
first_line_match: |-
14+
(?xi:
15+
^ \s* ; .*? -\*- .*? \bclojure\b .*? -\*- # editorconfig
16+
)
1117
1218
variables:
1319
non_symbol_chars: \s,;\(\)\[\]{}\"`~@\^\\

D/D.sublime-syntax

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
---
33
# http://www.sublimetext.com/docs/3/syntax.html
44
name: D
5-
comment: D language
5+
scope: source.d
6+
67
file_extensions:
78
- d
89
- di
9-
first_line_match: ^#!.*\bg?dmd\b.
10-
scope: source.d
10+
11+
first_line_match: |-
12+
(?xi:
13+
^ \#! .* \bg?dmd\b # shebang
14+
| ^ \s* // .*? -\*- .*? \bd(lang)?\b .*? -\*- # editorconfig
15+
)
16+
1117
variables:
1218
name: '[[:alpha:]_][[:alpha:]0-9_]*'
1319
name_lookahead: '(?=\b{{name}}\b)'

Erlang/Erlang.sublime-syntax

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ hidden_extensions:
1515
- Emakefile
1616

1717
first_line_match: |-
18-
(?x:
19-
^ \#! .* \b(erlang|escript)\b | # shebang
20-
^ \s* \%+ \s* -\*- .*? \b[Ee]rlang\b .*? -\*- # editorconfig
18+
(?xi:
19+
^ \#! .* \b(erlang|escript)\b # shebang
20+
| ^ \s* \%+ .*? -\*- .*? \berlang\b .*? -\*- # editorconfig
2121
)
2222
2323
###############################################################################

0 commit comments

Comments
 (0)