Page 1 of 1

ScintillaGadget and web language

Posted: Mon Jan 12, 2026 8:56 am
by Kwai chang caine
Hello at all

Since several days, i try to create an editor for web language
I believed, that is not also hard than another language, but i have see i'm wrong :oops:
The problem is in fact web language are not one simple language like PB, C, etc.. But four languages together
Then for the syntax coloring, it's a hell :twisted:
Because detecting the keywords of the four languages and coloring each one, not wotks, some words exists in several languages
Furthermore for the folding it's not also simple too, because the end keyword is the same that several other
If => } and function => } so detecting the } is not enough a } can close the FUNCTION then it's a } for a IF :cry:

Then i have thinking to try to parsing the code before, for separate the 4 languages and after coloring each part, for finally remix the 4 part

At your advice, is it the best way for do that ?
Or is it possible to coloring all in one time

Have a good day

Re: ScintillaGadget and web language

Posted: Mon Jan 12, 2026 9:19 am
by Skipper
For four languages, do not try to offer syntax highlighting for all of them at the same time.
Detect the language currently in use first, then only use the highlighter for that language. Invariably, there will be overlaps between the languages (keywords, structures, etc.), making parallel support for each of them at the same time more difficult.
It's easier to treat each one of them separately.

Re: ScintillaGadget and web language

Posted: Mon Jan 12, 2026 12:06 pm
by Kwai chang caine
Ok thanks for your advice 8)
I agree with you, which is why I'll first try parsing the language headers to determine which language we're using (HTML/CSS/JS/PHP) and then color-code the words for that language.
Thank you very much. :wink:

Re: ScintillaGadget and web language

Posted: Mon Jan 12, 2026 3:15 pm
by Skipper
you might want to introduce a 'state' variable and store the current language at hand. If you discover, perhaps in HTML, that you find JS, you can change the state and continue with the JS highlighter...

Re: ScintillaGadget and web language

Posted: Mon Jan 12, 2026 5:09 pm
by Kwai chang caine
Yes, I'm making good progress, or at least it seems to me, in that direction. :wink: