Skip to content

Commit f4d3279

Browse files
Merge pull request #429 from glennsarti/update-syntax
(GH-427) Update syntax highlighting to 1.2.0
2 parents aa5a201 + 3b1a3be commit f4d3279

File tree

1 file changed

+132
-14
lines changed

1 file changed

+132
-14
lines changed

syntaxes/puppet.tmLanguage

Lines changed: 132 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@
485485
</dict>
486486
</dict>
487487
<key>name</key>
488-
<string>string.quoted.double.puppet</string>
488+
<string>string.quoted.double.interpolated.puppet</string>
489489
<key>patterns</key>
490490
<array>
491491
<dict>
@@ -494,7 +494,127 @@
494494
</dict>
495495
<dict>
496496
<key>include</key>
497-
<string>#variable</string>
497+
<string>#interpolated_puppet</string>
498+
</dict>
499+
</array>
500+
</dict>
501+
<!-- Ref: https://puppet.com/docs/puppet/latest/lang_data_string.html#short-forms-for-variable-interpolation -->
502+
<key>interpolated_puppet</key>
503+
<dict>
504+
<key>patterns</key>
505+
<array>
506+
<!-- These definitions are the #variable matches but expressed as an interpolated string sequence e.g. ${var::foo .... } -->
507+
<!-- Short variable names can start with underscore e.g. "${_foo1}", "${_foo2.split(..)}" -->
508+
<dict>
509+
<key>begin</key>
510+
<string>(\${)(_[a-zA-Z0-9_]*)</string>
511+
<key>beginCaptures</key>
512+
<dict>
513+
<key>1</key>
514+
<dict>
515+
<key>name</key>
516+
<string>punctuation.section.embedded.begin.puppet</string>
517+
</dict>
518+
<key>2</key>
519+
<dict>
520+
<key>name</key>
521+
<string>source.puppet variable.other.readwrite.global.puppet</string>
522+
</dict>
523+
</dict>
524+
<key>end</key>
525+
<string>}</string>
526+
<key>endCaptures</key>
527+
<dict>
528+
<key>0</key>
529+
<dict>
530+
<key>name</key>
531+
<string>punctuation.section.embedded.end.puppet</string>
532+
</dict>
533+
</dict>
534+
<key>contentName</key>
535+
<string>source.puppet</string>
536+
<key>name</key>
537+
<string>meta.embedded.line.puppet</string>
538+
<key>patterns</key>
539+
<array>
540+
<dict>
541+
<key>include</key>
542+
<string>$self</string>
543+
</dict>
544+
</array>
545+
</dict>
546+
<!-- Qualified variable names (Can't start with underscore) -->
547+
<dict>
548+
<key>begin</key>
549+
<string>(\${)(([a-z][a-z0-9_]*)?(?:::[a-z][a-z0-9_]*)*)</string>
550+
<key>beginCaptures</key>
551+
<dict>
552+
<key>1</key>
553+
<dict>
554+
<key>name</key>
555+
<string>punctuation.section.embedded.begin.puppet</string>
556+
</dict>
557+
<key>2</key>
558+
<dict>
559+
<key>name</key>
560+
<string>source.puppet variable.other.readwrite.global.puppet</string>
561+
</dict>
562+
</dict>
563+
<key>end</key>
564+
<string>}</string>
565+
<key>endCaptures</key>
566+
<dict>
567+
<key>0</key>
568+
<dict>
569+
<key>name</key>
570+
<string>punctuation.section.embedded.end.puppet</string>
571+
</dict>
572+
</dict>
573+
<key>contentName</key>
574+
<string>source.puppet</string>
575+
<key>name</key>
576+
<string>meta.embedded.line.puppet</string>
577+
<key>patterns</key>
578+
<array>
579+
<dict>
580+
<key>include</key>
581+
<string>$self</string>
582+
</dict>
583+
</array>
584+
</dict>
585+
<!-- Catchall. Includes variables with leading $ -->
586+
<dict>
587+
<key>begin</key>
588+
<string>\${</string>
589+
<key>beginCaptures</key>
590+
<dict>
591+
<key>0</key>
592+
<dict>
593+
<key>name</key>
594+
<string>punctuation.section.embedded.begin.puppet</string>
595+
</dict>
596+
</dict>
597+
<key>end</key>
598+
<string>}</string>
599+
<key>endCaptures</key>
600+
<dict>
601+
<key>0</key>
602+
<dict>
603+
<key>name</key>
604+
<string>punctuation.section.embedded.end.puppet</string>
605+
</dict>
606+
</dict>
607+
<key>contentName</key>
608+
<string>source.puppet</string>
609+
<key>name</key>
610+
<string>meta.embedded.line.puppet</string>
611+
<key>patterns</key>
612+
<array>
613+
<dict>
614+
<key>include</key>
615+
<string>$self</string>
616+
</dict>
617+
</array>
498618
</dict>
499619
</array>
500620
</dict>
@@ -905,11 +1025,17 @@
9051025
</dict>
9061026
</array>
9071027
</dict>
1028+
<!-- Ref: https://puppet.com/docs/puppet/latest/lang_variables.html#regular-expressions-for-variable-names -->
9081029
<key>variable</key>
9091030
<dict>
9101031
<key>patterns</key>
9111032
<array>
1033+
<!--Short variable names can start with underscore -->
9121034
<dict>
1035+
<key>match</key>
1036+
<string>(\$)_[a-zA-Z0-9_]*</string>
1037+
<key>name</key>
1038+
<string>variable.other.readwrite.global.puppet</string>
9131039
<key>captures</key>
9141040
<dict>
9151041
<key>1</key>
@@ -918,29 +1044,21 @@
9181044
<string>punctuation.definition.variable.puppet</string>
9191045
</dict>
9201046
</dict>
1047+
</dict>
1048+
<!-- Qualified variable names (Can't start with underscore) -->
1049+
<dict>
9211050
<key>match</key>
922-
<string>(\$)((::)?[a-z]\w*)*((::)?[a-z_]\w*)\b</string>
1051+
<string>(\$)(([a-z][a-z0-9_]*)?(?:::[a-z][a-z0-9_]*)*)</string>
9231052
<key>name</key>
9241053
<string>variable.other.readwrite.global.puppet</string>
925-
</dict>
926-
<dict>
9271054
<key>captures</key>
9281055
<dict>
9291056
<key>1</key>
9301057
<dict>
9311058
<key>name</key>
9321059
<string>punctuation.definition.variable.puppet</string>
9331060
</dict>
934-
<key>2</key>
935-
<dict>
936-
<key>name</key>
937-
<string>punctuation.definition.variable.puppet</string>
938-
</dict>
9391061
</dict>
940-
<key>match</key>
941-
<string>(\$\{)(?:[a-zA-Zx7f-xff\$]|::)(?:[a-zA-Z0-9_x7f-xff\$]|::)*(\})</string>
942-
<key>name</key>
943-
<string>variable.other.readwrite.global.puppet</string>
9441062
</dict>
9451063
</array>
9461064
</dict>

0 commit comments

Comments
 (0)