From 631d628178226fd997440b03a544f7ba4fb097ec Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Sun, 18 Jul 2021 16:06:37 +0800 Subject: [PATCH] board_inspector: fix an opcode peek issue When parsing a sequence of clauses, it is not necessary to peek an opcode from the current stream unless that sequence starts with one. Peeking an opcode is even an error when the actual clause is empty (e.g. as a TermList). This patch makes the SequenceFactory only peeking at the next opcode when the grammar expects one. Tracked-On: #6298 Signed-off-by: Junjie Mao --- misc/config_tools/board_inspector/acpiparser/aml/parser.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/misc/config_tools/board_inspector/acpiparser/aml/parser.py b/misc/config_tools/board_inspector/acpiparser/aml/parser.py index 2af685f35..d122537c7 100644 --- a/misc/config_tools/board_inspector/acpiparser/aml/parser.py +++ b/misc/config_tools/board_inspector/acpiparser/aml/parser.py @@ -297,7 +297,6 @@ class SequenceFactory(Factory): tree.complete_parsing() return tree - opcode, opcode_width = stream.peek_opcode() package_end = 0 # Under any case this function shall maintain the balance of stream scopes. The following flags indicate the @@ -310,8 +309,8 @@ class SequenceFactory(Factory): pos = stream.current try: if isinstance(elem, int): # The leading opcode + opcode, _ = stream.get_opcode() assert elem == opcode - stream.seek(opcode_width) elif elem.endswith("*"): elem = elem[:-1] factory = globals()[elem]