astexplorer icon indicating copy to clipboard operation
astexplorer copied to clipboard

python - "Unexpected token" error on ellipsis

Open DetachHead opened this issue 2 years ago • 1 comments

Describe the bug a "Unexpected token" error occurs on an ellipsis literal (...), which is valid python syntax: see https://docs.python.org/3/library/constants.html#Ellipsis

To Reproduce Steps to reproduce the behavior:

  1. Go to the ast viewer site
  2. change language to python
  3. input an ellipsis (...)

Expected behavior no error

Screenshots image

Browser (please complete the following information):

  • OS: windows 10
  • Browser firefox
  • Version: 121.0

astexplorer settings:

  • Selected parser: python
  • Contents of the local storage key explorerSettingsV1 (code can be removed if you don't want it to be public):
    {
      "showTransformPanel": false,
      "parserSettings": {},
      "parserPerCategory": {},
      "workbench": {
        "parser": "python",
        "code": "...",
        "keyMap": "default",
        "transform": {
          "code": "",
          "transformer": null
        }
      }
    }
    

DetachHead avatar Jan 21 '24 09:01 DetachHead

Parser used for python is filbert which is fairly old (8 years old) and it seems that syntax is not supported by filbert. We could try to integrate another python parser.

Just in a quick search I could find: https://www.npmjs.com/package/dt-python-parser (Published 2 years ago) https://www.npmjs.com/package/jspython-interpreter (Published 4 months ago) https://www.npmjs.com/package/python-ast (Published 3 years ago)

Scipion avatar Jan 22 '24 11:01 Scipion