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

Rust parser: Error with parenthesised annotations #1011

Open
AA-Turner opened this issue Sep 5, 2023 · 0 comments
Open

Rust parser: Error with parenthesised annotations #1011

AA-Turner opened this issue Sep 5, 2023 · 0 comments
Labels
bug Something isn't working parsing Converting source code into CST nodes

Comments

@AA-Turner
Copy link

AA-Turner commented Sep 5, 2023

The following legal code errors on the Rust parser, but not the Python one:

(n): int = 1
$ python -m libcst.tool print tmp.py
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "...\Lib\site-packages\libcst\tool.py", line 863, in <module>
    main(os.environ.get("LIBCST_TOOL_COMMAND_NAME", "libcst.tool"), sys.argv[1:])
  File "...\Lib\site-packages\libcst\tool.py", line 858, in main
    return lookup.get(args.action or None, _invalid_command)(proc_name, command_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\Lib\site-packages\libcst\tool.py", line 279, in _print_tree_impl
    tree = parse_module(
           ^^^^^^^^^^^^^
  File "...\Lib\site-packages\libcst\_parser\entrypoints.py", line 109, in parse_module
    result = _parse(
             ^^^^^^^
  File "...\Lib\site-packages\libcst\_parser\entrypoints.py", line 55, in _parse
    return parse(source_str)
           ^^^^^^^^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 1:1.
parser error: error at 1:5: expected one of !=, %, &, (, *, **, +, ,, -, ., /, //, ;, <, <<, <=, =, ==, >, >=, >>, @, NEWLINE, [, ^, and, if, in, is, not, or, |

(n): int = 1
^

LibCST version 1.0.1; Python 3.11.5; Windows

A

@zsol zsol added bug Something isn't working parsing Converting source code into CST nodes labels Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parsing Converting source code into CST nodes
Projects
None yet
Development

No branches or pull requests

2 participants