Re: [code] More lexer nightmares. :(

From: Mitchell <m.att.foicica.com>
Date: Wed, 20 Nov 2013 10:08:53 -0500 (Eastern Standard Time)

Hi Michael,

On Wed, 20 Nov 2013, Michael Richter wrote:

> In the following samples of code, I'm trying to extract the dot-separated
> letters from the rest:
>
>
> - :(FOO.BAR)
> - :S(FOO.BAR)
> - :F(BAR.BAZ)
> - :S(FOO.BAR)F(BAR.BAZ)
> - :F(BAR.BAZ)S(FOO.BAR)
>
> That is to say in the resulting syntax-coloured code I should be seeing
> FOO.BAR and BAR.BAZ highlighted and nothing else.
>
> I cannot for the life of me get this to work.
>
> I have a lexer pattern "dotted_identifier" which works fine. (It's used
> all over the place in my lexer.) If I use this…
>
> ':(' * dotted_identifier * ')'
>
>
> … I get, as expected, :(FOO.BAR) highlighted. If, however, I do anything
> outside of this, I get inexplicable behaviour.
>
> #':(' * dotted_identifier * #')'
>
>
> This will find *any* instance of dotted_identifier and syntax-colour it
> along with the two characters before it. *Any* two characters before it,
> not just ":(".
>
> ':(' * S'SF'^-1 * dotted_identifier * ')'
>
>
> This will match exactly the same as the first pattern I had above. It will
> colour (as expected) :(FOO.BAR), but it will not colour :S(FOO.BAR) or
> :F(BAR.BAZ).
>
> I'm really at a loss now to know how to deal with this. Any tips?

Please attach your lexer. I have many questions that could be easily
answered by looking at it.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 20 Nov 2013 - 10:08:53 EST

This archive was generated by hypermail 2.2.0 : Thu 21 Nov 2013 - 06:39:12 EST