bug-global
[Top][All Lists]
Advanced

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

Re: question about reserved word file


From: Shigio Yamaguchi
Subject: Re: question about reserved word file
Date: Sun, 10 Oct 2004 19:57:33 +0900

> My interest is only in preprocessing directives.
> It will not be useful for other reserved words.
> 
> 1. In addition to Gperf source, Lex source is also generated by reserved.pl.

It seems that you want to move part of work which was done using gperf
into lex base. Yes, there are two methods to do the same job.
But if we do it, shouldn't we select either from among the two methods?
Otherwise, only complexity will be added, I think.

> When using the lookup function generated by gperf, writing the code
> for removing blank is necessary.

Removing blanks does not seem to be such complex processing.
However, I think that the place is certainly bad.
How about moving the processing into reserved_sharp() function like this?

   asm_scan.l
   +-------------------------------------
   | ....
   |#include "asm_res.h"
   | ....
   |<INITIAL>{
   |  ^[ \t]*\#[ \t]*{WORD} {
   |             if (reserved_sharp(yytext, yyleng)) {
   |                     ....          /* #define, #undef, .... */
   |             } else
   |                     yy_push_state(LINE_COMMENT);
   |     }
   |  ....
   +-------------------------------------

   asm_res.h
   +-------------------------------------
   |...
   int
   |reserved_sharp(text, leng) {
   |    <removing blanks>               /* '  #  define' => '#define' */
   |    .....
   |}
   +-------------------------------------
--
Shigio Yamaguchi <address@hidden> - Tama Communications Corporation
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




reply via email to

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