Table of Contents

Class ClsfRecordSyntax

Namespace
Hi.Numerical.ClsfParsers
Assembly
HiMech.dll

Per-record CLSF parsing syntax. Normalizes the block text (strips $$ comments, joins $ continuation lines), splits it into the record word and its comma-separated parameters, and stamps them into JsonObject under ClsfRecordKey for the downstream RecordTo* syntaxes to consume. Numeric parameters are pre-typed to double.

The word is everything before the first / with whitespace runs collapsed — multi-word heads (TOOL PATH) and hyphenated records without parameters (END-OF-PATH) are single words, fixing the legacy parser's first-token-only dispatch.

public class ClsfRecordSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
ClsfRecordSyntax
Implements
Inherited Members
Extension Methods

Examples

A GOTO record — word and typed parameters extracted, text fully consumed: #BeforeBuild:

{ "UnparsedText": "GOTO/10.5,20.25,3.5 $$ approach" }

#AfterBuild:

{ "ClsfRecord": { "Word": "GOTO", "Params": [10.5, 20.25, 3.5] } }

A multi-word head with a text parameter: #BeforeBuild:

{ "UnparsedText": "TOOL PATH/S1,TOOL,MILL_D10" }

#AfterBuild:

{ "ClsfRecord": { "Word": "TOOL PATH", "Params": ["S1", "TOOL", "MILL_D10"] } }

A record without parameters: #BeforeBuild:

{ "UnparsedText": "END-OF-PATH" }

#AfterBuild:

{ "ClsfRecord": { "Word": "END-OF-PATH", "Params": [] } }

Fields

ClsfRecordKey

JSON property name under which the parsed record is stored.

public const string ClsfRecordKey = "ClsfRecord"

Field Value

string

ParamsKey

Key of the parameter array inside the ClsfRecordKey section.

public const string ParamsKey = "Params"

Field Value

string

WordKey

Key of the record word inside the ClsfRecordKey section.

public const string WordKey = "Word"

Field Value

string

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

XName

XML element name for Generators registration.

public static string XName { get; }

Property Value

string

Methods

Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)

Build syntax arrangement into the syntaxPieceNode in-place.

public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)

Parameters

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>
ncDiagnosticProgress NcDiagnosticProgress

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.

Normalize(string)

Strips the $$ comment of every physical line, removes the trailing $ continuation characters, and joins the lines into one single-line record text.

public static string Normalize(string blockText)

Parameters

blockText string

Raw (possibly multi-line) CLSF block text.

Returns

string

The joined single-line record text; empty for comment-only blocks.

Reg(XFactory)

Registers this type's deserializer with the given XFactory (or Default when factory is null). Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory