Allow parser visitors to leverage the parser's state instead of creating their own stacks

This commit is contained in:
Dustin Spicuzza
2023-09-03 19:44:07 -04:00
parent 15ec31b84f
commit 3bae95f2a7
5 changed files with 125 additions and 79 deletions

View File

@@ -351,3 +351,29 @@ def test_warning_directive() -> None:
data = parse_string(content, cleandoc=True)
assert data == ParsedData()
def test_empty_block() -> None:
"""
Ensure the simple visitor doesn't break with an empty block
"""
content = """
{
class X {};
}
"""
data = parse_string(content, cleandoc=True)
assert data == ParsedData(
namespace=NamespaceScope(
classes=[
ClassScope(
class_decl=ClassDecl(
typename=PQName(
segments=[NameSpecifier(name="X")], classkey="class"
)
)
)
]
)
)