mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
formatter.py: Improve whitespace for clarity
This commit is contained in:
parent
1f999c3405
commit
1e33f208dd
1 changed files with 3 additions and 1 deletions
|
@ -28,10 +28,12 @@ class Format:
|
||||||
def format(data):
|
def format(data):
|
||||||
indent_levels = 0
|
indent_levels = 0
|
||||||
tokens = tokenizer.tokenize(data)
|
tokens = tokenizer.tokenize(data)
|
||||||
|
|
||||||
tokenized_str = ""
|
tokenized_str = ""
|
||||||
|
|
||||||
for index, item in enumerate(tokens):
|
for index, item in enumerate(tokens):
|
||||||
|
|
||||||
if item.type != tokenizer.TokenType.WHITESPACE:
|
if item.type != tokenizer.TokenType.WHITESPACE:
|
||||||
|
|
||||||
if str(item) in opening_tokens:
|
if str(item) in opening_tokens:
|
||||||
indent_levels += 1
|
indent_levels += 1
|
||||||
elif str(item) in closing_tokens:
|
elif str(item) in closing_tokens:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue