[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/26] qapi/parser.py: group variable declarations in __init__
From: |
John Snow |
Subject: |
[PATCH 02/26] qapi/parser.py: group variable declarations in __init__ |
Date: |
Tue, 22 Sep 2020 18:35:01 -0400 |
Add missing declarations and group them by function so they're easier to
understand at a distance.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/parser.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 55117f5754..b2984c8ff0 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -50,12 +50,19 @@ def __init__(self, fname, previously_included=None,
incl_info=None):
self._included = previously_included or set()
self._included.add(os.path.abspath(self._fname))
+ # Lexer state (see `accept` for details):
+ self.tok = None
+ self.pos = 0
self.cursor = 0
+ self.val = None
self.info = QAPISourceInfo(self._fname, 1, incl_info)
self.line_pos = 0
+
+ # Parser output:
self.exprs = []
self.docs = []
+ # Showtime!
try:
fp = open(self._fname, 'r', encoding='utf-8')
self.src = fp.read()
--
2.26.2
- [PATCH 00/26] qapi: static typing conversion, pt5, John Snow, 2020/09/22
- [PATCH 03/26] qapi/parser.py: use 'with' statement for opening files, John Snow, 2020/09/22
- [PATCH 02/26] qapi/parser.py: group variable declarations in __init__,
John Snow <=
- [PATCH 04/26] qapi/source.py: Add default arguments to QAPISourceInfo, John Snow, 2020/09/22
- [PATCH 01/26] qapi/parser.py: refactor parsing routine into method, John Snow, 2020/09/22
- [PATCH 05/26] qapi/parser.py: start source info at line 0, John Snow, 2020/09/22
- [PATCH 07/26] qapi/parser.py: fully remove 'null' constant, John Snow, 2020/09/22
- [PATCH 08/26] qapi/parser.py: Assert lexer value is a string, John Snow, 2020/09/22
- [PATCH 06/26] qapi/parser.py: raise QAPIParseError during file opening, John Snow, 2020/09/22
- [PATCH 09/26] qapi/parser.py: assert get_expr returns object in outer loop, John Snow, 2020/09/22
- [PATCH 10/26] qapi/parser.py: assert object keys are strings, John Snow, 2020/09/22
- [PATCH 11/26] qapi/parser.py: Convert several methods to @classmethod, John Snow, 2020/09/22
- [PATCH 12/26] qapi/parser.py: add casts to pragma checks, John Snow, 2020/09/22