Opened 6 years ago

Closed 4 years ago

#61 closed defect (worksforme)

Buffers in cdef function argument list

Reported by: dagss Owned by: dagss
Priority: minor Milestone: 0.14
Component: Parsing Keywords: buffer cdef parser numerics
Cc:

Description

The parser doesn't allow

cdef void foo(np.ndarray[float] X):
    pass

This is because the parser has to support

cdef void foo(int[] X)

and at the point of parsing the [ it isn't known whether is is a definition or declaration (right?)

One could for instance parse to the end of the line and check for a ":" when encountering the [ in a cdef (and store info to coordinate this in the parsing context) -- as the two cases can be seperated on whether it is a definition or not.

Another option is to use a "TrailingBracketTypeNode?" rather than let the parser resolve it.

Change History (3)

comment:1 in reply to: ↑ description Changed 6 years ago by dagss

Replying to dagss:

This is because the parser has to support

cdef void foo(int[] X)

Here it should have been

cdef void foo(int[])

And it seems we can just look ahead a single word to fix it for now...

comment:2 Changed 6 years ago by dagss

  • Keywords numerics added

comment:3 Changed 4 years ago by scoder

  • Milestone changed from wishlist to 0.14
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.