Ticket #61 (closed defect: worksforme)

Opened 6 years ago

Last modified 4 years ago

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

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...

  Changed 6 years ago by dagss

  • keywords numerics added

  Changed 4 years ago by scoder

  • status changed from new to closed
  • resolution set to worksforme
  • milestone changed from wishlist to 0.14
Note: See TracTickets for help on using tickets.