naxp error codes
naxp error reporting is founded on invariant error codes, e.g. NAXP1031.
(In contrast, the associated error messages may vary,
because they include some of the invalid text or
because they are later revised for improved clarity or even translated into another language.)
Error codes NAXP1001 to NAXP1999 are reserved for
parsing and other naxp errors.
Validation and error reporting are identical across all implementations.
Error codes from NAXP2001 upwards are used for build errors,
currently produced only by the C# source generator.
Tip
Each code below is linkable, as /error-codes/#naxp1031.
In Visual Studio the code in the Error List links here directly.
naxp errors
The table below lists parsing and other naxp errors.
The Rule column categorises the errors as
- Syntax for syntax errors, or
- W1 to W6 for failure against the spec’s well-formedness rules.
A {0} in the Message entry is
a placeholder for a context-dependent diagnostic.
| Code | Rule | Message |
|---|---|---|
NAXP1001 | Syntax | An atom may take only one quantifier. To repeat something already quantified, group it first with parentheses, as in '(A?){2}'. |
NAXP1002 | Syntax | The counts of an interval are separated by ',', not '-'. Write 'A{2,5}'. |
NAXP1003 | Syntax | An interval cannot be unbounded. Include both counts, as in 'A{2,5}'. |
NAXP1004 | Syntax | This interval is not closed. Add a '}'. |
NAXP1005 | Syntax | An interval count must be one or two digits. |
NAXP1006 | Syntax | The digits of an interval count cannot be separated by whitespace. |
NAXP1007 | W4 | The first count of an interval cannot exceed the second. |
NAXP1008 | W4 | An interval count may have at most two digits. |
NAXP1009 | Syntax | This group is not closed. Add a ')'. |
NAXP1010 | Syntax | '!!' makes the element before it optional, so that element cannot also have a '?'. Remove the preceding '?'. |
NAXP1011 | Syntax | '!?' makes the element before it optional, so that element cannot also have a '?'. Remove the preceding '?'. |
NAXP1012 | Syntax | '!!' must be written as one token. It cannot be split by whitespace. |
NAXP1013 | Syntax | '!?' must be written as one token. It cannot be split by whitespace. |
NAXP1014 | Syntax | A '!' must be followed by its rendering. Write 'x!y', 'x!!' or 'x!?'; there is no bare 'x!'. |
NAXP1015 | Syntax | There should be no whitespace between '#' and '[' in a decimal range. |
NAXP1016 | Syntax | A '#' introduces a decimal range and must be followed by '['. To match a hash write '\#'. |
NAXP1017 | Syntax | The bounds of a decimal range are separated by '-', not ','. Write '#[0-105]'. |
NAXP1018 | Syntax | This decimal range is not closed. Add a ']'. |
NAXP1019 | Syntax | A decimal range bound must be a run of one to fifteen digits. |
NAXP1020 | Syntax | The digits of a decimal range bound cannot be separated by whitespace. |
NAXP1021 | W4 | The lower bound of a decimal range may not have more digits than the upper bound. |
NAXP1022 | W4 | Where the upper bound of a decimal range has more digits than the lower, it may not have leading zeros. |
NAXP1023 | W4 | The lower bound of a decimal range may not exceed the upper bound. |
NAXP1024 | W4 | A decimal range bound may have at most fifteen digits. |
NAXP1025 | Syntax | This character set is not closed. Add a ']'. |
NAXP1026 | Syntax | A range in a character set runs between two single characters. Its upper bound cannot be a block escape. |
NAXP1027 | Syntax | A range in a character set must be written lowest first. Write '{0}'. |
NAXP1028 | Syntax | A character set must contain at least one character. '[]' is invalid. |
NAXP1029 | Syntax | A '\' cannot be followed by whitespace. To match a space write '\s'. |
NAXP1030 | Syntax | A '\' must be followed by an escape letter or a reserved character. |
NAXP1031 | Syntax | '\{0}' is not an escape. A backslash may be followed by one of the letters 's', '9', 'A', 'a', 'X', 'x', 'C' and 'c', or by a reserved character. |
NAXP1032 | Syntax | {0} cannot appear in a naxp. The only valid characters in a naxp are whitespace and the printable ASCII characters U+0021 to U+007E. |
NAXP1033 | Syntax | An element is expected here, but the naxp ends. |
NAXP1034 | Syntax | An alternative must contain at least one element. To admit the empty string write '()'. |
NAXP1035 | Syntax | The '!' operator requires a left operand, the subject it unifies. To match an exclamation mark write '\!'. |
NAXP1036 | Syntax | The naxp ends before it is complete. |
NAXP1037 | Syntax | '{0}' is reserved and cannot appear here. To match that character write '\{0}'. |
NAXP1038 | Syntax | {0} cannot appear here. |
NAXP1039 | W2 | A '!' may not nest. Neither the left operand (the subject) nor the right one (the rendering) may contain another '!'. |
NAXP1040 | W1 | The subject of a '!!' must generate exactly one string, because it is also the rendering. |
NAXP1041 | W1 | The rendering of a '!' must generate exactly one string. |
NAXP1042 | W1 | This element cannot be deleted, because its subject does not generate the empty string. Make the subject optional. |
NAXP1043 | W1 | The rendering '{0}' is not one of the strings its subject generates, so reconstituted text could not be encoded. |
NAXP1044 | W3 | Text unification must be single valued, but this naxp results in multiple canonical forms for some text inputs. |
NAXP1045 | W3 | Text unification must be single valued, but '{0}' results in multiple canonical forms. |
NAXP1046 | W5 | This naxp has more than the maximum permitted 18 446 744 073 709 551 615 encoded values. |
NAXP1047 | W6 | This element generates a string longer than the maximum permitted 1999 characters. |
NAXP1048 | W6 | This naxp exceeds the maximum permitted 2000 states. |
NAXP1049 | W6 | This naxp needs more than the maximum permitted 2000 states to canonicalise. |
NAXP1050 | W6 | Deciding whether unification is single valued for this naxp needs more than the maximum permitted 2000 pair states. |
NAXP1051 | W6 | Deciding whether unification is single valued for this naxp needs an intermediate string longer than the maximum permitted 1999 characters. |
NAXP1052 | Syntax | '\{0}' is a case fold and applies to a whole element, so it cannot appear inside a character set. Write it before the set instead. |
NAXP1053 | Syntax | The '!' or '?' must immediately follow the preceding zero without any separating whitespace. |
NAXP1054 | W4 | Only a zero may be marked with '!' or '?'. |
NAXP1055 | W4 | Only zeros at the front of a number may be marked with '!' or '?'. The lower bound must always end with a digit without a '!' or a '?'. |
NAXP1056 | W4 | Only the lower bound of a decimal range may be marked with '!' or '?'. |
NAXP1057 | Syntax | There is no group for this ')' to close. To match a parenthesis write '\)'. |
NAXP1058 | Syntax | A case fold cannot begin the rendering of a '!'. Write the rendering in the case you want, or case fold the whole text unification. |
NAXP1059 | Syntax | '{0}' is reserved. naxp has no unbounded repetition, so write an interval such as '{1,9}'. To match the character write '\{0}'. |
NAXP1060 | Syntax | '.' is reserved. Write the character set you mean, such as '\X'. To match a full stop write '\.'. |
NAXP1061 | Syntax | '{0}' is reserved. A naxp always matches the whole text, so there are no anchor operators. To match the character write '\{0}'. |
NAXP1062 | W4 | A fixed count of zero matches only the empty string. Write '()' instead. |
Build errors (C# source generator)
Build errors are currently reported only by the C# source generator included with the
naxp .NET package.
These errors relate to either the [Naxp] attribute itself or the type it annotates.
| Code | Message |
|---|---|
NAXP2001 | '{0}' is annotated with [Naxp] but is not a partial class or struct. Add the 'partial' modifier to '{0}'. |
NAXP2002 | '{0}' is annotated with [Naxp] but its containing type, '{1}', is not a partial class or struct. Add the 'partial' modifier to '{1}' as well. |
NAXP2003 | The [Naxp] attribute cannot be applied to a generic type such as '{0}'. |
NAXP2004 | Missing or null naxp argument. It should look something like '[Naxp(@"\A\9\X \s!! \9\A\A", typeof(int))]'. |
NAXP2005 | Prefix = "{0}" cannot start the generated member names: {1} Use ASCII letters, digits and underscores, starting with a letter or an underscore. |
NAXP2006 | '{0}' has two naxps with Prefix = "{1}", which would generate two members called '{1}Accepts'. Give each naxp in the same class or struct a different Prefix. |
NAXP2007 | {0} is not a valid encoded value type. Pass typeof of an integer type, e.g. 'typeof(int)'. |
NAXP2008 | This naxp encodes {0} values, which does not fit into {1}. Pass 'typeof({2})' or wider as the encoded value type (or change the naxp to produce a smaller number of encoded values). |
NAXP2009 | The naxp generator failed on this naxp. This is likely a bug in naxp rather than in your code: {0} Please report it at https://github.com/naxp-org/naxp/issues. |
NAXP2010 | '{0}' is a file-local type, which will not work with the source generator. Drop the 'file' modifier. |