[antlr-interest] grammar to latex

Ana Nelson nelson.ana at gmail.com
Sat Jun 28 09:04:59 PDT 2008


I've also been thinking about the line wrapping issue raised earlier.

I don't see any real reason why this has to be part of the syntax
highlighter. In fact, I think it makes more sense to run a pretty
printer/indenter on the source code separately, then put the modified
code through the syntax highlighter. For one thing, this would mean
you could compile the modified code and make sure it was still valid.

I did some searching and there seems to be some inexpensive commercial
products which do this, maybe some open source ones too. Or, maybe
this would be a nice ANTLR project for someone. :-)



2008/6/28 Ana Nelson <nelson.ana at gmail.com>:
> Johannes:
> Any target language code gets "delegated" to the pygments grammar for
> that language. So this is an issue with the pygments C# grammar. I
> have submitted a ticket to let them know about this, I'll update it
> with the v1/v2 distinction, that makes more sense.
>
> Jim:
> That's a very nice online interactive C# parser. :-) Have you thought
> about adding some syntax highlighting to it? ;-)
>
> I know nothing about C# by the way, they were just convenient test
> grammars and I'm trying to test this with different languages.
>
>
>
> 2008/6/28 Johannes Luber <jaluber at gmx.de>:
>> Jim Idle schrieb:
>>>
>>> On Fri, 2008-06-27 at 23:42 +0100, Ana Nelson wrote:
>>>>
>>>> Okay, I think I've worked out the last few kinks in the pygments
>>>> grammar. Examples are (temporarily) here:
>>>>
>>>
>>>>
>>>> A few of the C Sharp grammars do have 1 error in them, in lines such as
>>>> this:
>>>>
>>>> @header {
>>>>    #pragma warning disable 0219
>>>> }
>>>>
>>>> The # before pragma is showing up as an error. Maybe someone can tell
>>>> me, is that valid C sharp?
>>>
>>> It is, but strictly speaking the # should be at column position zero. If
>>> you use VS 2008 you will find that it auto moves the # to the first column.
>>
>> Actually, the whitespace before # is okay. Another possibility is that Ana
>> is using a C# 1 compiler. C# 1 doesn't know pragma and some other
>> preprocessor constructs added in C# 2. BTW, which grammars do you refer to,
>> Ana?
>>
>> Johannes
>>>
>>> If you are interested in C#, then you can view my online C# parser at
>>> www.temporal-wave.com <http://www.temporal-wave.com> where there is a nice
>>> example of an AST for C# too. Go on, you know you guys want to!!! ;-)
>>>
>>> Jim
>>
>>
>


More information about the antlr-interest mailing list