@@ -45,6 +45,7 @@ repository:
45
45
{include : " #loop" }
46
46
{include : " #escapes" }
47
47
{include : " #definition" }
48
+ {include : " #formatting" }
48
49
{include : " #face-innards" }
49
50
{include : " #expression" }
50
51
{include : " #operators" }
@@ -269,6 +270,56 @@ repository:
269
270
}]
270
271
271
272
273
+ # Formatting functions
274
+ formatting :
275
+ name : " meta.string-formatting.expression.emacs.lisp"
276
+ begin : ' (\\ ()(format|format-message|message|error)(?=\\ s|$|")'
277
+ end : ' \\ )'
278
+ beginCaptures :
279
+ 1 : name : " punctuation.section.expression.begin.emacs.lisp"
280
+ 2 : name : " support.function.$2.emacs.lisp"
281
+ endCaptures :
282
+ 0 : name : " punctuation.section.expression.end.emacs.lisp"
283
+ patterns : [{
284
+
285
+ # Pin-hack: Part 1
286
+ begin : ' \\ G\\ s*(")'
287
+ end : ' "'
288
+ beginCaptures : 1 : name : " punctuation.definition.string.begin.emacs.lisp"
289
+ endCaptures : 0 : name : " punctuation.definition.string.end.emacs.lisp"
290
+ patterns : [include : " #format" ]
291
+ },{
292
+ # Pin-hack: Part 2
293
+ begin : ' \\ G\\ s*$\\ n?'
294
+ end : ' "|(?<!^)$|[\\ s"](?=[^\\ s"])'
295
+ patterns : [
296
+ match : " ^\\ s*$\\ n?"
297
+
298
+ {match : ' (?:^|\\ G)\\ s*(")' ,
299
+ captures :
300
+ 1 : name : " punctuation.definition.string.begin.emacs.lisp" }
301
+
302
+ begin : ' (?<=")'
303
+ end : ' "'
304
+ patterns : [include : " #format" ]
305
+ endCaptures :
306
+ 0 : name : " punctuation.definition.string.end.emacs.lisp"
307
+ ]
308
+ }, include : " $self" ]
309
+
310
+
311
+ # Formatting string, where "%" has special significance
312
+ format :
313
+ contentName : " string.quoted.double.emacs.lisp"
314
+ begin : ' \\ G'
315
+ end : ' (?=")'
316
+ patterns : [{
317
+ match : " (%[%cdefgosSxX])|(%.)"
318
+ captures :
319
+ 1 : name : " constant.other.placeholder.emacs.lisp"
320
+ 2 : name : " invalid.illegal.placeholder.emacs.lisp"
321
+ }, include : " #string-innards" ]
322
+
272
323
273
324
# Primitives/Fundamental Lisp functions
274
325
functions :
@@ -434,6 +485,11 @@ repository:
434
485
end : ' "'
435
486
beginCaptures : 0 : name : " punctuation.definition.string.begin.emacs.lisp"
436
487
endCaptures : 0 : name : " punctuation.definition.string.end.emacs.lisp"
488
+ patterns : [include : " #string-innards" ]
489
+
490
+
491
+ # Escape sequences within double-quoted strings
492
+ " string-innards" :
437
493
patterns : [{
438
494
439
495
# Concealed newline
@@ -446,13 +502,6 @@ repository:
446
502
name : " constant.character.escape.emacs.lisp"
447
503
captures :
448
504
1 : name : " punctuation.escape.backslash.emacs.lisp"
449
- },{
450
-
451
- # Formatting placeholder
452
- match : " (%[%cdefgosSxX])|(%.)"
453
- captures :
454
- 1 : name : " constant.other.placeholder.emacs.lisp"
455
- 2 : name : " invalid.illegal.placeholder.emacs.lisp"
456
505
}]
457
506
458
507
0 commit comments