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

Mostly rewrite the open_scope and close_scope functions #29

Merged
merged 2 commits into from
Feb 9, 2018

Conversation

soupytwist
Copy link
Collaborator

These still could use some work, but they are (hopefully) more clear now
what is going on. Previously, the location and index internal to the
token generator was not being updated quite correctly. In debugging it I
cleaned up the logic a bit + added a test to demonstrate that this case
works now.

These still could use some work, but they are (hopefully) more clear now
what is going on. Previously, the location and index internal to the
token generator was not being updated quite correctly. In debugging it I
cleaned up the logic a bit + added a test to demonstrate that this case
works now.
@soupytwist soupytwist requested a review from akov February 7, 2018 23:44
# Eat whitespace or '(' tokens one at a time
for tok in self.takewhile(
lambda t: t.type in FORMATTING_TOKENS or t.src == '('):
# Stores all the code up and including this token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to?

@@ -34,6 +34,8 @@
# Alias for extracting token names
TOKENS = tokenize
Token = collections.namedtuple('Token', ('type', 'src', 'start', 'end', 'line'))
FORMATTING_TOKENS = (TOKENS.INDENT, TOKENS.DEDENT, TOKENS.NL, TOKENS.NEWLINE,
TOKENS.COMMENT)


class TokenGenerator(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add class docstring

@soupytwist soupytwist merged commit d973795 into master Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants