Answer the question
In order to leave comments, you need to log in
Syntax highlighting rules for Kate?
I want to add a rule so that an apostrophe inside a construct matching the q'(\S).*\1' regular expression is not considered a closing one. For example, q'#Oracle's quote#' is a single string literal.
Opened the file ~/.kde4/share/apps/katepart/syntax/sql.xml , into the element
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"><br>
<DetectChar attribute="String" context="String literal" char="'"/><br>
<RegExpr attribute="String" context="Oracle quote operator" String="q&(\S)" dinamic="true" lookAhead="true"/><br>
<context name="Oracle quote operator" attribute="String" lineEndContext="#stay" dinamic="true" lookAhead="true"><br>
<Detect2Chars attribute="String" context="#pop" char="%1" char1="&" dinamic="true"/><br>
<DetectChar attribute="String Char" context="#stay" char="&"/><br>
</context><br>
Answer the question
In order to leave comments, you need to log in
Found a variant of the task of rules at which everything works.
<contexts>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Operator" context="Quote operator brace" String="\bq'\{" insensitive="true"/>
<RegExpr attribute="Operator" context="Quote operator bracket" String="\bq'\[" insensitive="true"/>
<RegExpr attribute="Operator" context="Quote operator parenthesis" String="\bq'\(" insensitive="true"/>
<RegExpr attribute="Operator" context="Quote operator" String="\bq'(\S)" insensitive="true"/>
<DetectChar attribute="String" context="String literal" char="'" insensitive="true"/>
</context>
<context name="Quote operator" attribute="String" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="Operator" context="#pop" String="%1'" dynamic="true"/>
</context>
<context name="Quote operator brace" attribute="String" lineEndContext="#stay">
<Detect2Chars attribute="Operator" context="#pop" char="}" char1="'"/>
</context>
<context name="Quote operator bracket" attribute="String" lineEndContext="#stay">
<Detect2Chars attribute="Operator" context="#pop" char="]" char1="'"/>
</context>
<context name="Quote operator parenthesis" attribute="String" lineEndContext="#stay">
<Detect2Chars attribute="Operator" context="#pop" char=")" char1="'"/>
</context>
</contexts>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question