GH-120024: Tidy up case generator code a bit. (GH-122780)

This commit is contained in:
Mark Shannon 2024-08-08 10:57:59 +01:00 committed by GitHub
parent 0d9c123d1a
commit 81c739e2dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 175 additions and 103 deletions

View file

@ -66,6 +66,7 @@ class Node:
assert context is not None
return context.owner.tokens[context.begin]
@dataclass
class Block(Node):
# This just holds a context which has the list of tokens.
@ -426,7 +427,9 @@ class Parser(PLexer):
raise self.make_syntax_error("Expected {")
if members := self.members():
if self.expect(lx.RBRACE) and self.expect(lx.SEMI):
return Pseudo(tkn.text, inp, outp, flags, members)
return Pseudo(
tkn.text, inp, outp, flags, members
)
return None
def members(self) -> list[str] | None: