Package org.bct.api
Class NestedTokenizer
java.lang.Object
org.bct.api.NestedTokenizer
Splits a nested comma-delimited string into a list of Token objects using a state machine parser.
This class parses complex nested structures with support for escaping and arbitrary nesting depth. The parser uses a finite state machine to handle different contexts during parsing.
Supported Syntax:
"foo" - Single value token"foo,bar" - Multiple value tokens"foo{a,b},bar" - Token with nested values"foo{a{a1,a2}},bar" - Recursively nested values"foo\\,bar" - Escaped comma in value"foo\\{bar\\}" - Escaped braces in value
State Machine:
The parser operates in several states:
- PARSING_VALUE: Reading a token value
- PARSING_NESTED: Reading nested content within braces
- IN_ESCAPE: Processing escaped character
Usage Examples:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumParser states for the finite state machine.static classRepresents a parsed token with optional nested sub-tokens. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
NestedTokenizer
NestedTokenizer()
-
-
Method Details
-
tokenize
-