Re: When to use a token yacc_EOF instead of relying on 0 return value of yylex()?

2019-02-12 Thread Akim Demaille
> Le 11 févr. 2019 à 23:56, Peng Yu a écrit : > >> I have no idea. You'd have to study the grammar to see if there >> are doing fancy things around yacc_EOF. > > declare -p BASH_SOURCE > > Here is what I got with the above one line bash code (with the newline > at the end). > > The lines wi

Re: When to use a token yacc_EOF instead of relying on 0 return value of yylex()?

2019-02-11 Thread Peng Yu
> I have no idea. You'd have to study the grammar to see if there > are doing fancy things around yacc_EOF. declare -p BASH_SOURCE Here is what I got with the above one line bash code (with the newline at the end). The lines with -> are the parsing rules activated. The rest lines are yylex() re

Re: When to use a token yacc_EOF instead of relying on 0 return value of yylex()?

2019-02-11 Thread Akim Demaille
Hi Peng, > Le 11 févr. 2019 à 18:12, Peng Yu a écrit : > > Hi, > > yacc_EOF instead of 0 is used in `yylex()`. > > http://git.savannah.gnu.org/cgit/bash.git/tree/parse.y#n3257 Which is if (character == EOF) { EOF_Reached = 1; return (yacc_EOF); } > The grammar explici

When to use a token yacc_EOF instead of relying on 0 return value of yylex()?

2019-02-11 Thread Peng Yu
Hi, yacc_EOF instead of 0 is used in `yylex()`. http://git.savannah.gnu.org/cgit/bash.git/tree/parse.y#n3257 The grammar explicitly relies on yacc_EOF. http://git.savannah.gnu.org/cgit/bash.git/tree/parse.y#n376 But this seems to be different from the normal usage in flex/bison. For example, f