Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rv/rvgen: extract node marker string to class constant

Add a node_marker class constant to the Automata class to replace the
hardcoded "{node" string literal used throughout the DOT file parsing
logic. This follows the existing pattern established by the init_marker
and invalid_state_str class constants in the same class.

The "{node" string is used as a marker to identify node declaration
lines in DOT files during state variable extraction and cursor
positioning. Extracting it to a named constant improves code
maintainability and makes the marker's purpose explicit.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Link: https://lore.kernel.org/r/20260223162407.147003-17-wander@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>

authored by

Wander Lairson Costa and committed by
Gabriele Monaco
2074723f 8aee49c5

+5 -4
+5 -4
tools/verification/rvgen/rvgen/automata.py
··· 44 44 45 45 invalid_state_str = "INVALID_STATE" 46 46 init_marker = "__init_" 47 + node_marker = "{node" 47 48 # val can be numerical, uppercase (constant or macro), lowercase (parameter or function) 48 49 # only numerical values should have units 49 50 constraint_rule = re.compile(r""" ··· 113 112 for cursor, line in enumerate(self.__dot_lines): 114 113 split_line = line.split() 115 114 116 - if len(split_line) and split_line[0] == "{node": 115 + if len(split_line) and split_line[0] == self.node_marker: 117 116 return cursor 118 117 119 118 raise AutomataError("Could not find a beginning state") ··· 128 127 continue 129 128 130 129 if state == 0: 131 - if line[0] == "{node": 130 + if line[0] == self.node_marker: 132 131 state = 1 133 - elif line[0] != "{node": 132 + elif line[0] != self.node_marker: 134 133 break 135 134 else: 136 135 raise AutomataError("Could not find beginning event") ··· 152 151 # process nodes 153 152 for line in islice(self.__dot_lines, cursor, None): 154 153 split_line = line.split() 155 - if not split_line or split_line[0] != "{node": 154 + if not split_line or split_line[0] != self.node_marker: 156 155 break 157 156 158 157 raw_state = split_line[-1]