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
jbeamTextstringThe raw jbeam string to parse.
Returns
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
pathstringThe file path to parse.
varsDictionary<string, float>Optional variable table for resolving $var expressions.
Returns
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
pathstringThe file path to parse.
inheritedVarsDictionary<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
varsDictionary<string, float>Variable map for the current parse, or null to clear it.