Rename `normand.VarsT` to `normand.SymbolsT` v0.5.0
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 29 Sep 2023 18:06:24 +0000 (14:06 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 29 Sep 2023 18:06:24 +0000 (14:06 -0400)
This term is more general and applies to both labels and variables.

Change-Id: Iad4d72fa1cf26b934d04ebd014acf51b6881c817
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
README.adoc
normand/normand.py
pyproject.toml

index e350be56c02d75b1861b2901577a90202bf560fc..0252a22b672bfe696797e73915a49deca352e0ee 100644 (file)
@@ -29,7 +29,7 @@ _**Normand**_ is a text-to-binary processor with its own language.
 This package offers both a portable {py3} module and a command-line
 tool.
 
-WARNING: This version of Normand is 0.4, meaning both the Normand
+WARNING: This version of Normand is 0.5, meaning both the Normand
 language and the module/CLI interface aren't stable.
 
 ifdef::env-github[]
@@ -1053,9 +1053,6 @@ class ByteOrder(enum.Enum):
     LE = ...
 
 
-VarsT = typing.Dict[str, int]
-
-
 class TextLoc:
     # Line number.
     @property
@@ -1075,6 +1072,9 @@ class ParseError(RuntimeError):
         ...
 
 
+SymbolsT = typing.Dict[str, int]
+
+
 class ParseResult:
     # Generated data.
     @property
@@ -1083,12 +1083,12 @@ class ParseResult:
 
     # Updated variable values.
     @property
-    def variables(self) -> VarsT:
+    def variables(self) -> SymbolsT:
         ...
 
     # Updated main group label values.
     @property
-    def labels(self) -> VarsT:
+    def labels(self) -> SymbolsT:
         ...
 
     # Final offset.
@@ -1098,12 +1098,13 @@ class ParseResult:
 
     # Final byte order.
     @property
-    def byte_order(self) -> typing.Optional[int]:
+    def byte_order(self) -> typing.Optional[ByteOrder]:
         ...
 
+
 def parse(normand: str,
-          init_variables: typing.Optional[VarsT] = None,
-          init_labels: typing.Optional[VarsT] = None,
+          init_variables: typing.Optional[SymbolsT] = None,
+          init_labels: typing.Optional[SymbolsT] = None,
           init_offset: int = 0,
           init_byte_order: typing.Optional[ByteOrder] = None) -> ParseResult:
     ...
index 35c2330662ccb40ba67a1ab030e054408615a334..d84dce41afdbf936992dbf9297b69fca090944d3 100644 (file)
 # Upstream repository: <https://github.com/efficios/normand>.
 
 __author__ = "Philippe Proulx"
-__version__ = "0.4.0"
+__version__ = "0.5.0"
 __all__ = [
     "ByteOrder",
     "parse",
     "ParseError",
     "ParseResult",
     "TextLoc",
-    "VarsT",
+    "SymbolsT",
     "__author__",
     "__version__",
 ]
@@ -361,7 +361,7 @@ def _raise_error(msg: str, text_loc: TextLoc) -> NoReturn:
 
 
 # Variable/label dictionary type.
-VarsT = Dict[str, int]
+SymbolsT = Dict[str, int]
 
 
 # Python name pattern.
@@ -375,7 +375,7 @@ _py_name_pat = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*")
 class _Parser:
     # Builds a parser to parse the Normand input `normand`, parsing
     # immediately.
-    def __init__(self, normand: str, variables: VarsT, labels: VarsT):
+    def __init__(self, normand: str, variables: SymbolsT, labels: SymbolsT):
         self._normand = normand
         self._at = 0
         self._line_no = 1
@@ -1016,8 +1016,8 @@ class ParseResult:
     def _create(
         cls,
         data: bytearray,
-        variables: VarsT,
-        labels: VarsT,
+        variables: SymbolsT,
+        labels: SymbolsT,
         offset: int,
         bo: Optional[ByteOrder],
     ):
@@ -1031,8 +1031,8 @@ class ParseResult:
     def _init(
         self,
         data: bytearray,
-        variables: VarsT,
-        labels: VarsT,
+        variables: SymbolsT,
+        labels: SymbolsT,
         offset: int,
         bo: Optional[ByteOrder],
     ):
@@ -1159,7 +1159,11 @@ class _ExprNamesVisitor(_NodeVisitor):
 # Generator state.
 class _GenState:
     def __init__(
-        self, variables: VarsT, labels: VarsT, offset: int, bo: Optional[ByteOrder]
+        self,
+        variables: SymbolsT,
+        labels: SymbolsT,
+        offset: int,
+        bo: Optional[ByteOrder],
     ):
         self.variables = variables.copy()
         self.labels = labels.copy()
@@ -1197,8 +1201,8 @@ class _Gen:
     def __init__(
         self,
         group: _Group,
-        variables: VarsT,
-        labels: VarsT,
+        variables: SymbolsT,
+        labels: SymbolsT,
         offset: int,
         bo: Optional[ByteOrder],
     ):
@@ -1744,8 +1748,8 @@ class _Gen:
 # Raises `ParseError` on any parsing error.
 def parse(
     normand: str,
-    init_variables: Optional[VarsT] = None,
-    init_labels: Optional[VarsT] = None,
+    init_variables: Optional[SymbolsT] = None,
+    init_labels: Optional[SymbolsT] = None,
     init_offset: int = 0,
     init_byte_order: Optional[ByteOrder] = None,
 ):
index 2e3f1152bd60ccf63c97f51def7159a72f64e404..ac3849ce3525050c835e6c59226f16875a75634b 100644 (file)
@@ -23,7 +23,7 @@
 
 [tool.poetry]
 name = 'normand'
-version = '0.4.0'
+version = '0.5.0'
 description = 'Text-to-binary processor with its own language'
 license = 'MIT'
 authors = ['Philippe Proulx <eeppeliteloop@gmail.com>']
This page took 0.027513 seconds and 4 git commands to generate.