Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-dev] using lex/yacc files for syntax highlighting

Henrik,

I agree that you may be able to use the last ';' as a re-parse point and
then call your parser. What I was trying to say is that the syntax
coloring function in theory will be called for every significant change
that is made to an editor. Changes in a comment or a string can be
handled as a special case. Entering or removing the beginning or end of
a multiline comment can have much greater impact. For example typing /*
will change the syntax coloring  from that point to the next closing */
or end of file.

How all this gets handled depends upon the editor. Performance can
easily become an issue for large files. IMO a full parser is overkill
for syntax coloring.

However, a full parser is useful for building a content tree view and
for code completion for an editor. A full parser could also be used to
provide an auto indent capability.

Chet

-----Original Message-----
From: platform-dev-admin@xxxxxxxxxxx
[mailto:platform-dev-admin@xxxxxxxxxxx]On Behalf Of Henrik Sorensen
Sent: Sunday, January 16, 2005 6:15 PM
To: platform-dev@xxxxxxxxxxx
Subject: Re: [platform-dev] using lex/yacc files for syntax highlighting


Hi Chet,

Well, I wasn't planning on reading the whole program all the time ;-)

In PL/I, each statement is separated by a ';', so at least in teory it
should
be possible to just call the parser for one statement at the time.

So if lex/yacc is not the best choice, what is ?

How is it done for the Java editor ? (references to the source code
whould be
really appreciated)

Henrik


On Monday 17 January 2005 02.51, Chet Murphy wrote:
> Hi Henrik,
>
> Lex/yacc is not a good choice for syntax highlighting. Syntax
> highlighting requires an dynamic parser that is fault tolerant and
that
> can start parsing at the last known good re-parse point. You do not
want
> to run a full parser each time syntax coloring is needed while
editing.
>
> Chet Murphy
> Modelworks Software
> cmurphy@xxxxxxxxxxxxxx
> http://www.modelworks.com
> voice: 425 488 5686
> fax: 425 488 3986
>
> -----Original Message-----
> From: platform-dev-admin@xxxxxxxxxxx
> [mailto:platform-dev-admin@xxxxxxxxxxx]On Behalf Of Henrik Sorensen
> Sent: Sunday, January 16, 2005 4:42 PM
> To: platform-dev@xxxxxxxxxxx
> Subject: [platform-dev] using lex/yacc files for syntax highlightning
>
>
> please let me know if this is not the right mailinglist for hl related
> questions.
>
> I am working on a new frontend for gcc for the programming language
> PL/I.
> (pl1gcc.sourceforge.net)
>
> Now that I have the lex scanner and yacc (bison) parser in a good
shape,
> it
> would be natural to integrate this into the powerfull eclipse editor
> framework.
>
> What is the best approach for this ?
>
>
> Henrik
>
>
> _______________________________________________
> platform-dev mailing list
> platform-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-dev
>
> _______________________________________________
> platform-dev mailing list
> platform-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-dev
_______________________________________________
platform-dev mailing list
platform-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-dev



Back to the top