Discussion:
JSON Lexer
Mike Lischke
2013-09-16 13:06:29 UTC
Permalink
Hey Neil,

my search in the archive or google hasn't brought up anything useful, so a question is due: it seems there is no dedicated JSON lexer for scintilla, only the Javascript handling in the HTML lexer (though I doubt this can be used to colorize standalone JSON text). So what can we do about this? I guess, if all fails, we have to write a new lexer, right?

Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Lex Trotman
2013-09-16 13:25:55 UTC
Permalink
Hi Mike,

Look inside LexCPP.cxx for the "standalone" js lexer :)

I'm told it works fine for JSON.

Cheers
Lex
Post by Mike Lischke
Hey Neil,
my search in the archive or google hasn't brought up anything useful, so a
question is due: it seems there is no dedicated JSON lexer for scintilla,
only the Javascript handling in the HTML lexer (though I doubt this can be
used to colorize standalone JSON text). So what can we do about this? I
guess, if all fails, we have to write a new lexer, right?
Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups
"scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Mike Lischke
2013-09-16 13:36:17 UTC
Permalink
Post by Lex Trotman
Look inside LexCPP.cxx for the "standalone" js lexer :)
Ugh, how on earth did a javascript lexer end up in the c++ lexer? There's another one in the HTML lexer, so .. duplicate code probably.

Thanks, Lex,

Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Lex Trotman
2013-09-16 13:53:07 UTC
Permalink
Post by Lex Trotman
Look inside LexCPP.cxx for the "standalone" js lexer :)
Ugh, how on earth did a javascript lexer end up in the c++ lexer? There's
another one in the HTML lexer, so .. duplicate code probably.
It is common (but bad IMHO) to mix together languages that have a
superficial syntactic similarity, for example ctags has *parsers* for most
of the { } languages in one totally unmaintainable file.

Calling one lexer from another is complicated by questions like making sure
styles don't overlap between the languages and when the embedded lexer
returns to the embedding one. So it is just simpler to just have another
version of the embedded language as part of the embedding one.

Cheers
Lex
Post by Lex Trotman
Thanks, Lex,
Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups
"scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Philippe Lhoste
2013-09-19 07:34:21 UTC
Permalink
Post by Mike Lischke
Post by Lex Trotman
Look inside LexCPP.cxx for the "standalone" js lexer :)
Ugh, how on earth did a javascript lexer end up in the c++ lexer? There's another one
in the HTML lexer, so .. duplicate code probably.
It is common (but bad IMHO) to mix together languages that have a superficial syntactic
similarity, for example ctags has *parsers* for most of the { } languages in one totally
unmaintainable file.
There is no LexJava either, for example. Indeed, a number of "C-like languages" have been
put in this lexer, mostly because a Scintilla lexer acts only on a superficial level, so
it is OK for all these languages. If you look at it, it doesn't has so much contortions to
address a specific flavor. If a language differs too much (like allowing to nest block
comments, etc.), it forks this lexer (but now, indeed, we have to remove some fluff).
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Continue reading on narkive:
Loading...