Package dev.omnist.oml
Class OmlReader
java.lang.Object
dev.omnist.oml.OmlReader
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
OmlReader
Constructs a reader over a pre-tokenized OML source. The source is immediately tokenized byOmlLexerduring construction.- Parameters:
source- the OML text;nullis treated as emptylimits- safety limits applied during tokenization and parsing;nulldefaults toLimits.DEFAULT
-
-
Method Details
-
read
Parses OML text into aDocumentusingLimits.DEFAULTsafety limits. Equivalent toread(source, Limits.DEFAULT).- Parameters:
source- the OML text;nullis treated as empty- Returns:
- the parsed document
- Throws:
OmlParseException- if the text contains any lexical or structural error
-
read
Parses OML text into aDocumentusing caller-supplied safety limits.- Parameters:
source- the OML text;nullis treated as emptylimits- safety limits for depth, node count, and integer digit length;nulldefaults toLimits.DEFAULT- Returns:
- the parsed document
- Throws:
OmlParseException- if any limit is exceeded or the text is malformed
-
parseDocument
Parses the token stream into a top-levelDocument. Handles three shapes: an empty document (returns an emptyNode), a node-edge list (label-colon-value pairs separated by newlines), and a bare scalar value.- Returns:
- the parsed document
- Throws:
OmlParseException- if the token stream does not form a valid OML document
-