public final class ParserUtils
extends java.lang.Object
SimpleParser
and parse
Smithy grammar productions.Modifier and Type | Method and Description |
---|---|
static void |
consumeIdentifier(SimpleParser parser)
Expects and skips over a Smithy identifier production.
|
static void |
consumeNamespace(SimpleParser parser)
Expects and consumes a valid Smithy shape ID namespace.
|
static boolean |
isAlphabetic(char c)
Returns true if the given character is an alphabetic character
A-Z, a-z.
|
static boolean |
isDigit(char c)
Returns true if the given value is a digit 0-9.
|
static boolean |
isIdentifierStart(char c)
Returns true if the given character is allowed to start an identifier.
|
static boolean |
isValidIdentifierCharacter(char c)
Returns true if the given character is allowed in an identifier.
|
static java.lang.String |
parseIdentifier(SimpleParser parser)
Expects and returns a parsed Smithy identifier production.
|
static java.lang.String |
parseNumber(SimpleParser parser)
Parses a Smithy number production into a string.
|
static java.lang.String |
parseRootShapeId(SimpleParser parser)
Expects and returns a parsed absolute Smithy Shape ID that
does not include a member.
|
static java.lang.String |
parseShapeId(SimpleParser parser)
Expects and returns a parsed absolute Smithy Shape ID.
|
public static java.lang.String parseNumber(SimpleParser parser)
-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?
parser
- Parser to consume tokens from.public static java.lang.String parseIdentifier(SimpleParser parser)
parser
- Parser to consume tokens from.public static java.lang.String parseRootShapeId(SimpleParser parser)
parser
- Parser to consume tokens from.public static java.lang.String parseShapeId(SimpleParser parser)
parser
- Parser to consume tokens from.public static void consumeNamespace(SimpleParser parser)
parser
- Parser to consume tokens from.public static void consumeIdentifier(SimpleParser parser)
identifier = identifier_start *identifier_chars identifier_start = *"_" ALPHA identifier_chars = ALPHA / DIGIT / "_"
parser
- Parser to consume tokens from.public static boolean isValidIdentifierCharacter(char c)
c
- Character to check.public static boolean isIdentifierStart(char c)
c
- Character to check.public static boolean isDigit(char c)
c
- Character to check.public static boolean isAlphabetic(char c)
Character.isAlphabetic(int)
.c
- Character to check.