Class OsdReader

java.lang.Object
dev.omnist.schema.OsdReader

public class OsdReader extends Object
OSD (Omnist Schema Definition) Reader (omnist-spec §5). Parses OSD text into a Schema.
  • Constructor Details

    • OsdReader

      public OsdReader(String source)
      Constructs a reader for the given OSD source text. The source is immediately tokenized by OsdLexer during construction.
      Parameters:
      source - the OSD text to parse; null is treated as empty
  • Method Details

    • read

      public static Schema read(String source)
      Parses OSD text and returns the resulting Schema. Convenience wrapper for new OsdReader(source).parseSchema().
      Parameters:
      source - the OSD text; null is treated as empty
      Returns:
      the fully-validated Schema
      Throws:
      OsdParseException - if the text is syntactically or structurally invalid
    • parseSchema

      public Schema parseSchema()
      Parses the token stream into a Schema (omnist-spec §5.5–§5.8). Processes record and root declarations in any order, then validates that a root is declared, that the root record exists, and that all Type.Ref targets resolve to defined records.
      Returns:
      the fully-validated Schema
      Throws:
      OsdParseException - on duplicate record names, duplicate root declarations, missing root, undeclared root record, or unresolved type references