Add java language parsing based on C language.

Yes I did not like JAVA, but I needed it for the Android application
This commit is contained in:
Edouard Dupin 2011-12-01 09:59:46 +01:00
parent a351fe72bd
commit 870e127932
5 changed files with 98 additions and 4 deletions

View File

@ -134,6 +134,11 @@ void HighlightManager::loadLanguages(void)
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_java.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
//myHightline->Display();
}

View File

@ -42,16 +42,17 @@
// Variables privé du namespace
#define POLICE_NAME "Monospace"
/*
#ifdef USE_GTK_VERSION_3_0
#define POLICE_SIZE 15
static int32_t m_pangoFontWidth = 9;
static int32_t m_pangoFontHeight = 19;
#elif USE_GTK_VERSION_2_0
*/
#define POLICE_SIZE 12
static int32_t m_pangoFontWidth = 7;
static int32_t m_pangoFontHeight = 15;
#endif
//#endif
/*
#define POLICE_SIZE 11
static int32_t m_pangoFontWidth = 7;

View File

@ -79,7 +79,7 @@
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<start>\@try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
<start>\@new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
</rule>
<rule name="my type">
<color>type</color>

87
data/lang_java.xml Normal file
View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="java">
<ext>*.java</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<start>/\*\*</start>
<end>\*/</end>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<start>/\*</start>
<end>\*/</end>
</rule>
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<start>//!</start>
<end>\n</end>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<start>//[ \t]*TODO[ \t]*:</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="my comment">
<color>comment</color>
<start>//</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>'</start>
<end>'</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<start>\@new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
</rule>
<rule name="my type">
<color>type</color>
<start>\@bool|char|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128)\@</start>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<start>\@import|package|extends|Override|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum\@</start>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<start>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</start>
</rule>
<rule name="numeric constant">
<color>number</color>
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
</rule>
<rule name="my boolean">
<color>boolean</color>
<start>\@true|TRUE|false|FALSE\@</start>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start>
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule>
</pass2>
</EdnLang>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="XML">
<EdnLang version="0.2" lang="XML">
<ext>*.xml</ext>
<ext>*.eol</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Comment">
<color>comment</color>