Previously the parser returned detected parse errors by setting the token type to an error and setting the string member (normally used to hold the string of the token) to the error message. Since these messages need to be translated, the parser required the Qt translate functions. The parser was modified to use status error codes instead of messages.
The token does not have a status member, and only the parser would need to use it for errors. Instead, an error status member was added to the parser class with an access function. If token has an error, the caller obtains the status error code by calling the access function. The set error access functions of the token class were also moved to the parser class, since only the parser class uses them. These were modified to set the parser error status code instead of setting the token string to an error message.
The parser error messages were changed to status codes and appropriate enumerators were added to the status enumeration, and the messages were added to the switch statement in the static token error message function. The result is that the parser class is no longer dependent on the Qt translate functions.
The two users of the parser class, the translator and the tester classes, now retrieve the error status from the parser when the token has an error and this error status is used to get the error message. Previously they obtained the error message from the token where the parser put it.
[branch err-msgs commit 84c52f0e9b]
Sunday, September 21, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)