[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: using flex for source-hilighting
From: |
Janus N. |
Subject: |
RE: using flex for source-hilighting |
Date: |
10 Jun 2002 11:31:24 +0200 |
On Mon, 2002-06-10 at 10:29, Valkanas Nikos wrote:
> Hi,
>
> Being one of the performance die-hards, I feel obliged to offer a solution.
>
> It is rather straightforward to implement it yourself through lex. Declare a
> global integer, floc, and increment in every production by +=yylen (Take care
> if you are using yyless() to increment only by yyless). You can then return
> this number at the beginning of a token (before adding yylen) and after
> (assumming you match exactly a token). The advantage is that you can easily
> manipulate it to get exactly what you need (minus parens or white space for
> example). You could also define it with YY_USER_ACTION but I wouldn't
> recommend it if you are using yyless or other similar functions that back up
> the stream.
>
Thank you for your suggestion. I actually already tried this ... but I
could give it another shot. I implemented the needed lexer by hand but
it is a lot harder to maintain than a lex file so I hope I can make this
work :)
-Janus
--
Janus Nørgaard Tøndering
email: address@hidden or address@hidden
"Would you buy a car with the hood welded shut?"
-Phil Hughes, Linux Journal Magazine