mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-22 13:53:40 +00:00
ast, read_verilog: refactoring
This commit is contained in:
parent
5af4e05125
commit
242853f1f2
7 changed files with 16 additions and 21 deletions
|
@ -3,6 +3,9 @@ GENFILES += frontends/verilog/verilog_parser.tab.cc
|
|||
GENFILES += frontends/verilog/verilog_parser.tab.hh
|
||||
GENFILES += frontends/verilog/verilog_parser.output
|
||||
GENFILES += frontends/verilog/verilog_lexer.cc
|
||||
GENFILES += frontends/verilog/location.hh
|
||||
GENFILES += frontends/verilog/position.hh
|
||||
GENFILES += frontends/verilog/stack.hh
|
||||
|
||||
frontends/verilog/verilog_parser.tab.cc: frontends/verilog/verilog_parser.y
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
|
|
|
@ -787,15 +787,6 @@ void VERILOG_FRONTEND::verr_at(std::string filename, int begin_line, char const
|
|||
exit(1);
|
||||
}
|
||||
|
||||
[[noreturn]]
|
||||
void VERILOG_FRONTEND::err_at_loc(parser::location_type loc, char const *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
verr_at(AST::current_filename, loc.begin.line, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
[[noreturn]]
|
||||
void VERILOG_FRONTEND::err_at_ast(AstSrcLocType loc, char const *fmt, ...)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "kernel/yosys.h"
|
||||
#include "frontends/ast/ast.h"
|
||||
#include "frontends/verilog/location.hh"
|
||||
|
||||
#if ! defined(yyFlexLexerOnce)
|
||||
#define yyFlexLexer frontend_verilog_yyFlexLexer
|
||||
|
@ -66,10 +65,6 @@ namespace VERILOG_FRONTEND
|
|||
|
||||
};
|
||||
[[noreturn]]
|
||||
extern void verr_at(std::string filename, int begin_line, char const *fmt, va_list ap);
|
||||
[[noreturn]]
|
||||
extern void err_at_loc(frontend_verilog_yy::location loc, char const *fmt, ...);
|
||||
[[noreturn]]
|
||||
extern void err_at_ast(AST::AstSrcLocType loc, char const *fmt, ...);
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
namespace VERILOG_FRONTEND {
|
||||
// lexer input stream
|
||||
[[noreturn]]
|
||||
extern void verr_at(std::string filename, int begin_line, char const *fmt, va_list ap);
|
||||
using parser = frontend_verilog_yy::parser;
|
||||
class VerilogLexer : public frontend_verilog_yyFlexLexer {
|
||||
ParseState* extra;
|
||||
|
|
|
@ -244,6 +244,17 @@
|
|||
node->children.push_back(std::move(rangeNode));
|
||||
}
|
||||
|
||||
[[noreturn]]
|
||||
extern void verr_at(std::string filename, int begin_line, char const *fmt, va_list ap);
|
||||
[[noreturn]]
|
||||
static void err_at_loc(frontend_verilog_yy::parser::location_type loc, char const *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
verr_at(AST::current_filename, loc.begin.line, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static void checkLabelsMatch(const frontend_verilog_yy::parser::location_type& loc, const char *element, const std::string* before, const std::string *after)
|
||||
{
|
||||
if (!before && after)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue