[antlr-interest] Syntax highlighting : need some advice
sam at tunnelvisionlabs.com
Mon Apr 9 11:17:59 PDT 2012
You should be aware from the start that you're entering an area with sparse
documentation, much of which suffers from:
* Incomplete (works for some examples but leaves you hanging when you want
to do something more)
* Outdated (applies to Visual Studio 2008 or earlier - Visual Studio 2010
supports this but also offers a much more powerful new model that is
preferable in pretty much every way).
* Incorrect (violates best practices and/or exemplifies things I've come to
realize are bad ideas)
I also have to point out the following regarding your message below:
* When it comes to this task, the only things "simple" about the Java
language is it doesn't require a preprocessor and it doesn't have any
* One extension for Java support already exists, so if you're just looking
for something to use it may save you some time:
Here are some resources to get you started:
 Diff Classifier example. I haven't looked at the code, but based on the
description it uses the new Visual Studio 2010 APIs which I recommend unless
you absolutely must for some reason support 2008 and/or 2005.
 DiveDeeper's blog. This is a mix of many VSX topics.
 Topics tagged "Programming" on my blog. It's a mix of various topics
from Visual Studio 2008 and 2010, plus a bit of information about using
ANTLR 3 as part of your extension.
Owner, Lead Developer
From: forumer at smartmobili.com [mailto:forumer at smartmobili.com]
Sent: Sunday, April 08, 2012 7:14 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Syntax highlighting : need some advice
I would like to create some visual studio plugins to provide syntax
highlighting (and maybe latter code completion) for some custom languages.
To start with a "simple" language I am using the java 1.6 grammar and I
would like to know how can I provide syntax coloration knowing that editor
calls a function and gives source code line by line.
For instance editor gives the following lines instead of providing the
entire source code:
* Some comment
and the first question is how can I parse those lines and know in which
context I am ?
Is the lexer enough or do I have to use the parser ?
In java 1.6 grammar comments are skipped so how can I change that to
recognize comments ?
About comments, if I only get a part of the comment like this :
I suppose lexer will throw an exception because it will try to find the
matching */ so how can I prevent this ?
More information about the antlr-interest