Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fix for black formatter breaking standalone parser generation. #1363

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lark/tools/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ def extract_sections(lines):
text = []
sections = defaultdict(list)
for line in lines:
if line.startswith('###'):
if line[3] == '{':
section = line[4:].strip()
elif line[3] == '}':
clean_line = line.strip()
if clean_line.startswith("###"):
if clean_line[3] == "{":
section = clean_line[4:].strip()
elif clean_line[3] == "}":
sections[section] += text
section = None
text = []
Expand Down
Loading