Skip to content

Commit

Permalink
Update xml syntax definitions for:
Browse files Browse the repository at this point in the history
bash, cmake, commonlisp, isocpp, javascript-react, julia, latex, lua,
markdown, modelines, nix, php, python, rhtml, ruby, swift, xml, yaml,
zig, zsh.
  • Loading branch information
jgm committed Dec 9, 2024
1 parent d06b359 commit 2e2220a
Show file tree
Hide file tree
Showing 21 changed files with 2,839 additions and 728 deletions.
31 changes: 17 additions & 14 deletions skylighting-core/test/expected/abc.ruby.native
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[ [ ( NormalTok , "words " )
, ( KeywordTok , "=" )
, ( OtherTok , " %w(" )
, ( StringTok , "A BaRK BOoK tREaT COmMOn SqUAD CoNfuSE" )
, ( OperatorTok , "=" )
, ( NormalTok , " " )
, ( OtherTok , "%w(" )
, ( VerbatimStringTok , "A BaRK BOoK tREaT COmMOn SqUAD CoNfuSE" )
, ( OtherTok , ")" )
, ( NormalTok , " " )
, ( KeywordTok , "<<" )
, ( OperatorTok , "<<" )
, ( NormalTok , " " )
, ( StringTok , "\"\"" )
]
Expand All @@ -14,36 +15,38 @@
, ( NormalTok , " " )
, ( ControlFlowTok , "do" )
, ( NormalTok , " " )
, ( KeywordTok , "|" )
, ( OperatorTok , "|" )
, ( NormalTok , "word" )
, ( KeywordTok , "|" )
, ( OperatorTok , "|" )
]
, [ ( NormalTok , " blocks " )
, ( KeywordTok , "=" )
, ( OperatorTok , "=" )
, ( NormalTok , " " )
, ( StringTok
, "\"BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM\""
)
]
, [ ( NormalTok , " res " )
, ( KeywordTok , "=" )
, ( OperatorTok , "=" )
, ( NormalTok , " word" )
, ( AttributeTok , ".each_char.all?" )
, ( KeywordTok , "{|" )
, ( OperatorTok , "{|" )
, ( NormalTok , "c" )
, ( KeywordTok , "|" )
, ( OperatorTok , "|" )
, ( NormalTok , " blocks" )
, ( AttributeTok , ".sub!" )
, ( NormalTok , "(" )
, ( SpecialStringTok , "/\\w?" )
, ( SpecialStringTok , "/" )
, ( SpecialCharTok , "\\w" )
, ( SpecialStringTok , "?" )
, ( SpecialCharTok , "#{" )
, ( NormalTok , "c" )
, ( SpecialCharTok , "}" )
, ( SpecialStringTok , "\\w?/i" )
, ( SpecialCharTok , "}\\w" )
, ( SpecialStringTok , "?/i" )
, ( NormalTok , ", " )
, ( StringTok , "\"\"" )
, ( NormalTok , ")" )
, ( KeywordTok , "}" )
, ( OperatorTok , "}" )
, ( NormalTok , " " )
, ( CommentTok , "#regexps can be interpolated like strings" )
]
Expand Down
50 changes: 36 additions & 14 deletions skylighting-core/xml/bash.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,22 @@

<!ENTITY arithmetic_as_subshell "\(((?:[^`'&quot;()$]++|\$\{[^`'&quot;(){}$]+\}|\$(?=[^{`'&quot;()])|`[^`]*+`|\((?1)(?:[)]|(?=['&quot;])))++)(?:[)](?=$|[^)])|[&quot;'])">

<!ENTITY unary_operators "-[abcdefghkprstuwxGLNOSovRnz]&eos;">
<!ENTITY binary_operators "(?:-(?:e[fq]|[nolg]t|[nlg]e)|==?|!=)&eos;">
<!ENTITY unary_operators "-[abcdefghkprstuwxGLNOSovRnz](?=\\?$|[ &tab;])">
<!ENTITY binary_operators "(?:-(?:e[fq]|[nolg]t|[nlg]e)|==?|!=)(?=\\?$|[ &tab;])">

<!ENTITY dblbracket_close "\]\](?=($|[ &tab;;|&amp;)]))">

<!ENTITY weakDeliminatorSymbols "^&#37;#[]$.{}:-/">
]>

<!--
https://git.savannah.gnu.org/cgit/bash.git/tree/NEWS
current: bash-5.2
-->

<language
name="Bash"
version="51"
version="53"
kateversion="5.79"
section="Scripts"
extensions="*.sh;*.bash;*.ebuild;*.eclass;*.exlib;*.exheres-0;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD"
Expand Down Expand Up @@ -872,6 +877,7 @@

<!-- FindPathThenPopInAlternateValue consumes path in ${xx:here}-->
<context attribute="Normal Text" lineEndContext="#pop" name="FindPathThenPopInAlternateValue">
<DetectChar attribute="Variable" char="&amp;"/>
<Detect2Chars context="#pop!PathThenPopInAlternateValue" char="?" char1="(" lookAhead="1"/>
<Detect2Chars context="#pop!PathThenPopInAlternateValue" char="*" char1="(" lookAhead="1"/>
<Detect2Chars context="#pop!PathThenPopInAlternateValue" char="+" char1="(" lookAhead="1"/>
Expand Down Expand Up @@ -1239,12 +1245,12 @@
<IncludeRules context="Start"/>
</context>

<!-- StringEsc eats till ', but escaping many characters -->
<!-- StringEsc eats till ', but escaping many characters in $'...' -->
<context attribute="String SingleQ" lineEndContext="#stay" name="StringEsc">
<DetectSpaces attribute="String SingleQ"/>
<DetectIdentifier attribute="String SingleQ"/>
<DetectChar attribute="String SingleQ" context="#pop" char="'"/>
<RegExpr attribute="String Escape" context="#stay" String="\\(?:[abefnrtv\\']|[0-7]{1,3}|x[A-Fa-f0-9]{1,2}|c.)"/>
<RegExpr attribute="String Escape" context="#stay" String="\\(?:[abeEfnrtv\\'&quot;?]|[0-7]{1,3}|x[A-Fa-f0-9]{1,2}|u[A-Fa-f0-9]{1,4}|U[A-Fa-f0-9]{1,8}|c.)"/>
</context>

<context attribute="Normal Text" lineEndContext="#stay" name="FindWord">
Expand Down Expand Up @@ -1368,7 +1374,7 @@
<!-- called as soon as ${xxx@ is encoutered -->
<context attribute="Normal Text" lineEndContext="#stay" name="VarTransformation" fallthroughContext="#pop!VarError">
<DetectChar attribute="Parameter Expansion" context="#pop" char="}"/>
<AnyChar attribute="Parameter Expansion" context="#stay" String="UuLQEPAKa"/>
<AnyChar attribute="Parameter Expansion" context="#stay" String="UuLQEPAKak"/>
</context>

<context attribute="Escape" lineEndContext="#pop" name="BraceExpansion">
Expand Down Expand Up @@ -1495,13 +1501,19 @@
<IncludeRules context="FindNormalText"/>
</context>

<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracketParam2" fallthroughContext="ExprBracketValue">
<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracketParam2" fallthroughContext="#pop!ExprBracketParam2_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracketParam2_Value" fallthroughContext="ExprBracketValue">
<DetectSpaces attribute="Normal Text" context="#pop!ExprBracketParam3"/>
<AnyChar context="TestMaybeBinary" String="-=!" lookAhead="1"/>
<IncludeRules context="FindExprBracketEnd"/>
</context>

<context attribute="Normal Text" lineEndContext="ExprBracketFinal" name="ExprBracketParam3" fallthroughContext="ExprBracketValue">
<context attribute="Normal Text" lineEndContext="ExprBracketFinal" name="ExprBracketParam3" fallthroughContext="#pop!ExprBracketParam3_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="ExprBracketFinal" name="ExprBracketParam3_Value" fallthroughContext="ExprBracketValue">
<DetectSpaces attribute="Normal Text" context="#pop!ExprBracketFinal"/>
<IncludeRules context="FindExprBracketEnd"/>
</context>
Expand All @@ -1525,8 +1537,12 @@
<RegExpr attribute="Expression" context="#pop" String="&binary_operators;"/>
</context>

<context attribute="Normal Text" lineEndContext="#pop" name="SkipSpaces" fallthroughContext="#pop">
<DetectSpaces context="#pop"/>
</context>

<!-- ExprDblBracket consumes an expression till ]] -->

<!-- ExprDblBracket consumes an expression till ]] in [[ ... ]] -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracket" fallthroughContext="#pop!ExprDblBracketNot">
<DetectSpaces attribute="Normal Text" context="#stay"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
Expand Down Expand Up @@ -1641,7 +1657,10 @@
<DetectChar attribute="Operator" context="ExprDblBracketValuePattern" char=")" endRegion="expression" beginRegion="subshell"/>
</context>

<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2" fallthroughContext="ExprDblBracketValuePattern">
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2" fallthroughContext="#pop!ExprDblBracketParam2_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam2_Value" fallthroughContext="ExprDblBracketValuePattern">
<DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketParam3"/>
<AnyChar context="TestMaybeBinary2" String="-=!" lookAhead="1"/>
<AnyChar attribute="Expression" context="#pop!ExprDblBracketParam3Spe" String="&lt;>"/>
Expand All @@ -1657,7 +1676,10 @@
<DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketParam3"/>
</context>

<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam3" fallthroughContext="ExprDblBracketValuePattern">
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam3" fallthroughContext="#pop!ExprDblBracketParam3_Value">
<LineContinue attribute="Escape" context="SkipSpaces"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracketParam3_Value" fallthroughContext="ExprDblBracketValuePattern">
<DetectSpaces attribute="Normal Text" context="#pop!ExprDblBracketFinal"/>
<IncludeRules context="FindExprDblBracketEnd"/>
<AnyChar attribute="Error" context="#stay" String="&lt;>"/>
Expand Down Expand Up @@ -1773,7 +1795,7 @@
<DetectChar attribute="Error" context="#pop" char="]"/>
</context>

<!-- SubShell consumes shell input till ) -->
<!-- SubShell consumes shell input till ) in (...) -->
<context attribute="Normal Text" lineEndContext="#stay" name="SubShell" fallthroughContext="Command">
<DetectChar attribute="Keyword" context="#pop" char=")" endRegion="subshell"/>
<IncludeRules context="Start"/>
Expand All @@ -1788,7 +1810,7 @@
<IncludeRules context="NormalOption"/>
</context>

<!-- AssignArray consumes everything till ), marking assignments -->
<!-- AssignArray consumes everything till ) in var=(...), marking assignments -->
<context attribute="Normal Text" lineEndContext="#stay" name="AssignArray" fallthroughContext="NormalOption">
<DetectSpaces attribute="Normal Text" context="#stay"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
Expand All @@ -1807,7 +1829,7 @@
<IncludeRules context="Start"/>
</context>

<!-- Subscript consumes anything till ], marks as Variable -->
<!-- Subscript consumes anything till ] in [ ... ], marks as Variable -->
<context attribute="Normal Text" lineEndContext="#stay" name="Subscript" fallthroughContext="#pop!Subscript2">
<DetectChar attribute="Parameter Expansion Operator" context="#pop" char="]"/>
<AnyChar attribute="Decimal" context="#stay" String="0123456789"/>
Expand Down
Loading

0 comments on commit 2e2220a

Please sign in to comment.