diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-09-12 09:43:19 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-09-12 09:43:32 +0200 |
commit | 7eb593829f62476598bb15c2fb903d50108e5274 (patch) | |
tree | c8f9ffad6993bac2997fde34be311450384e67d7 /frontends/verilog | |
parent | f72765090cd001ff4dc54d5a9c01a2d4b3339865 (diff) | |
download | yosys-7eb593829f62476598bb15c2fb903d50108e5274.tar.gz yosys-7eb593829f62476598bb15c2fb903d50108e5274.tar.bz2 yosys-7eb593829f62476598bb15c2fb903d50108e5274.zip |
Fix lexing of integer literals, fixes #1364
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/const2ast.cc | 4 | ||||
-rw-r--r-- | frontends/verilog/verilog_lexer.l | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/frontends/verilog/const2ast.cc b/frontends/verilog/const2ast.cc index 4bf5b1cf5..5da88a93f 100644 --- a/frontends/verilog/const2ast.cc +++ b/frontends/verilog/const2ast.cc @@ -199,13 +199,13 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn if (str == endptr) len_in_bits = -1; - // The "<bits>'s?[bodhBODH]<digits>" syntax + // The "<bits>'[sS]?[bodhBODH]<digits>" syntax if (*endptr == '\'') { std::vector<RTLIL::State> data; bool is_signed = false; bool is_unsized = len_in_bits < 0; - if (*(endptr+1) == 's') { + if (*(endptr+1) == 's' || *(endptr+1) == 'S') { is_signed = true; endptr++; } diff --git a/frontends/verilog/verilog_lexer.l b/frontends/verilog/verilog_lexer.l index 57e55b1f4..e344ffd4f 100644 --- a/frontends/verilog/verilog_lexer.l +++ b/frontends/verilog/verilog_lexer.l @@ -239,7 +239,7 @@ YOSYS_NAMESPACE_END return TOK_CONSTVAL; } -[0-9]*[ \t]*\'s?[bodhBODH]*[ \t\r\n]*[0-9a-fA-FzxZX?_]+ { +[0-9]*[ \t]*\'[sS]?[bodhBODH][ \t\r\n]*[0-9a-fA-FzxZX?_]+ { frontend_verilog_yylval.string = new std::string(yytext); return TOK_CONSTVAL; } |