mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-11 13:40:53 +00:00
Changes for bison < 3.6
Includes fix for double quoted tokens in syntax errors.
This commit is contained in:
parent
fd463f9597
commit
675a5744fa
3 changed files with 11 additions and 4 deletions
|
@ -25,7 +25,7 @@ namespace VERILOG_FRONTEND {
|
||||||
// get rid of override virtual function warning
|
// get rid of override virtual function warning
|
||||||
using FlexLexer::yylex;
|
using FlexLexer::yylex;
|
||||||
parser::symbol_type terminate() {
|
parser::symbol_type terminate() {
|
||||||
return parser::make_FRONTEND_VERILOG_YYEOF(out_loc);
|
return parser::symbol_type(0, std::move(out_loc));
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<std::string> current_filename;
|
std::shared_ptr<std::string> current_filename;
|
||||||
|
|
|
@ -149,7 +149,7 @@ parser::symbol_type char_tok(char c, parser::location_type loc) {
|
||||||
case 'p': return parser::make_TOK_p(loc);
|
case 'p': return parser::make_TOK_p(loc);
|
||||||
case 'x': return parser::make_TOK_x(loc);
|
case 'x': return parser::make_TOK_x(loc);
|
||||||
case 'z': return parser::make_TOK_z(loc);
|
case 'z': return parser::make_TOK_z(loc);
|
||||||
case 0: return parser::make_FRONTEND_VERILOG_YYEOF(loc);
|
case 0: return parser::symbol_type(0, std::move(loc));
|
||||||
default:
|
default:
|
||||||
return parser::make_ch_t(c, loc);
|
return parser::make_ch_t(c, loc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,7 +428,14 @@
|
||||||
|
|
||||||
void frontend_verilog_yy::parser::error(const frontend_verilog_yy::parser::location_type& loc, const std::string& msg)
|
void frontend_verilog_yy::parser::error(const frontend_verilog_yy::parser::location_type& loc, const std::string& msg)
|
||||||
{
|
{
|
||||||
err_at_loc(loc, "%s", msg.c_str());
|
std::string new_msg(msg);
|
||||||
|
size_t pos = new_msg.find("\"'");
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
new_msg.replace(pos, 2, "'");
|
||||||
|
pos = new_msg.find("'\"");
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
new_msg.replace(pos, 2, "'");
|
||||||
|
err_at_loc(loc, "%s", new_msg.c_str());
|
||||||
}
|
}
|
||||||
// end unqual
|
// end unqual
|
||||||
}
|
}
|
||||||
|
@ -589,7 +596,7 @@
|
||||||
%precedence OP_CAST
|
%precedence OP_CAST
|
||||||
%precedence UNARY_OPS
|
%precedence UNARY_OPS
|
||||||
|
|
||||||
%define parse.error detailed
|
%define parse.error verbose
|
||||||
%define parse.lac full
|
%define parse.lac full
|
||||||
|
|
||||||
%precedence FAKE_THEN
|
%precedence FAKE_THEN
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue