add lua and otml syntax highlighting spec for usage with kate

This commit is contained in:
Eduardo Bart 2012-01-03 21:34:35 -02:00
parent 7c4191b1e6
commit 36ba3f639e
6 changed files with 432 additions and 4 deletions

View File

@ -6,7 +6,7 @@ function Effects.fadeIn(widget, time, elapsed)
widget:setOpacity(math.min((255*elapsed)/time, 255))
if elapsed < time then
scheduleEvent(function()
GFX.fadeIn(widget, time, elapsed + 30)
Effects.fadeIn(widget, time, elapsed + 30)
end, 30)
end
end
@ -17,7 +17,7 @@ function Effects.fadeOut(widget, time, elapsed)
widget:setOpacity((255*(time - elapsed))/time)
if elapsed < time then
scheduleEvent(function()
GFX.fadeOut(widget, time, elapsed + 30)
Effects.fadeOut(widget, time, elapsed + 30)
end, 30)
else
widget:destroy()

View File

@ -0,0 +1,6 @@
Hotkeys = {}
function Hotkeys.bindKey(keyDesc, func)
end

View File

@ -74,4 +74,3 @@ ButtonBox < UICheckBox
$disabled:
color: #f0ad4d88
background-color: #ffffff88

View File

@ -0,0 +1,6 @@
Syntax for OTML files for kate/kwrite/kdevelop
Place the xml files in $HOME/.kde4/share/apps/katepart/syntax/
After installing the files to go in "Configure Kate->Editor Component->Open/Save->Mode & Filetypes"
select "Markup/OTML" and add "kate: space-indent on; indent-width 2;" in Variables field,
do the same for "Scripts/Lua".

View File

@ -0,0 +1,379 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Lua" version="2.0" indenter="lua" kateversion="2.4" section="Scripts" extensions="*.lua" mimetype="text/x-lua">
<highlighting>
<list name="keywords">
<item> and </item>
<item> function </item>
<item> in </item>
<item> local </item>
<item> not </item>
<item> or </item>
</list>
<list name="control">
<item> break </item>
<item> do </item>
<item> else </item>
<item> elseif </item>
<item> end </item>
<item> for </item>
<item> if </item>
<item> repeat </item>
<item> return </item>
<item> then </item>
<item> until </item>
<item> while </item>
</list>
<list name="pseudo-variables">
<item> nil </item>
<item> false </item>
<item> true </item>
</list>
<list name="lua-base-functions">
<item> string.byte </item> <item> string.char </item>
<item> string.find </item> <item> string.len </item>
<item> string.lower </item> <item> string.rep </item>
<item> string.sub </item> <item> string.upper </item>
<item> string.format </item><item> string.gfind </item>
<item> string.gsub </item> <item> table.concat </item>
<item> table.getn </item> <item> table.sort </item>
<item> table.insert </item> <item> table.remove </item>
<item> table.setn </item> <item> math.abs </item>
<item> math.sin </item> <item> math.cos </item>
<item> math.tan </item> <item> math.asin </item>
<item> math.acos </item> <item> math.atan </item>
<item> math.atan2 </item> <item> math.ceil </item>
<item> math.floor </item> <item> math.mod </item>
<item> math.frexp </item> <item> math.ldexp </item>
<item> math.squrt </item> <item> math.min </item>
<item> math.max </item> <item> math.log </item>
<item> math.log10 </item> <item> math.exp </item>
<item> math.deg </item> <item> math.rad </item>
<item> math.random </item> <item> math.randomseed </item>
<item> io.close </item> <item> io.flush </item>
<item> io.input </item> <item> io.lines </item>
<item> io.open </item> <item> io.output </item>
<item> io.read </item> <item> io.stderr </item>
<item> io.stdin </item> <item> io.stdout </item>
<item> io.tmpfile </item> <item> io.write </item>
<item> os.clock </item> <item> os.date </item>
<item> os.difftime </item> <item> os.execute </item>
<item> os.exit </item> <item> os.getenv </item>
<item> os.remove </item> <item> os.rename </item>
<item> os.setlocale </item> <item> os.time </item>
<item> os.tmpname </item> <item> debug.getinfo </item>
<item> debug.getlocal </item><item> debug.setlocal </item>
<item> debug.sethook </item><item> debug.gethook </item>
<item> assert </item> <item> collectgarbage </item>
<item> dofile </item> <item> error </item>
<item> next </item> <item> print </item>
<item> rawget </item> <item> rawset </item>
<item> tonumber </item> <item> tostring </item>
<item> type </item> <item> _ALERT </item>
<item> _ERRORMESSAGE </item><item> call </item>
<item> getmetatable </item><item> gcinfo </item>
<item> ipairs </item> <item> loadfile </item>
<item> loadstring </item> <item> pairs </item>
<item> pcall </item> <item> require </item>
<item> LUA_PATH </item> <item> setmetatable </item>
<item> _LOADED </item> <item> _VERSION </item>
<item> gettagmethod </item><item> globals </item>
<item> newtag </item> <item> setglobal </item>
<item> settag </item> <item> settagmethod </item>
<item> setlinehook </item> <item> getglobals </item>
<item> copytagmethods </item><item> dostring </item>
<item> getglobal </item> <item> tag </item>
<item> setglobals </item> <item> unpack </item>
<item> exit </item> <item> readfrom </item>
<item> writeto </item> <item> appendto </item>
<item> read </item> <item> write </item>
<item> getinfo </item> <item> getlocal </item>
<item> setlocal </item> <item> setcallhook </item>
<item> tinsert </item> <item> tremove </item>
<item> flush </item> <item> seek </item>
<item> setlocale </item> <item> execute </item>
<item> remove </item> <item> rename </item>
<item> tmpname </item> <item> getenv </item>
<item> getn </item> <item> sort </item>
<item> table.foreach </item> <item> table.foreachi </item>
<item> foreach </item> <item> foreachi </item>
<item> abs </item> <item> sin </item>
<item> cos </item> <item> tan </item>
<item> asin </item> <item> acos </item>
<item> atan </item> <item> atan2 </item>
<item> ceil </item> <item> floor </item>
<item> mod </item> <item> frexp </item>
<item> ldexp </item> <item> squrt </item>
<item> min </item> <item> max </item>
<item> log </item> <item> log10 </item>
<item> exp </item> <item> deg </item>
<item> rad </item> <item> random </item>
<item> randomseed </item> <item> strlen </item>
<item> strsub </item> <item> strlower </item>
<item> strupper </item> <item> strchar </item>
<item> strrep </item> <item> ascii </item>
<item> strbyte </item> <item> format </item>
<item> strfind </item> <item> gsub </item>
<item> openfile </item> <item> closefile </item>
<item> date </item> <item> clock </item>
<item> string.trim </item> <item> string.starts </item>
<item> string.split </item>
<item> table.dump </item> <item> table.copy </item>
<item> table.selective_copy </item> <item> table.merge </item>
<item> toboolean </item>
</list>
<list name="otclient-core-functions">
<item> connect </item>
<item> extends </item>
<item> print </item>
<item> fatal </item>
<item> scheduleEvent </item>
<item> addEvent </item>
<item> removeEvent </item>
<item> displayUI </item>
<item> createWidget </item>
</list>
<list name="otclient-core-constants">
<item> AnchorNone </item>
<item> AnchorTop </item>
<item> AnchorBottom </item>
<item> AnchorLeft </item>
<item> AnchorRight </item>
<item> AnchorVerticalCenter </item>
<item> AnchorHorizontalCenter </item>
<item> LogDebug </item>
<item> LogInfo </item>
<item> LogWarning </item>
<item> LogError </item>
<item> LogFatal </item>
<item> ActiveFocusReason </item>
<item> KeyUnknown </item>
<item> KeyEscape </item>
<item> KeyTab </item>
<item> KeyBackspace </item>
<item> KeyReturn </item>
<item> KeyEnter </item>
<item> KeyInsert </item>
<item> KeyDelete </item>
<item> KeyPause </item>
<item> KeyPrintScreen </item>
<item> KeyHome </item>
<item> KeyEnd </item>
<item> KeyPageUp </item>
<item> KeyPageDown </item>
<item> KeyUp </item>
<item> KeyDown </item>
<item> KeyLeft </item>
<item> KeyRight </item>
<item> KeyNumLock </item>
<item> KeyScrollLock </item>
<item> KeyCapsLock </item>
<item> KeyCtrl </item>
<item> KeyShift </item>
<item> KeyAlt </item>
<item> KeyAltGr </item>
<item> KeyMeta </item>
<item> KeyMenu </item>
<item> KeySpace </item>
<item> KeyExclamation </item>
<item> KeyQuote </item>
<item> KeyNumberSign </item>
<item> KeyDollar </item>
<item> KeyPercent </item>
<item> KeyAmpersand </item>
<item> KeyApostrophe </item>
<item> KeyLeftParen </item>
<item> KeyRightParen </item>
<item> KeyAsterisk </item>
<item> KeyPlus </item>
<item> KeyComma </item>
<item> KeyMinus </item>
<item> KeyPeriod </item>
<item> KeySlash </item>
<item> Key0 </item>
<item> Key1 </item>
<item> Key2 </item>
<item> Key3 </item>
<item> Key4 </item>
<item> Key5 </item>
<item> Key6 </item>
<item> Key7 </item>
<item> Key8 </item>
<item> Key9 </item>
<item> KeyColon </item>
<item> KeySemicolon </item>
<item> KeyLess </item>
<item> KeyEqual </item>
<item> KeyGreater </item>
<item> KeyQuestion </item>
<item> KeyAtSign </item>
<item> KeyA </item>
<item> KeyB </item>
<item> KeyC </item>
<item> KeyD </item>
<item> KeyE </item>
<item> KeyF </item>
<item> KeyG </item>
<item> KeyH </item>
<item> KeyI </item>
<item> KeyJ </item>
<item> KeyK </item>
<item> KeyL </item>
<item> KeyM </item>
<item> KeyN </item>
<item> KeyO </item>
<item> KeyP </item>
<item> KeyQ </item>
<item> KeyR </item>
<item> KeyS </item>
<item> KeyT </item>
<item> KeyU </item>
<item> KeyV </item>
<item> KeyW </item>
<item> KeyX </item>
<item> KeyY </item>
<item> KeyZ </item>
<item> KeyLeftBracket </item>
<item> KeyBackslash </item>
<item> KeyRightBracket </item>
<item> KeyCaret </item>
<item> KeyUnderscore </item>
<item> KeyGrave </item>
<item> KeyLeftCurly </item>
<item> KeyBar </item>
<item> KeyRightCurly </item>
<item> KeyTilde </item>
<item> KeyF1 </item>
<item> KeyF2 </item>
<item> KeyF3 </item>
<item> KeyF4 </item>
<item> KeyF5 </item>
<item> KeyF6 </item>
<item> KeyF7 </item>
<item> KeyF8 </item>
<item> KeyF9 </item>
<item> KeyF10 </item>
<item> KeyF11 </item>
<item> KeyF12 </item>
<item> KeyboardNoModifier </item>
<item> KeyboardCtrlModifier </item>
<item> KeyboardAltModifier </item>
<item> KeyboardShiftModifier </item>
<item> MouseNoButton </item>
<item> MouseLeftButton </item>
<item> MouseRightButton </item>
<item> MouseMidButton </item>
</list>
<list name="attention">
<item> TODO </item>
<item> FIXME </item>
<item> NOTE </item>
</list>
<list name="deprecated">
<item> table.foreach </item> <item> table.foreachi </item>
<item> foreach </item> <item> foreachi </item>
</list>
<contexts>
<context name="Base" attribute="Comment" lineEndContext="Normal">
<RegExpr attribute="Comment" context="Normal" String="#!.*$" column="0" />
<RegExpr attribute="Comment" context="Normal" String="^.*$" lookAhead="true" />
</context>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="##DoxygenLua" />
<keyword attribute="Error" context="#stay" String="deprecated" />
<DetectSpaces />
<RegExpr attribute="Comment" context="Block Comment" beginRegion="block comment" String="--\[(=*)\[" dynamic="true" />
<Detect2Chars attribute="Comment" context="Comment" char="-" char1="-"/>
<RegExpr attribute="Strings" context="String_block" String="\[(=*)\[" dynamic="true" />
<DetectChar attribute="Strings" context="String_single" char="'"/>
<DetectChar attribute="Strings" context="String_double" char="&quot;"/>
<keyword attribute="Lua Base Func" context="#stay" String="lua-base-functions"/>
<keyword attribute="Otclient Core Func" context="#stay" String="otclient-core-functions" />
<RegExpr attribute="Keyword" context="#stay" beginRegion="chunk" String="\bfunction\b" />
<keyword attribute="Keyword" context="#stay" String="keywords" />
<keyword attribute="Keyword" context="#stay" String="pseudo-variables" />
<keyword attribute="Otclient Core Const" context="#stay" String="otclient-core-constants" />
<RegExpr attribute="Keyword" context="#stay" endRegion="chunk" beginRegion="chunk" String="\belse\b" />
<RegExpr attribute="Keyword" context="#stay" endRegion="chunk" beginRegion="chunk" String="\belseif\b" />
<RegExpr attribute="Keyword" context="#stay" beginRegion="chunk" String="\bdo\b" />
<RegExpr attribute="Keyword" context="#stay" beginRegion="chunk" String="\bif\b" />
<RegExpr attribute="Keyword" context="#stay" endRegion="chunk" String="\bend\b" />
<keyword attribute="Keyword" context="#stay" String="control" />
<DetectChar attribute="Symbols" context="#stay" beginRegion="table" char="{" />
<DetectChar attribute="Symbols" context="#stay" endRegion="table" char="}" />
<RegExpr attribute="Numbers" context="#stay" String="\b\d*\.?\d*(e|e\-|e\+)?\d+\b"/>
<RegExpr attribute="Numbers" context="#stay" String="\b-?0[xX][0-9a-fA-F]+\b"/>
<RegExpr attribute="Normal Text" context="#stay" String="\b[a-zA-Z_][a-zA-Z0-9_]*(?=\s*([({'&quot;]|\[\[))\b" />
<RegExpr attribute="Const" context="#stay" String="\b[A-Z_][A-Z0-9_]*\b" />
<RegExpr attribute="Global Class" context="#stay" String="\b[A-Z_][a-zA-Z0-9_]*\b" />
<RegExpr attribute="Var" context="#stay" String="\b[a-zA-Z_][a-zA-Z0-9_]*\b" />
<Detect2Chars attribute="Error" context="#stay" char="!" char1="="/>
<Detect2Chars attribute="Error" context="#stay" char="-" char1="="/>
<Detect2Chars attribute="Error" context="#stay" char="+" char1="="/>
<Detect2Chars attribute="Error" context="#stay" char="+" char1="+"/>
<Detect2Chars attribute="Error" context="#stay" char="." char1="="/>
<AnyChar attribute="Symbols" context="#stay" String="[]().=~+-*/^&gt;&lt;#;" />
</context>
<context name="Comment" attribute="Comment" lineEndContext="#pop">
<Detect2Chars attribute="Alerts" context="#stay" char="-" char1="-" />
<keyword attribute="Alerts" context="#stay" String="attention"/>
</context>
<context name="Block Comment" attribute="Comment" lineEndContext="#stay" dynamic="true" >
<RegExpr attribute="Comment" context="#pop" endRegion="block comment" String="\]%1\]" dynamic="true" />
<Detect2Chars attribute="Alerts" context="#stay" char="-" char1="-" />
<keyword attribute="Alerts" context="#stay" String="attention" />
</context>
<context name="String_single" attribute="Strings" lineEndContext="Error">
<RegExpr attribute="Symbols" context="#stay" String="\\(a|b|f|n|r|t|v|\\|&quot;|\'|[|])" />
<DetectChar attribute="Strings" context="#pop" char="'"/>
</context>
<context name="String_double" attribute="Strings" lineEndContext="Error">
<RegExpr attribute="Symbols" context="#stay" String="\\[abfnrtv'&quot;\\\[\]]" />
<DetectChar attribute="Strings" context="#pop" char="&quot;"/>
</context>
<context name="String_block" attribute="Strings" lineEndContext="#stay" dynamic="true">
<RegExpr attribute="Symbols" context="#stay" String="\\(a|b|f|n|r|t|v|\\|&quot;|\'|[|])" />
<RegExpr attribute="Strings" context="#pop" String="\]%1\]" dynamic="true" />
</context>
<context name="Error" attribute="Error" lineEndContext="#stay">
</context>
</contexts>
<itemDatas>
<itemData name="Alerts" defStyleNum="dsAlert" />
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Lua Base Func" defStyleNum="dsNormal" color="#0057AE"/>
<itemData name="Otclient Core Func" defStyleNum="dsKeyword" color="#0057AE"/>
<itemData name="Const" defStyleNum="dsNormal" color="#a800ff"/>
<itemData name="Otclient Core Const" defStyleNum="dsNormal" color="#a42a38"/>
<itemData name="Global Class" defStyleNum="dsKeyword" color="#006E28"/>
<itemData name="Keyword" defStyleNum="dsKeyword"/>
<itemData name="Error" defStyleNum="dsError"/>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Numbers" defStyleNum="dsDecVal"/>
<itemData name="Strings" defStyleNum="dsString"/>
<itemData name="Symbols" defStyleNum="dsOthers"/>
<itemData name="Var" defStyleNum="dsKeyword" color="#5555aa" selColor="#ffffff" bold="0"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="--" />
<comment name="multiLine" start="--[[" end="]]" />
</comments>
<keywords casesensitive="1" weakDeliminator="&#46;" additionalDeliminator="&quot;"/>
</general>
</language>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="OTML" section="Markup"
version="1.0"
mimetype="text/otml"
extensions="*.otml;*.otui;*.otmod;*.otfont;*.otpa"
author="Eduardo Bart"
license="MIT">
<highlighting>
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="normal">
<RegExpr attribute="Comment" context="#stay" String="^ *//.*$" />
<RegExpr attribute="List Item" context="#stay" String=" *-.*$" />
<RegExpr attribute="State Hash Tag" context="#stay" String="^ *\$[^:]*:" />
<RegExpr attribute="Function Hash Tag" context="#stay" String="^ *@[^:]*:" />
<RegExpr attribute="Lua Value Hash Tag" context="#stay" String="^ *&amp;[^:]*:" />
<RegExpr attribute="Hash Tag" context="#stay" String="^ *[^:]*:" />
<RegExpr attribute="Tag" context="#stay" String="^ *[#]?[a-zA-Z0-9-_]*$" />
<RegExpr attribute="Inheritance Tag" context="#stay" String="^ *[a-zA-Z0-9-_]*\s*&lt;\s*[a-zA-Z0-9-_]*$" />
<RegExpr attribute="Color" context="#stay" String="#\b[0-9a-fA-F]+\b" />
<RegExpr attribute="Number" context="#stay" String="\b[0-9]+\b" />
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="List Item" defStyleNum="dsNormal" />
<itemData name="Hash Tag" defStyleNum="dsFunction" />
<itemData name="Lua Value Hash Tag" defStyleNum="dsDataType" />
<itemData name="Function Hash Tag" defStyleNum="dsOthers" />
<itemData name="State Hash Tag" defStyleNum="dsOthers" bold="1" />
<itemData name="Tag" defStyleNum="dsKeyword" />
<itemData name="Inheritance Tag" defStyleNum="dsDataType" bold="1" />
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Number" defStyleNum="dsDecVal" />
<itemData name="Color" defStyleNum="dsString" />
</itemDatas>
</highlighting>
</language>