DavidKinder / Inform6

The latest version of the Inform 6 compiler, used for generating interactive fiction games.
http://inform-fiction.org/
Other
204 stars 34 forks source link

Create ebf_token_error(), call it in most places #213

Closed erkyrath closed 1 year ago

erkyrath commented 1 year ago

Nearly all uses of ebf_error() pass the global token_text as the second argument. (This includes all uses of the wrapper ebf_error_recover() in directs.c.)

This being the case, we could have a separate function ebf_token_error() which omits the second argument and produces more informative error messages. For example:

Global 'foo';

This currently says

Error: Expected new global variable name but found foo

We could instead peek at the token_type global and say

Error: Expected new global variable name but found the single-quoted string 'foo'