Updated lexers & parsers to include prefixes

This commit is contained in:
William Speirs 2014-10-14 17:06:02 -04:00 committed by Clifford Wolf
parent 2873a8444e
commit fad0b0c506
6 changed files with 35 additions and 27 deletions

View File

@ -1,18 +1,18 @@
GENFILES += frontends/ilang/parser.tab.cc GENFILES += frontends/ilang/ilang_parser.tab.cc
GENFILES += frontends/ilang/parser.tab.h GENFILES += frontends/ilang/ilang_parser.tab.h
GENFILES += frontends/ilang/parser.output GENFILES += frontends/ilang/ilang_parser.output
GENFILES += frontends/ilang/lexer.cc GENFILES += frontends/ilang/ilang_lexer.cc
frontends/ilang/parser.tab.cc: frontends/ilang/parser.y frontends/ilang/ilang_parser.tab.cc: frontends/ilang/ilang_parser.y
$(P) bison -d -r all -b frontends/ilang/parser frontends/ilang/parser.y $(P) bison -d -r all -b frontends/ilang/ilang_parser frontends/ilang/ilang_parser.y
$(Q) mv frontends/ilang/parser.tab.c frontends/ilang/parser.tab.cc $(Q) mv frontends/ilang/ilang_parser.tab.c frontends/ilang/ilang_parser.tab.cc
frontends/ilang/parser.tab.h: frontends/ilang/parser.tab.cc frontends/ilang/ilang_parser.tab.h: frontends/ilang/ilang_parser.tab.cc
frontends/ilang/lexer.cc: frontends/ilang/lexer.l frontends/ilang/ilang_lexer.cc: frontends/ilang/ilang_lexer.l
$(P) flex -o frontends/ilang/lexer.cc frontends/ilang/lexer.l $(P) flex -o frontends/ilang/ilang_lexer.cc frontends/ilang/ilang_lexer.l
OBJS += frontends/ilang/parser.tab.o frontends/ilang/lexer.o OBJS += frontends/ilang/ilang_parser.tab.o frontends/ilang/ilang_lexer.o
OBJS += frontends/ilang/ilang_frontend.o OBJS += frontends/ilang/ilang_frontend.o

View File

@ -30,12 +30,16 @@
#endif #endif
#include "ilang_frontend.h" #include "ilang_frontend.h"
#include "parser.tab.h" #include "ilang_parser.tab.h"
USING_YOSYS_NAMESPACE USING_YOSYS_NAMESPACE
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
result = readsome(*ILANG_FRONTEND::lexin, buf, max_size); do { \
ILANG_FRONTEND::lexin->read(buf, max_size-1); \
result = ILANG_FRONTEND::lexin->gcount(); \
if (result >= 0) buf[result] = '\0'; \
} while (0)
%} %}

View File

@ -1,20 +1,20 @@
GENFILES += frontends/verilog/parser.tab.cc GENFILES += frontends/verilog/verilog_parser.tab.cc
GENFILES += frontends/verilog/parser.tab.h GENFILES += frontends/verilog/verilog_parser.tab.h
GENFILES += frontends/verilog/parser.output GENFILES += frontends/verilog/verilog_parser.output
GENFILES += frontends/verilog/lexer.cc GENFILES += frontends/verilog/verilog_lexer.cc
frontends/verilog/parser.tab.cc: frontends/verilog/parser.y frontends/verilog/verilog_parser.tab.cc: frontends/verilog/verilog_parser.y
$(P) bison -d -r all -b frontends/verilog/parser frontends/verilog/parser.y $(P) bison -d -r all -b frontends/verilog/verilog_parser frontends/verilog/verilog_parser.y
$(Q) mv frontends/verilog/parser.tab.c frontends/verilog/parser.tab.cc $(Q) mv frontends/verilog/verilog_parser.tab.c frontends/verilog/verilog_parser.tab.cc
frontends/verilog/parser.tab.h: frontends/verilog/parser.tab.cc frontends/verilog/verilog_parser.tab.h: frontends/verilog/verilog_parser.tab.cc
frontends/verilog/lexer.cc: frontends/verilog/lexer.l frontends/verilog/verilog_lexer.cc: frontends/verilog/verilog_lexer.l
$(P) flex -o frontends/verilog/lexer.cc frontends/verilog/lexer.l $(P) flex -o frontends/verilog/verilog_lexer.cc frontends/verilog/verilog_lexer.l
OBJS += frontends/verilog/parser.tab.o OBJS += frontends/verilog/verilog_parser.tab.o
OBJS += frontends/verilog/lexer.o OBJS += frontends/verilog/verilog_lexer.o
OBJS += frontends/verilog/preproc.o OBJS += frontends/verilog/preproc.o
OBJS += frontends/verilog/verilog_frontend.o OBJS += frontends/verilog/verilog_frontend.o
OBJS += frontends/verilog/const2ast.o OBJS += frontends/verilog/const2ast.o

View File

@ -42,7 +42,7 @@
#include "kernel/log.h" #include "kernel/log.h"
#include "verilog_frontend.h" #include "verilog_frontend.h"
#include "frontends/ast/ast.h" #include "frontends/ast/ast.h"
#include "parser.tab.h" #include "verilog_parser.tab.h"
USING_YOSYS_NAMESPACE USING_YOSYS_NAMESPACE
using namespace AST; using namespace AST;
@ -64,7 +64,11 @@ YOSYS_NAMESPACE_END
return TOK_ID; return TOK_ID;
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
result = readsome(*lexin, buf, max_size); do { \
lexin->read(buf, max_size-1); \
result = lexin->gcount(); \
if (result >= 0) buf[result] = '\0'; \
} while (0)
%} %}