Re: [abc-users] Problem with lexer/keywords

From: Pavel Avgustinov <pavel.avgustinov@magdalen.oxford.ac.uk>
Date: Fri Jun 03 2005 - 14:54:01 BST

Keywords are identifiers, and identifiers are generally comprised of
letters, digits and underscores. Using non-alphanumeric characaters like
<, -, > results in those being parsed as operators rather than keywords.
There is at present no mechanism for adding your own operators -- you'll
have to look into extending the flex file. It should be quite
straightforward to do, if you look at how all other operators are handled.

Note that this also explains why "Impl" and "Equiv" work -- these are
valid identifiers. The mechanism for adding keywords requires on the
keyword being lexed by the identifier pattern, and only then is a
string-based lookup performed.

- P

Eric Bodden wrote:

>

> Hello.
>
> I was trying to add an "implies" operator "->" and an "equivalent"
> operator "<->" as keywords to the pointcut state of the lexer.
> However, this does not seem to work and results in parsing errors,
> which disappear, when I e.g. use "Impl" and "Equiv" as keywords
> instead. I assume, that the lexer is scanning "->" as "-" followed by
> ">" or something like this. Maybe those keywords have a higher
> priority...
> So do you know a way to get around this without touching the original
> lexer code?
>
> Cheers,
> Eric
>
Received on Fri Jun 3 15:17:11 2005

This archive was generated by hypermail 2.1.8 : Sat Jun 04 2005 - 11:40:06 BST