10.6. AST quasiquoting infrastructure
The QUOTE module provides quasiquotation support for AST construction.
It allows building AST nodes using daslang syntax with $-prefixed
splice points for inserting computed values, making macro writing more
readable and less error-prone than manual AST construction.
All functions and symbols are in “quote” module, use require to get access to it.
require daslib/quote
10.6.1. Structures
- CaptureEntryInitData
Initialization data for a captured variable entry.
- Fields:
name : string - Variable name being captured.
mode : CaptureMode - Capture mode (copy, reference, move, or clone).
- LineInfoInitData
Initialization data for source line info reconstruction.
- Fields:
fileInfo : FileInfo? - Pointer to the source file info.
column : uint - Column number (1-based).
line : uint - Line number (1-based).
last_column : uint - Last column number of the range.
last_line : uint - Last line number of the range.
- EnumEntryInitData
Initialization data for a quoted enum entry.
- Fields:
name : string - Enum entry name.
cppName : string - C++-side name for the entry (used when generating bindings).
- AnnotationArgumentInitData
Initialization data for a quoted annotation argument.
- Fields:
basicType : Type - Argument type tag (string / bool / int / float / etc.).
name : string - Argument name as written in the annotation.
sValue : string - String value (used when basicType is tString).
bValue : bool - Bool value (used when basicType is tBool).
iValue : int - Int value (used when basicType is tInt).
fValue : float - Float value (used when basicType is tFloat).
- FileInfoInitData
Initialization data for reconstructing file info.
- Fields:
name : string - File name string.
tabSize : int - Tab size for the file.
10.6.2. Clone operations
clone (var a: AnnotationArgumentList; b: array<AnnotationArgumentInitData>)
clone (var a: dasvector`CaptureEntry; b: array<CaptureEntryInitData>)
clone (var a: dasvector`EnumEntry; var b: array<EnumEntryInitData>)
clone (var a: dasvector`LineInfo; b: array<LineInfoInitData>)
clone (var args: AnnotationList; var nargs: array<AnnotationDeclaration?>)
10.6.2.1. clone
- clone(a: AnnotationArgumentList; b: array<AnnotationArgumentInitData> )
Clones an array of AnnotationArgumentInitData into an AnnotationArgumentList.
- Arguments:
b : array< AnnotationArgumentInitData>
- clone(a: dasvector`CaptureEntry; b: array<CaptureEntryInitData> )
- clone(a: dasvector`EnumEntry; b: array<EnumEntryInitData> )
- clone(a: dasvector`LineInfo; b: array<LineInfoInitData> )
- clone(args: AnnotationList; nargs: array<AnnotationDeclaration?> )
- clone_file_info(b: FileInfoInitData ): FileInfo?
Creates a FileInfo from a FileInfoInitData struct.
- Arguments:
b : FileInfoInitData
- clone_line_info(b: LineInfoInitData ): LineInfo
Creates a LineInfo from a LineInfoInitData struct.
- Arguments:
b : LineInfoInitData
10.6.3. Conversion
- cvt_to_mks(args: auto ): MakeStruct?
Converts an array of arguments into a MakeStruct pointer.
- Arguments:
args : auto