Chapter 9Return codes

If the parse succeeds, CoffeePot exits with a return code value of 0, indicating success. It can also end with error codes indicating failures.

1

An unsuccessful parse. There are no errors in the grammar, but the input provided is not a sentence in the language defined by that grammar.

2

The output format CSV was selected, but the result of the parse cannot be represented as CSV.

3

An exception occurred, the processor was not able to construct a parser from the grammar or was not able to process the input for some more significant reason than “not a sentence”.

Scripts running CoffeePot can usually detect the return code, but exactly how varies by operating system and shell. On unix-based systems, it’s often possible to check the return code by inspecting the magic variable named $?.