@@ -140,14 +140,14 @@ module.exports = grammar({
140
140
'>' ,
141
141
choice (
142
142
alias ( token . immediate ( / [ a - z 0 - 9 ] + \n / ) , $ . language ) ,
143
- token . immediate ( '\n' ) ) ,
143
+ token . immediate ( / \n / ) ) ,
144
144
alias ( repeat1 ( alias ( $ . line_code , $ . line ) ) , $ . code ) ,
145
145
// Codeblock ends if a line starts with non-whitespace.
146
146
// Terminating "<" is consumed in other rules.
147
147
) ) ,
148
148
149
149
// Lines.
150
- _blank : ( ) => field ( 'blank' , '\n' ) ,
150
+ _blank : ( ) => field ( 'blank' , / \n / ) ,
151
151
line : ( $ ) => choice (
152
152
$ . column_heading ,
153
153
$ . h1 ,
@@ -161,18 +161,18 @@ module.exports = grammar({
161
161
optional ( token . immediate ( '<' ) ) , // Treat codeblock-terminating "<" as whitespace.
162
162
_li_token ,
163
163
choice (
164
- alias ( seq ( repeat1 ( $ . _atom ) , '\n' ) , $ . line ) ,
164
+ alias ( seq ( repeat1 ( $ . _atom ) , / \n / ) , $ . line ) ,
165
165
seq ( alias ( repeat1 ( $ . _atom ) , $ . line ) , $ . codeblock ) ,
166
166
) ,
167
167
repeat ( alias ( $ . _line_noli , $ . line ) ) ,
168
168
) ) ,
169
169
// Codeblock lines: must be indented by at least 1 space/tab.
170
170
// Line content (incl. whitespace) is captured as a single atom.
171
- line_code : ( ) => choice ( '\n' , / [ \t ] + [ ^ \n ] + \n / ) ,
171
+ line_code : ( ) => choice ( / \n / , / [ \t ] + [ ^ \n ] + \n / ) ,
172
172
_line_noli : ( $ ) => seq (
173
173
choice ( $ . _atom_noli , $ . _uppercase_words ) ,
174
174
repeat ( $ . _atom ) ,
175
- choice ( $ . codeblock , '\n' )
175
+ choice ( $ . codeblock , / \n / )
176
176
) ,
177
177
178
178
// Modeline: must start with "vim:" (optionally preceded by whitespace)
@@ -196,23 +196,23 @@ module.exports = grammar({
196
196
alias ( token . immediate ( / = = = = = = = = = = = = + [ \t ] * \n / ) , $ . delimiter ) ,
197
197
alias ( repeat1 ( $ . _atom ) , $ . heading ) ,
198
198
optional ( seq ( $ . tag , repeat ( $ . _atom ) ) ) ,
199
- '\n' ,
199
+ / \n / ,
200
200
) ) ,
201
201
202
202
h2 : ( $ ) =>
203
203
prec ( 1 , seq (
204
204
alias ( token . immediate ( / - - - - - - - - - - - - + [ \t ] * \n / ) , $ . delimiter ) ,
205
205
alias ( repeat1 ( $ . _atom ) , $ . heading ) ,
206
206
optional ( seq ( $ . tag , repeat ( $ . _atom ) ) ) ,
207
- '\n' ,
207
+ / \n / ,
208
208
) ) ,
209
209
210
210
// Heading 3: UPPERCASE NAME, followed by optional *tags*.
211
211
h3 : ( $ ) =>
212
212
seq (
213
213
alias ( $ . uppercase_name , $ . heading ) ,
214
214
optional ( seq ( $ . tag , repeat ( $ . _atom ) ) ) ,
215
- '\n' ,
215
+ / \n / ,
216
216
) ,
217
217
218
218
tag : ( $ ) => _word ( $ ,
0 commit comments