From 81b63c3d78ce2e275558811f6bd10de6c90c8726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Mon, 20 Sep 2021 17:24:45 +0100 Subject: [PATCH] scripts: fix API parsing of *** pointers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The currrent generated API contains *** pointer types with bogus whitespace in the middle: because the tokenizer only tries to merge 2 distinct '*' together. This refactors the code to merge an arbitrary number, resulting in Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- scripts/apibuild.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index b94c0f6c09..722fd33f0e 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -603,13 +603,12 @@ class CLexer: i = i + 3 continue - j = i + 1 - if j < nline and line[j] in "+-*><=/%&!|": - self.tokens.append(('op', line[i:j + 1])) - i = j + 1 - else: - self.tokens.append(('op', line[i])) - i = i + 1 + j = i + while (j + 1) < nline and line[j+1] in "+-*><=/%&!|": + j = j + 1 + + self.tokens.append(('op', line[i:j+1])) + i = j + 1 continue s = i while i < nline: