Table of Contents

Class JBeamParser

Namespace
LibreRally.Vehicle.JBeam
Assembly
LibreRally.dll

Parses .jbeam files into a list of JBeamPart objects.

jbeam extends JSON with:

  • C-style // line comments and /* */ block comments
  • Optional commas between array/object elements (any adjacent values)
  • Trailing commas before } or ]

The private preprocessing stage normalises the text to valid JSON before parsing.

public static class JBeamParser
Inheritance
JBeamParser
Inherited Members

Methods

Parse(string)

Parses jbeam text into a list of JBeamPart objects.

public static List<JBeamPart> Parse(string jbeamText)

Parameters

jbeamText string

The raw jbeam string to parse.

Returns

List<JBeamPart>

A list of parsed parts.

Exceptions

FormatException

Thrown when the preprocessed text cannot be parsed as JSON.

ParseFile(string, Dictionary<string, float>?)

Parses a .jbeam file from the given path into a list of JBeamPart objects.

public static List<JBeamPart> ParseFile(string path, Dictionary<string, float>? vars = null)

Parameters

path string

The file path to parse.

vars Dictionary<string, float>

Optional variable table for resolving $var expressions.

Returns

List<JBeamPart>

A list of parsed parts.

ParseVariableDefaultsFile(string, Dictionary<string, float>?)

Parses only the variable defaults from a .jbeam file.

public static Dictionary<string, float> ParseVariableDefaultsFile(string path, Dictionary<string, float>? inheritedVars = null)

Parameters

path string

The file path to parse.

inheritedVars Dictionary<string, float>

Optional dictionary of inherited variable values.

Returns

Dictionary<string, float>

A dictionary of variable names and their default values.

SetVars(Dictionary<string, float>?)

Sets the active variable table for the current thread. Any $varName values encountered during parsing will be resolved from this dictionary.

public static void SetVars(Dictionary<string, float>? vars)

Parameters

vars Dictionary<string, float>

Variable map for the current parse, or null to clear it.