[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Please help with new syntax highlighting file
From: george moudry <gmoudry () yahoo ! com>
Date: 2004-09-03 23:03:49
Message-ID: 20040903230349.21232.qmail () web41011 ! mail ! yahoo ! com
[Download RAW message or body]
Dear kate developers,
I want to create a syntax file for my prototyping
language (called rulz.net). Since my language is a
derivative of C#, I took kate's cs.xml file, made a
few small changes and saved it as rulz.xml in the same
directory (/opt/kde3/share/apps/katepart/syntax/). My
rulz.xml file is attached to this email.
Next, I opened kate, and opened a sample rulz file
(airline.rulz, also attached), but there is no
highlighting.
Even after rebooting kde, the rulz.xml does not get
applied.
The 'Tools' menu -> Highligh mode -> Sources submenu
shows C# as an (unchecked) option, but rulz is not on
the submenu.
Question: Do I need to register a MIME type for my
extension? Do I need to take any additional steps to
install the syntax file?
I am using Kate 2.2.1 on Suse Linux 9.1
Thanks for any help,
George Moudry
["rulz.xml" (text/xml)]
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Rulz.NET" version="0.01" kateversion="2.1" section="Sources" \
extensions="*.rulz" mimetype="text/x-rulznet-src;text/x-rulznet-hde"> <highlighting>
<list name="keywords">
<item> abstract</item>
<item> as</item>
<item> base</item>
<item> break</item>
<item> case</item>
<item> catch</item>
<item> class</item>
<item> checked</item>
<item> continue</item>
<item> default</item>
<item> delegate</item>
<item> do</item>
<item> else</item>
<item> enum</item>
<item> event</item>
<item> explicit</item>
<item> extern</item>
<item> false</item>
<item> for</item>
<item> foreach</item>
<item> finally</item>
<item> fixed</item>
<item> goto</item>
<item> if</item>
<item> implicit</item>
<item> in</item>
<item> interface</item>
<item> internal</item>
<item> is</item>
<item> lock</item>
<item> namespace</item>
<item> new</item>
<item> null</item>
<item> operator</item>
<item> out</item>
<item> override</item>
<item> params</item>
<item> private</item>
<item> protected</item>
<item> public</item>
<item> readonly</item>
<item> ref</item>
<item> return</item>
<item> sealed</item>
<item> sizeof</item>
<item> stackalloc</item>
<item> static</item>
<item> struct</item>
<item> switch</item>
<item> this</item>
<item> throw</item>
<item> true</item>
<item> try</item>
<item> typeof</item>
<item> unchecked</item>
<item> unsafe</item>
<item> using</item>
<item> virtual</item>
<item> while</item>
<item> #if</item>
<item> #else</item>
<item> #elif</item>
<item> #endif</item>
<item> #define</item>
<item> #undef</item>
<item> #warning</item>
<item> #error</item>
<item> #line</item>
<item> where</item>
<item> rule</item>
<item> rclass</item>
<item> rinterface</item>
</list>
<list name="types">
<item> bool</item>
<item> byte</item>
<item> char</item>
<item> const</item>
<item> decimal</item>
<item> double</item>
<item> float</item>
<item> int</item>
<item> long</item>
<item> object</item>
<item> uint</item>
<item> ushort</item>
<item> ulong</item>
<item> sbyte</item>
<item> short</item>
<item> string</item>
<item> void</item>
</list>
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
<keyword attribute="Keyword" context="#stay" String="keywords"/>
<keyword attribute="Data Type" context="#stay" String="types" />
<Float attribute="Float" context="#stay">
<AnyChar String="fF" attribute="Float" context="#stay"/>
</Float>
<HlCOct attribute="Octal" context="#stay"/>
<HlCHex attribute="Hex" context="#stay"/>
<Int attribute="Decimal" context="#stay" >
<StringDetect attribute="Decimal" context="#stay" String="ULL" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LUL" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LLU" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="UL" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LU" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="LL" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="U" \
insensitive="TRUE"/>
<StringDetect attribute="Decimal" context="#stay" String="L" \
insensitive="TRUE"/> </Int>
<HlCChar attribute="Char" context="#stay"/>
<DetectChar attribute="String" context="String" char="""/>
<Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*"/>
<DetectChar attribute="Symbol" context="#stay" char="{" \
beginRegion="block1"/>
<DetectChar attribute="Symbol" context="#stay" char="}" endRegion="block1"/>
<RegExpr attribute="Decimal" context="#stay" String="#region.*$" \
beginRegion="Region1"/>
<RegExpr attribute="Decimal" context="#stay" String="#endregion.*$" \
endRegion="Region1"/>
<RegExpr attribute="Function" context="#stay" \
String="\b[_\w][_\w\d]*(?=[\s]*[(])" /> <RegExpr attribute="Symbol" context="Member" \
String="[.]{1,1}" />
<AnyChar attribute="Symbol" context="#stay" \
String=":!%&()+,-/.*<=>?[]|~^;"/> </context>
<context attribute="String" lineEndContext="#pop" name="String">
<LineContinue attribute="String" context="#pop"/>
<HlCStringChar attribute="String Char" context="#stay"/>
<DetectChar attribute="String" context="#pop" char="""/>
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="Member">
<RegExpr attribute="Function" context="#pop" \
String="\b[_\w][_\w\d]*(?=[\s]*)" /> </context>
<context attribute="Comment" lineEndContext="#pop" name="Commentar 1"/>
<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Keyword" defStyleNum="dsKeyword"/>
<itemData name="Function" defStyleNum="dsKeyword" color="#000080" \
selColor="#ffffff" bold="0" italic="0"/> <itemData name="Data Type" \
defStyleNum="dsDataType"/> <itemData name="Decimal" defStyleNum="dsDecVal"/>
<itemData name="Octal" defStyleNum="dsBaseN"/>
<itemData name="Hex" defStyleNum="dsBaseN"/>
<itemData name="Float" defStyleNum="dsFloat"/>
<itemData name="Char" defStyleNum="dsChar"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="String Char" defStyleNum="dsChar"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Symbol" defStyleNum="dsNormal"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="//" />
<comment name="multiLine" start="/*" end="*/" />
</comments>
<keywords casesensitive="1" />
</general>
</language>
["airline.rulz" (text/x-c++src)]
using System;
public class Employee { }
public class Pilot : Employee { }
public class Steward : Employee { }
public class FAA_Exception : System.Exception { }
public rclass CalculateOvertimePay
{
///<summary>
/// the public interface is what the outside world calls.
/// It returns dollar amount of overtime pay, for the current employee.
///</summary>
[rulz.GenerateFctMatchFirst]
[rulz.GenerateFctMatchAll("overtime_MatchAll")]
rinterface double overtimePay(Employee employee,int overtimeHours);
rule double overtimePay(Pilot pilot,int overtimeHours)
where(overtimeHours>100)
{
//must notify FAA
throw new FAA_Exception();
}
rule double overtimePay(Pilot pilot,int overtimeHours)
{
return 0.10 * overtimeHours;
}
rule double overtimePay(Steward steward,int overtimeHours)
{
return 0.05 * overtimeHours;
}
}
public class MainClass
{
public static void Main(string[] argv)
{
CalculateOvertimePay cop = new CalculateOvertimePay();
Pilot pilot = new Pilot();
Steward steward = new Steward();
Employee employee = new Employee();
double[] dArr = cop.overtime_MatchAll(pilot,99);
Console.WriteLine("MatchAll Begin: Pilot, ResultLength="+dArr.Length);
foreach(double d in dArr){
Console.WriteLine(" Result "+d);
}
Console.WriteLine("MatchAll End");
Console.WriteLine();
dArr = cop.overtime_MatchAll(employee,99);
Console.WriteLine("MatchAll Begin: Employee, ResultLength="+dArr.Length);
foreach(double d in dArr){
Console.WriteLine(" Result "+d);
}
Console.WriteLine("MatchAll End");
Console.WriteLine();
Console.WriteLine("MatchFirst Begin");
double stew_pay = cop.overtimePay(steward,77);
Console.WriteLine(" Result "+stew_pay);
Console.WriteLine("MatchFirst End");
}
}
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic