syntax

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package ast provides TTCN-3 syntax tree nodes and functions for tree traversal.

Package parser implements a tolerant TTCN-3 parser library.

It implements most of TTCN-3 core language specification 4.10 (2018), Advanced Parametrisation, Behaviour Types, Performance and Realtime Testing, simplistic preprocessor support, multi-line string literals for Titan TestPorts, and optional semicolon for backward compatibility.

Index

Constants

View Source
const (
	PedanticSemicolon = 1 << iota // expect semicolons pedantically
	IgnoreComments                // ignore comments
	Trace                         // print a trace of parsed productions
)
View Source
const (
	LowestPrec  = 0 // non-operators
	UnaryPrec   = 6
	HighestPrec = 15
)

A set of constants for precedence-based expression parsing. Non-operators have lowest precedence, followed by operators starting with precedence 1 up to unary operators. The highest precedence serves as "catch-all" precedence for selector, indexing, and other operator and delimiter tokens.

Variables

This section is empty.

Functions

func Doc added in v0.18.0

func Doc(n Node) string

Doc returns the documentation string for the given node.

func Filename added in v0.18.0

func Filename(n Node) string

func Inspect added in v0.19.0

func Inspect(n Node, f func(Node) bool)

Inspect traverse the syntax tree in depth-first order.

func IsNil added in v0.18.0

func IsNil(n Node) bool

IsNil returns true if the node is nil.

func Name

func Name(n Node) string

Name returns the name of a Node. If the node has no name (like statements) Name will return an empty string.

func NewParser added in v0.18.0

func NewParser(src []byte) *parser

func Unquote added in v0.18.0

func Unquote(s string) (string, error)

Unquote interprets s as a quoted TTCN-3 string literal, returning the string value that s quotes.

Types

type AltStmt

type AltStmt struct {
	Tok       Token // ALT or INTERLEAVE
	NoDefault Token
	Body      *BlockStmt // Block statement with alternations
}

A AltStmt represents an alternative statement.

func (*AltStmt) Children added in v0.18.0

func (n *AltStmt) Children() []Node

func (*AltStmt) End added in v0.18.0

func (n *AltStmt) End() int

func (*AltStmt) FirstTok added in v0.18.0

func (n *AltStmt) FirstTok() Token

func (*AltStmt) Inspect added in v0.18.0

func (n *AltStmt) Inspect(f func(Node) bool)

func (*AltStmt) LastTok added in v0.18.0

func (n *AltStmt) LastTok() Token

func (*AltStmt) Pos added in v0.18.0

func (n *AltStmt) Pos() int

type BehaviourSpec added in v0.18.0

type BehaviourSpec struct {
	Kind   Token       // TESTCASE, FUNCTION, ALTSTEP
	Params *FormalPars // Parameter list or nil
	RunsOn *RunsOnSpec // runs on spec or nil
	System *SystemSpec // system spec or nil
	Return *ReturnSpec // return value spec or nil
}

A BehaviourSpec represents a behaviour type specification.

func (*BehaviourSpec) Children added in v0.18.0

func (n *BehaviourSpec) Children() []Node

func (*BehaviourSpec) End added in v0.18.0

func (n *BehaviourSpec) End() int

func (*BehaviourSpec) FirstTok added in v0.18.0

func (n *BehaviourSpec) FirstTok() Token

func (*BehaviourSpec) Inspect added in v0.18.0

func (n *BehaviourSpec) Inspect(f func(Node) bool)

func (*BehaviourSpec) LastTok added in v0.18.0

func (n *BehaviourSpec) LastTok() Token

func (*BehaviourSpec) Pos added in v0.18.0

func (n *BehaviourSpec) Pos() int

type BehaviourTypeDecl added in v0.18.0

type BehaviourTypeDecl struct {
	TypeTok  Token // Position of "type"
	Kind     Token // TESTCASE, ALTSTEP, FUNCTION
	Name     *Ident
	TypePars *FormalPars
	Params   *FormalPars // Formal parameter list
	RunsOn   *RunsOnSpec // Optional runs-on spec
	System   *SystemSpec // Optional system spec
	Return   *ReturnSpec // Optional return spec
	With     *WithSpec
}

A BehaviourTypeDecl represents a named behaviour type.

func (*BehaviourTypeDecl) Children added in v0.18.0

func (n *BehaviourTypeDecl) Children() []Node

func (*BehaviourTypeDecl) End added in v0.18.0

func (n *BehaviourTypeDecl) End() int

func (*BehaviourTypeDecl) FirstTok added in v0.18.0

func (n *BehaviourTypeDecl) FirstTok() Token

func (*BehaviourTypeDecl) Inspect added in v0.18.0

func (n *BehaviourTypeDecl) Inspect(f func(Node) bool)

func (*BehaviourTypeDecl) LastTok added in v0.18.0

func (n *BehaviourTypeDecl) LastTok() Token

func (*BehaviourTypeDecl) Pos added in v0.18.0

func (n *BehaviourTypeDecl) Pos() int

type BinaryExpr

type BinaryExpr struct {
	X  Expr  // First operand
	Op Token // Operator token
	Y  Expr  // Second operand
}

A BinaryExpr represents a binary expression. Possible operands are all tokens with a precedence value, TO and FROM.

func (*BinaryExpr) Children added in v0.18.0

func (n *BinaryExpr) Children() []Node

func (*BinaryExpr) End added in v0.18.0

func (n *BinaryExpr) End() int

func (*BinaryExpr) FirstTok added in v0.18.0

func (n *BinaryExpr) FirstTok() Token

func (*BinaryExpr) Inspect added in v0.18.0

func (n *BinaryExpr) Inspect(f func(Node) bool)

func (*BinaryExpr) LastTok added in v0.18.0

func (n *BinaryExpr) LastTok() Token

func (*BinaryExpr) Pos added in v0.18.0

func (n *BinaryExpr) Pos() int

type BlockStmt added in v0.18.0

type BlockStmt struct {
	LBrace Token  // Position of "{"
	Stmts  []Stmt // List of statements
	RBrace Token  // Position of "}"
}

A BlockStmt represents a curly braces enclosed list of statements.

func (*BlockStmt) Children added in v0.18.0

func (n *BlockStmt) Children() []Node

func (*BlockStmt) End added in v0.18.0

func (n *BlockStmt) End() int

func (*BlockStmt) FirstTok added in v0.18.0

func (n *BlockStmt) FirstTok() Token

func (*BlockStmt) Inspect added in v0.18.0

func (n *BlockStmt) Inspect(f func(Node) bool)

func (*BlockStmt) LastTok added in v0.18.0

func (n *BlockStmt) LastTok() Token

func (*BlockStmt) Pos added in v0.18.0

func (n *BlockStmt) Pos() int

type BranchStmt added in v0.18.0

type BranchStmt struct {
	Tok   Token  // REPEAT, BREAK, CONTINUE, LABEL, GOTO
	Label *Ident // Label literal or nil
}

A BranchStmt represents a branch statement.

func (*BranchStmt) Children added in v0.18.0

func (n *BranchStmt) Children() []Node

func (*BranchStmt) End added in v0.18.0

func (n *BranchStmt) End() int

func (*BranchStmt) FirstTok added in v0.18.0

func (n *BranchStmt) FirstTok() Token

func (*BranchStmt) Inspect added in v0.18.0

func (n *BranchStmt) Inspect(f func(Node) bool)

func (*BranchStmt) LastTok added in v0.18.0

func (n *BranchStmt) LastTok() Token

func (*BranchStmt) Pos added in v0.18.0

func (n *BranchStmt) Pos() int

type CallExpr added in v0.18.0

type CallExpr struct {
	Fun  Expr       // Function expression
	Args *ParenExpr // Function arguments
}

A CallExpr represents a regular function call.

func (*CallExpr) Children added in v0.18.0

func (n *CallExpr) Children() []Node

func (*CallExpr) End added in v0.18.0

func (n *CallExpr) End() int

func (*CallExpr) FirstTok added in v0.18.0

func (n *CallExpr) FirstTok() Token

func (*CallExpr) Inspect added in v0.18.0

func (n *CallExpr) Inspect(f func(Node) bool)

func (*CallExpr) LastTok added in v0.18.0

func (n *CallExpr) LastTok() Token

func (*CallExpr) Pos added in v0.18.0

func (n *CallExpr) Pos() int

type CallStmt added in v0.18.0

type CallStmt struct {
	Stmt Stmt       // "call" statement
	Body *BlockStmt // Block statement with alternations
}

A CallStmt represents a "call" statement with communication-block.

func (*CallStmt) Children added in v0.18.0

func (n *CallStmt) Children() []Node

func (*CallStmt) End added in v0.18.0

func (n *CallStmt) End() int

func (*CallStmt) FirstTok added in v0.18.0

func (n *CallStmt) FirstTok() Token

func (*CallStmt) Inspect added in v0.18.0

func (n *CallStmt) Inspect(f func(Node) bool)

func (*CallStmt) LastTok added in v0.18.0

func (n *CallStmt) LastTok() Token

func (*CallStmt) Pos added in v0.18.0

func (n *CallStmt) Pos() int

type CaseClause added in v0.18.0

type CaseClause struct {
	Tok  Token      // Position of "case"
	Case *ParenExpr // nil means else-case
	Body *BlockStmt // Case body
}

A CaseClause represents a case clause.

func (*CaseClause) Children added in v0.18.0

func (n *CaseClause) Children() []Node

func (*CaseClause) End added in v0.18.0

func (n *CaseClause) End() int

func (*CaseClause) FirstTok added in v0.18.0

func (n *CaseClause) FirstTok() Token

func (*CaseClause) Inspect added in v0.18.0

func (n *CaseClause) Inspect(f func(Node) bool)

func (*CaseClause) LastTok added in v0.18.0

func (n *CaseClause) LastTok() Token

func (*CaseClause) Pos added in v0.18.0

func (n *CaseClause) Pos() int

type ClassTypeDecl added in v0.19.0

type ClassTypeDecl struct {
	TypeTok    Token  // Position of "type"
	Kind       Token  // CLASS
	Modif      Token  // "@abstract" or nil
	Name       *Ident // Name
	ExtendsTok Token
	Extends    []Expr
	RunsOn     *RunsOnSpec // Optional runs-on-spec
	Mtc        *MtcSpec    // Optional mtc-spec
	System     *SystemSpec // Optional system-spec
	LBrace     Token       // Position of "{"
	Defs       []*ModuleDef
	RBrace     Token // Position of }"
	With       *WithSpec
}

A StructTypeDecl represents a name struct type.

func (*ClassTypeDecl) Children added in v0.19.0

func (n *ClassTypeDecl) Children() []Node

func (*ClassTypeDecl) End added in v0.19.0

func (n *ClassTypeDecl) End() int

func (*ClassTypeDecl) FirstTok added in v0.19.0

func (n *ClassTypeDecl) FirstTok() Token

func (*ClassTypeDecl) Inspect added in v0.19.0

func (n *ClassTypeDecl) Inspect(f func(Node) bool)

func (*ClassTypeDecl) LastTok added in v0.19.0

func (n *ClassTypeDecl) LastTok() Token

func (*ClassTypeDecl) Pos added in v0.19.0

func (n *ClassTypeDecl) Pos() int

type CommClause added in v0.18.0

type CommClause struct {
	LBrack Token      // Position of '['
	X      Expr       // Conditional guard expression or nil
	Else   Token      // Else-clause of nil
	RBrack Token      // Position of ']'
	Comm   Stmt       // Communication statement
	Body   *BlockStmt // Body of nil
}

A CommClause represents communication clauses used by alt, interleave or check.

func (*CommClause) Children added in v0.18.0

func (n *CommClause) Children() []Node

func (*CommClause) End added in v0.18.0

func (n *CommClause) End() int

func (*CommClause) FirstTok added in v0.18.0

func (n *CommClause) FirstTok() Token

func (*CommClause) Inspect added in v0.18.0

func (n *CommClause) Inspect(f func(Node) bool)

func (*CommClause) LastTok added in v0.18.0

func (n *CommClause) LastTok() Token

func (*CommClause) Pos added in v0.18.0

func (n *CommClause) Pos() int

type ComponentTypeDecl added in v0.18.0

type ComponentTypeDecl struct {
	TypeTok    Token
	CompTok    Token
	Name       *Ident
	TypePars   *FormalPars
	ExtendsTok Token
	Extends    []Expr
	Body       *BlockStmt
	With       *WithSpec
}

func (*ComponentTypeDecl) Children added in v0.18.0

func (n *ComponentTypeDecl) Children() []Node

func (*ComponentTypeDecl) End added in v0.18.0

func (n *ComponentTypeDecl) End() int

func (*ComponentTypeDecl) FirstTok added in v0.18.0

func (n *ComponentTypeDecl) FirstTok() Token

func (*ComponentTypeDecl) Inspect added in v0.18.0

func (n *ComponentTypeDecl) Inspect(f func(Node) bool)

func (*ComponentTypeDecl) LastTok added in v0.18.0

func (n *ComponentTypeDecl) LastTok() Token

func (*ComponentTypeDecl) Pos added in v0.18.0

func (n *ComponentTypeDecl) Pos() int

type CompositeLiteral added in v0.18.0

type CompositeLiteral struct {
	LBrace Token  // Position of "{"
	List   []Expr // Expression list
	RBrace Token  // Position of "{"
}

A CompositeLiteral represents composite literals, e.g. "{x:=23, y:=5}".

func (*CompositeLiteral) Children added in v0.18.0

func (n *CompositeLiteral) Children() []Node

func (*CompositeLiteral) End added in v0.18.0

func (n *CompositeLiteral) End() int

func (*CompositeLiteral) FirstTok added in v0.18.0

func (n *CompositeLiteral) FirstTok() Token

func (*CompositeLiteral) Inspect added in v0.18.0

func (n *CompositeLiteral) Inspect(f func(Node) bool)

func (*CompositeLiteral) LastTok added in v0.18.0

func (n *CompositeLiteral) LastTok() Token

func (*CompositeLiteral) Pos added in v0.18.0

func (n *CompositeLiteral) Pos() int

type ConstructorDecl added in v0.19.0

type ConstructorDecl struct {
	CreateTok Token       // CREATE
	Params    *FormalPars // Formal parameter list
	Body      *BlockStmt  // Body
}

A ConstructorDecl represents a class constructor definition.

func (*ConstructorDecl) Children added in v0.19.0

func (n *ConstructorDecl) Children() []Node

func (*ConstructorDecl) End added in v0.19.0

func (n *ConstructorDecl) End() int

func (*ConstructorDecl) FirstTok added in v0.19.0

func (n *ConstructorDecl) FirstTok() Token

func (*ConstructorDecl) Inspect added in v0.19.0

func (n *ConstructorDecl) Inspect(f func(Node) bool)

func (*ConstructorDecl) LastTok added in v0.19.0

func (n *ConstructorDecl) LastTok() Token

func (*ConstructorDecl) Pos added in v0.19.0

func (n *ConstructorDecl) Pos() int

type ControlPart added in v0.18.0

type ControlPart struct {
	Name *Ident
	Body *BlockStmt
	With *WithSpec
}

func (*ControlPart) Children added in v0.18.0

func (n *ControlPart) Children() []Node

func (*ControlPart) End added in v0.18.0

func (n *ControlPart) End() int

func (*ControlPart) FirstTok added in v0.18.0

func (n *ControlPart) FirstTok() Token

func (*ControlPart) Inspect added in v0.18.0

func (n *ControlPart) Inspect(f func(Node) bool)

func (*ControlPart) LastTok added in v0.18.0

func (n *ControlPart) LastTok() Token

func (*ControlPart) Pos added in v0.18.0

func (n *ControlPart) Pos() int

type Decl

type Decl interface {
	Node
	// contains filtered or unexported methods
}

All declaration nodes implement the Decl interface.

type DeclStmt added in v0.18.0

type DeclStmt struct {
	Decl Decl
}

A DeclStmt represents a value declaration used as statement, lika a local variable declaration.

func (*DeclStmt) Children added in v0.18.0

func (n *DeclStmt) Children() []Node

func (*DeclStmt) End added in v0.18.0

func (n *DeclStmt) End() int

func (*DeclStmt) FirstTok added in v0.18.0

func (n *DeclStmt) FirstTok() Token

func (*DeclStmt) Inspect added in v0.18.0

func (n *DeclStmt) Inspect(f func(Node) bool)

func (*DeclStmt) LastTok added in v0.18.0

func (n *DeclStmt) LastTok() Token

func (*DeclStmt) Pos added in v0.18.0

func (n *DeclStmt) Pos() int

type Declarator

type Declarator struct {
	Name      *Ident
	ArrayDef  []*ParenExpr
	AssignTok Token
	Value     Expr
}

A Declarator represents a single varable declaration

func (*Declarator) Children added in v0.18.0

func (n *Declarator) Children() []Node

func (*Declarator) End added in v0.18.0

func (n *Declarator) End() int

func (*Declarator) FirstTok added in v0.18.0

func (n *Declarator) FirstTok() Token

func (*Declarator) Inspect added in v0.18.0

func (n *Declarator) Inspect(f func(Node) bool)

func (*Declarator) LastTok added in v0.18.0

func (n *Declarator) LastTok() Token

func (*Declarator) Pos added in v0.18.0

func (n *Declarator) Pos() int

type DecmatchExpr added in v0.18.0

type DecmatchExpr struct {
	Tok    Token // Position of "decmatch"
	Params Expr  // Parameter list or nil
	X      Expr  // Template expression
}

A DecmatchExpr represents a "decmatch" expression.

func (*DecmatchExpr) Children added in v0.18.0

func (n *DecmatchExpr) Children() []Node

func (*DecmatchExpr) End added in v0.18.0

func (n *DecmatchExpr) End() int

func (*DecmatchExpr) FirstTok added in v0.18.0

func (n *DecmatchExpr) FirstTok() Token

func (*DecmatchExpr) Inspect added in v0.18.0

func (n *DecmatchExpr) Inspect(f func(Node) bool)

func (*DecmatchExpr) LastTok added in v0.18.0

func (n *DecmatchExpr) LastTok() Token

func (*DecmatchExpr) Pos added in v0.18.0

func (n *DecmatchExpr) Pos() int

type DecodedExpr added in v0.18.0

type DecodedExpr struct {
	Tok    Token // Position of "decoded"
	Params Expr  // Parameter list or nil
	X      Expr  // Template expression
}

A DecodedExpr represents a "@decoded" expression.

func (*DecodedExpr) Children added in v0.18.0

func (n *DecodedExpr) Children() []Node

func (*DecodedExpr) End added in v0.18.0

func (n *DecodedExpr) End() int

func (*DecodedExpr) FirstTok added in v0.18.0

func (n *DecodedExpr) FirstTok() Token

func (*DecodedExpr) Inspect added in v0.18.0

func (n *DecodedExpr) Inspect(f func(Node) bool)

func (*DecodedExpr) LastTok added in v0.18.0

func (n *DecodedExpr) LastTok() Token

func (*DecodedExpr) Pos added in v0.18.0

func (n *DecodedExpr) Pos() int

type DefKindExpr added in v0.18.0

type DefKindExpr struct {
	Kind Token  // Definition kind, "type", "group", ...
	List []Expr // List of identifiers or except-expressions
}

A DefKindExpr represents a definition kind expression, used by imports and with-attributes.

func (*DefKindExpr) Children added in v0.18.0

func (n *DefKindExpr) Children() []Node

func (*DefKindExpr) End added in v0.18.0

func (n *DefKindExpr) End() int

func (*DefKindExpr) FirstTok added in v0.18.0

func (n *DefKindExpr) FirstTok() Token

func (*DefKindExpr) Inspect added in v0.18.0

func (n *DefKindExpr) Inspect(f func(Node) bool)

func (*DefKindExpr) LastTok added in v0.18.0

func (n *DefKindExpr) LastTok() Token

func (*DefKindExpr) Pos added in v0.18.0

func (n *DefKindExpr) Pos() int

type DoWhileStmt added in v0.18.0

type DoWhileStmt struct {
	DoTok    Token      // Position of "do"
	Body     *BlockStmt // Loop-Body
	WhileTok Token      // Position of "while"
	LParen   Token      // Position of "("
	Cond     Expr       // Conditional expression
	RParen   Token      // Position of ")"
}

A DoWhileStmt represents a do-while statement.

func (*DoWhileStmt) Children added in v0.18.0

func (n *DoWhileStmt) Children() []Node

func (*DoWhileStmt) End added in v0.18.0

func (n *DoWhileStmt) End() int

func (*DoWhileStmt) FirstTok added in v0.18.0

func (n *DoWhileStmt) FirstTok() Token

func (*DoWhileStmt) Inspect added in v0.18.0

func (n *DoWhileStmt) Inspect(f func(Node) bool)

func (*DoWhileStmt) LastTok added in v0.18.0

func (n *DoWhileStmt) LastTok() Token

func (*DoWhileStmt) Pos added in v0.18.0

func (n *DoWhileStmt) Pos() int

type EnumSpec added in v0.18.0

type EnumSpec struct {
	Tok    Token  // Position of "enumerated"
	LBrace Token  // Position of "{"
	Enums  []Expr // Enum list
	RBrace Token  // Position of "}"
}

A EnumSpec represents a enumeration type specification.

func (*EnumSpec) Children added in v0.18.0

func (n *EnumSpec) Children() []Node

func (*EnumSpec) End added in v0.18.0

func (n *EnumSpec) End() int

func (*EnumSpec) FirstTok added in v0.18.0

func (n *EnumSpec) FirstTok() Token

func (*EnumSpec) Inspect added in v0.18.0

func (n *EnumSpec) Inspect(f func(Node) bool)

func (*EnumSpec) LastTok added in v0.18.0

func (n *EnumSpec) LastTok() Token

func (*EnumSpec) Pos added in v0.18.0

func (n *EnumSpec) Pos() int

type EnumTypeDecl added in v0.18.0

type EnumTypeDecl struct {
	TypeTok  Token // Position of "type"
	EnumTok  Token // Position of "ENUMERATED"
	Name     *Ident
	TypePars *FormalPars
	LBrace   Token  // Position of "{"
	Enums    []Expr // Enum list
	RBrace   Token  // Position of "}"
	With     *WithSpec
}

A EnumTypeDecl represents a named enum type.

func (*EnumTypeDecl) Children added in v0.18.0

func (n *EnumTypeDecl) Children() []Node

func (*EnumTypeDecl) End added in v0.18.0

func (n *EnumTypeDecl) End() int

func (*EnumTypeDecl) FirstTok added in v0.18.0

func (n *EnumTypeDecl) FirstTok() Token

func (*EnumTypeDecl) Inspect added in v0.18.0

func (n *EnumTypeDecl) Inspect(f func(Node) bool)

func (*EnumTypeDecl) LastTok added in v0.18.0

func (n *EnumTypeDecl) LastTok() Token

func (*EnumTypeDecl) Pos added in v0.18.0

func (n *EnumTypeDecl) Pos() int

type Error

type Error struct {
	Node
	Msg string
}

Error represents a syntax error.

func (Error) Error

func (e Error) Error() string

type ErrorNode added in v0.18.0

type ErrorNode struct {
	From, To Token
}

func (*ErrorNode) Children added in v0.18.0

func (n *ErrorNode) Children() []Node

func (*ErrorNode) End added in v0.18.0

func (n *ErrorNode) End() int

func (*ErrorNode) FirstTok added in v0.18.0

func (n *ErrorNode) FirstTok() Token

func (*ErrorNode) Inspect added in v0.18.0

func (n *ErrorNode) Inspect(f func(Node) bool)

func (*ErrorNode) LastTok added in v0.18.0

func (n *ErrorNode) LastTok() Token

func (*ErrorNode) Pos added in v0.18.0

func (n *ErrorNode) Pos() int

type ExceptExpr added in v0.18.0

type ExceptExpr struct {
	X         Expr   // (Qualified) identifier or "all"
	ExceptTok Token  // Position of "except"
	LBrace    Token  // Position of "{" or nil
	List      []Expr // List of identifiers or DefKindExprs to exclude
	RBrace    Token  // Position of "}" or nil
}

A ExceptExpr is used by DefKindExpr to express exlusion of specific defintions.

func (*ExceptExpr) Children added in v0.18.0

func (n *ExceptExpr) Children() []Node

func (*ExceptExpr) End added in v0.18.0

func (n *ExceptExpr) End() int

func (*ExceptExpr) FirstTok added in v0.18.0

func (n *ExceptExpr) FirstTok() Token

func (*ExceptExpr) Inspect added in v0.18.0

func (n *ExceptExpr) Inspect(f func(Node) bool)

func (*ExceptExpr) LastTok added in v0.18.0

func (n *ExceptExpr) LastTok() Token

func (*ExceptExpr) Pos added in v0.18.0

func (n *ExceptExpr) Pos() int

type Expr

type Expr interface {
	Node
	// contains filtered or unexported methods
}

All expression nodes implement the Expr interface.

type ExprStmt added in v0.18.0

type ExprStmt struct {
	Expr Expr
}

An ExprStmt represents a expression used as statement, like an assignment or function call.

func (*ExprStmt) Children added in v0.18.0

func (n *ExprStmt) Children() []Node

func (*ExprStmt) End added in v0.18.0

func (n *ExprStmt) End() int

func (*ExprStmt) FirstTok added in v0.18.0

func (n *ExprStmt) FirstTok() Token

func (*ExprStmt) Inspect added in v0.18.0

func (n *ExprStmt) Inspect(f func(Node) bool)

func (*ExprStmt) LastTok added in v0.18.0

func (n *ExprStmt) LastTok() Token

func (*ExprStmt) Pos added in v0.18.0

func (n *ExprStmt) Pos() int

type Field added in v0.18.0

type Field struct {
	DefaultTok       Token        // Position of "@default" or nil
	Type             TypeSpec     // Type
	Name             *Ident       // Name
	ArrayDef         []*ParenExpr // Array definitions
	TypePars         *FormalPars
	ValueConstraint  *ParenExpr  // Value constraint or nil
	LengthConstraint *LengthExpr // Length constraint or nil
	Optional         Token       // Position of "optional" or nil
}

A Field represents a named struct member or sub type definition

func (*Field) Children added in v0.18.0

func (n *Field) Children() []Node

func (*Field) End added in v0.18.0

func (n *Field) End() int

func (*Field) FirstTok added in v0.18.0

func (n *Field) FirstTok() Token

func (*Field) Inspect added in v0.18.0

func (n *Field) Inspect(f func(Node) bool)

func (*Field) LastTok added in v0.18.0

func (n *Field) LastTok() Token

func (*Field) Pos added in v0.18.0

func (n *Field) Pos() int

type ForRangeStmt added in v0.19.0

type ForRangeStmt struct {
	Tok    Token
	LParen Token
	Init   Stmt
	InTok  Token
	Range  Expr
	RParen Token
	Body   *BlockStmt
}

func (*ForRangeStmt) Children added in v0.19.0

func (n *ForRangeStmt) Children() []Node

func (*ForRangeStmt) End added in v0.19.0

func (n *ForRangeStmt) End() int

func (*ForRangeStmt) FirstTok added in v0.19.0

func (n *ForRangeStmt) FirstTok() Token

func (*ForRangeStmt) Inspect added in v0.19.0

func (n *ForRangeStmt) Inspect(f func(Node) bool)

func (*ForRangeStmt) LastTok added in v0.19.0

func (n *ForRangeStmt) LastTok() Token

func (*ForRangeStmt) Pos added in v0.19.0

func (n *ForRangeStmt) Pos() int

type ForStmt

type ForStmt struct {
	Tok      Token      // Position of "for"
	LParen   Token      // Position of "("
	Init     Stmt       // Initialization statement
	InitSemi Token      // Position of ";"
	Cond     Expr       // Conditional expression
	CondSemi Token      // Position of ";"
	Post     Stmt       // Post iteration statement
	RParen   Token      // Position of ")"
	Body     *BlockStmt // Loop-Body
}

A ForStmt represents a "for" statement.

func (*ForStmt) Children added in v0.18.0

func (n *ForStmt) Children() []Node

func (*ForStmt) End added in v0.18.0

func (n *ForStmt) End() int

func (*ForStmt) FirstTok added in v0.18.0

func (n *ForStmt) FirstTok() Token

func (*ForStmt) Inspect added in v0.18.0

func (n *ForStmt) Inspect(f func(Node) bool)

func (*ForStmt) LastTok added in v0.18.0

func (n *ForStmt) LastTok() Token

func (*ForStmt) Pos added in v0.18.0

func (n *ForStmt) Pos() int

type FormalPar

type FormalPar struct {
	Direction           Token
	TemplateRestriction *RestrictionSpec
	Modif               Token
	Type                Expr
	Name                *Ident
	ArrayDef            []*ParenExpr
	AssignTok           Token
	Value               Expr
}

func (*FormalPar) Children added in v0.18.0

func (n *FormalPar) Children() []Node

func (*FormalPar) End added in v0.18.0

func (n *FormalPar) End() int

func (*FormalPar) FirstTok added in v0.18.0

func (n *FormalPar) FirstTok() Token

func (*FormalPar) Inspect added in v0.18.0

func (n *FormalPar) Inspect(f func(Node) bool)

func (*FormalPar) LastTok added in v0.18.0

func (n *FormalPar) LastTok() Token

func (*FormalPar) Pos added in v0.18.0

func (n *FormalPar) Pos() int

type FormalPars

type FormalPars struct {
	LParen Token
	List   []*FormalPar
	RParen Token
}

func (*FormalPars) Children added in v0.18.0

func (n *FormalPars) Children() []Node

func (*FormalPars) End added in v0.18.0

func (n *FormalPars) End() int

func (*FormalPars) FirstTok added in v0.18.0

func (n *FormalPars) FirstTok() Token

func (*FormalPars) Inspect added in v0.18.0

func (n *FormalPars) Inspect(f func(Node) bool)

func (*FormalPars) LastTok added in v0.18.0

func (n *FormalPars) LastTok() Token

func (*FormalPars) Pos added in v0.18.0

func (n *FormalPars) Pos() int

type FriendDecl added in v0.18.0

type FriendDecl struct {
	FriendTok Token
	ModuleTok Token
	Module    *Ident
	With      *WithSpec
}

func (*FriendDecl) Children added in v0.18.0

func (n *FriendDecl) Children() []Node

func (*FriendDecl) End added in v0.18.0

func (n *FriendDecl) End() int

func (*FriendDecl) FirstTok added in v0.18.0

func (n *FriendDecl) FirstTok() Token

func (*FriendDecl) Inspect added in v0.18.0

func (n *FriendDecl) Inspect(f func(Node) bool)

func (*FriendDecl) LastTok added in v0.18.0

func (n *FriendDecl) LastTok() Token

func (*FriendDecl) Pos added in v0.18.0

func (n *FriendDecl) Pos() int

type FromExpr added in v0.18.0

type FromExpr struct {
	Kind    Token // ANY or ALL
	FromTok Token // Position of "from"
	X       Expr  // Expression
}

A FromExpr represents a "from" expression, like "any from a".

func (*FromExpr) Children added in v0.18.0

func (n *FromExpr) Children() []Node

func (*FromExpr) End added in v0.18.0

func (n *FromExpr) End() int

func (*FromExpr) FirstTok added in v0.18.0

func (n *FromExpr) FirstTok() Token

func (*FromExpr) Inspect added in v0.18.0

func (n *FromExpr) Inspect(f func(Node) bool)

func (*FromExpr) LastTok added in v0.18.0

func (n *FromExpr) LastTok() Token

func (*FromExpr) Pos added in v0.18.0

func (n *FromExpr) Pos() int

type FuncDecl added in v0.18.0

type FuncDecl struct {
	External Token // Position of "external" or nil
	Kind     Token // TESTCASE, ALTSTEP, FUNCTION
	Name     *Ident
	Modif    Token // Position of "@deterministic" or nil
	TypePars *FormalPars
	Params   *FormalPars // Formal parameter list or nil
	RunsOn   *RunsOnSpec // Optional runs-on-spec
	Mtc      *MtcSpec    // Optional mtc-spec
	System   *SystemSpec // Optional system-spec
	Return   *ReturnSpec // Optional return-spec
	Body     *BlockStmt  // Body or nil
	With     *WithSpec
}

A FuncDecl represents a behaviour definition.

func (*FuncDecl) Children added in v0.18.0

func (n *FuncDecl) Children() []Node

func (*FuncDecl) End added in v0.18.0

func (n *FuncDecl) End() int

func (*FuncDecl) FirstTok added in v0.18.0

func (n *FuncDecl) FirstTok() Token

func (*FuncDecl) Inspect added in v0.18.0

func (n *FuncDecl) Inspect(f func(Node) bool)

func (*FuncDecl) IsControl added in v0.18.0

func (x *FuncDecl) IsControl() bool

func (*FuncDecl) IsTest added in v0.18.0

func (x *FuncDecl) IsTest() bool

func (*FuncDecl) LastTok added in v0.18.0

func (n *FuncDecl) LastTok() Token

func (*FuncDecl) Pos added in v0.18.0

func (n *FuncDecl) Pos() int

type GroupDecl added in v0.18.0

type GroupDecl struct {
	Tok    Token
	Name   *Ident
	LBrace Token
	Defs   []*ModuleDef
	RBrace Token
	With   *WithSpec
}

func (*GroupDecl) Children added in v0.18.0

func (n *GroupDecl) Children() []Node

func (*GroupDecl) End added in v0.18.0

func (n *GroupDecl) End() int

func (*GroupDecl) FirstTok added in v0.18.0

func (n *GroupDecl) FirstTok() Token

func (*GroupDecl) Inspect added in v0.18.0

func (n *GroupDecl) Inspect(f func(Node) bool)

func (*GroupDecl) LastTok added in v0.18.0

func (n *GroupDecl) LastTok() Token

func (*GroupDecl) Pos added in v0.18.0

func (n *GroupDecl) Pos() int

type Ident added in v0.18.0

type Ident struct {
	IsName bool  // true if this is a name, false if it is a reference
	Tok    Token // first identifier token
	Tok2   Token `json:",omitempty"` // optional second identifier token, e.g. for "any port"
}

Ident represents an identifier.

func (*Ident) Children added in v0.18.0

func (n *Ident) Children() []Node

func (*Ident) End added in v0.18.0

func (n *Ident) End() int

func (*Ident) FirstTok added in v0.18.0

func (n *Ident) FirstTok() Token

func (*Ident) Inspect added in v0.18.0

func (n *Ident) Inspect(f func(Node) bool)

func (*Ident) LastTok added in v0.18.0

func (n *Ident) LastTok() Token

func (*Ident) Pos added in v0.18.0

func (n *Ident) Pos() int

func (*Ident) String added in v0.18.0

func (x *Ident) String() string

type IfStmt

type IfStmt struct {
	Tok     Token // Position of "if"
	LParen  Token
	Cond    Expr // Conditional expression
	RParen  Token
	Then    *BlockStmt // True branch
	ElseTok Token      // Position of "else" or nil
	Else    Stmt       // Else branch
}

A IfStmt represents a conditional statement.

func (*IfStmt) Children added in v0.18.0

func (n *IfStmt) Children() []Node

func (*IfStmt) End added in v0.18.0

func (n *IfStmt) End() int

func (*IfStmt) FirstTok added in v0.18.0

func (n *IfStmt) FirstTok() Token

func (*IfStmt) Inspect added in v0.18.0

func (n *IfStmt) Inspect(f func(Node) bool)

func (*IfStmt) LastTok added in v0.18.0

func (n *IfStmt) LastTok() Token

func (*IfStmt) Pos added in v0.18.0

func (n *IfStmt) Pos() int

type ImportDecl added in v0.18.0

type ImportDecl struct {
	ImportTok Token
	FromTok   Token
	Module    *Ident
	Language  *LanguageSpec
	LBrace    Token
	List      []*DefKindExpr
	RBrace    Token
	With      *WithSpec
}

func (*ImportDecl) Children added in v0.18.0

func (n *ImportDecl) Children() []Node

func (*ImportDecl) End added in v0.18.0

func (n *ImportDecl) End() int

func (*ImportDecl) FirstTok added in v0.18.0

func (n *ImportDecl) FirstTok() Token

func (*ImportDecl) Inspect added in v0.18.0

func (n *ImportDecl) Inspect(f func(Node) bool)

func (*ImportDecl) LastTok added in v0.18.0

func (n *ImportDecl) LastTok() Token

func (*ImportDecl) Pos added in v0.18.0

func (n *ImportDecl) Pos() int

type IndexExpr added in v0.18.0

type IndexExpr struct {
	X      Expr  // Preceding expression (might be nil)
	LBrack Token // Position of "["
	Index  Expr  // Actuall index expression (might be "-")
	RBrack Token // Position of "]"
}

A IndexExpr represents an expression followed by an index.

func (*IndexExpr) Children added in v0.18.0

func (n *IndexExpr) Children() []Node

func (*IndexExpr) End added in v0.18.0

func (n *IndexExpr) End() int

func (*IndexExpr) FirstTok added in v0.18.0

func (n *IndexExpr) FirstTok() Token

func (*IndexExpr) Inspect added in v0.18.0

func (n *IndexExpr) Inspect(f func(Node) bool)

func (*IndexExpr) LastTok added in v0.18.0

func (n *IndexExpr) LastTok() Token

func (*IndexExpr) Pos added in v0.18.0

func (n *IndexExpr) Pos() int

type Kind

type Kind int

Kind is the set of lexical tokens of the Go programming language.

const (
	// Special tokens
	ILLEGAL Kind = iota
	EOF
	UNTERMINATED
	MALFORMED

	COMMENT
	PREPROC

	// Identifiers and basic type literals
	// (these tokens stand for classes of literals)
	IDENT   // main
	INT     // 12345
	FLOAT   // 123.45
	STRING  // "abc"
	BSTRING // '101?F'H
	MODIF   // @fuzzy

	// Operators and delimiters
	INC // ++
	ADD // +
	SUB // -
	DEC // --
	MUL // *
	DIV // /

	SHL    // <<
	ROL    // <@
	SHR    // >>
	ROR    // @>
	CONCAT // &

	REDIR      // ->
	DECODE     // =>
	ANY        // ?
	EXCL       // !
	RANGE      // ..
	ELIPSIS    // ...
	ASSIGN     // :=
	COLONCOLON // ::

	EQ // ==
	NE // !=
	LT // <
	LE // <=
	GT // >
	GE // >=

	LPAREN // (
	LBRACK // [
	LBRACE // {
	COMMA  // ,
	DOT    // .

	RPAREN    // )
	RBRACK    // ]
	RBRACE    // }
	SEMICOLON // ;
	COLON     // :

	// Keywords
	MOD // mod
	REM // rem

	AND // and
	OR  // or
	XOR // xor
	NOT // not

	AND4B // and4b
	OR4B  // or4b
	XOR4B // xor4b
	NOT4B // not4b

	ADDRESS
	ALIVE
	ALL
	ALT
	ALTSTEP
	ANYKW
	BREAK
	CASE
	CHARSTRING
	CLASS
	COMPONENT
	CONST
	CONTINUE
	CONTROL
	CREATE
	DECMATCH
	DISPLAY
	DO
	ELSE
	ENCODE
	ENUMERATED
	ERROR
	EXCEPT
	EXCEPTION
	EXTENDS
	EXTENSION
	EXTERNAL
	FAIL
	FALSE
	FOR
	FRIEND
	FROM
	FUNCTION
	GOTO
	GROUP
	IF
	IFPRESENT
	IMPORT
	IN
	INCONC
	INOUT
	INTERLEAVE
	LABEL
	LANGUAGE
	LENGTH
	MAP
	MESSAGE
	MIXED
	MODIFIES
	MODULE
	MODULEPAR
	MTC
	NAN
	NOBLOCK
	NONE
	NULL
	OF
	OMIT
	ON
	OPTIONAL
	OUT
	OVERRIDE
	PARAM
	PASS
	PATTERN
	PORT
	PRESENT
	PRIVATE
	PROCEDURE
	PUBLIC
	REALTIME
	RECORD
	REGEXP
	REPEAT
	RETURN
	RUNS
	SELECT
	SENDER
	SET
	SIGNATURE
	STEPSIZE
	SYSTEM
	TEMPLATE
	TESTCASE
	TIMER
	TIMESTAMP
	TO
	TRUE
	TYPE
	UNION
	UNIVERSAL
	UNMAP
	VALUE
	VAR
	VARIANT
	WHILE
	WITH
)

The list of tokens.

func Lookup added in v0.18.0

func Lookup(ident []byte) Kind

Lookup maps an identifier to its keyword token or IDENT (if not a keyword).

func (Kind) IsKeyword

func (tok Kind) IsKeyword() bool

IsKeyword returns true for tokens corresponding to keywords; it returns false otherwise.

func (Kind) IsLiteral

func (tok Kind) IsLiteral() bool

IsLiteral returns true for tokens corresponding to identifiers and basic type literals; it returns false otherwise.

func (Kind) IsOperator added in v0.18.0

func (tok Kind) IsOperator() bool

IsOperator returns true for tokens corresponding to operators and delimiters; it returns false otherwise.

func (Kind) Precedence added in v0.18.0

func (tok Kind) Precedence() int

Precedence returns the operator precedence of the binary operator op. If op is not a binary operator, the result is LowestPrecedence.

func (Kind) String

func (tok Kind) String() string

String returns the string corresponding to the token tok. For operators, delimiters, and keywords the string is the actual token character sequence (e.g., for the token ADD, the string is "+"). For all other tokens the string corresponds to the token constant name (e.g. for the token IDENT, the string is "IDENT").

type LanguageSpec added in v0.18.0

type LanguageSpec struct {
	Tok  Token
	List []Token
}

func (*LanguageSpec) Children added in v0.18.0

func (n *LanguageSpec) Children() []Node

func (*LanguageSpec) End added in v0.18.0

func (n *LanguageSpec) End() int

func (*LanguageSpec) FirstTok added in v0.18.0

func (n *LanguageSpec) FirstTok() Token

func (*LanguageSpec) Inspect added in v0.18.0

func (n *LanguageSpec) Inspect(f func(Node) bool)

func (*LanguageSpec) LastTok added in v0.18.0

func (n *LanguageSpec) LastTok() Token

func (*LanguageSpec) Pos added in v0.18.0

func (n *LanguageSpec) Pos() int

type LengthExpr added in v0.18.0

type LengthExpr struct {
	X    Expr       // Preceding expression
	Len  Token      // Position of "length" keyword
	Size *ParenExpr // Size expression
}

A LengthExpr represents a length expression.

func (*LengthExpr) Children added in v0.18.0

func (n *LengthExpr) Children() []Node

func (*LengthExpr) End added in v0.18.0

func (n *LengthExpr) End() int

func (*LengthExpr) FirstTok added in v0.18.0

func (n *LengthExpr) FirstTok() Token

func (*LengthExpr) Inspect added in v0.18.0

func (n *LengthExpr) Inspect(f func(Node) bool)

func (*LengthExpr) LastTok added in v0.18.0

func (n *LengthExpr) LastTok() Token

func (*LengthExpr) Pos added in v0.18.0

func (n *LengthExpr) Pos() int

type ListSpec added in v0.18.0

type ListSpec struct {
	Kind     Token       // RECORD, SET
	Length   *LengthExpr // Length constraint or nil
	OfTok    Token       // Position of "of"
	ElemType TypeSpec    // Element type specification
}

A ListSpec represents a list type specification.

func (*ListSpec) Children added in v0.18.0

func (n *ListSpec) Children() []Node

func (*ListSpec) End added in v0.18.0

func (n *ListSpec) End() int

func (*ListSpec) FirstTok added in v0.18.0

func (n *ListSpec) FirstTok() Token

func (*ListSpec) Inspect added in v0.18.0

func (n *ListSpec) Inspect(f func(Node) bool)

func (*ListSpec) LastTok added in v0.18.0

func (n *ListSpec) LastTok() Token

func (*ListSpec) Pos added in v0.18.0

func (n *ListSpec) Pos() int

type MapSpec added in v0.19.0

type MapSpec struct {
	MapTok   Token
	FromTok  Token
	FromType TypeSpec
	ToTok    Token
	ToType   TypeSpec
}

A MapSpec represents a map type specification.

func (*MapSpec) Children added in v0.19.0

func (n *MapSpec) Children() []Node

func (*MapSpec) End added in v0.19.0

func (n *MapSpec) End() int

func (*MapSpec) FirstTok added in v0.19.0

func (n *MapSpec) FirstTok() Token

func (*MapSpec) Inspect added in v0.19.0

func (n *MapSpec) Inspect(f func(Node) bool)

func (*MapSpec) LastTok added in v0.19.0

func (n *MapSpec) LastTok() Token

func (*MapSpec) Pos added in v0.19.0

func (n *MapSpec) Pos() int

type MapTypeDecl added in v0.19.0

type MapTypeDecl struct {
	TypeTok  Token
	Spec     *MapSpec
	Name     *Ident
	TypePars *FormalPars
	With     *WithSpec
}

func (*MapTypeDecl) Children added in v0.19.0

func (n *MapTypeDecl) Children() []Node

func (*MapTypeDecl) End added in v0.19.0

func (n *MapTypeDecl) End() int

func (*MapTypeDecl) FirstTok added in v0.19.0

func (n *MapTypeDecl) FirstTok() Token

func (*MapTypeDecl) Inspect added in v0.19.0

func (n *MapTypeDecl) Inspect(f func(Node) bool)

func (*MapTypeDecl) LastTok added in v0.19.0

func (n *MapTypeDecl) LastTok() Token

func (*MapTypeDecl) Pos added in v0.19.0

func (n *MapTypeDecl) Pos() int

type Mode added in v0.18.0

type Mode uint

A Mode value is a set of flags (or 0). They control the amount of source code parsed and other optional parser functionality.

type ModifiesExpr added in v0.18.0

type ModifiesExpr struct {
	Tok    Token // Position of "modifies"
	X      Expr  // Base template expression
	Assign Token // Position of ":="
	Y      Expr  // Modifying expression
}

A ModifiesExpr represents a "modifies" expression.

func (*ModifiesExpr) Children added in v0.18.0

func (n *ModifiesExpr) Children() []Node

func (*ModifiesExpr) End added in v0.18.0

func (n *ModifiesExpr) End() int

func (*ModifiesExpr) FirstTok added in v0.18.0

func (n *ModifiesExpr) FirstTok() Token

func (*ModifiesExpr) Inspect added in v0.18.0

func (n *ModifiesExpr) Inspect(f func(Node) bool)

func (*ModifiesExpr) LastTok added in v0.18.0

func (n *ModifiesExpr) LastTok() Token

func (*ModifiesExpr) Pos added in v0.18.0

func (n *ModifiesExpr) Pos() int

type Module

type Module struct {
	Tok      Token
	Name     *Ident
	Language *LanguageSpec
	LBrace   Token
	Defs     []*ModuleDef
	RBrace   Token
	With     *WithSpec
}

func (*Module) Children added in v0.18.0

func (n *Module) Children() []Node

func (*Module) End added in v0.18.0

func (n *Module) End() int

func (*Module) FirstTok added in v0.18.0

func (n *Module) FirstTok() Token

func (*Module) Inspect added in v0.18.0

func (n *Module) Inspect(f func(Node) bool)

func (*Module) LastTok added in v0.18.0

func (n *Module) LastTok() Token

func (*Module) Pos added in v0.18.0

func (n *Module) Pos() int

type ModuleDef added in v0.18.0

type ModuleDef struct {
	Visibility Token
	Def        Node
}

func (*ModuleDef) Children added in v0.18.0

func (n *ModuleDef) Children() []Node

func (*ModuleDef) End added in v0.18.0

func (n *ModuleDef) End() int

func (*ModuleDef) FirstTok added in v0.18.0

func (n *ModuleDef) FirstTok() Token

func (*ModuleDef) Inspect added in v0.18.0

func (n *ModuleDef) Inspect(f func(Node) bool)

func (*ModuleDef) LastTok added in v0.18.0

func (n *ModuleDef) LastTok() Token

func (*ModuleDef) Pos added in v0.18.0

func (n *ModuleDef) Pos() int

type ModuleParameterGroup added in v0.18.0

type ModuleParameterGroup struct {
	Tok    Token        // Position of "modulepar"
	LBrace Token        // Position of "{"
	Decls  []*ValueDecl // Module parameter list
	RBrace Token        // Position of "}"
	With   *WithSpec
}

A ModuleParameterGroup represents a deprecated module parameter list

func (*ModuleParameterGroup) Children added in v0.18.0

func (n *ModuleParameterGroup) Children() []Node

func (*ModuleParameterGroup) End added in v0.18.0

func (n *ModuleParameterGroup) End() int

func (*ModuleParameterGroup) FirstTok added in v0.18.0

func (n *ModuleParameterGroup) FirstTok() Token

func (*ModuleParameterGroup) Inspect added in v0.18.0

func (n *ModuleParameterGroup) Inspect(f func(Node) bool)

func (*ModuleParameterGroup) LastTok added in v0.18.0

func (n *ModuleParameterGroup) LastTok() Token

func (*ModuleParameterGroup) Pos added in v0.18.0

func (n *ModuleParameterGroup) Pos() int

type MtcSpec added in v0.18.0

type MtcSpec struct {
	Tok  Token
	Comp Expr
}

func (*MtcSpec) Children added in v0.18.0

func (n *MtcSpec) Children() []Node

func (*MtcSpec) End added in v0.18.0

func (n *MtcSpec) End() int

func (*MtcSpec) FirstTok added in v0.18.0

func (n *MtcSpec) FirstTok() Token

func (*MtcSpec) Inspect added in v0.18.0

func (n *MtcSpec) Inspect(f func(Node) bool)

func (*MtcSpec) LastTok added in v0.18.0

func (n *MtcSpec) LastTok() Token

func (*MtcSpec) Pos added in v0.18.0

func (n *MtcSpec) Pos() int

type Node

type Node interface {
	Pos() int
	End() int
	FirstTok() Token
	LastTok() Token
	Children() []Node
	Inspect(func(Node) bool)
}

All node types implement the Node interface.

func FindChildOf added in v0.18.0

func FindChildOf(n Node, pos int) Node

FindChildOfType returns the first direct child of the give node, enclosing given position.

type NodeList added in v0.18.0

type NodeList struct {
	Nodes []Node
}

func (*NodeList) Children added in v0.18.0

func (n *NodeList) Children() []Node

func (*NodeList) End added in v0.18.0

func (n *NodeList) End() int

func (*NodeList) FirstTok added in v0.18.0

func (n *NodeList) FirstTok() Token

func (*NodeList) Inspect added in v0.18.0

func (n *NodeList) Inspect(f func(Node) bool)

func (*NodeList) LastTok added in v0.18.0

func (n *NodeList) LastTok() Token

func (*NodeList) Pos added in v0.18.0

func (n *NodeList) Pos() int

type ParamExpr added in v0.18.0

type ParamExpr struct {
	X   Expr  // map or unmap statement
	Tok Token // Position "param"
	Y   Expr  // Additional arguments for map/unmap
}

A ParamExpr represents parametrized map and unmap statements.

func (*ParamExpr) Children added in v0.18.0

func (n *ParamExpr) Children() []Node

func (*ParamExpr) End added in v0.18.0

func (n *ParamExpr) End() int

func (*ParamExpr) FirstTok added in v0.18.0

func (n *ParamExpr) FirstTok() Token

func (*ParamExpr) Inspect added in v0.18.0

func (n *ParamExpr) Inspect(f func(Node) bool)

func (*ParamExpr) LastTok added in v0.18.0

func (n *ParamExpr) LastTok() Token

func (*ParamExpr) Pos added in v0.18.0

func (n *ParamExpr) Pos() int

type ParametrizedIdent added in v0.18.0

type ParametrizedIdent struct {
	Ident  *Ident     // Identifier
	Params *ParenExpr // Parameter list
}

ParametrizedIdent represents a paremetrized identifier, e.g. "f<charstring>".

func (*ParametrizedIdent) Children added in v0.18.0

func (n *ParametrizedIdent) Children() []Node

func (*ParametrizedIdent) End added in v0.18.0

func (n *ParametrizedIdent) End() int

func (*ParametrizedIdent) FirstTok added in v0.18.0

func (n *ParametrizedIdent) FirstTok() Token

func (*ParametrizedIdent) Inspect added in v0.18.0

func (n *ParametrizedIdent) Inspect(f func(Node) bool)

func (*ParametrizedIdent) LastTok added in v0.18.0

func (n *ParametrizedIdent) LastTok() Token

func (*ParametrizedIdent) Pos added in v0.18.0

func (n *ParametrizedIdent) Pos() int

type ParenExpr added in v0.18.0

type ParenExpr struct {
	LParen Token  // Position of "(", "<", "["
	List   []Expr // Expression list
	RParen Token  // Position of ")", ">", "]"
}

A ParenExpr represents parenthized expression lists.

func (*ParenExpr) Children added in v0.18.0

func (n *ParenExpr) Children() []Node

func (*ParenExpr) End added in v0.18.0

func (n *ParenExpr) End() int

func (*ParenExpr) FirstTok added in v0.18.0

func (n *ParenExpr) FirstTok() Token

func (*ParenExpr) Inspect added in v0.18.0

func (n *ParenExpr) Inspect(f func(Node) bool)

func (*ParenExpr) LastTok added in v0.18.0

func (n *ParenExpr) LastTok() Token

func (*ParenExpr) Pos added in v0.18.0

func (n *ParenExpr) Pos() int

type ParserOption added in v0.18.0

type ParserOption func(*parser) error

func WithFilename added in v0.18.0

func WithFilename(filename string) ParserOption

type PatternExpr added in v0.18.0

type PatternExpr struct {
	Tok    Token // Position of "pattern"
	NoCase Token // Position of "@nocase" of nil
	X      Expr  // Pattern expression
}

A PatternExpr represents a "pattern" expression.

func (*PatternExpr) Children added in v0.18.0

func (n *PatternExpr) Children() []Node

func (*PatternExpr) End added in v0.18.0

func (n *PatternExpr) End() int

func (*PatternExpr) FirstTok added in v0.18.0

func (n *PatternExpr) FirstTok() Token

func (*PatternExpr) Inspect added in v0.18.0

func (n *PatternExpr) Inspect(f func(Node) bool)

func (*PatternExpr) LastTok added in v0.18.0

func (n *PatternExpr) LastTok() Token

func (*PatternExpr) Pos added in v0.18.0

func (n *PatternExpr) Pos() int

type PortAttribute

type PortAttribute struct {
	Kind  Token // IN, OUT, INOUT, ADDRESS
	Types []Expr
}

func (*PortAttribute) Children added in v0.18.0

func (n *PortAttribute) Children() []Node

func (*PortAttribute) End added in v0.18.0

func (n *PortAttribute) End() int

func (*PortAttribute) FirstTok added in v0.18.0

func (n *PortAttribute) FirstTok() Token

func (*PortAttribute) Inspect added in v0.18.0

func (n *PortAttribute) Inspect(f func(Node) bool)

func (*PortAttribute) LastTok added in v0.18.0

func (n *PortAttribute) LastTok() Token

func (*PortAttribute) Pos added in v0.18.0

func (n *PortAttribute) Pos() int

type PortMapAttribute added in v0.18.0

type PortMapAttribute struct {
	MapTok   Token // MAP, UNMAP
	ParamTok Token
	Params   *FormalPars
}

func (*PortMapAttribute) Children added in v0.18.0

func (n *PortMapAttribute) Children() []Node

func (*PortMapAttribute) End added in v0.18.0

func (n *PortMapAttribute) End() int

func (*PortMapAttribute) FirstTok added in v0.18.0

func (n *PortMapAttribute) FirstTok() Token

func (*PortMapAttribute) Inspect added in v0.18.0

func (n *PortMapAttribute) Inspect(f func(Node) bool)

func (*PortMapAttribute) LastTok added in v0.18.0

func (n *PortMapAttribute) LastTok() Token

func (*PortMapAttribute) Pos added in v0.18.0

func (n *PortMapAttribute) Pos() int

type PortTypeDecl added in v0.18.0

type PortTypeDecl struct {
	TypeTok  Token
	PortTok  Token
	Name     *Ident
	TypePars *FormalPars
	Kind     Token // MIXED, MESSAGE, PROCEDURE
	Realtime Token
	LBrace   Token
	Attrs    []Node
	RBrace   Token
	With     *WithSpec
}

func (*PortTypeDecl) Children added in v0.18.0

func (n *PortTypeDecl) Children() []Node

func (*PortTypeDecl) End added in v0.18.0

func (n *PortTypeDecl) End() int

func (*PortTypeDecl) FirstTok added in v0.18.0

func (n *PortTypeDecl) FirstTok() Token

func (*PortTypeDecl) Inspect added in v0.18.0

func (n *PortTypeDecl) Inspect(f func(Node) bool)

func (*PortTypeDecl) LastTok added in v0.18.0

func (n *PortTypeDecl) LastTok() Token

func (*PortTypeDecl) Pos added in v0.18.0

func (n *PortTypeDecl) Pos() int

type Position added in v0.18.0

type Position struct {
	Line, Column int
}

Position is a cursor position in a source file. Lines and columns are 1-based.

func Begin added in v0.18.0

func Begin(n Node) Position

func End added in v0.18.0

func End(n Node) Position

func (*Position) After added in v0.18.0

func (pos *Position) After(other Position) bool

After returns true if the position is after other given position.

func (*Position) Before added in v0.18.0

func (pos *Position) Before(other Position) bool

Before returns true if the position is before the other given position.

func (*Position) IsValid added in v0.18.0

func (pos *Position) IsValid() bool

IsValid returns true if the position is valid.

func (Position) String added in v0.18.0

func (pos Position) String() string

String returns the position's string representation.

type PostExpr added in v0.19.0

type PostExpr struct {
	X  Expr
	Op Token
}

A postfix expresseion (i++, i--)

func (*PostExpr) Children added in v0.19.0

func (n *PostExpr) Children() []Node

func (*PostExpr) End added in v0.19.0

func (n *PostExpr) End() int

func (*PostExpr) FirstTok added in v0.19.0

func (n *PostExpr) FirstTok() Token

func (*PostExpr) Inspect added in v0.19.0

func (n *PostExpr) Inspect(f func(Node) bool)

func (*PostExpr) LastTok added in v0.19.0

func (n *PostExpr) LastTok() Token

func (*PostExpr) Pos added in v0.19.0

func (n *PostExpr) Pos() int

type RedirectExpr added in v0.18.0

type RedirectExpr struct {
	X             Expr   // Preceding redirected expression
	Tok           Token  // Position of "->"
	ValueTok      Token  // Position of "value" or nil
	Value         []Expr // Value expression
	ParamTok      Token  // Position of "param" or nil
	Param         []Expr // Param expression
	SenderTok     Token  // Position of "sender" or nil
	Sender        Expr   // Sender expression
	IndexTok      Token  // Position of "@index" or nil
	IndexValueTok Token  // Position of "value" or nil
	Index         Expr   // Index expression
	TimestampTok  Token  // Position of "timestamp" or nil
	Timestamp     Expr   // Timestamp expression
}

A RedirectExpr represents various redirect expressions

func (*RedirectExpr) Children added in v0.18.0

func (n *RedirectExpr) Children() []Node

func (*RedirectExpr) End added in v0.18.0

func (n *RedirectExpr) End() int

func (*RedirectExpr) FirstTok added in v0.18.0

func (n *RedirectExpr) FirstTok() Token

func (*RedirectExpr) Inspect added in v0.18.0

func (n *RedirectExpr) Inspect(f func(Node) bool)

func (*RedirectExpr) LastTok added in v0.18.0

func (n *RedirectExpr) LastTok() Token

func (*RedirectExpr) Pos added in v0.18.0

func (n *RedirectExpr) Pos() int

type RefSpec added in v0.18.0

type RefSpec struct {
	X Expr
}

A RefSpec represents a type reference.

func (*RefSpec) Children added in v0.18.0

func (n *RefSpec) Children() []Node

func (*RefSpec) End added in v0.18.0

func (n *RefSpec) End() int

func (*RefSpec) FirstTok added in v0.18.0

func (n *RefSpec) FirstTok() Token

func (*RefSpec) Inspect added in v0.18.0

func (n *RefSpec) Inspect(f func(Node) bool)

func (*RefSpec) LastTok added in v0.18.0

func (n *RefSpec) LastTok() Token

func (*RefSpec) Pos added in v0.18.0

func (n *RefSpec) Pos() int

type RegexpExpr added in v0.18.0

type RegexpExpr struct {
	Tok    Token // Position of "regexp"
	NoCase Token // Position of "@nocase" or nil
	X      Expr  // Regex expression
}

A RegexExpr represents a "regexp" expression.

func (*RegexpExpr) Children added in v0.18.0

func (n *RegexpExpr) Children() []Node

func (*RegexpExpr) End added in v0.18.0

func (n *RegexpExpr) End() int

func (*RegexpExpr) FirstTok added in v0.18.0

func (n *RegexpExpr) FirstTok() Token

func (*RegexpExpr) Inspect added in v0.18.0

func (n *RegexpExpr) Inspect(f func(Node) bool)

func (*RegexpExpr) LastTok added in v0.18.0

func (n *RegexpExpr) LastTok() Token

func (*RegexpExpr) Pos added in v0.18.0

func (n *RegexpExpr) Pos() int

type RestrictionSpec added in v0.18.0

type RestrictionSpec struct {
	TemplateTok Token
	LParen      Token
	Tok         Token
	RParen      Token
}

func (*RestrictionSpec) Children added in v0.18.0

func (n *RestrictionSpec) Children() []Node

func (*RestrictionSpec) End added in v0.18.0

func (n *RestrictionSpec) End() int

func (*RestrictionSpec) FirstTok added in v0.18.0

func (n *RestrictionSpec) FirstTok() Token

func (*RestrictionSpec) Inspect added in v0.18.0

func (n *RestrictionSpec) Inspect(f func(Node) bool)

func (*RestrictionSpec) LastTok added in v0.18.0

func (n *RestrictionSpec) LastTok() Token

func (*RestrictionSpec) Pos added in v0.18.0

func (n *RestrictionSpec) Pos() int

type ReturnSpec added in v0.18.0

type ReturnSpec struct {
	Tok         Token
	Restriction *RestrictionSpec
	Modif       Token
	Type        Expr
}

func (*ReturnSpec) Children added in v0.18.0

func (n *ReturnSpec) Children() []Node

func (*ReturnSpec) End added in v0.18.0

func (n *ReturnSpec) End() int

func (*ReturnSpec) FirstTok added in v0.18.0

func (n *ReturnSpec) FirstTok() Token

func (*ReturnSpec) Inspect added in v0.18.0

func (n *ReturnSpec) Inspect(f func(Node) bool)

func (*ReturnSpec) LastTok added in v0.18.0

func (n *ReturnSpec) LastTok() Token

func (*ReturnSpec) Pos added in v0.18.0

func (n *ReturnSpec) Pos() int

type ReturnStmt

type ReturnStmt struct {
	Tok    Token // Position of "return"
	Result Expr  // Resulting expression of nil
}

A ReturnStmt represents a return statement.

func (*ReturnStmt) Children added in v0.18.0

func (n *ReturnStmt) Children() []Node

func (*ReturnStmt) End added in v0.18.0

func (n *ReturnStmt) End() int

func (*ReturnStmt) FirstTok added in v0.18.0

func (n *ReturnStmt) FirstTok() Token

func (*ReturnStmt) Inspect added in v0.18.0

func (n *ReturnStmt) Inspect(f func(Node) bool)

func (*ReturnStmt) LastTok added in v0.18.0

func (n *ReturnStmt) LastTok() Token

func (*ReturnStmt) Pos added in v0.18.0

func (n *ReturnStmt) Pos() int

type Root

type Root struct {
	NodeList
	*Scanner
	Filename string
	// contains filtered or unexported fields
}

func Parse

func Parse(src []byte, opts ...ParserOption) (root *Root, names map[string]bool, uses map[string]bool)

Parse the source code of a single file and return the corresponding syntax tree. The source code may be provided via the filename of the source file, or via the src parameter.

If src != nil, Parse parses the source from src and the filename is only used when recording position information. The type of the argument for the src parameter must be string, []byte, or io.Reader. If src == nil, Parse parses the file specified by filename.

The mode parameter controls the amount of source text parsed and other optional parser functionality.

If the source couldn't be read, the returned AST is nil and the error indicates the specific failure. If the source was read but syntax errors were found, the result is a partial AST (with Bad* nodes representing the fragments of erroneous source code). Multiple errors are returned via a ErrorList which is sorted by file position.

func Tokenize

func Tokenize(src []byte) *Root

Tokenize given source code and return a root node with all the tokens.

func (*Root) Children added in v0.18.0

func (n *Root) Children() []Node

func (*Root) End added in v0.18.0

func (n *Root) End() int

func (*Root) Err added in v0.18.0

func (n *Root) Err() error

func (*Root) FirstTok added in v0.18.0

func (n *Root) FirstTok() Token

func (*Root) Inspect added in v0.18.0

func (n *Root) Inspect(f func(Node) bool)

func (*Root) LastTok added in v0.18.0

func (n *Root) LastTok() Token

func (*Root) Pos added in v0.18.0

func (n *Root) Pos() int

func (*Root) PosFor added in v0.18.0

func (n *Root) PosFor(line, col int) int

func (*Root) Position added in v0.18.0

func (n *Root) Position(offset int) Position

type RunsOnSpec added in v0.18.0

type RunsOnSpec struct {
	RunsTok Token
	OnTok   Token
	Comp    Expr
}

func (*RunsOnSpec) Children added in v0.18.0

func (n *RunsOnSpec) Children() []Node

func (*RunsOnSpec) End added in v0.18.0

func (n *RunsOnSpec) End() int

func (*RunsOnSpec) FirstTok added in v0.18.0

func (n *RunsOnSpec) FirstTok() Token

func (*RunsOnSpec) Inspect added in v0.18.0

func (n *RunsOnSpec) Inspect(f func(Node) bool)

func (*RunsOnSpec) LastTok added in v0.18.0

func (n *RunsOnSpec) LastTok() Token

func (*RunsOnSpec) Pos added in v0.18.0

func (n *RunsOnSpec) Pos() int

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner scans a TTCN-3 source.

func NewScanner

func NewScanner(src []byte) *Scanner

NewScanner returns a new TTCN-3 scanner for src.

func (*Scanner) Lines added in v0.18.0

func (s *Scanner) Lines() []int

Lines returns the line offsets of the source.

func (*Scanner) Scan

func (s *Scanner) Scan() (Kind, int, int)

Scan returns the next token and its range.

type SelectStmt

type SelectStmt struct {
	Tok    Token         // Position of "select"
	Union  Token         // Position of "union" or nil
	Tag    *ParenExpr    // Tag expression
	LBrace Token         // Position of "{"
	Body   []*CaseClause // List of case clauses
	RBrace Token         // Position of "}"
}

A SelectStmt represents a select statements.

func (*SelectStmt) Children added in v0.18.0

func (n *SelectStmt) Children() []Node

func (*SelectStmt) End added in v0.18.0

func (n *SelectStmt) End() int

func (*SelectStmt) FirstTok added in v0.18.0

func (n *SelectStmt) FirstTok() Token

func (*SelectStmt) Inspect added in v0.18.0

func (n *SelectStmt) Inspect(f func(Node) bool)

func (*SelectStmt) LastTok added in v0.18.0

func (n *SelectStmt) LastTok() Token

func (*SelectStmt) Pos added in v0.18.0

func (n *SelectStmt) Pos() int

type SelectorExpr added in v0.18.0

type SelectorExpr struct {
	X   Expr  // Preceding expression (might be nil)
	Dot Token // Position of "."
	Sel Expr  // Literal, identifier or reference.
}

A SelectorExpr represents an expression followed by a selector.

func (*SelectorExpr) Children added in v0.18.0

func (n *SelectorExpr) Children() []Node

func (*SelectorExpr) End added in v0.18.0

func (n *SelectorExpr) End() int

func (*SelectorExpr) FirstTok added in v0.18.0

func (n *SelectorExpr) FirstTok() Token

func (*SelectorExpr) Inspect added in v0.18.0

func (n *SelectorExpr) Inspect(f func(Node) bool)

func (*SelectorExpr) LastTok added in v0.18.0

func (n *SelectorExpr) LastTok() Token

func (*SelectorExpr) Pos added in v0.18.0

func (n *SelectorExpr) Pos() int

type SignatureDecl added in v0.18.0

type SignatureDecl struct {
	Tok          Token // Position of "signature"
	Name         *Ident
	TypePars     *FormalPars
	Params       *FormalPars
	NoBlock      Token       // Optional "noblock"
	Return       *ReturnSpec // Optional return-spec
	ExceptionTok Token       // Position of "exeception" or nil
	Exception    *ParenExpr  // Exception list
	With         *WithSpec
}

A SignatureDecl represents a signature type for procedure based communication.

func (*SignatureDecl) Children added in v0.18.0

func (n *SignatureDecl) Children() []Node

func (*SignatureDecl) End added in v0.18.0

func (n *SignatureDecl) End() int

func (*SignatureDecl) FirstTok added in v0.18.0

func (n *SignatureDecl) FirstTok() Token

func (*SignatureDecl) Inspect added in v0.18.0

func (n *SignatureDecl) Inspect(f func(Node) bool)

func (*SignatureDecl) LastTok added in v0.18.0

func (n *SignatureDecl) LastTok() Token

func (*SignatureDecl) Pos added in v0.18.0

func (n *SignatureDecl) Pos() int

type Span added in v0.18.0

type Span struct {
	Filename   string
	Begin, End Position
}

Span is the text span in the source code.

func SpanOf added in v0.18.0

func SpanOf(n Node) Span

func (*Span) String added in v0.18.0

func (s *Span) String() string

String returns the string representation of the text span.

type Stmt

type Stmt interface {
	Node
	// contains filtered or unexported methods
}

All statement nodes implement the Stmt interface.

type StructSpec added in v0.18.0

type StructSpec struct {
	Kind   Token    // RECORD, SET, UNION
	LBrace Token    // Position of "{"
	Fields []*Field // Member list
	RBrace Token    // Position of "}"
}

A StructSpec represents a struct type specification.

func (*StructSpec) Children added in v0.18.0

func (n *StructSpec) Children() []Node

func (*StructSpec) End added in v0.18.0

func (n *StructSpec) End() int

func (*StructSpec) FirstTok added in v0.18.0

func (n *StructSpec) FirstTok() Token

func (*StructSpec) Inspect added in v0.18.0

func (n *StructSpec) Inspect(f func(Node) bool)

func (*StructSpec) LastTok added in v0.18.0

func (n *StructSpec) LastTok() Token

func (*StructSpec) Pos added in v0.18.0

func (n *StructSpec) Pos() int

type StructTypeDecl added in v0.18.0

type StructTypeDecl struct {
	TypeTok  Token  // Position of "type"
	Kind     Token  // RECORD, SET, UNION
	Name     *Ident // Name
	TypePars *FormalPars
	LBrace   Token    // Position of "{"
	Fields   []*Field // Member list
	RBrace   Token    // Position of }"
	With     *WithSpec
}

A StructTypeDecl represents a name struct type.

func (*StructTypeDecl) Children added in v0.18.0

func (n *StructTypeDecl) Children() []Node

func (*StructTypeDecl) End added in v0.18.0

func (n *StructTypeDecl) End() int

func (*StructTypeDecl) FirstTok added in v0.18.0

func (n *StructTypeDecl) FirstTok() Token

func (*StructTypeDecl) Inspect added in v0.18.0

func (n *StructTypeDecl) Inspect(f func(Node) bool)

func (*StructTypeDecl) LastTok added in v0.18.0

func (n *StructTypeDecl) LastTok() Token

func (*StructTypeDecl) Pos added in v0.18.0

func (n *StructTypeDecl) Pos() int

type SubTypeDecl added in v0.18.0

type SubTypeDecl struct {
	TypeTok Token  // Position of "type"
	Field   *Field // Field spec
	With    *WithSpec
}

A SubTypeDecl represents a named sub type declaration

func (*SubTypeDecl) Children added in v0.18.0

func (n *SubTypeDecl) Children() []Node

func (*SubTypeDecl) End added in v0.18.0

func (n *SubTypeDecl) End() int

func (*SubTypeDecl) FirstTok added in v0.18.0

func (n *SubTypeDecl) FirstTok() Token

func (*SubTypeDecl) Inspect added in v0.18.0

func (n *SubTypeDecl) Inspect(f func(Node) bool)

func (*SubTypeDecl) LastTok added in v0.18.0

func (n *SubTypeDecl) LastTok() Token

func (*SubTypeDecl) Pos added in v0.18.0

func (n *SubTypeDecl) Pos() int

type SystemSpec added in v0.18.0

type SystemSpec struct {
	Tok  Token
	Comp Expr
}

func (*SystemSpec) Children added in v0.18.0

func (n *SystemSpec) Children() []Node

func (*SystemSpec) End added in v0.18.0

func (n *SystemSpec) End() int

func (*SystemSpec) FirstTok added in v0.18.0

func (n *SystemSpec) FirstTok() Token

func (*SystemSpec) Inspect added in v0.18.0

func (n *SystemSpec) Inspect(f func(Node) bool)

func (*SystemSpec) LastTok added in v0.18.0

func (n *SystemSpec) LastTok() Token

func (*SystemSpec) Pos added in v0.18.0

func (n *SystemSpec) Pos() int

type TemplateDecl added in v0.18.0

type TemplateDecl struct {
	*RestrictionSpec
	Modif       Token // "@lazy", "@fuzzy" or nil
	Type        Expr
	Name        *Ident
	TypePars    *FormalPars
	Params      *FormalPars
	ModifiesTok Token
	Base        Expr
	AssignTok   Token
	Value       Expr
	With        *WithSpec
}

func (*TemplateDecl) Children added in v0.18.0

func (n *TemplateDecl) Children() []Node

func (*TemplateDecl) End added in v0.18.0

func (n *TemplateDecl) End() int

func (*TemplateDecl) FirstTok added in v0.18.0

func (n *TemplateDecl) FirstTok() Token

func (*TemplateDecl) Inspect added in v0.18.0

func (n *TemplateDecl) Inspect(f func(Node) bool)

func (*TemplateDecl) LastTok added in v0.18.0

func (n *TemplateDecl) LastTok() Token

func (*TemplateDecl) Pos added in v0.18.0

func (n *TemplateDecl) Pos() int

type Token added in v0.18.0

type Token interface {
	Node
	Kind() Kind
	String() string
	PrevTok() Token
	NextTok() Token
}

type TypeSpec added in v0.18.0

type TypeSpec interface {
	Node
	// contains filtered or unexported methods
}

All nested types implement TypeSpec interface.

type UnaryExpr

type UnaryExpr struct {
	Op Token // Operator token, like "+", "-", "!", ...
	X  Expr
}

A UnaryExpr represents a unary expresions.

func (*UnaryExpr) Children added in v0.18.0

func (n *UnaryExpr) Children() []Node

func (*UnaryExpr) End added in v0.18.0

func (n *UnaryExpr) End() int

func (*UnaryExpr) FirstTok added in v0.18.0

func (n *UnaryExpr) FirstTok() Token

func (*UnaryExpr) Inspect added in v0.18.0

func (n *UnaryExpr) Inspect(f func(Node) bool)

func (*UnaryExpr) LastTok added in v0.18.0

func (n *UnaryExpr) LastTok() Token

func (*UnaryExpr) Pos added in v0.18.0

func (n *UnaryExpr) Pos() int

type ValueDecl added in v0.18.0

type ValueDecl struct {
	Kind                Token // VAR, CONST, TIMER, PORT, TEMPLATE, MODULEPAR
	TemplateRestriction *RestrictionSpec
	Modif               Token // "@lazy", "@fuzzy" or nil
	Type                Expr
	Decls               []*Declarator
	With                *WithSpec
}

A ValueDecl represents a value declaration.

func (*ValueDecl) Children added in v0.18.0

func (n *ValueDecl) Children() []Node

func (*ValueDecl) End added in v0.18.0

func (n *ValueDecl) End() int

func (*ValueDecl) FirstTok added in v0.18.0

func (n *ValueDecl) FirstTok() Token

func (*ValueDecl) Inspect added in v0.18.0

func (n *ValueDecl) Inspect(f func(Node) bool)

func (*ValueDecl) LastTok added in v0.18.0

func (n *ValueDecl) LastTok() Token

func (*ValueDecl) Pos added in v0.18.0

func (n *ValueDecl) Pos() int

type ValueExpr added in v0.18.0

type ValueExpr struct {
	X   Expr  // Preceding template expression
	Tok Token // Position of "value"
	Y   Expr  // Value expression
}

A ValueExpr represents the return value used by signature based communication.

func (*ValueExpr) Children added in v0.18.0

func (n *ValueExpr) Children() []Node

func (*ValueExpr) End added in v0.18.0

func (n *ValueExpr) End() int

func (*ValueExpr) FirstTok added in v0.18.0

func (n *ValueExpr) FirstTok() Token

func (*ValueExpr) Inspect added in v0.18.0

func (n *ValueExpr) Inspect(f func(Node) bool)

func (*ValueExpr) LastTok added in v0.18.0

func (n *ValueExpr) LastTok() Token

func (*ValueExpr) Pos added in v0.18.0

func (n *ValueExpr) Pos() int

type ValueLiteral added in v0.18.0

type ValueLiteral struct {
	Tok Token
}

A ValueLiteral represents simple literals, like integers, charstrings, ...

func (*ValueLiteral) Children added in v0.18.0

func (n *ValueLiteral) Children() []Node

func (*ValueLiteral) End added in v0.18.0

func (n *ValueLiteral) End() int

func (*ValueLiteral) FirstTok added in v0.18.0

func (n *ValueLiteral) FirstTok() Token

func (*ValueLiteral) Inspect added in v0.18.0

func (n *ValueLiteral) Inspect(f func(Node) bool)

func (*ValueLiteral) LastTok added in v0.18.0

func (n *ValueLiteral) LastTok() Token

func (*ValueLiteral) Pos added in v0.18.0

func (n *ValueLiteral) Pos() int

type WhileStmt

type WhileStmt struct {
	Tok    Token      // Position of "while"
	LParen Token      // Position of "("
	Cond   Expr       // Conditional expression
	RParen Token      // Position of ")"
	Body   *BlockStmt // Loop-body
}

A WhilStmt represents a "while" statement.

func (*WhileStmt) Children added in v0.18.0

func (n *WhileStmt) Children() []Node

func (*WhileStmt) End added in v0.18.0

func (n *WhileStmt) End() int

func (*WhileStmt) FirstTok added in v0.18.0

func (n *WhileStmt) FirstTok() Token

func (*WhileStmt) Inspect added in v0.18.0

func (n *WhileStmt) Inspect(f func(Node) bool)

func (*WhileStmt) LastTok added in v0.18.0

func (n *WhileStmt) LastTok() Token

func (*WhileStmt) Pos added in v0.18.0

func (n *WhileStmt) Pos() int

type WithSpec added in v0.18.0

type WithSpec struct {
	Tok    Token
	LBrace Token
	List   []*WithStmt
	RBrace Token
}

func (*WithSpec) Children added in v0.18.0

func (n *WithSpec) Children() []Node

func (*WithSpec) End added in v0.18.0

func (n *WithSpec) End() int

func (*WithSpec) FirstTok added in v0.18.0

func (n *WithSpec) FirstTok() Token

func (*WithSpec) Inspect added in v0.18.0

func (n *WithSpec) Inspect(f func(Node) bool)

func (*WithSpec) LastTok added in v0.18.0

func (n *WithSpec) LastTok() Token

func (*WithSpec) Pos added in v0.18.0

func (n *WithSpec) Pos() int

type WithStmt

type WithStmt struct {
	Kind     Token
	Override Token
	LParen   Token
	List     []Expr
	RParen   Token
	Value    Expr
}

func (*WithStmt) Children added in v0.18.0

func (n *WithStmt) Children() []Node

func (*WithStmt) End added in v0.18.0

func (n *WithStmt) End() int

func (*WithStmt) FirstTok added in v0.18.0

func (n *WithStmt) FirstTok() Token

func (*WithStmt) Inspect added in v0.18.0

func (n *WithStmt) Inspect(f func(Node) bool)

func (*WithStmt) LastTok added in v0.18.0

func (n *WithStmt) LastTok() Token

func (*WithStmt) Pos added in v0.18.0

func (n *WithStmt) Pos() int

Directories

Path Synopsis
internal
gen

Jump to

Keyboard shortcuts

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