Mailinglist Archive: opensuse-kde3 (8 mails)

< Previous Next >
[opensuse-kde3] katepart syntax/javascript.xml broken in 42.3
All,

The javascript kate/kwrite syntax highlighting is broken on 42.3. I don't
know what broke it. I have an older copy (newer version) that restores proper
syntax highlighting for javascript. (I've attached the working file below) The
changes from the working copy of the syntax hightlight file and the current
opensuse broken one are:

diff -uNb javascript.xml ~/tmp/javascript.xml
--- javascript.xml 2014-01-19 05:59:20.000000000 -0600
+++ /home/david/tmp/javascript.xml 2014-07-14 05:03:17.000000000 -0500
@@ -3,7 +3,7 @@
<!-- Author: Anders Lund <anders@xxxxxxxx> //-->
<!-- Minor changes: Joseph Wenninger <jowenn@xxxxxxx> //-->
<!-- Full JavaScript 1.0 support by Whitehawk Stormchaser //-->
-<language name="JavaScript" version="1.23" kateversion="2.5"
section="Scripts" extensions="*.js;*.kwinscript"
+<language name="JavaScript" version="1.23" kateversion="2.4"
section="Scripts" extensions="*.js;*.kwinscript"
mimetype="text/x-javascript;application/x-javascript"
indenter="cstyle"
author="Anders Lund (anders@xxxxxxxx), Joseph Wenninger
(jowenn@xxxxxxx), Whitehawk Stormchaser (zerokode@xxxxxxx)" license="">
<highlighting>
@@ -64,6 +64,17 @@
<item> undefined </item>
</list>
<contexts>
+
+ <!-- Shebang: ("#!") Detect shebang and fallthrough to Normal -->
+ <!-- Based on the similar clause from prolog.xml, which notes the
following BUG:
+ If the file starts with whitespace and a shebang on a line other than
the first line,
+ this rule will still match it as a shebang, even tough the shebang is
only valid on
+ the very first line.
+ -->
+ <context name="Shebang" lineEndContext="Normal" attribute="Syntax
Error" fallthrough="true" fallthroughContext="Normal" >
+ <Detect2Chars column="0" char="#" char1="!" context="Comment"
attribute="Comment" />
+ </context>
+
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
<DetectSpaces/>
<StringDetect attribute="Region Marker" context="region_marker"
String="//BEGIN" beginRegion="Region1" />
@@ -102,16 +113,13 @@
<AnyChar attribute="Symbol" String=":!%&amp;+,-/.*&lt;=&gt;?|~^&#59;"
/>
</context>

- <context attribute="Normal Text" lineEndContext="#stay"
fallthrough="true" fallthroughContext="#pop" name="Object Member">
+ <context attribute="Normal Text" lineEndContext="#pop"
fallthrough="true" fallthroughContext="#pop" name="Object Member">
<DetectChar char="." />
<!--DetectIdentifier-->
<RegExpr attribute="Objects" context="Object Member"
String="[a-zA-Z_$][\w$]*(?=\s*\.)" />
<!--DetectIdentifier-->
<RegExpr attribute="Object Member" String="[a-zA-Z_$][\w$]*" />
- <!-- NoRegExp without DetectSpaces. TODO: code reuse without
detecting spaces as object member? -->
- <Detect2Chars context="#pop" lookAhead="true" char="/" char1="/" />
- <Detect2Chars context="#pop" lookAhead="true" char="/" char1="*" />
- <DetectChar context="#pop" char="/" />
+ <IncludeRules context="NoRegExp" />
</context>

<context attribute="Normal Text" lineEndContext="#stay"
fallthrough="true" fallthroughContext="#pop" name="NoRegExp">

The working version is attached. May be worth a bug. We also need a kde3
repo for 15 - Go Ilya!



--
David C. Rankin, J.D.,P.E.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!-- Author: Anders Lund <anders@xxxxxxxx> //-->
<!-- Minor changes: Joseph Wenninger <jowenn@xxxxxxx> //-->
<!-- Full JavaScript 1.0 support by Whitehawk Stormchaser //-->
<language name="JavaScript" version="1.23" kateversion="2.5" section="Scripts"
extensions="*.js;*.kwinscript"
mimetype="text/x-javascript;application/x-javascript"
indenter="cstyle"
author="Anders Lund (anders@xxxxxxxx), Joseph Wenninger
(jowenn@xxxxxxx), Whitehawk Stormchaser (zerokode@xxxxxxx)" license="">
<highlighting>
<list name="keywords">
<item> break </item>
<item> case </item>
<item> catch </item>
<item> const </item>
<item> continue </item>
<item> debugger </item>
<item> default </item>
<item> delete </item>
<item> do </item>
<item> else </item>
<item> finally </item>
<item> for </item>
<item> function </item>
<item> if </item>
<item> in </item>
<item> instanceof </item>
<item> new </item>
<item> return </item>
<item> switch </item>
<item> this </item>
<item> throw </item>
<item> try </item>
<item> typeof </item>
<item> var </item>
<item> void </item>
<item> while </item>
<item> with </item>
</list>
<list name="reserved">
<item> class </item>
<item> enum </item>
<item> export </item>
<item> extends </item>
<item> import </item>
<item> super </item>

<!-- The following keywords are reserved only in strict-mode -->
<item> implements </item>
<item> interface </item>
<item> let </item>
<item> package </item>
<item> private </item>
<item> protected </item>
<item> public </item>
<item> static </item>
<item> yield </item>
</list>
<list name="primitives">
<item> Infinity </item>
<item> NaN </item>
<item> false </item>
<item> null </item>
<item> true </item>
<item> undefined </item>
</list>
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
<DetectSpaces/>
<StringDetect attribute="Region Marker" context="region_marker"
String="//BEGIN" beginRegion="Region1" />
<StringDetect attribute="Region Marker" context="region_marker"
String="//END" endRegion="Region1" />

<Float attribute="Float" context="NoRegExp" />
<HlCOct attribute="Octal" context="NoRegExp" />
<HlCHex attribute="Hex" context="NoRegExp" />
<Int attribute="Decimal" context="NoRegExp" />
<AnyChar context="NoRegExp" String="])" />

<keyword attribute="Keyword" String="keywords" />
<keyword attribute="Reserved" String="reserved" />
<keyword attribute="Keyword" context="NoRegExp" String="primitives" />

<!--DetectIdentifier-->
<RegExpr attribute="Objects" context="Object Member"
String="[a-zA-Z_$][\w$]*(?=\s*\.)" />
<!--DetectIdentifier-->
<RegExpr attribute="Object Member" context="NoRegExp"
String="[a-zA-Z_$][\w$]*(?=\s*\()" />
<DetectChar context="Object Member" char="." />
<!--DetectIdentifier-->
<RegExpr context="NoRegExp" String="[a-zA-Z_$][\w$]*" />

<DetectChar attribute="String" context="String" char="&quot;" />
<DetectChar attribute="String" context="String SQ" char="'" />

<IncludeRules context="##Doxygen" />
<Detect2Chars attribute="Comment" context="Comment" char="/" char1="/"
/>
<Detect2Chars attribute="Comment" context="Multi/inline Comment"
char="/" char1="*" beginRegion="Comment" />

<DetectChar attribute="Regular Expression" context="(regex caret first
check)" char="/" />

<DetectChar attribute="Symbol" context="Object" char="{"
beginRegion="Brace" />
<DetectChar attribute="Symbol" context="Conditional Expression"
char="?" />

<AnyChar attribute="Symbol" String=":!%&amp;+,-/.*&lt;=&gt;?|~^&#59;" />
</context>

<context attribute="Normal Text" lineEndContext="#stay"
fallthrough="true" fallthroughContext="#pop" name="Object Member">
<DetectChar char="." />
<!--DetectIdentifier-->
<RegExpr attribute="Objects" context="Object Member"
String="[a-zA-Z_$][\w$]*(?=\s*\.)" />
<!--DetectIdentifier-->
<RegExpr attribute="Object Member" String="[a-zA-Z_$][\w$]*" />
<!-- NoRegExp without DetectSpaces. TODO: code reuse without detecting
spaces as object member? -->
<Detect2Chars context="#pop" lookAhead="true" char="/" char1="/" />
<Detect2Chars context="#pop" lookAhead="true" char="/" char1="*" />
<DetectChar context="#pop" char="/" />
</context>

<context attribute="Normal Text" lineEndContext="#stay"
fallthrough="true" fallthroughContext="#pop" name="NoRegExp">
<Detect2Chars context="#pop" lookAhead="true" char="/" char1="/" />
<Detect2Chars context="#pop" lookAhead="true" char="/" char1="*" />
<DetectChar context="#pop" char="/" />
<DetectSpaces/>
</context>

<context attribute="Normal Text" lineEndContext="#stay" name="Conditional
Expression">
<DetectChar context="#pop" char=":" />
<IncludeRules context="Normal" />
</context>

<context attribute="Normal Text" lineEndContext="#stay" name="Object">
<!-- Mostly required for define: in switch blocks -->
<keyword attribute="Keyword" String="keywords" />
<!--DetectIdentifier-->
<RegExpr attribute="JSON" String="[a-zA-Z_$][\w$]*\s*(?=:)" />
<DetectChar attribute="Symbol" char="}" endRegion="Brace"
context="#pop" />
<IncludeRules context="Normal" />
</context>

<context attribute="String" lineEndContext="#pop" name="String">
<HlCStringChar attribute="Char" />
<LineContinue/>
<DetectChar attribute="String" context="#pop" char="&quot;" />
</context>
<context attribute="String" lineEndContext="#pop" name="String SQ">
<HlCStringChar attribute="Char" />
<LineContinue/>
<DetectChar attribute="String" context="#pop" char="'" />
</context>

<context attribute="Comment" lineEndContext="#pop" name="Comment">
<IncludeRules context="##Alerts" />
<IncludeRules context="##Modelines" />
</context>
<context attribute="Comment" lineEndContext="#stay" name="Multi/inline
Comment">
<IncludeRules context="##Alerts" />
<IncludeRules context="##Modelines" />
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/"
endRegion="Comment" />
</context>

<context attribute="Regular Expression" lineEndContext="#stay"
name="Regular Expression">
<RegExpr attribute="Regular Expression" context="#pop#pop"
String="/\w*" />
<RegExpr attribute="Pattern Internal Operator" String="\{[\d, ]+\}" />
<RegExpr attribute="Pattern Internal Operator" String="\\[bB]" />
<RegExpr attribute="Pattern Character Class" String="\\[nrtvfDdSsWw]" />
<DetectChar attribute="Pattern Character Class" context="(charclass
caret first check)" char="[" />
<RegExpr attribute="Pattern Internal Operator" String="\\." />
<RegExpr attribute="Pattern Internal Operator" String="\$(?=/)" />
<AnyChar attribute="Pattern Internal Operator" String="?+*()|" />
</context>
<context attribute="Pattern Character Class" lineEndContext="#stay"
name="Regular Expression Character Class">
<RegExpr String="\\[\[\]]" />
<RegExpr attribute="Pattern Internal Operator" String="\\." />
<DetectChar attribute="Pattern Character Class" context="#pop#pop"
char="]" />
</context>
<context attribute="Pattern Internal Operator" lineEndContext="#pop"
name="(regex caret first check)" fallthrough="true" fallthroughContext="Regular
Expression">
<DetectChar attribute="Pattern Internal Operator" context="Regular
Expression" char="^" />
</context>
<context attribute="Pattern Internal Operator" lineEndContext="#pop"
name="(charclass caret first check)" fallthrough="true"
fallthroughContext="Regular Expression Character Class">
<DetectChar attribute="Pattern Internal Operator" context="Regular
Expression Character Class" char="^" />
</context>

<context name="region_marker" attribute="Region Marker"
lineEndContext="#pop" >
<DetectIdentifier/>
<DetectSpaces/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal"
spellChecking="false" />
<itemData name="Keyword" defStyleNum="dsKeyword"
spellChecking="false" />
<itemData name="Reserved" defStyleNum="dsKeyword" italic="true"
spellChecking="false" />
<itemData name="Function" defStyleNum="dsFunction"
spellChecking="false" />
<itemData name="Objects" defStyleNum="dsOthers"
spellChecking="false" />
<itemData name="Object Member" defStyleNum="dsFunction"
spellChecking="false" />

<itemData name="Decimal" defStyleNum="dsDecVal"
spellChecking="false" />
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"
/>
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"
/>
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"
/>
<itemData name="Char" defStyleNum="dsChar" spellChecking="false"
/>
<itemData name="String" defStyleNum="dsString" />

<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Symbol" defStyleNum="dsNormal"
spellChecking="false" />
<itemData name="Regular Expression" defStyleNum="dsOthers"
spellChecking="false" />
<itemData name="Pattern Internal Operator" defStyleNum="dsFloat"
spellChecking="false" />
<itemData name="Pattern Character Class" defStyleNum="dsBaseN"
spellChecking="false" />
<itemData name="Region Marker" defStyleNum="dsRegionMarker"
spellChecking="false" />
<itemData name="JSON" defStyleNum="dsDataType"
spellChecking="false" />
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="//" />
<comment name="multiLine" start="/*" end="*/" />
</comments>
<keywords casesensitive="1" />
</general>
</language>
< Previous Next >
Follow Ups