traindown library

Classes

ConsolePresenter
Turns a Session into a string that is decent for terminal output.
Formatter
Formatter takes in a list of tokens and returns a string formatted per the settings.
HtmlPresenter
Turns a Session into an HTML document.
Importer
Importer provides a means to pull in a blob of multiple Sessions and spit out Session instances.
Inspector
Inspector provides tools for analyzing Sessions.
JsonPresenter
Converts a Session into a JSON string.
Metadata
Metadatable
Metadatable provides an API for notes and kvps that are available at each scope of a Traindown document.
Movement
Movement represents a single type of exercise or, well, movement. A Movement has many Performances and a Session can have many Movements. An example would simply be "Squats".
MovementSearchResult
A search result that contains a DateTime and a Movement.
Parser
Parser defines the rules for the Traindown language and drives the Lexer to produce a list of tokens for further processing.
Performance
Performance represents a single expression of movement. It can be as little as a single or as much as needed. Each Performance must have a load otherwise it is somewhat nonsensical. Outside that, a Performance may have a count of repititions performed for the given load, a count of sets of reps, a count of failed reps, and a unit for the load.
Presenter
Base class for turning a Session into a string.
Session
Session represents a single instance of training. It contains data on what was performed as well as notes and metadata.
Token
A Token has a type and a literal. It is the intermediate form of the source that is used by things like the Formatter or Session to understand how to interpret the source.

Enums

TokenType
All possible types of Traindown tokens.
TraindownScope
Scope levels useful for querying

Functions

dateTimeState(Lexer lexer) Function
idleState(Lexer lexer) Function?
This is the default state. It routes to the appropriate state for further handling.
isColonTerminator(String chr) bool
This checks for the presence of : or EOF and is used to determine movement names and metakeys. Without a catch for EOF, this has the potential to infinite loop on malformed sources.
isLineTerminator(String chr) bool
Line termination is a critical piece to parsing Traindown. Here we look for the explicit codepoints that indicate EOL.
isWhitespace(String chr) bool
metaKeyState(Lexer lexer) Function
metaValueState(Lexer lexer) Function
movementState(Lexer lexer) Function?
noteState(Lexer lexer) Function
numberState(Lexer lexer) Function
valueState(Lexer lexer) Function