Unable to declare an explanation with "ptr"
jengelh opened this issue · 3 comments
jengelh commented
The explain command's output is normally usable a command in its own right (and vice-versa), but this falls on its feet when the variable name is called ptr:
c++decl> explain void *ptr
declare ptr as pointer to void
c++decl> declare ptr as pointer to void
^
18: syntax error: "ptr": name or operator expected
paul-j-lucas commented
That's because ptr
is a cdecl keyword that's a shorthand for pointer
. Note that cdecl recognizes such words only when parsing English and not gibberish (which is why your explain
line works).
paul-j-lucas commented
I could perhaps add code to check to see if a token is a cdecl keyword and include that in the error message. Cdecl already does that for C/C++ keywords, e.g.:
cdecl> declare switch as pointer to void
^
18: syntax error: "switch": name or operator expected ("switch" is a keyword)
but not currently for cdecl keywords.
paul-j-lucas commented
As of 306ff626412a
, cdecl token checks are done.