-
Couldn't load subscription status.
- Fork 0
Field annotations
This annotation should be used on fields that represent tokens that may not be present in parser input.
A whenFollowedBy annotation parameter may be used on conditionally optional fields. If provied, parser will test the following characters for exact match with whenFollowedBy value and fail parent token if the test fails. It is a better practice, however, to mark conditionally optional tokens with @SkipIfFollowedBy annotation.
whenFieldIsNull and whenFieldNotNull context-aware annotations were added in version 0.8. These annotations allow to mark some fields as optional at the parsing stage by analyzing the status of previously populated (or skipped) fields. These annotations take field name as their value.
Thi annotation should be used on fields that represent conditionally optional tokens.
It takes a string value and works similarly to @OptionalToken annotation with whenFollowedBy parameter.
This annotation should be used on array fields to impose minimum and/or maximum number of tokens to populate the array with.
It takes two int parameters: min and max
Thi annotation should be used on String fields to define a regular expression pattern that a token for that field should match.
It takes several parameters:
-
value(or its deprecated alternativepattern): Accepts a regular expression that will be used to match characters from the input. If provided thenuntilparameter will be ignored -
replacement: Accepts a regular expression replacement parameter that can be used either to:- transform matched by defined as
valueregexp text - transform matched by
untillimiter and append transformation result to the end of captured text
- transform matched by defined as
- until: Accepts a regular expression that Parser will use as stop token for capturing process.
- If no
replacementis specified, then matched by this expression stop token will be discarded. - If
replacementis specified, then stop token will be transformed using that value and appended to captured text - Ignored if either
valueorpatternare not empty
- If no
Should be used on fields that require a custom TokenMatcher. May not be fully supported in latest versions.
This annotation (added in version 0.8) allows configuring field matcher to exactly match a value previously matched for another field inside a grammar rule represented by the same CompoundToken. The annotation takes one parameter matchField that accepts the name of previosly populated field to be matched.