smhg / gettext-parser

Parse and compile gettext po and mo files, nothing more, nothing less
MIT License
158 stars 44 forks source link

Add parser error checking for unescaped quotes #47

Closed probertson closed 5 years ago

probertson commented 5 years ago

This adds (one type of) error checking to the parser.

This fixes #37

Specifically it detects and throws an error when there is an unsupported "key" (msgid, msgstr, etc.). This error occurs when there is an unescaped double quote in a string (the parser sees the double quote as the end of the string. Whatever part of the string follows is interpreted as a new key when of course it's not meant to be a key.

It also adds basic "line counting" so that the line number can be included in the error message.

probertson commented 5 years ago

This isn't quite ready for review -- I realized I didn't add support for the stream parser yet

probertson commented 5 years ago

This is now ready for review 😅

probertson commented 5 years ago

@smhg This is now ready for review (just in case you didn't get a notification already -- if you did then sorry for spamming you!)