Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » TheIDE now supports JavaScript syntax highlighting for .js file extension
Re: TheIDE now supports JavaScript syntax highlighting for .js file extension [message #36650 is a reply to message #36617] Sun, 24 June 2012 09:13 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1791
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mirek wrote on Wed, 20 June 2012 17:54

I guess html will come in next development cycle - it will need major refactoring of syntax highlighting mechanism (it is now pretty much tied to curly braces languages...).


Funny coincidence: Just a few days before you announced the JS highlighting, I thought that it might be fun to reimplement CodeEditor to support user-defined highlighting. I even started working on it in my free time, so here is a little tasting:
index.php?t=getfile&id=3785&private=0
The image shows CodeEditor using the highlight definition file specifying highlighting of higlighting definition files to highlight highlight definition file specifying highlighting of higlighting definition files. Pretty meta, right? Very Happy

It is based on pcre and caching. Basic highlighting works just fine, some of the higher level features (scope highlighting, matching brackets, ...) are not yet implemented and some are using the old CodeEditor code. The goal is to allow loading user specified highlighters, both at compile time (by include) and at run-time. It requires some pcre skill (or copy&paste skill Smile ) to write one, but otherwise it is very simple format as you can see above - it takes only 16 lines to describe C++ Smile This file imitates current CodeEditor:
Quote:

HL_PATTERN(INK_OPERATOR, "[\\Q!+-*/\%&|=[]:?<>.~^\\E]")
HL_PATTERN(INK_KEYWORD, " \\b(__(asm|cdecl|declspec|except|fastcall|finally|inline|int (16|32|64|8)|leave|stdcall|try|uuidof)|auto|bool|break|case| catch|char|class|const|const_cast|continue|default|delete|dl l(ex|im)port|do|double|dynamic_cast|else|enum|explicit|exter n|false|float|for|force_inline|friend|goto|if|inline|int|lon g|mutable|namespace|new|operator|private|protected|public|re gister|reinterpret_cast|return|short|signed|sizeof|static|st atic_cast|struct|switch|template|this|thread|throw|true|try| typedef|typeid|typename|union|unsigned|using|virtual|void|vo latile|while)\\b ")
HL_PATTERN(INK_UPPER, "\\b[A-Z][A-Z_0-9]*\\b")
HL_PATTERN(INK_UPP, "\\bupp\\b")
HL_PATTERN(INK_MACRO, " ^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)d ef|endif|el(if|se)|if|warning|error|pragma|using)\\b ")
HL_PATTERN(INK_UPPMACROS, " \\b(CLASSNAME|(THIS|PTE)BACK([1-4]?)|QUOTE|X?ASSERT|X?NEVER| X?CHECK|NAMESPACE_UPP|END_UPP_NAMESPACE|NEVER_|ASSERT_)\\b ")
HL_PATTERN(INK_UPPLOGS, " \\b([DLR]?DUMP(C|CC|CC|HEX|M)?|[DLR]?LOG(F|HEX|BEGIN|END|BLO CK|HEXDUMP|SRCPOS)?|[DLR]?TIMING|DEBUGCODE|RQUOTE)\\b ")
HL_PATTERN(INK_CONST_INT, "\\b[0-9]+\\b")
HL_PATTERN(INK_CONST_HEX, "\\b0(x|X)[[:xdigit:]]+\\b")
HL_PATTERN(INK_CONST_OCT, "\\b0[0-7]+\\b")
HL_PATTERN(INK_CONST_FLOAT, "\\b[0-9]+\\.[0-9]*\\b")
HL_PATTERN(INK_CONST_STRINGOP, "TODO")
HL_PATTERN(INK_CONST_STRING, "[\"](\\.|[^\"])*[\"]")
HL_PATTERN(INK_COMMENT, "//.*")
HL_PATTERN_ML(INK_COMMENT, "/\\*", "\\*/")
HL_SCOPE("[{]", "[}]")


If there is anyone interested in more details we can discuss it in separate thread Wink

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TheIDE raster image file support
Next Topic: .ini file helpers
Goto Forum:
  


Current Time: Tue Jul 15 04:23:03 CEST 2025

Total time taken to generate the page: 0.04242 seconds