Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMatch reports line,col, but debug messages report position. #71

Open
StyXman opened this issue Mar 15, 2020 · 1 comment
Open

NoMatch reports line,col, but debug messages report position. #71

StyXman opened this issue Mar 15, 2020 · 1 comment

Comments

@StyXman
Copy link

StyXman commented Mar 15, 2020

From this page https://textx.github.io/Arpeggio/stable/handling_errors/ :

Traceback (most recent call last):
  ...
arpeggio.NoMatch: Expected '+' or '-' or 'number' or 
  '(' at position (1, 6) => '23+4/*r-89'.

But the debug messages show only the position in file (from another project I'm working on):

[...]
                                                                 ?? Try match rule StrMatch(:) in set_attribute at position 15638 => -dasharray*: @primary
                                                                  ++ Match ':' at 15638 => '-dasharray*:* @primary'
                                                                  >> Matching rule expression=OrderedChoice in set_attribute at position 15639 => dasharray:* @primary-
[...]

It would be nice that the debug messages also reported line+col, as many editors only support displaying that instead of position in file.

If you could point me to where the code should be changed, I could even try to do the patch myself.

@igordejanovic
Copy link
Member

igordejanovic commented Mar 19, 2020

You can convert absolute position to line,col format by parser.pos_to_linecol and the use line,col in debug outputs (e.g. https://github.com/textX/Arpeggio/blob/master/arpeggio/__init__.py#L258)

The only concern is that it will incur a considerable overhead but since it's only for debugging I guess it's ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants