QMI IDL compiler
Go to file
Alex Elder c7c8e47f74 parser: only one lookahead byte is required
The scratch_buf[] array is used to hold characters supplied to
unput().

The only time unput() is called is in yylex(), when a character
returned by input() isn't in the character set appropriate for the
symbol being parsed.  And in that case unput() is called only once.

We will not call unput() again until input() has been called at
least once, and that will consume the only character in the scratch
buffer.

Therefore, for our purposes, only one character is required for the
lookahead buffer.

We never accept a NUL byte on input, so it will never be used as a
lookahead character.  So we can use 0 as a special lookahead value
that indicates "no lookahead present."

So replace the scratch_buf[] and scratch_pos with a single character
lookahead, which is considered invalid if its value is 0.

Signed-off-by: Alex Elder <elder@linaro.org>
Message-Id: <20211001232338.769309-13-elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-10-04 12:21:00 -05:00
.gitignore qmic: Add .gitignore 2016-06-02 10:27:42 -07:00
accessor.c kernel: Introduce kernel-style generator 2018-01-31 13:00:02 -08:00
kernel.c kernel: Support having strings in structs 2018-06-29 14:12:50 -07:00
LICENSE qmic: Add the missing LICENSE file 2016-06-02 10:26:43 -07:00
list.h qmic: Adopt common list implementation 2018-01-30 15:55:49 -08:00
Makefile Makefile: Allow compiler/linker flags to be overridden 2018-03-05 21:54:21 -08:00
parser.c parser: only one lookahead byte is required 2021-10-04 12:21:00 -05:00
qmi_tlv.c qmic: Initial basic implementation 2016-02-07 09:27:50 -08:00
qmic.c kernel: Introduce kernel-style generator 2018-01-31 13:00:02 -08:00
qmic.h kernel: Introduce kernel-style generator 2018-01-31 13:00:02 -08:00