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

Provide accurate error line number #8

Open
Steve-xmh opened this issue Jun 4, 2023 · 1 comment
Open

Provide accurate error line number #8

Steve-xmh opened this issue Jun 4, 2023 · 1 comment

Comments

@Steve-xmh
Copy link

First of all, this tool has huge contribution to our Chinese Translation Patch. We are highly appreciated to your work!

But we have some trouble in checking grammar error on modifying tpl scripts. TextPet only reports the error message but not providing accurate line number, which always confuse us when repacking ROMs. It would be very helpful if we can know which line has the grammar error.

@Prof9
Copy link
Owner

Prof9 commented Jun 6, 2023

This is a bit difficult to do because TextPet uses a Regex-based tokenizer for TPL. However, .NET's Regex facilities do not record line/column numbers for matches. Therefore the easiest way to determine the line number would be to manually compute the line number for each match, by counting the number of newlines before the match. This is not great for performance, hence why it is currently not done.

https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.match

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