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

A {0} in the Message entry is a placeholder for a context-dependent diagnostic.

Code Rule Message
NAXP1001SyntaxAn atom may take only one quantifier. To repeat something already quantified, group it first with parentheses, as in '(A?){2}'.
NAXP1002SyntaxThe counts of an interval are separated by ',', not '-'. Write 'A{2,5}'.
NAXP1003SyntaxAn interval cannot be unbounded. Include both counts, as in 'A{2,5}'.
NAXP1004SyntaxThis interval is not closed. Add a '}'.
NAXP1005SyntaxAn interval count must be one or two digits.
NAXP1006SyntaxThe digits of an interval count cannot be separated by whitespace.
NAXP1007W4The first count of an interval cannot exceed the second.
NAXP1008W4An interval count may have at most two digits.
NAXP1009SyntaxThis group is not closed. Add a ')'.
NAXP1010Syntax'!!' makes the element before it optional, so that element cannot also have a '?'. Remove the preceding '?'.
NAXP1011Syntax'!?' makes the element before it optional, so that element cannot also have a '?'. Remove the preceding '?'.
NAXP1012Syntax'!!' must be written as one token. It cannot be split by whitespace.
NAXP1013Syntax'!?' must be written as one token. It cannot be split by whitespace.
NAXP1014SyntaxA '!' must be followed by its rendering. Write 'x!y', 'x!!' or 'x!?'; there is no bare 'x!'.
NAXP1015SyntaxThere should be no whitespace between '#' and '[' in a decimal range.
NAXP1016SyntaxA '#' introduces a decimal range and must be followed by '['. To match a hash write '\#'.
NAXP1017SyntaxThe bounds of a decimal range are separated by '-', not ','. Write '#[0-105]'.
NAXP1018SyntaxThis decimal range is not closed. Add a ']'.
NAXP1019SyntaxA decimal range bound must be a run of one to fifteen digits.
NAXP1020SyntaxThe digits of a decimal range bound cannot be separated by whitespace.
NAXP1021W4The lower bound of a decimal range may not have more digits than the upper bound.
NAXP1022W4Where the upper bound of a decimal range has more digits than the lower, it may not have leading zeros.
NAXP1023W4The lower bound of a decimal range may not exceed the upper bound.
NAXP1024W4A decimal range bound may have at most fifteen digits.
NAXP1025SyntaxThis character set is not closed. Add a ']'.
NAXP1026SyntaxA range in a character set runs between two single characters. Its upper bound cannot be a block escape.
NAXP1027SyntaxA range in a character set must be written lowest first. Write '{0}'.
NAXP1028SyntaxA character set must contain at least one character. '[]' is invalid.
NAXP1029SyntaxA '\' cannot be followed by whitespace. To match a space write '\s'.
NAXP1030SyntaxA '\' must be followed by an escape letter or a reserved character.
NAXP1031Syntax'\{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.
NAXP1032Syntax{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.
NAXP1033SyntaxAn element is expected here, but the naxp ends.
NAXP1034SyntaxAn alternative must contain at least one element. To admit the empty string write '()'.
NAXP1035SyntaxThe '!' operator requires a left operand, the subject it unifies. To match an exclamation mark write '\!'.
NAXP1036SyntaxThe naxp ends before it is complete.
NAXP1037Syntax'{0}' is reserved and cannot appear here. To match that character write '\{0}'.
NAXP1038Syntax{0} cannot appear here.
NAXP1039W2A '!' may not nest. Neither the left operand (the subject) nor the right one (the rendering) may contain another '!'.
NAXP1040W1The subject of a '!!' must generate exactly one string, because it is also the rendering.
NAXP1041W1The rendering of a '!' must generate exactly one string.
NAXP1042W1This element cannot be deleted, because its subject does not generate the empty string. Make the subject optional.
NAXP1043W1The rendering '{0}' is not one of the strings its subject generates, so reconstituted text could not be encoded.
NAXP1044W3Text unification must be single valued, but this naxp results in multiple canonical forms for some text inputs.
NAXP1045W3Text unification must be single valued, but '{0}' results in multiple canonical forms.
NAXP1046W5This naxp has more than the maximum permitted 18 446 744 073 709 551 615 encoded values.
NAXP1047W6This element generates a string longer than the maximum permitted 1999 characters.
NAXP1048W6This naxp exceeds the maximum permitted 2000 states.
NAXP1049W6This naxp needs more than the maximum permitted 2000 states to canonicalise.
NAXP1050W6Deciding whether unification is single valued for this naxp needs more than the maximum permitted 2000 pair states.
NAXP1051W6Deciding whether unification is single valued for this naxp needs an intermediate string longer than the maximum permitted 1999 characters.
NAXP1052Syntax'\{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.
NAXP1053SyntaxThe '!' or '?' must immediately follow the preceding zero without any separating whitespace.
NAXP1054W4Only a zero may be marked with '!' or '?'.
NAXP1055W4Only 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 '?'.
NAXP1056W4Only the lower bound of a decimal range may be marked with '!' or '?'.
NAXP1057SyntaxThere is no group for this ')' to close. To match a parenthesis write '\)'.
NAXP1058SyntaxA case fold cannot begin the rendering of a '!'. Write the rendering in the case you want, or case fold the whole text unification.
NAXP1059Syntax'{0}' is reserved. naxp has no unbounded repetition, so write an interval such as '{1,9}'. To match the character write '\{0}'.
NAXP1060Syntax'.' is reserved. Write the character set you mean, such as '\X'. To match a full stop write '\.'.
NAXP1061Syntax'{0}' is reserved. A naxp always matches the whole text, so there are no anchor operators. To match the character write '\{0}'.
NAXP1062W4A 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.
NAXP2003The [Naxp] attribute cannot be applied to a generic type such as '{0}'.
NAXP2004Missing or null naxp argument. It should look something like '[Naxp(@"\A\9\X \s!! \9\A\A", typeof(int))]'.
NAXP2005Prefix = "{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)'.
NAXP2008This 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).
NAXP2009The 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.