summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorWilliam Speirs <bill.speirs@gmail.com>2014-10-14 17:06:02 -0400
committerClifford Wolf <clifford@clifford.at>2014-10-15 00:48:19 +0200
commitfad0b0c506f2d7cb1158a3dac53139b8dec7a04e (patch)
treeb8e0f8be2f0d8989ac3ad8225a767efce3e93269 /frontends
parent2873a8444ee5dbd0a3d034fb4a7a877c680be45d (diff)
Updated lexers & parsers to include prefixes
Diffstat (limited to 'frontends')
-rw-r--r--frontends/ilang/Makefile.inc22
-rw-r--r--frontends/ilang/ilang_lexer.l (renamed from frontends/ilang/lexer.l)8
-rw-r--r--frontends/ilang/ilang_parser.y (renamed from frontends/ilang/parser.y)0
-rw-r--r--frontends/verilog/Makefile.inc24
-rw-r--r--frontends/verilog/verilog_lexer.l (renamed from frontends/verilog/lexer.l)8
-rw-r--r--frontends/verilog/verilog_parser.y (renamed from frontends/verilog/parser.y)0
6 files changed, 35 insertions, 27 deletions
diff --git a/frontends/ilang/Makefile.inc b/frontends/ilang/Makefile.inc
index e832cfed..984d436c 100644
--- a/frontends/ilang/Makefile.inc
+++ b/frontends/ilang/Makefile.inc
@@ -1,18 +1,18 @@
-GENFILES += frontends/ilang/parser.tab.cc
-GENFILES += frontends/ilang/parser.tab.h
-GENFILES += frontends/ilang/parser.output
-GENFILES += frontends/ilang/lexer.cc
+GENFILES += frontends/ilang/ilang_parser.tab.cc
+GENFILES += frontends/ilang/ilang_parser.tab.h
+GENFILES += frontends/ilang/ilang_parser.output
+GENFILES += frontends/ilang/ilang_lexer.cc
-frontends/ilang/parser.tab.cc: frontends/ilang/parser.y
- $(P) bison -d -r all -b frontends/ilang/parser frontends/ilang/parser.y
- $(Q) mv frontends/ilang/parser.tab.c frontends/ilang/parser.tab.cc
+frontends/ilang/ilang_parser.tab.cc: frontends/ilang/ilang_parser.y
+ $(P) bison -d -r all -b frontends/ilang/ilang_parser frontends/ilang/ilang_parser.y
+ $(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
- $(P) flex -o frontends/ilang/lexer.cc frontends/ilang/lexer.l
+frontends/ilang/ilang_lexer.cc: frontends/ilang/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
diff --git a/frontends/ilang/lexer.l b/frontends/ilang/ilang_lexer.l
index 9669f092..dcbc6b6d 100644
--- a/frontends/ilang/lexer.l
+++ b/frontends/ilang/ilang_lexer.l
@@ -30,12 +30,16 @@
#endif
#include "ilang_frontend.h"
-#include "parser.tab.h"
+#include "ilang_parser.tab.h"
USING_YOSYS_NAMESPACE
#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)
%}
diff --git a/frontends/ilang/parser.y b/frontends/ilang/ilang_parser.y
index a5cc0689..a5cc0689 100644
--- a/frontends/ilang/parser.y
+++ b/frontends/ilang/ilang_parser.y
diff --git a/frontends/verilog/Makefile.inc b/frontends/verilog/Makefile.inc
index 49eb320e..1b6854bb 100644
--- a/frontends/verilog/Makefile.inc
+++ b/frontends/verilog/Makefile.inc
@@ -1,20 +1,20 @@
-GENFILES += frontends/verilog/parser.tab.cc
-GENFILES += frontends/verilog/parser.tab.h
-GENFILES += frontends/verilog/parser.output
-GENFILES += frontends/verilog/lexer.cc
+GENFILES += frontends/verilog/verilog_parser.tab.cc
+GENFILES += frontends/verilog/verilog_parser.tab.h
+GENFILES += frontends/verilog/verilog_parser.output
+GENFILES += frontends/verilog/verilog_lexer.cc
-frontends/verilog/parser.tab.cc: frontends/verilog/parser.y
- $(P) bison -d -r all -b frontends/verilog/parser frontends/verilog/parser.y
- $(Q) mv frontends/verilog/parser.tab.c frontends/verilog/parser.tab.cc
+frontends/verilog/verilog_parser.tab.cc: frontends/verilog/verilog_parser.y
+ $(P) bison -d -r all -b frontends/verilog/verilog_parser frontends/verilog/verilog_parser.y
+ $(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
- $(P) flex -o frontends/verilog/lexer.cc frontends/verilog/lexer.l
+frontends/verilog/verilog_lexer.cc: frontends/verilog/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/lexer.o
+OBJS += frontends/verilog/verilog_parser.tab.o
+OBJS += frontends/verilog/verilog_lexer.o
OBJS += frontends/verilog/preproc.o
OBJS += frontends/verilog/verilog_frontend.o
OBJS += frontends/verilog/const2ast.o
diff --git a/frontends/verilog/lexer.l b/frontends/verilog/verilog_lexer.l
index 98f36088..0d28e2e7 100644
--- a/frontends/verilog/lexer.l
+++ b/frontends/verilog/verilog_lexer.l
@@ -42,7 +42,7 @@
#include "kernel/log.h"
#include "verilog_frontend.h"
#include "frontends/ast/ast.h"
-#include "parser.tab.h"
+#include "verilog_parser.tab.h"
USING_YOSYS_NAMESPACE
using namespace AST;
@@ -64,7 +64,11 @@ YOSYS_NAMESPACE_END
return TOK_ID;
#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)
%}
diff --git a/frontends/verilog/parser.y b/frontends/verilog/verilog_parser.y
index cf02a56a..cf02a56a 100644
--- a/frontends/verilog/parser.y
+++ b/frontends/verilog/verilog_parser.y