Enum Class RNCTokenType
- All Implemented Interfaces:
Serializable,Comparable<RNCTokenType>,Constable
RNCScanner when scanning
RELAX NG Compact Syntax (RNC) text.
Use case: consumed by all RNC language features (formatting, semantic tokens, folding, highlighting, completions, code actions) to analyze the structure of an RNC document without building a full AST.
Example — the RNC text start = element root { text }
produces the following token sequence:
KeywordStart "start"
Whitespace " "
Assign "="
Whitespace " "
KeywordElement "element"
Whitespace " "
Identifier "root"
Whitespace " "
BraceOpen "{"
Whitespace " "
KeywordText "text"
Whitespace " "
BraceClose "}"
EOS
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe interleave operator:&.The assignment operator:=.The choice-combine assignment operator:|=.The interleave-combine assignment operator:&=.The backslash:\.Closing brace:}.Opening brace:{.Closing bracket:].Opening bracket:[.The colon separator::.The group (sequence) operator:,.A single-line comment starting with#(but not##).A documentation comment starting with##.End of stream — returned when the scanner has consumed all input.A user-defined identifier (define name, element/attribute name reference).Theattributekeyword — defines an attribute pattern.Thedatatypeskeyword — declares a datatype library prefix.Thedefaultkeyword — used withnamespaceto set the default namespace.Thedivkeyword — groups grammar definitions for organizational purposes (has no semantic effect).Theelementkeyword — defines an element pattern.Theemptykeyword — matches empty content (no text, no elements).Theexternalkeyword — references an external grammar as a pattern.Thegrammarkeyword — defines an explicit grammar block.Theincludekeyword — includes another RNC grammar file.Theinheritkeyword — inherits the default namespace from the including grammar.Thelistkeyword — matches whitespace-separated tokens.Themixedkeyword — equivalent to(text | pattern)*, allows mixed content.Thenamespacekeyword — declares a namespace prefix.ThenotAllowedkeyword — a pattern that matches nothing.Theparentkeyword — references a define in the parent grammar (used insidegrammarblocks).Thestartkeyword — defines the start pattern of the grammar.Thestringkeyword — built-in datatype that matches a string value (with whitespace normalization).Thetextkeyword — matches any text content.Thetokenkeyword — built-in datatype that matches a tokenized string (whitespace collapsed).A quoted string literal (single or double quotes, including triple-quoted).The minus operator:-.Closing parenthesis:).Opening parenthesis:(.The choice (alternation) operator:|.The one-or-more postfix operator:+.The optional postfix operator:?— zero or one occurrence.The zero-or-more postfix operator:*.The tilde operator:~.An unknown/unrecognized character.Whitespace: spaces, tabs, newlines, carriage returns. -
Method Summary
Modifier and TypeMethodDescriptionstatic RNCTokenTypeReturns the enum constant of this class with the specified name.static RNCTokenType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
EOS
End of stream — returned when the scanner has consumed all input. -
Identifier
A user-defined identifier (define name, element/attribute name reference).Use case: in
root = element root { text }, the firstrootis an Identifier (define name), while the secondrootafterelementis also an Identifier (element name).Escaped identifiers (
\element,\text) are also reported as Identifier, allowing reserved words to be used as names. -
Literal
A quoted string literal (single or double quotes, including triple-quoted).Use case: namespace URIs, datatype values, include file paths.
Examples:
"http://example.com",'value',"""multi-line""". -
Comment
A single-line comment starting with#(but not##).Example:
# This is a regular comment -
DocumentationComment
A documentation comment starting with##.Documentation comments are attached to the following definition and can be used to generate human-readable schema documentation.
Example:
## The root element of the document -
KeywordNamespace
Thenamespacekeyword — declares a namespace prefix.Example:
namespace a = "http://example.com" -
KeywordDefault
Thedefaultkeyword — used withnamespaceto set the default namespace.Example:
default namespace = "http://example.com" -
KeywordDatatypes
Thedatatypeskeyword — declares a datatype library prefix.Example:
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" -
KeywordElement
Theelementkeyword — defines an element pattern.Example:
element root { text } -
KeywordAttribute
Theattributekeyword — defines an attribute pattern.Example:
attribute id { text } -
KeywordList
Thelistkeyword — matches whitespace-separated tokens.Example:
list { xsd:integer+ } -
KeywordMixed
Themixedkeyword — equivalent to(text | pattern)*, allows mixed content.Example:
mixed { element b { text }* } -
KeywordText
Thetextkeyword — matches any text content.Example:
element name { text } -
KeywordEmpty
Theemptykeyword — matches empty content (no text, no elements).Example:
element br { empty } -
KeywordNotAllowed
ThenotAllowedkeyword — a pattern that matches nothing. Used for extensibility (a definition can be overridden via combine).Example:
extra = notAllowed -
KeywordExternal
Theexternalkeyword — references an external grammar as a pattern.Example:
external "other.rnc" -
KeywordGrammar
Thegrammarkeyword — defines an explicit grammar block.Example:
grammar { start = element root { text } } -
KeywordStart
Thestartkeyword — defines the start pattern of the grammar.Example:
start = root -
KeywordInclude
Theincludekeyword — includes another RNC grammar file.Example:
include "common.rnc" -
KeywordDiv
Thedivkeyword — groups grammar definitions for organizational purposes (has no semantic effect).Example:
div { a = text } -
KeywordParent
Theparentkeyword — references a define in the parent grammar (used insidegrammarblocks).Example:
parent name -
KeywordInherit
Theinheritkeyword — inherits the default namespace from the including grammar.Example:
namespace local = inherit -
KeywordString
Thestringkeyword — built-in datatype that matches a string value (with whitespace normalization).Example:
attribute type { string "fixed" } -
KeywordToken
Thetokenkeyword — built-in datatype that matches a tokenized string (whitespace collapsed).Example:
attribute type { token "value" } -
Assign
The assignment operator:=.Example:
start = root -
AssignChoice
The choice-combine assignment operator:|=.Use case: extending a definition with additional alternatives. Example:
content |= newElement -
AssignInterleave
The interleave-combine assignment operator:&=.Use case: extending a definition with interleaved content. Example:
content &= optionalElement -
Pipe
The choice (alternation) operator:|.Example:
a | b | c— matches a, b, or c. -
Ampersand
The interleave operator:&.Example:
a & b— matches a and b in any order. -
Comma
The group (sequence) operator:,.Example:
a, b, c— matches a followed by b followed by c. -
QuestionMark
The optional postfix operator:?— zero or one occurrence.Example:
name? -
Star
The zero-or-more postfix operator:*.Example:
item* -
Plus
The one-or-more postfix operator:+.Example:
name+ -
Minus
The minus operator:-. Used in name classes for exception patterns.Example:
anyName - (foo | bar) -
Tilde
The tilde operator:~. Used as a shorthand for the inherit namespace in name classes. -
BraceOpen
Opening brace:{. Starts a block (element body, attribute body, div body, grammar body, include overrides). -
BraceClose
Closing brace:}. Ends a block. -
ParenOpen
Opening parenthesis:(. Groups patterns.Example:
(a | b)* -
ParenClose
Closing parenthesis:). -
BracketOpen
Opening bracket:[. Starts an annotation.Example:
[a:documentation "..."] -
BracketClose
Closing bracket:]. Ends an annotation. -
Colon
The colon separator::. Used for prefixed names.Example:
xsd:integer,a:documentation -
Backslash
The backslash:\. Used to escape keywords as identifiers.Example:
\element— uses "element" as an identifier rather than a keyword. -
Whitespace
Whitespace: spaces, tabs, newlines, carriage returns. Whitespace tokens are significant for the formatter (it adjusts them) but are skipped by most other language features. -
Unknown
An unknown/unrecognized character. Produced for characters that don't match any RNC syntax rule.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-