Package atessera.markup
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:- Headers phase — non-empty trimmed lines at the
beginning are offered to a set of
HeaderLinematchers. The first unrecognised line ends this phase and is forwarded to the states phase without being discarded. - States phase — each trimmed line is checked
against
NewStateLinematchers to detect section boundaries. When a boundary is found, the previousStateiscommittedand a new state becomes active. Lines that do not trigger a transition are dispatched to the current state'sonLinemethod.
- Headers phase — non-empty trimmed lines at the
beginning are offered to a set of
- Nested interfaces
-
HeaderLine— inspects a header line and updates the model if recognised.NewStateLine— detects state boundaries and creates newStateinstances.State— accumulates lines belonging to a single logical section and finalizes withcommit.
Concrete implementations
PresentationParser- Parses Alpha Tessera presentation files (with
FRAME BEGIN/FRAME ENDmarkers, global headers likeTITLE,SUBTITLE,AUTHORS, and frame-level metadata) into aPresentationContentmodel. ExtendsTextStateParser<PresentationContent>with:- Header matchers for
TITLE,SUBTITLE,AUTHORS,DATE, andTHEME. - Frame state that accumulates source lines and metadata
(
TITLE,SUBTITLE,LABEL,LISTING_LANG) inside a frame. - State-boundary matchers that detect
FRAME BEGIN [type]andFRAME END.
parsePresentation(List<String>)for one-step parsing. - Header matchers for
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.
-
ClassDescriptionParses Alpha Tessera presentation files into
PresentationContent.A generic two-phase line-by-line text parser based on a state machine pattern.Matches a line as a header entry during the headers phase.Detects a state boundary and creates the correspondingTextStateParser.State.Represents a parsing state that processes lines belonging to a specific section of the input.