[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem compiling flex sources
From: |
Shigio Yamaguchi |
Subject: |
Re: Problem compiling flex sources |
Date: |
Wed, 30 Mar 2005 11:04:07 +0900 |
> a) Let's #define LEX(x) (<prefix> ## x) and use that like LEX(in) or
> LEX(restart). That way we don't have to add new defines to every
> single flex source each time we need a new symbol.
>
> b) Let's make all lex prefixes end with an underscore, or make them
> uppercase. This will save concerns of the same sort of problem arising
> in the future.
I have reflected your idea in the CVS repository.
I hope that it will works well in your environment.
Index: THANKS
===================================================================
RCS file: /cvsroot/global/global/THANKS,v
retrieving revision 1.54
diff -r1.54 THANKS
54a55
> Jun Inoue idea about generation of lex symbol.
Index: htags/asm.l
===================================================================
RCS file: /cvsroot/global/global/htags/asm.l,v
retrieving revision 1.10
diff -r1.10 asm.l
39d38
< #include "lexcommon.h"
41,42c40,41
< #define LEXTEXT asmtext
< #define LEXLENG asmleng
---
> #define lex_symbol_generation_rule(x) asm_ ## x
> #include "lexcommon.h"
65c64
< %option 8bit noyywrap noyy_top_state stack prefix="asm"
---
> %option 8bit noyywrap noyy_top_state stack prefix="asm_"
Index: htags/c.l
===================================================================
RCS file: /cvsroot/global/global/htags/c.l,v
retrieving revision 1.18
diff -r1.18 c.l
39d38
< #include "lexcommon.h"
41,42c40,41
< #define LEXTEXT ctext
< #define LEXLENG cleng
---
> #define lex_symbol_generation_rule(x) c_ ## x
> #include "lexcommon.h"
69c68
< %option 8bit noyywrap noyy_top_state stack prefix="c"
---
> %option 8bit noyywrap noyy_top_state stack prefix="c_"
Index: htags/cpp.l
===================================================================
RCS file: /cvsroot/global/global/htags/cpp.l,v
retrieving revision 1.14
diff -r1.14 cpp.l
39d38
< #include "lexcommon.h"
41,42c40,41
< #define LEXTEXT cpptext
< #define LEXLENG cppleng
---
> #define lex_symbol_generation_rule(x) cpp_ ## x
> #include "lexcommon.h"
65c64
< %option 8bit noyywrap noyy_top_state stack prefix="cpp"
---
> %option 8bit noyywrap noyy_top_state stack prefix="cpp_"
Index: htags/java.l
===================================================================
RCS file: /cvsroot/global/global/htags/java.l,v
retrieving revision 1.7
diff -r1.7 java.l
37d36
< #include "lexcommon.h"
39,40c38,39
< #define LEXTEXT javatext
< #define LEXLENG javaleng
---
> #define lex_symbol_generation_rule(x) java_ ## x
> #include "lexcommon.h"
62c61
< %option 8bit noyywrap noyy_top_state stack prefix="java"
---
> %option 8bit noyywrap noyy_top_state stack prefix="java_"
Index: htags/lexcommon.h
===================================================================
RCS file: /cvsroot/global/global/htags/lexcommon.h,v
retrieving revision 1.11
diff -r1.11 lexcommon.h
23a24,44
>
> /*
> * Definition of LEXTEXT, LEXLENG, LEXIN and LEXRESTART.
> *
> * These symbol are the substitutions of yytext, yyleng, yyin and yyrestart.
> * You should write code using them.
> * How to include this file. For example, in c.l:
> *
> * #define lex_symbol_generation_rule(x) c_ ## x
> * #include "lexcommon.h"
> */
> #ifndef lex_symbol_generation_rule
> ERROR: lex_symbol_generation_rule(x) macro not defined.
> lexcommon.h requires the lex_symbol_generation_rule(x) macro for each language
> to generate language specific symbols.
> #endif
> #define LEXTEXT lex_symbol_generation_rule(text)
> #define LEXLENG lex_symbol_generation_rule(leng)
> #define LEXIN lex_symbol_generation_rule(in)
> #define LEXRESTART lex_symbol_generation_rule(restart)
>
41,42c62,63
< yyin = ip; \
< yyrestart(yyin); \
---
> LEXIN = ip; \
> LEXRESTART(LEXIN); \
100,104d120
< * Input.
< */
< extern FILE *yyin;
<
< /*
Index: htags/php.l
===================================================================
RCS file: /cvsroot/global/global/htags/php.l,v
retrieving revision 1.9
diff -r1.9 php.l
44d43
< #include "lexcommon.h"
46,47c45,46
< #define LEXTEXT phptext
< #define LEXLENG phpleng
---
> #define lex_symbol_generation_rule(x) php_ ## x
> #include "lexcommon.h"
69c68
< %option 8bit noyywrap noyy_top_state stack prefix="php"
---
> %option 8bit noyywrap noyy_top_state stack prefix="php_"
Index: htags/src2html.c
===================================================================
RCS file: /cvsroot/global/global/htags/src2html.c,v
retrieving revision 1.26
diff -r1.26 src2html.c
67,71c67,71
< int clex(void);
< int cpplex(void);
< int javalex(void);
< int phplex(void);
< int asmlex(void);
---
> int c_lex(void);
> int cpp_lex(void);
> int java_lex(void);
> int php_lex(void);
> int asm_lex(void);
78,83c78,83
< {"c", c_parser_init, clex}, /* DEFAULT */
< {"yacc", yacc_parser_init, clex},
< {"cpp", cpp_parser_init, cpplex},
< {"java", java_parser_init, javalex},
< {"php", php_parser_init, phplex},
< {"asm", asm_parser_init, asmlex}
---
> {"c", c_parser_init, c_lex}, /* DEFAULT */
> {"yacc", yacc_parser_init, c_lex},
> {"cpp", cpp_parser_init, cpp_lex},
> {"java", java_parser_init, java_lex},
> {"php", php_parser_init, php_lex},
> {"asm", asm_parser_init, asm_lex}
--
Shigio YAMAGUCHI <address@hidden> - Tama Communications Corporation
PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3