public final class UnicodeRangeValueParser extends Object implements Parser
UnicodeRangeValue
.
There are three types of allowed values:
- single codepoint (e.g. U+416
)
- interval range (e.g. U+400-4ff
)
- wildcard range (e.g. U+4??
)
Check out the grammar (see UNICODE-RANGE) and the textual spec.
The grammar indicates otherwise, but textual spec says that only trailing '?' are allowed (not mixed in between hexidecimals), and also that '?' is not allowed in ranges. Verified in chrome that this is how they treat it as well, so going with that (even though it makes this parser much more complicated than otherwise). The textual spec also implies that a max of 5 '?' are allowed, not 6, but we won't worry about that for now.
This does not validate the range of the code points specified (unicode codepoint values must be between 0 and 10FFFF inclusive, end ranges must come after start ranges, etc...). If this is important, a custom validation plugin can be written. However this does validate the length of the code point, {1-6}.
UnicodeRangeValue
Constructor and Description |
---|
UnicodeRangeValueParser() |
Modifier and Type | Method and Description |
---|---|
boolean |
parse(Source source,
Grammar grammar,
Broadcaster broadcaster)
Parse from the current position of the given source, notifying the given
Broadcaster of any applicable events and
data. |
public boolean parse(Source source, Grammar grammar, Broadcaster broadcaster)
Parser
Broadcaster
of any applicable events and
data.
Necessary grammar tokens and other parsers should be retrieved from the provided Grammar
instance.
parse
in interface Parser
source
- The source to parse.grammar
- The grammar.broadcaster
- The broadcaster.#parse(Source, Grammar, Broadcaster, Boolean)
Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.