Skip to content

Commit 15a9c81

Browse files
committed
lopper: correctly label compact (or sparse) nodes in --enhanced mode
Before this commit, the following device tree /dts-v1/; / { compact_label: compact_thing@0 { compatible = "baz"; }; less_compact_label: compact_thing@1 { compatible = "baz"; }; normal_label: compact_thing@2 { compatible = "baz"; }; sparse_label: compact_thing@3 { compatible = "baz"; }; }; ...resulted in mangled device-tree code (and hence a failing dtc invocation). By matching the "{" inside the regular expression, we no longer rely on whitespace as a marker for structure. Signed-off-by: Graeme Smecher <[email protected]>
1 parent 1288749 commit 15a9c81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lopper/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def _label_translate(text):
916916
r'^\s*?\w*?\s*?\:', re.DOTALL
917917
)
918918
pattern = re.compile(
919-
r'^\s*?(\w*?)\s*?\:(.*?)$', re.DOTALL | re.MULTILINE
919+
r'^\s*?(\w*?)\s*?\:([^{]*?)\s*\{', re.DOTALL | re.MULTILINE
920920
)
921921
return re.sub(pattern, lopper_base._label_replacer, text)
922922

0 commit comments

Comments
 (0)