diff options
| author | Clément Zrounba <clement.zrounba@ec-lyon.fr> | 2023-11-23 18:26:52 +0000 |
|---|---|---|
| committer | Clément Zrounba <clement.zrounba@ec-lyon.fr> | 2023-11-23 18:56:27 +0000 |
| commit | 7a6345e2a4068de676e879e79f8c31965ecd0771 (patch) | |
| tree | 4ebf8f0cce309093e0bbae9f6bf5df60f24c4292 /src/parser/parser.l | |
| parent | dd122cf6bf92e594a972188bda4927fbc4417ebc (diff) | |
| download | specs-7a6345e2a4068de676e879e79f8c31965ecd0771.tar.gz specs-7a6345e2a4068de676e879e79f8c31965ecd0771.zip | |
Temporarily fix small issue in parser
Change the way unary signs are handled (e.g., "+1e9", "-15"):
- instead of lexer, it is not the job of the parser
- due to how positional arguments chain together, expressions now need
to be grouped using curly brackets in positional arguments list in
order to avoid ambiguous netlists (e.g., `wg1 in out 100e-9 +2`)
- `-` appearing in net names could also pose issue but I think it's ok
now ?
Now:
- `wg1 in out {2 - 1}` → one positional arg (= 2-1 = 1)
- `wg1 in out 2 - 1` → two positional args (2 and -1)
- `wg1 in out-abc + 1` → one positional args (1) (output net name: `out-abc`)
- `wg1 in out - abc + 1` → one positional args (1) (output net name: `out-abc`)
Ultimately this should be revamped in a better way, but the way the parser works,
it was the best minimal change fix. It should hold for now.
Diffstat (limited to 'src/parser/parser.l')
| -rw-r--r-- | src/parser/parser.l | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parser/parser.l b/src/parser/parser.l index 3519d0d..ad86569 100644 --- a/src/parser/parser.l +++ b/src/parser/parser.l @@ -336,13 +336,15 @@ string convert_special_char(char c) return '"'; } -[+-]?{D}+ { +(?# [+-]?{D}+) +{D}+ { /* signed integer number */ yylval_param->i_val = from_string<int>(yytext); return T_INT; } -[+-]?{DOUBLE} { +(?# [+-]?{DOUBLE}+) +{DOUBLE} { /* signed floating point number */ yylval_param->d_val = from_string<double>(yytext); return T_NUM; |
