On Fri, Jun 30, 2017 at 6:05 PM, Michael Matz <[email protected]> wrote: > Hi, > > On Fri, 30 Jun 2017, uso ewin wrote: > >> I'd like to do that, problem is with default: >> if we encounter a default, >> we need to remember that there is a default in the generic, >> but we need to continue parsing generic expression to check >> if there is a type that match, and with you technique we can't go back and >> re-evaluate default if at the end, no match was found. > > Aw, crap, right, they've introduced more syntax that defeats single-pass > parsing. Okay, then your token saving code is nevertheless buggy > I think. E.g. what are you using 'i' for: you sometimes increase it, but > zero it always, and never make use of it. And this code will be wrong > when presented with an expression like 'call(a,b)' because of the skipping > on ','. Instead of doing it yourself try to use skip_or_save_block. > Despite its name it can also be used to skip expressions (i.e. stops at > outer ',') and should be usable here. > > (You also don't make use of the outer buf[], so remove it and its > setting). Oh, and your call to unary() should be expr_eq, the accepted > expressions after the ':' are assignment-expression, not just unaries. > > > Ciao, > Michael.
Aw oops i and buf[] was legacy code, so thanks for noticing them. fix here: https://github.com/cosmo-ray/tcc/commit/2fac0b438fc8ca706f1a6e12742873e34a3cd636 I've try to use skip_or_save_block but using this function would ask me to completely refactor it, so I've made a skip_or_save_block2 (code here: https://github.com/cosmo-ray/tcc/commit/48e16cb2e33ea39b5051992ab23b006523fd14b4 ), it work mostly like skip_or_save_block but, don't allocate TokString, and ignore braces, as brace should not be take into account inside a generic expression (I'm not sure here). sorry for the bad function name BTW, if you have a better idea I take it. Thanks for your time Matthias _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
