Next: , Previous: , Up: Error methods macros and codes   [Contents]


19.3 External error codes

This section lists the external error codes. These are the only error codes that users of the Libmarpa external interface should ever see. Internal error codes are in their own section. See Internal error codes.

Macro: int MARPA_ERR_NONE

No error condition. The error code is initialized to this value. Methods which do not result in failure sometimes reset the error code to MARPA_ERR_NONE. Numeric value: 0. Suggested message: "No error".

Macro: int MARPA_ERR_BAD_SEPARATOR

A separator was specified for a sequence rule, but its ID was not that of a valid symbol. Numeric value: 6. Suggested message: "Separator has invalid symbol ID".

Macro: int MARPA_ERR_BEFORE_FIRST_TREE

A tree iterator is positioned before the first tree, and it was specified in a context where that is not allowed. A newly created tree is positioned before the first tree. To position a newly created tree iterator to the first tree use the marpa_t_next() method. Numeric value: 91. Suggested message: "Tree iterator is before first tree".

Macro: int MARPA_ERR_COUNTED_NULLABLE

A “counted” symbol was found that is also a nullable symbol. A “counted” symbol is one that appears on the RHS of a sequence rule. If a symbol is nullable, counting its occurrences becomes difficult. Questions of definition and problems of implementation arise. At a minimum, a sequence with counted nullables would be wildly ambigious.

Sequence rules are simply an optimized shorthand for rules that can also be written in ordinary BNF. If the equivalent of a sequence of nullables is really what your application needs, nothing in Libmarpa prevents you from specifying that sequence with ordinary BNF rules.

Numeric value: 8. Suggested message: "Nullable symbol on RHS of a sequence rule".

Macro: int MARPA_ERR_DUPLICATE_RULE

This error indicates an attempt to add a BNF rule which is a duplicate of a BNF rule already in the grammar. Two BNF rules are considered duplicates if

Duplication of sequence rules, and duplication between BNF rules and sequence rules, is dealt with by requiring that the LHS of a sequence rule not be the LHS of any other rule.

Numeric value: 11. Suggested message: "Duplicate rule".

Macro: int MARPA_ERR_DUPLICATE_TOKEN

This error indicates an attempt to add a duplicate token. A token is a duplicate if one already read at the same earleme has the same symbol ID and the same length. Numeric value: 12. Suggested message: "Duplicate token".

Macro: int MARPA_ERR_YIM_COUNT

This error code indicates that an implementation-defined limit on the number of Earley items per Earley set was exceedeed. This limit is different from the Earley item warning threshold, an optional limit on the number of Earley items in an Earley set, which can be set by the application.

The implementation defined-limit is very large, at least 500,000,000 earlemes. An application is unlikely ever to see this error. Libmarpa’s use of memory would almost certainly exceed the implementation’s limits before it occurred. Numeric value: 13. Suggested message: "Maximum number of Earley items exceeded".

Macro: int MARPA_ERR_EVENT_IX_NEGATIVE

A negative event index was specified. That is not allowed. Numeric value: 15. Suggested message: "Negative event index".

Macro: int MARPA_ERR_EVENT_IX_OOB

An non-negative event index was specified, but there is no event at that index. Since the events are in sequence, this means it was too large. Numeric value: 16. Suggested message: "No event at that index".

Macro: int MARPA_ERR_GRAMMAR_HAS_CYCLE

The grammar has a cycle — one or more loop rules. This is a recoverable error, although most applications will want to treat it as fatal. For more see the description of marpa_g_precompute. Numeric value: 17. Suggested message: "Grammar has cycle".

Macro: int MARPA_ERR_HEADERS_DO_NOT_MATCH

This is an internal error, and indicates that Libmarpa was wrongly built. Libmarpa was compiled with headers which do not match the rest of the code. The solution is to find a correctly built Libmarpa. Numeric value: 98. Suggested message: "Internal error: Libmarpa was built incorrectly"

Macro: int MARPA_ERR_I_AM_NOT_OK

The Libmarpa base grammar is in a "not ok" state. Currently, the only way this can happen is if Libmarpa memory is being overwritten. Numeric value: 29. Suggested message: "Marpa is in a not OK state".

Macro: int MARPA_ERR_INACCESSIBLE_TOKEN

This error code indicates that the token symbol is an inaccessible symbol — one which cannot be reached from the start symbol.

Since the inaccessibility of a symbol is a property of the grammar, this error code typically indicates an application error. Nevertheless, a retry at this location, using another token ID, may succeed. At this writing, the author knows of no uses of this technique.

Numeric value: 18. Suggested message: "Token symbol is inaccessible".

Macro: int MARPA_ERR_INVALID_BOOLEAN

A function was called that takes a boolean argument, but the value of that argument was not either 0 or 1. Numeric value: 22. Suggested message: "Argument is not boolean".

Macro: int MARPA_ERR_INVALID_LOCATION

The location (Earley set ID) is not valid. It may be invalid for one of two reasons:

For users of input models other than the standard one, the term “location”, as used in association with this error code, means Earley set ID or Earley set ordinal. In the standard input model, this will always be identical with Libmarpa’s other idea of location, the earleme.

Numeric value: 25. Suggested message: "Location is not valid".

Macro: int MARPA_ERR_INVALID_START_SYMBOL

A start symbol was specified, but its symbol ID is not that of a valid symbol. Numeric value: 27. Suggested message: "Specified start symbol is not valid".

Macro: int MARPA_ERR_INVALID_ASSERTION_ID

A method was called with an invalid assertion ID. This is a assertion ID which not only does not exist, but cannot exist. Currently that means its value is less than zero. Numeric value: 96. Suggested message: "Assertion ID is malformed".

Macro: int MARPA_ERR_INVALID_RULE_ID

A method was called with an invalid rule ID. This is a rule ID which not only does not exist, but cannot exist. Currently that means its value is less than zero. Numeric value: 26. Suggested message: "Rule ID is malformed".

Macro: int MARPA_ERR_INVALID_SYMBOL_ID

A method was called with an invalid symbol ID. This is a symbol ID which not only does not exist, but cannot exist. Currently that means its value is less than zero. Numeric value: 28. Suggested message: "Symbol ID is malformed".

Macro: int MARPA_ERR_MAJOR_VERSION_MISMATCH

There was a mismatch in the major version number between the requested version of libmarpa, and the actual one. Numeric value: 30. Suggested message: "Libmarpa major version number is a mismatch".

Macro: int MARPA_ERR_MICRO_VERSION_MISMATCH

There was a mismatch in the micro version number between the requested version of libmarpa, and the actual one. Numeric value: 31. Suggested message: "Libmarpa micro version number is a mismatch".

Macro: int MARPA_ERR_MINOR_VERSION_MISMATCH

There was a mismatch in the minor version number between the requested version of libmarpa, and the actual one. Numeric value: 32. Suggested message: "Libmarpa minor version number is a mismatch".

Macro: int MARPA_ERR_NO_EARLEY_SET_AT_LOCATION

A non-negative Earley set ID (also called an Earley set ordinal) was specified, but there is no corresponding Earley set. Since the Earley set ordinals are in sequence, this means that the specified ID is greater than that of the latest Earley set. Numeric value: 39. Suggested message: "Earley set ID is after latest Earley set".

Macro: int MARPA_ERR_NOT_PRECOMPUTED

The grammar is not precomputed, and attempt was made to do something with it that is not allowed for unprecomputed grammars. For example, a recognizer cannot be created from a grammar until it is precomputed. Numeric value: 34. Suggested message: "This grammar is not precomputed".

Macro: int MARPA_ERR_NO_PARSE

The application attempted to create a bocage from a recognizer without a parse. Applications will often want to treat this as a soft error. Numeric value: 41. Suggested message: "No parse".

Macro: int MARPA_ERR_NO_RULES

A grammar which has no rules is being used in a way that is not allowed. Usually the problem is that the user is trying to precompute the grammar. Numeric value: 42. Suggested message: "This grammar does not have any rules".

Macro: int MARPA_ERR_NO_START_SYMBOL

The grammar has no start symbol, and an attempt was made to perform an operation which requires one. Usually the problem is that the user is trying to precompute the grammar. Numeric value: 43. Suggested message: "This grammar has no start symbol".

Macro: int MARPA_ERR_NO_SUCH_ASSERTION_ID

A method was called with an assertion ID which is well-formed, but the assertion does not exist. Numeric value: 97. Suggested message: "No assertion with this ID exists".

Macro: int MARPA_ERR_NO_SUCH_RULE_ID

A method was called with a rule ID which is well-formed, but the rule does not exist. Numeric value: 89. Suggested message: "No rule with this ID exists".

Macro: int MARPA_ERR_NO_SUCH_SYMBOL_ID

A method was called with a symbol ID which is well-formed, but the symbol does not exist. Numeric value: 90. Suggested message: "No symbol with this ID exists".

Macro: int MARPA_ERR_NO_TOKEN_EXPECTED_HERE

This error code indicates that no tokens at all were expected at this earleme location. This can only happen in alternative input models.

Typically, this indicates an application programming error. Retrying input at this location will always fail. But if the application is able to leave this earleme empty, a retry at a later location, using this or another token, may succeed. At this writing, the author knows of no uses of this technique.

Numeric value: 44. Suggested message: "No token is expected at this earleme location".

Macro: int MARPA_ERR_NOT_A_SEQUENCE

This error occurs in situations where a rule is required to be a sequence, and indicates that the rule of interest is, in fact, not a sequence.

Numeric value: 99. Suggested message: "Rule is not a sequence".

Macro: int MARPA_ERR_NULLING_TERMINAL

Marpa does not allow a symbol to be both nulling and a terminal. Numeric value: 49. Suggested message: "A symbol is both terminal and nulling".

Macro: int MARPA_ERR_ORDER_FROZEN

The Marpa order object has been frozen. If a Marpa order object is frozen, it cannot be changed.

Multiple tree iterators can share a Marpa order object, but that order object is frozen after the first tree iterator is created from it. Applications can order an bocage in many ways, but they must do so by creating multiple order objects.

Numeric value: 50. Suggested message: "The ordering is frozen".

Macro: int MARPA_ERR_PARSE_EXHAUSTED

The parse is exhausted. Numeric value: 53. Suggested message: "The parse is exhausted".

Macro: int MARPA_ERR_PARSE_TOO_LONG

The parse is too long. The limit on the length of a parse is implementation dependent, but it is very large, at least 500,000,000 earlemes.

This error code is unlikely in the standard input model. Almost certainly memory would be exceeded before it could occur. If an application sees this error, it almost certainly using one of the non-standard input models.

Most often this messsage will occur because of a request to add a single extremely long token, perhaps as a result of an application error. But it is also possible this error condition will occur after the input of a large number of long tokens.

Numeric value: 54. Suggested message: "This input would make the parse too long".

Macro: int MARPA_ERR_POINTER_ARG_NULL

In a method which takes pointers as arguments, one of the pointer arguments is NULL, in a case where that is not allowed. One such method is marpa_r_progress_item(). Numeric value: 56. Suggested message: "An argument is null when it should not be".

Macro: int MARPA_ERR_PRECOMPUTED

An attempt was made to use a precomputed grammar in a way that is not allowed. Often this is an attempt to change the grammar. Nearly every change to a grammar after precomputation invalidates the precomputation, and is therefore not allowed. Numeric value: 57. Suggested message: "This grammar is precomputed".

Macro: int MARPA_ERR_PROGRESS_REPORT_NOT_STARTED

No recognizer progress report is currently active, and an action has been attempted which is inconsistent with that. One such action would be a marpa_r_progress_item() call. Numeric value: 59. Suggested message: "No progress report has been started".

Macro: int MARPA_ERR_PROGRESS_REPORT_EXHAUSTED

The progress report is “exhausted” — all its items have been iterated through. Numeric value: 58. Suggested message: "The progress report is exhausted".

Macro: int MARPA_ERR_RANK_TOO_LOW

A symbol or rule rank was specified which was less than an implementation-defined minimum. Implementations will always allow at least those ranks in the range between -134,217,727 and 134,217,727. Numeric value: 85. Suggested message: "Rule or symbol rank too low".

Macro: int MARPA_ERR_RANK_TOO_HIGH

A symbol or rule rank was specified which was greater than an implementation-defined maximum. Implementations will always allow at least those ranks in the range between -134,217,727 and 134,217,727. Numeric value: 86. Suggested message: "Rule or symbol rank too high".

Macro: int MARPA_ERR_RECCE_IS_INCONSISTENT

The recognizer is “inconsistent”, usually because the user has rejected one or more rules or terminals, and has not yet called the marpa_r_consistent() method. Numeric value: 95. Suggested message: "The recognizer is inconsistent.

Macro: int MARPA_ERR_RECCE_NOT_ACCEPTING_INPUT

The recognizer is not accepting input, and the application has attempted something that is inconsistent with that fact. Numeric value: 60. Suggested message: "The recognizer is not accepting input".

Macro: int MARPA_ERR_RECCE_NOT_STARTED

The recognizer has not been started. and the application has attempted something that is inconsistent with that fact. Numeric value: 61. Suggested message: "The recognizer has not been started".

Macro: int MARPA_ERR_RECCE_STARTED

The recognizer has been started. and the application has attempted something that is inconsistent with that fact. Numeric value: 62. Suggested message: "The recognizer has been started".

Macro: int MARPA_ERR_RHS_IX_NEGATIVE

The index of a RHS symbol was specified, and it was negative. That is not allowed. Numeric value: 63. Suggested message: "RHS index cannot be negative".

Macro: int MARPA_ERR_RHS_IX_OOB

A non-negative index of RHS symbol was specified, but there is no symbol at that index. Since the indexes are in sequence, this means the index was greater than or equal to the rule length. Numeric value: 64. Suggested message: "RHS index must be less than rule length".

Macro: int MARPA_ERR_RHS_TOO_LONG

An attempt was made to add a rule with too many right hand side symbols. The limit on the RHS symbol count is implementation dependent, but it is very large, at least 500,000,000 symbols. This is far beyond what is required in any current practical grammar. An application with rules of this length is almost certain to run into memory and other limits. Numeric value: 65. Suggested message: "The RHS is too long".

Macro: int MARPA_ERR_SEQUENCE_LHS_NOT_UNIQUE

The LHS of a sequence rule cannot be the LHS of any other rule, whether a sequence rule or a BNF rule. An attempt was made to violate this restriction. Numeric value: 66. Suggested message: "LHS of sequence rule would not be unique".

Macro: int MARPA_ERR_START_NOT_LHS

The start symbol is not on the LHS on any rule. That means it could never match any possible input, not even the null string. Presumably, an error in writing the grammar. Numeric value: 73. Suggested message: "Start symbol not on LHS of any rule".

Macro: int MARPA_ERR_SYMBOL_IS_NOT_COMPLETION_EVENT

An attempt was made to use a symbol in a way that requires it to be set up for completion events, but the symbol was not set set up for completion events. The archetypal case is an attempt to activate completion events for the symbol in the recognizer. The archetypal case is an attempt to activate a completion event in the recognizer for a symbol that is not set up as a completion event. Numeric value: 92. Suggested message: "Symbol is not set up for completion events".

Macro: int MARPA_ERR_SYMBOL_IS_NOT_NULLED_EVENT

An attempt was made to use a symbol in a way that requires it to be set up for nulled events, but the symbol was not set set up for nulled events. The archetypal case is an attempt to activate a nulled events in the recognizer for a symbol that is not set up as a nulled event. Numeric value: 93. Suggested message: "Symbol is not set up for nulled events".

Macro: int MARPA_ERR_SYMBOL_IS_NOT_PREDICTION_EVENT

An attempt was made to use a symbol in a way that requires it to be set up for predictino events, but the symbol was not set set up for predictino events. The archetypal case is an attempt to activate a prediction event in the recognizer for a symbol that is not set up as a prediction event. Numeric value: 94. Suggested message: "Symbol is not set up for prediction events".

Macro: int MARPA_ERR_SYMBOL_VALUED_CONFLICT

Unvalued symbols are a deprecated Marpa feature, which may be avoided with the marpa_g_force_valued method. An unvalued symbol may take on any value, and therefore a symbol which is unvalued at some points cannot safely to be used to contain a value at others. This error indicates that such an unsafe use is being attempted. Numeric value: 74. Suggested message: "Symbol is treated both as valued and unvalued".

Macro: int MARPA_ERR_TERMINAL_IS_LOCKED

An attempt was made to change the terminal status of a symbol to a different value after it was locked. Numeric value: 75. Suggested message: "The terminal status of the symbol is locked".

Macro: int MARPA_ERR_TOKEN_IS_NOT_TERMINAL

A token was specified whose symbol ID is not a terminal. Numeric value: 76. Suggested message: "Token symbol must be a terminal".

Macro: int MARPA_ERR_TOKEN_LENGTH_LE_ZERO

A token length was specified which is less than or equal to zero. Zero-length tokens are not allowed in Libmarpa. Numeric value: 77. Suggested message: "Token length must greater than zero".

Macro: int MARPA_ERR_TOKEN_TOO_LONG

The token length is too long. The limit on the length of a token is implementation dependent, but it is at least 500,000,000 earlemes. An application using a token that long is almost certain to run into some other limit. Numeric value: 78. Suggested message: "Token is too long".

Macro: int MARPA_ERR_TREE_EXHAUSTED

A Libmarpa parse tree iterator is “exhausted”, that is, it has no more parses. Numeric value: 79. Suggested message: "Tree iterator is exhausted".

Macro: int MARPA_ERR_TREE_PAUSED

A Libmarpa tree is “paused” and an operation was attempted which is inconsistent with that fact. Typically, this operation will be a call of the marpa_t_next() method. Numeric value: 80. Suggested message: "Tree iterator is paused".

Macro: int MARPA_ERR_UNEXPECTED_TOKEN_ID

An attempt was made to read a token where a token with that symbol ID is not expected. This message can also occur when an attempt is made to read a token at a location where no token is expected. Numeric value: 81. Suggested message: "Unexpected token".

Macro: int MARPA_ERR_UNPRODUCTIVE_START

The start symbol is unproductive. That means it could never match any possible input, not even the null string. Presumably, an error in writing the grammar. Numeric value: 82. Suggested message: "Unproductive start symbol".

Macro: int MARPA_ERR_VALUATOR_INACTIVE

The valuator is inactive in a context where that should not be the case. Numeric value: 83. Suggested message: "Valuator inactive".

Macro: int MARPA_ERR_VALUED_IS_LOCKED

Unvalued symbols are a deprecated Marpa feature, which may be avoided with the marpa_g_force_valued method. This error code indicates that the valued status of a symbol is locked, and an attempt was made to change it to a status different from the current one. Numeric value: 84. Suggested message: "The valued status of the symbol is locked".

Macro: int MARPA_ERR_SYMBOL_IS_NULLING

An attempt was made to do something with a nulling symbol that is not allowed. For example, the ID of a nulling symbol cannot be an argument to marpa_r_expected_symbol_event_set — because it is not possible to create an “expected symbol” event for a nulling symbol. Numeric value: 87. Suggested message: "Symbol is nulling".

Macro: int MARPA_ERR_SYMBOL_IS_UNUSED

An attempt was made to do something with an unused symbol that is not allowed. An “unused” symbol is a inaccessible or unproductive symbol. For example, the ID of a unused symbol cannot be an argument to marpa_r_expected_symbol_event_set — because it is not possible to create an “expected symbol” event for an unused symbol. Numeric value: 88. Suggested message: "Symbol is not used".


Next: , Previous: , Up: Error methods macros and codes   [Contents]