simc-ast-builder
Version:
Parser and AST generator for SimulationCraft files
82 lines • 2.54 kB
TypeScript
/**
* Builder for creating ExpressionNode instances
* Provides a fluent API for constructing nodes with proper type checking
*/
import { ExpressionNode } from "../parser/visitors/ast/common-types";
import { FieldDefinition } from "../parser/visitors/ast/utils/fieldMaps";
import { Field } from "./Field";
/**
* Builder for creating ExpressionNode instances
*/
export declare class NodeBuilder {
/**
* The node being built
*/
private node;
/**
* Build the node
* @returns The built ExpressionNode
* @throws Error if the node is invalid
*/
build(): ExpressionNode;
/**
* Create a new builder with the same properties as this one
* @returns A new NodeBuilder with the same properties
*/
clone(): NodeBuilder;
/**
* Reset the builder to its initial state
* @returns This builder for chaining
*/
reset(): NodeBuilder;
/**
* Set the action name
* @param actionName Name of the action
* @returns This builder for chaining
*/
withActionName(actionName: string): NodeBuilder;
/**
* Set the expression type
* @param expressionType Type of the expression
* @returns This builder for chaining
*/
withExpressionType(expressionType: "boolean" | "numeric" | "neutral"): NodeBuilder;
/**
* Set a field using a Field instance
* @param field Field to set
* @returns This builder for chaining
*/
withField(field: Field | any): NodeBuilder;
/**
* Set a field using a FieldDefinition
* @param fieldDef Field definition to set
* @returns This builder for chaining
*/
withFieldDef(fieldDef: FieldDefinition): NodeBuilder;
/**
* Set multiple properties on the node
* @param properties Properties to set
* @returns This builder for chaining
*/
withProperties(properties: Partial<ExpressionNode>): NodeBuilder;
/**
* Set any property on the node
* @param key Property key
* @param value Property value
* @returns This builder for chaining
*/
withProperty<K extends keyof ExpressionNode>(key: K, value: ExpressionNode[K]): NodeBuilder;
/**
* Set the node type
* @param nodeType Type of the node
* @returns This builder for chaining
*/
withType(nodeType: string): NodeBuilder;
/**
* Set the value
* @param value Value to set
* @returns This builder for chaining
*/
withValue(value: any): NodeBuilder;
}
//# sourceMappingURL=NodeBuilder.d.ts.map