mirror of
https://github.com/linux-msm/qmic.git
synced 2024-11-23 09:44:06 +08:00
QMI IDL compiler
28c48a5e18
In qmi_parse(), the main loop accepts tokens until it sees one with id 0. If an unrecognized (or unexpected) token is encountered, it reports an error and exits using yyerror(). Normally, input() returns the next character to be processed while parsing. If the read() call in input() encounters an error, input() will return -1 instead (which happens to be EOF). The only caller of input() is yylex(). It recognizes tokens comprised of alphanumeric characters and '_'. If input() returns any other value, it uses that value as the token identifier. And in particular, if input() returns -1, that will be the value stored in the id field of the token structure yylex() returns. So, back to the top, qmi_parse() will not consider -1 a valid token id, and will report the read error as an "unexpected symbol". Instead, report a read error immediately when it occurs and exit. Move the definition of yyerror() earlier in the source file so it can be called from yylex() (and all other functions) without needing a declaration. Signed-off-by: Alex Elder <elder@linaro.org> Message-Id: <20211001232338.769309-8-elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> |
||
---|---|---|
.gitignore | ||
accessor.c | ||
kernel.c | ||
LICENSE | ||
list.h | ||
Makefile | ||
parser.c | ||
qmi_tlv.c | ||
qmic.c | ||
qmic.h |