diff options
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml')
-rw-r--r-- | src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml | 125 |
1 files changed, 61 insertions, 64 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml b/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml index a451e1442f..7c1163910f 100644 --- a/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml +++ b/src/libs/3rdparty/syntax-highlighting/data/syntax/ruby.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE language SYSTEM "language.dtd"> +<!DOCTYPE language> <!-- Ruby syntax highlighting definition for Kate. @@ -31,7 +31,7 @@ <!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". --> <language name="Ruby" section="Scripts" - version="10" kateversion="3.3" + version="18" kateversion="5.0" extensions="*.rb;*.rjs;*.rxml;*.xml.erb;*.js.erb;*.rake;Rakefile;Gemfile;*.gemspec;Vagrantfile" mimetype="application/x-ruby" style="ruby" indenter="ruby" @@ -183,6 +183,8 @@ <item>extend</item> <item>include</item> <item>prepend</item> + <item>refine</item> + <item>using</item> </list> <contexts> @@ -191,19 +193,17 @@ <LineContinue attribute="Normal Text" context="Line Continue"/> <!-- __END__ token on own line. --> - <RegExpr attribute="Keyword" String="__END__$" context="DATA" column="0"/> + <RegExpr attribute="Keyword" String="^__END__$" context="DATA" column="0"/> <!-- "shebang" line --> - <RegExpr attribute="Keyword" String="#!\/.*" context="#stay" column="0"/> + <RegExpr attribute="Keyword" String="^#!\/.*" context="#stay" column="0"/> <!-- "def" - "end" blocks --> <!-- check for statement modifiers with regexes --> <DetectChar attribute="Operator" char="{" context="Find closing block brace" beginRegion="def block"/> - <RegExpr attribute="Keyword" String="(\=|\(|\[|\{)\s*(if|unless|while|until)\b" context="#stay" beginRegion="def block"/> - <RegExpr attribute="Keyword" String="(while|until)\b(?!.*\bdo\b)" context="#stay" beginRegion="def block" /> - <RegExpr attribute="Keyword" String="\;\s*(while|until)\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/> + <DetectChar attribute="Delimiter" char="}" context="check_div_1" endRegion="def block"/> + <RegExpr attribute="Keyword" String="[=([]\s*(if|unless|while|until)\b|(while|until)\b(?!.*\bdo\b)|\;\s*(while|until)\b(?!.*\bdo\b)|\;\s*(if|unless)\b" context="#stay" beginRegion="def block"/> <RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/> - <RegExpr attribute="Keyword" String="\;\s*(if|unless)\b" context="#stay" beginRegion="def block"/> <WordDetect attribute="Keyword" String="class" context="no_heredoc" beginRegion="def block"/> <WordDetect attribute="Keyword" String="module" context="#stay" beginRegion="def block"/> <WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/> @@ -236,8 +236,7 @@ <!-- (global) vars starting with $ Match them before $_. --> - <RegExpr attribute="Global Variable" String="\$[a-zA-Z_0-9]+" context="check_div_1"/> - <RegExpr attribute="Global Variable" String="\$\-[a-zA-Z_]\b" context="check_div_1"/> + <RegExpr attribute="Global Variable" String="\$[a-zA-Z_0-9]+|\$\-[a-zA-Z_]\b" context="check_div_1"/> <!-- special-character globals --> <RegExpr attribute="Default globals" String="\$[\d_*`+@;,.~=\!\$:?'/\\\-\&"><]" context="check_div_1"/> <RegExpr attribute="Global Constant" String="\b[_A-Z]+[A-Z_0-9]+\b" context="check_div_2"/> @@ -269,21 +268,16 @@ <DetectChar attribute="Operator" char="." context="#stay"/> <Detect2Chars attribute="Operator" char="&" char1="&" context="#stay"/> <Detect2Chars attribute="Operator" char="|" char1="|" context="#stay"/> - <RegExpr attribute="Operator" String="\s[\?\:\%]\s" context="#stay"/> - <RegExpr attribute="Operator" String="[|&<>\^\+*~\-=]+" context="#stay"/> - <!-- regexp hack --> - <RegExpr attribute="Operator" String="\s!" context="#stay"/> - <RegExpr attribute="Operator" String="/=\s" context="#stay" insensitive="0"/> + <!-- \s! is regexp hack --> + <RegExpr attribute="Operator" String="\s[\?\:\%]\s|[|&<>\^\+*~\-=]+|\s!|/=\s" context="#stay"/> <Detect2Chars attribute="Operator" char="%" char1="=" context="#stay"/> <Detect2Chars attribute="Operator" char=":" char1=":" context="Member Access"/> - <RegExpr attribute="Symbol" String=":(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?" context="check_div_1"/> - <RegExpr attribute="Symbol" String=":\[\]=?" context="check_div_1"/> + <RegExpr attribute="Symbol" String=":(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?|:\[\]=?" context="check_div_1"/> <!-- Do not send to "check_div_1" context!: after detecting these rules (": ") there can be a regular expression (see bug: #361875) --> - <RegExpr attribute="Symbol" String="(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?: " context="#stay"/> - <RegExpr attribute="Symbol" String="\[\]=?: " context="#stay"/> + <RegExpr attribute="Symbol" String="(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?: |\[\]=?: " context="#stay"/> <DetectChar attribute="String" char=""" context="Quoted String"/> <DetectChar attribute="Raw String" char="'" context="Apostrophed String"/> @@ -291,14 +285,12 @@ <Detect2Chars attribute="Normal Text" char="?" char1="#" context="#stay"/> - <RegExpr attribute="Comment" String="#\s*BEGIN.*$" context="#stay" beginRegion="marker" column="0"/> - <RegExpr attribute="Comment" String="#\s*END.*$" context="#stay" endRegion="marker" column="0"/> + <RegExpr attribute="Comment" String="^#\s*BEGIN.*$" context="#stay" beginRegion="marker" column="0"/> + <RegExpr attribute="Comment" String="^#\s*END.*$" context="#stay" endRegion="marker" column="0"/> <DetectChar attribute="Comment" char="#" context="General Comment"/> <DetectChar attribute="Delimiter" char="[" context="#stay"/> <DetectChar attribute="Delimiter" char="]" context="check_div_1"/> - <DetectChar attribute="Delimiter" char="{" context="#stay" beginRegion="def block"/> - <DetectChar attribute="Delimiter" char="}" context="check_div_1" endRegion="def block"/> <RegExpr attribute="Instance Variable" String="@[a-zA-Z_0-9]+" context="check_div_1"/> <RegExpr attribute="Class Variable" String="@@[a-zA-Z_0-9]+" context="check_div_1"/> @@ -320,20 +312,20 @@ <!-- A slash is always a division operator, even if preceeded by whitespace --> <context name="check_div_1" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop"> - <RegExpr attribute="Normal Text" String="\s*" context="#stay"/> + <DetectSpaces attribute="Normal Text" context="#stay"/> <AnyChar attribute="Operator" String="/%" context="#pop"/> </context> <!-- Same as check_div_1, but with double pop to exit the surrounding context --> <context name="check_div_1_pop" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop"> - <RegExpr attribute="Normal Text" String="\s*" context="#stay"/> + <DetectSpaces attribute="Normal Text" context="#stay"/> <AnyChar attribute="Operator" String="/%" context="#pop#pop"/> </context> <!-- A slash is division operator if it's the first character, or if preceeded and followed by whitespace --> <context name="check_div_2" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop"> <AnyChar attribute="Operator" String="/%" context="#pop"/> - <RegExpr attribute="Normal Text" String="\s+" context="check_div_2_internal"/> + <DetectSpaces attribute="Normal Text" context="check_div_2_internal"/> </context> <!-- Internal context used by check_div_2 --> @@ -345,7 +337,7 @@ <!-- Same as check_div_2, but with double pop to exit the surrounding context --> <context name="check_div_2_pop" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop"> <AnyChar attribute="Operator" String="/%" context="#pop#pop"/> - <RegExpr attribute="Normal Text" String="\s+" context="check_div_2_pop_internal"/> + <DetectSpaces attribute="Normal Text" context="check_div_2_pop_internal"/> </context> <!-- Internal context used by check_div_2_pop --> @@ -355,8 +347,7 @@ </context> <context name="Line Continue" attribute="Normal Text" lineEndContext="#pop"> - <RegExpr attribute="Keyword" String="(while|until)\b(?!.*\bdo\b)" context="#stay" firstNonSpace="true"/> - <RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" firstNonSpace="true"/> + <RegExpr attribute="Keyword" String="(while|until)\b(?!.*\bdo\b)|(if|unless)\b" context="#stay" firstNonSpace="true"/> <IncludeRules context="Normal"/> </context> @@ -369,6 +360,7 @@ <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> <Detect2Chars attribute="String" char="\" char1=""" context="#stay"/> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> <DetectChar char=""" attribute="String" context="check_div_1_pop"/> </context> @@ -383,18 +375,21 @@ <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> <Detect2Chars attribute="String" char="\" char1="`" context="#stay"/> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> <DetectChar char="`" attribute="Command" context="check_div_1_pop"/> </context> <context name="Embedded documentation" attribute="Blockcomment" lineEndContext="#stay"> <RegExpr attribute="Comment" String="^=end(?:\s.*|$)" context="#pop" endRegion="comment block" column="0"/> - <IncludeRules context="##Alerts" /> + <DetectSpaces /> + <IncludeRules context="##Comments" /> </context> <context name="RegEx 1" attribute="Regular Expression" lineEndContext="#stay"> <Detect2Chars attribute="Regular Expression" char="\" char1="/" context="#stay"/> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> <RegExpr attribute="Regular Expression" String="/[uiomxn]*" context="check_div_1_pop"/> </context> @@ -409,6 +404,7 @@ <context name="Short Subst" attribute="Substitution" lineEndContext="#pop"> <!-- Check for e.g.: "#@var#@@xy" --> <RegExpr attribute="Substitution" String="#@{1,2}" context="#stay"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="#stay"/> <RegExpr attribute="Substitution" String="\w(?!\w)" context="#pop"/> </context> @@ -431,7 +427,8 @@ </context> <context name="General Comment" attribute="Comment" lineEndContext="#pop"> - <IncludeRules context="##Alerts" /> + <DetectSpaces /> + <IncludeRules context="##Comments" /> </context> <!-- HEREDOC support @@ -440,15 +437,11 @@ <!-- here we markup the heredoc markers --> <context name="find_heredoc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <RegExpr attribute="Keyword" context="apostrophed_normal_heredoc" String="'(\w+)'" /> - <RegExpr attribute="Keyword" context="normal_heredoc" String="(\w+)" /> - <RegExpr attribute="Keyword" context="normal_heredoc" String=""(\w+)"" /> - <RegExpr attribute="Keyword" context="normal_heredoc" String="`(\w+)`" /> + <RegExpr attribute="Keyword" context="normal_heredoc" String="(?|(\w+)|"(\w+)"|`(\w+)`)" /> </context> <context name="find_indented_heredoc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> <RegExpr attribute="Keyword" context="apostrophed_indented_heredoc" String="'(\w+)'" /> - <RegExpr attribute="Keyword" context="indented_heredoc" String="(\w+)" /> - <RegExpr attribute="Keyword" context="indented_heredoc" String=""(\w+)"" /> - <RegExpr attribute="Keyword" context="indented_heredoc" String="`(\w+)`" /> + <RegExpr attribute="Keyword" context="indented_heredoc" String="(?|(\w+)|"(\w+)"|`(\w+)`)" /> </context> <!-- these are the real heredoc contexts --> <context name="indented_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> @@ -460,16 +453,17 @@ </context> <context name="normal_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> - <RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" column="0"/> + <RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/> <IncludeRules context="heredoc_rules" /> </context> <context name="apostrophed_normal_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> - <RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" column="0"/> + <RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/> </context> <!-- rules for heredoc types --> <context name="heredoc_rules" attribute="Normal Text" lineEndContext="#stay"> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> </context> @@ -478,8 +472,8 @@ <DetectSpaces /> <Detect2Chars attribute="Operator" char="<" char1="<" context="#pop"/> <!-- comments --> - <RegExpr attribute="Comment" String="#\s*BEGIN.*$" context="#stay" beginRegion="marker" column="0"/> - <RegExpr attribute="Comment" String="#\s*END.*$" context="#stay" endRegion="marker" column="0"/> + <RegExpr attribute="Comment" String="^#\s*BEGIN.*$" context="#stay" beginRegion="marker" column="0"/> + <RegExpr attribute="Comment" String="^#\s*END.*$" context="#stay" endRegion="marker" column="0"/> <DetectChar attribute="Comment" char="#" context="General Comment"/> </context> @@ -599,13 +593,14 @@ --> <context name="gdl_dq_string_5" attribute="String" lineEndContext="#stay" dynamic="true"> <IncludeRules context="dq_string_rules" /> - <RegExpr attribute="String" String="\\%1" context="#stay" dynamic="true" /> + <StringDetect attribute="String" String="\%1" context="#stay" dynamic="true" /> <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> </context> <!-- rules to be included in all dq_string contexts --> <context name="dq_string_rules" attribute="String" lineEndContext="#stay" > <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> </context> @@ -664,7 +659,7 @@ --> <context name="gdl_token_array_5" attribute="String" lineEndContext="#stay" dynamic="true"> <IncludeRules context="token_array_rules" /> - <RegExpr attribute="String" String="\\%1" context="#stay" dynamic="true"/> + <StringDetect attribute="String" String="\%1" context="#stay" dynamic="true"/> <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> </context> @@ -728,7 +723,7 @@ --> <context name="gdl_apostrophed_5" attribute="Raw String" lineEndContext="#stay" dynamic="true"> <IncludeRules context="apostrophed_rules" /> - <RegExpr attribute="Raw String" String="\\%1" context="#stay" dynamic="true"/> + <StringDetect attribute="Raw String" String="\%1" context="#stay" dynamic="true"/> <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> </context> @@ -792,7 +787,7 @@ --> <context name="gdl_shell_command_5" attribute="Command" lineEndContext="#stay" dynamic="true"> <IncludeRules context="shell_command_rules" /> - <RegExpr attribute="Command" String="\\%1" context="#stay" dynamic="true" /> + <StringDetect attribute="Command" String="\%1" context="#stay" dynamic="true" /> <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> </context> @@ -800,6 +795,7 @@ <context name="shell_command_rules" attribute="Command" lineEndContext="#stay" > <Detect2Chars attribute="Command" char="\" char1="\" context="#stay"/> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> </context> @@ -858,7 +854,7 @@ --> <context name="gdl_regexpr_5" attribute="Regular Expression" lineEndContext="#stay" dynamic="true"> <IncludeRules context="regexpr_rules" /> - <RegExpr attribute="Regular Expression" String="\\%1" context="#stay" dynamic="true" /> + <StringDetect attribute="Regular Expression" String="\%1" context="#stay" dynamic="true" /> <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1[uiomxn]*" dynamic="true" endRegion="GdlInput" /> </context> @@ -866,6 +862,7 @@ <context name="regexpr_rules" attribute="Regular Expression" lineEndContext="#stay" > <Detect2Chars attribute="Regular Expression" char="\" char1="\" context="#stay"/> <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> + <Detect2Chars attribute="Substitution" char="#" char1="$" context="Short Subst"/> <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> </context> @@ -878,9 +875,9 @@ <itemDatas> <itemData name="Normal Text" defStyleNum="dsNormal"/> - <itemData name="Keyword" defStyleNum="dsKeyword"/> + <itemData name="Keyword" defStyleNum="dsControlFlow"/> <itemData name="Attribute Definition" defStyleNum="dsOthers"/> - <itemData name="Access Control" defStyleNum="dsKeyword" color="#0000FF"/> + <itemData name="Access Control" defStyleNum="dsAttribute" bold="1"/> <!-- #0000FF --> <itemData name="Definition" defStyleNum="dsKeyword"/> <itemData name="Pseudo variable" defStyleNum="dsDecVal"/> @@ -891,24 +888,24 @@ <itemData name="Hex" defStyleNum="dsBaseN"/> <itemData name="Bin" defStyleNum="dsBaseN"/> - <itemData name="Symbol" defStyleNum="dsString" color="#D40000"/> + <itemData name="Symbol" defStyleNum="dsWarning" bold="0" underline="0"/> <!-- #D40000 --> <itemData name="String" defStyleNum="dsString"/> - <itemData name="Raw String" defStyleNum="dsString" color="#DD4A4A" selColor="#DD4A4A"/> - <itemData name="Command" defStyleNum="dsString" color="#AA3000"/> - <itemData name="Message" defStyleNum="dsNormal" color="#4000A7"/> <!-- #4A00C0 --> - <itemData name="Regular Expression" defStyleNum="dsOthers" color="#4A5704"/> - <itemData name="Substitution" defStyleNum="dsOthers"/> + <itemData name="Raw String" defStyleNum="dsVerbatimString" /> <!-- #DD4A4A --> + <itemData name="Command" defStyleNum="dsInformation"/> <!-- #AA3000 --> + <itemData name="Message" defStyleNum="dsAttribute" bold="0"/> <!-- #4000A7 --> + <itemData name="Regular Expression" defStyleNum="dsSpecialString"/> <!-- #4A5704 --> + <itemData name="Substitution" defStyleNum="dsSpecialChar"/> <itemData name="Data" defStyleNum="dsNormal"/> <!-- short for 'general delimited input' --> <itemData name="GDL input" defStyleNum="dsOthers" /> - <itemData name="Default globals" defStyleNum="dsDataType" color="#C00000" bold="1"/> - <itemData name="Global Variable" defStyleNum="dsDataType" color="#C00000"/> - <itemData name="Global Constant" defStyleNum="dsDataType" color="#bb1188" bold="1"/> + <itemData name="Default globals" defStyleNum="dsVariable" bold="1"/> <!-- #C00000 --> + <itemData name="Global Variable" defStyleNum="dsVariable"/> <!-- #C00000 --> + <itemData name="Global Constant" defStyleNum="dsConstant" bold="1"/> <!-- #bb1188 --> <itemData name="Constant" defStyleNum="dsDataType"/> - <itemData name="Constant Value" defStyleNum="dsDataType" color="#bb1188"/> - <itemData name="Kernel methods" defStyleNum="dsNormal" color="#000080" selColor="#ffffff"/> <!-- #CC0E86 --> - <itemData name="Module mixin methods" defStyleNum="dsNormal" color="#000080" selColor="#ffffff"/> <!-- #CC0E86 --> + <itemData name="Constant Value" defStyleNum="dsConstant" bold="0"/> <!-- #bb1188 --> + <itemData name="Kernel methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 --> + <itemData name="Module mixin methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 --> <itemData name="Member" defStyleNum="dsNormal"/> <itemData name="Instance Variable" defStyleNum="dsOthers"/> <itemData name="Class Variable" defStyleNum="dsOthers"/> @@ -916,15 +913,15 @@ <itemData name="Comment" defStyleNum="dsComment"/> <itemData name="Blockcomment" defStyleNum="dsComment"/> - <itemData name="Here Document" defStyleNum="dsOthers"/> + <itemData name="Here Document" defStyleNum="dsDocumentation"/> - <itemData name="Delimiter" defStyleNum="dsNormal" color="#FF9FEC"/> - <itemData name="Operator" defStyleNum="dsNormal" color="#FF9FEC"/> + <itemData name="Delimiter" defStyleNum="dsKeyword"/> <!-- #FF9FEC --> + <itemData name="Operator" defStyleNum="dsKeyword"/> <!-- #FF9FEC --> </itemDatas> </highlighting> <general> <comments> - <comment name="singleLine" start="#"/> + <comment name="singleLine" start="#" position="afterwhitespace"/> </comments> <keywords casesensitive="1" weakDeliminator="!?"/> </general> |