Skip to content

[Parser] Error in parsing function definition (new parser) #803

@akshanshbhatt

Description

@akshanshbhatt
$ cat examples/expr2.py
def func(i,):
    pass

$ lpython --show-ast examples/expr2.py --tree  # Old-Module
  |-body=|-FunctionDef
  |   |-name=func
  |   |-args=
  |   | |-posonlyargs=|   | |-args=|   | |-
  |   | |   |-arg=i
  |   | |   |-annotation=()
  |   | |-type_comment=()
  |   | |-vararg=|   | |-kwonlyargs=|   | |-kw_defaults=|   | |-kwarg=|   |-defaults=|   |-body=|   |-Pass
  |   |-decorator_list=|   |-returns=()
  |-type_comment=()
  └-type_ignores=↧

$ lpython --show-ast examples/expr2.py --tree --new-parser  # New
tokenizer error: Parenthesis unexpected
 --> examples/expr2.py:1:12
  |
1 | def func(i,):
  |            ^


Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that needs to be fixed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions