Crate xtrakcad_parser

Crate xtrakcad_parser 

Source
Expand description

XtrkCAD layout file parser in Rust, using a lalrpop parser.

Ported from the Bison++/C++ parser that is part of the Model Railroad System

The parser is invoked as part of the new() class function of the Layout struct. This function takes a layout filename as its only parameter. It opens the file and procedes to parse the file and the parser’s action code populates the Layout struct with the contents of the file. The new() returns the fully populated struct, which can then be accessed via various accessor methods to retrieve information about the layout, including tracks, structures, scenery features, and control features.

Modules§

xtrakcad

Structs§

Aspect
Signal aspect
AspectList
Signal aspect list
BZLSegments
BZLSegments list.
BZRLine
BZRLine struct
BZRLineBody
A BZRLineBody Struct
BZSegments
BZSegments list struct
Bezier
Bezier curve track struct
BezierBody
A Bezier Body
Block
A Block
Car
Car struct
CarAux
CarAux – car on layout information
Control
A control
Cornu
Cornu curve track struct
CornuBody
A Cornu body
CornuBodyElement
A CornuBodyElement
Curve
Curve track struct
Drawing
Drawing struct
FBlock
A FBlock liist
FBlockElement
A FBlock element
FileLocation
File location structure. The file’s location is a column on a line
IntegerList
A list of integers (u32)
Joint
Joint track struct
Layer
Layer struct
Layout
Layout structure. Contains a parsed layout file.
Lexer
Lexer structure Reads characters from the layout file and returns Tokens to the Parser. Handles all of the low-level character level processing
Note
Note struct
Sensor
A sensor
Signal
A signal
Straight
Straight track struct
Structure
Structure struct
StructureBody
A list of Structure Body Elements
SwitchMotor
A switch motor control
TextItem
A text item
TrackBody
A track body (conventual track)
Turnout
Turnout track struct
TurnoutBody
A turnout body
Turntable
Turntable track struct

Enums§

BZSegment
BZSegment elements
BezierBodyElement
Bezier Body elements
FloatOrString
A Float (f64) or String
LayoutError
Layout error codes
LexicalError
Lexer errors
Scale
Standard scales
ScanEOL
Manage special case of parsing Title lines.
StructureBodyElement
A Structure Body Element
Tok
Lexer tokens
TrackBodyElement
A track body element (track ends)
TrackBodySubElement
A track body sub element
TurnoutBodyElement
TurnoutBodyElements

Type Aliases§

Spanned
Lexer result type