Fix lexing of integer literals, fixes #1364
authorClifford Wolf <clifford@clifford.at>
Thu, 12 Sep 2019 07:43:19 +0000 (09:43 +0200)
committerClifford Wolf <clifford@clifford.at>
Thu, 12 Sep 2019 07:43:32 +0000 (09:43 +0200)
Signed-off-by: Clifford Wolf <clifford@clifford.at>
frontends/verilog/const2ast.cc
frontends/verilog/verilog_lexer.l

index 4bf5b1cf53cd788283517924bab7245ddf3d1140..5da88a93f1af3447f1d217adc660968402dc8d31 100644 (file)
@@ -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++;
                }
index 57e55b1f4a0e03753a6077805e804305ca339718..e344ffd4fcffd427eeaf8d69c9d51aa6662dec10 100644 (file)
@@ -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;
 }