Python Slice notation

25 views
Skip to first unread message

Andreas Olschnögger

unread,
Dec 3, 2024, 4:40:06 AM12/3/24
to Boa Language and Infrastructure User Forum
Hello,

i recognized that Boa does not correctly parse the python slice notation.

For example 
label = file_name.split('/')[:-2] will be parsed to label = file_name.split('/')[-2]

When looking at the AST of the expression i see that the colon is not captured:
{
....
            {
               "kind": "ARRAYINDEX",
               "expressions": [
                  {
                     "kind": "UNARY",
                     "expressions": [
                        {
                           "kind": "LITERAL",
                           "literal": "-"
                        },
                        {
                           "kind": "LITERAL",
                           "literal": "2"
                        }
                     ]
                  }

            ...
   ]
}

It would be great if someone could have a look on this.

Thanks and Best wishes
Andreas

Robert Dyer

unread,
Dec 4, 2024, 3:18:36 PM12/4/24
to Boa Language and Infrastructure User Forum
Hi Andreas,

It looks like this might be a bug in the parser we use.  Would you mind filing it on the issue tracker (https://github.com/boalang/compiler/issues)?

Note that even once we get a fix in, existing datasets will unfortunately always have such bad data as the datasets are immutable.  But it would fix it for future datasets.

- Robert

Reply all
Reply to author
Forward
0 new messages