Package atessera.markup


package atessera.markup
Provides a generic state-machine-based framework for parsing line-oriented markup formats.

This package contains reusable parsing infrastructure that is used by higher-level subsystems to process structured text files. It does not define a specific markup language; instead it provides the abstract machinery that concrete parsers (such as PresentationParser) build upon.

Core abstractions

TextStateParser<M>
A generic two-phase line-by-line parser parameterized by a model type M. It processes a list of lines in two sequential phases:
  1. Headers phase — non-empty trimmed lines at the beginning are offered to a set of HeaderLine matchers. The first unrecognised line ends this phase and is forwarded to the states phase without being discarded.
  2. States phase — each trimmed line is checked against NewStateLine matchers to detect section boundaries. When a boundary is found, the previous State is committed and a new state becomes active. Lines that do not trigger a transition are dispatched to the current state's onLine method.
The model instance is shared across all phases, states, and matchers, accumulating results as parsing progresses.
Nested interfaces
  • HeaderLine — inspects a header line and updates the model if recognised.
  • NewStateLine — detects state boundaries and creates new State instances.
  • State — accumulates lines belonging to a single logical section and finalizes with commit.

Concrete implementations

PresentationParser
Parses Alpha Tessera presentation files (with FRAME BEGIN/​FRAME END markers, global headers like TITLE, SUBTITLE, AUTHORS, and frame-level metadata) into a PresentationContent model. Extends TextStateParser&lt;PresentationContent&gt; with:
  • Header matchers for TITLE, SUBTITLE, AUTHORS, DATE, and THEME.
  • Frame state that accumulates source lines and metadata (TITLE, SUBTITLE, LABEL, LISTING_LANG) inside a frame.
  • State-boundary matchers that detect FRAME BEGIN [type] and FRAME END.
Provides a static convenience method parsePresentation(List<String>) for one-step parsing.

Extending the framework

To parse a new markup format, extend TextStateParser with a suitable model type, supply implementations of HeaderLine, NewStateLine, and State, and pass them to the constructor. The two-phase design handles the common pattern of «global metadata followed by delimited sections» that appears in many line-oriented formats.

Relationship to other packages

This package sits at the bottom of the parsing stack and is consumed by the presentation subsystem. It is independent of the Markdown processing pipeline in atessera.markdown, which uses commonmark-java and has its own parser architecture.

See Also: