[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GMP parser

From: Hans Aberg
Subject: Re: GMP parser
Date: Mon, 30 Apr 2001 12:24:55 +0200

At 08:41 +1000 2001/04/30, Kevin Ryde wrote:
>>   "abs"    { return ABS; }
>>   "bin"    { return BIN; }
>>   ...
>> is probably also much faster, as Flex should translate it into a one
>> character look-ahead NFA.
>I think I wanted to lex out a whole word, so for instance "hexx" would
>be an error, rather than "hex" followed by "x".  Of course in a
>different calculator perhaps the latter would be wanted.

Was not "hexx" to be treated as an identifier? If you use identifiers, then
  "hex"            { return hex_key; }
  [[:alpha:]]+     { ... return identifier; }
will make "hexx" an identifier. However, if you merely strip out the
identifier part above, then "hexx" will be an error. -- Flex always looks
for the longest sequence, so whatever, it expected behavior should be

  Hans Aberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]