On 2022-09-22T07:57:45UTC Hans Åberg <haber...@telia.com> wrote: > On 22 Sep 2022, at 08:30, Lukas Arsalan <cptarse-l...@yahoo.com> wrote: >> [1] -1 --> "num" >> [2] 1-2 --> "num" "-" "num" >> [3] (-1^-2) --> "(" "num" "^" "num" ")" >> [4] 1--2 --> "num" "-" "num" >> [5] 1---3 --> "num" "-" "-" "num" >> [6] 1-2^3 --> "num" "-" "num" "^" "num" >> I do not think that it is possible, to do that with regular expressions... >> > I think it is not possible, so therefore one expects -2⁴ to be parsed as > -(2⁴). > I found that `%s nosinum` for the ll-file... Now I can do things like this: "+" BEGIN(INITIAL); return yy::parser::make_ADD(loc); "(" BEGIN(INITIAL); return yy::parser::make_BROP(loc); ")" BEGIN(nosinum); return yy::parser::make_BRCL(loc); {bint} BEGIN(nosinum); return make_INT(yytext,loc); {float} BEGIN(nosinum); return make_FLOAT(yytext,loc); <INITIAL>[+-]?{bint} BEGIN(nosinum); return make_INT(yytext,loc); <INITIAL>[+-]?{float} BEGIN(nosinum); return make_FLOAT(yytext,loc);
and i removed the SNUM token... now it seems to work just right.. 🥳 it even handles the whitespaces to my liking... 😋 but i do not know what kind of formal language that is now... -arne