damlparser

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package damlparser provides a lightweight parser for Daml *Types.daml source files. It extracts record and variant type definitions for codec generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParsedConstructor

type ParsedConstructor struct {
	Name        string
	PayloadType string // empty for unit constructors like "Indefinite"
}

ParsedConstructor represents a constructor in a variant type.

type ParsedField

type ParsedField struct {
	Name     string
	TypeExpr string // e.g., "Numeric 0", "Bool", "[RawInstanceAddress]"
}

ParsedField represents a field in a record type.

type ParsedModule

type ParsedModule struct {
	ModuleName string
	Imports    []string
	Records    []ParsedRecord
	Variants   []ParsedVariant
}

ParsedModule represents a parsed Daml module with its type definitions.

func Parse

func Parse(r io.Reader) (*ParsedModule, error)

Parse reads a Daml source file and extracts type definitions.

func ParseString

func ParseString(source string) (*ParsedModule, error)

ParseString parses Daml source from a string.

type ParsedRecord

type ParsedRecord struct {
	Name   string
	Fields []ParsedField
}

ParsedRecord represents a Daml record type (data Name = Name with ...).

type ParsedVariant

type ParsedVariant struct {
	Name         string
	Constructors []ParsedConstructor
}

ParsedVariant represents a Daml variant/sum type (data Name = Ctor1 | Ctor2 Payload).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL