Class OmlReader

java.lang.Object
dev.omnist.oml.OmlReader

public class OmlReader extends Object
OML (Omnist Markup Language) Core Reader (omnist-spec ยง4). Reads OML-Core text format into a Document using OmlLexer.
  • Constructor Details

    • OmlReader

      public OmlReader(String source, Limits limits)
      Constructs a reader over a pre-tokenized OML source. The source is immediately tokenized by OmlLexer during construction.
      Parameters:
      source - the OML text; null is treated as empty
      limits - safety limits applied during tokenization and parsing; null defaults to Limits.DEFAULT
  • Method Details

    • read

      public static Document read(String source)
      Parses OML text into a Document using Limits.DEFAULT safety limits. Equivalent to read(source, Limits.DEFAULT).
      Parameters:
      source - the OML text; null is treated as empty
      Returns:
      the parsed document
      Throws:
      OmlParseException - if the text contains any lexical or structural error
    • read

      public static Document read(String source, Limits limits)
      Parses OML text into a Document using caller-supplied safety limits.
      Parameters:
      source - the OML text; null is treated as empty
      limits - safety limits for depth, node count, and integer digit length; null defaults to Limits.DEFAULT
      Returns:
      the parsed document
      Throws:
      OmlParseException - if any limit is exceeded or the text is malformed
    • parseDocument

      public Document parseDocument()
      Parses the token stream into a top-level Document. Handles three shapes: an empty document (returns an empty Node), 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