You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to know where a node ends. For the start of a token, we have node.coord. Similarly, it would be nice if we also had node.endcoord. The reason why I want this feature is that it would enable precisely underlined error messages like GCC has:
main.c: In function ‘main’:
main.c:2:13: warning: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
2 | int x = "asdf";
| ^~~~~~
Here is where the coord is parameter is retrieved from yacc:
I am not sure if the end position can be obtained from yacc. In case this is not possible, here is a hacky idea: Find the end position by scanning backwards from the next token until a non-whitespace character is found.
I do not have the time to implement this right now, but I thought I should start a discussion here in case someone has a better idea.
The text was updated successfully, but these errors were encountered:
It would be nice to know where a node ends. For the start of a token, we have
node.coord
. Similarly, it would be nice if we also hadnode.endcoord
. The reason why I want this feature is that it would enable precisely underlined error messages like GCC has:Here is where the
coord
is parameter is retrieved from yacc:pycparser/pycparser/plyparser.py
Line 55 in f740995
yacc defines e.g. lineno here:
pycparser/pycparser/ply/yacc.py
Line 258 in f740995
I am not sure if the end position can be obtained from yacc. In case this is not possible, here is a hacky idea: Find the end position by scanning backwards from the next token until a non-whitespace character is found.
I do not have the time to implement this right now, but I thought I should start a discussion here in case someone has a better idea.
The text was updated successfully, but these errors were encountered: