Skip to content

[libSyntax] Small improvements #60196

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

Merged
merged 2 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions lib/Parse/ParsedSyntaxBuilders.cpp.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void Parsed${node.name}Builder::finishLayout(bool deferred) {
% if node.children:
% for (idx, child) in enumerate(node.children):
% child_elt = None
% child_elt_name = child.name + 'Member'
% child_node = NODE_MAP.get(child.syntax_kind)
% if child_node and child_node.is_syntax_collection():
% child_elt = child_node.collection_element_name
Expand Down
2 changes: 1 addition & 1 deletion utils/gyb_syntax_support/Classification.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .Node import error
from .Utils import error
from .kinds import lowercase_first_word # noqa: I201


Expand Down
8 changes: 1 addition & 7 deletions utils/gyb_syntax_support/Node.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import sys # noqa: I201

from .Utils import error
from .kinds import SYNTAX_BASE_KINDS, kind_to_type, lowercase_first_word


def error(msg):
print('error: ' + msg, file=sys.stderr)
sys.exit(-1)


class Node(object):
"""
A Syntax node, possibly with children.
Expand Down
2 changes: 1 addition & 1 deletion utils/gyb_syntax_support/NodeSerializationCodes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .Node import error
from .Utils import error


SYNTAX_NODE_SERIALIZATION_CODES = {
Expand Down
2 changes: 1 addition & 1 deletion utils/gyb_syntax_support/Token.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .Classification import classification_by_name
from .Node import error # noqa: I201
from .Utils import error # noqa: I201
from .kinds import lowercase_first_word # noqa: I201


Expand Down
2 changes: 1 addition & 1 deletion utils/gyb_syntax_support/Trivia.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .Node import error
from .Utils import error
from .kinds import lowercase_first_word # noqa: I201


Expand Down
6 changes: 6 additions & 0 deletions utils/gyb_syntax_support/Utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys


def error(msg):
print('error: ' + msg, file=sys.stderr)
sys.exit(-1)