Documentation ¶
Overview ¶
Package ast provides TTCN-3 syntax tree nodes and functions for tree traversal.
Index ¶
- func Inspect(node Node, f func(Node) bool)
- func IsNil(n Node) bool
- func Name(n Node) string
- func Walk(v Visitor, node Node)
- func WalkModuleDefs(fun func(def *ModuleDef) bool, nodes ...Node)
- type AltStmt
- type ApplyFunc
- type BehaviourSpec
- type BehaviourTypeDecl
- type BinaryExpr
- type BlockStmt
- type BranchStmt
- type CallExpr
- type CallStmt
- type CaseClause
- type CommClause
- type ComponentTypeDecl
- type CompositeLiteral
- type ControlPart
- type Cursor
- type Decl
- type DeclStmt
- type Declarator
- type DecmatchExpr
- type DecodedExpr
- type DefKindExpr
- type DoWhileStmt
- type EnumSpec
- type EnumTypeDecl
- type ErrorNode
- type ExceptExpr
- type Expr
- type ExprStmt
- type Field
- type ForStmt
- type FormalPar
- type FormalPars
- type FriendDecl
- type FromExpr
- type FuncDecl
- type GroupDecl
- type Ident
- type IfStmt
- type ImportDecl
- type IndexExpr
- type LanguageSpec
- type LengthExpr
- type ListSpec
- type ModifiesExpr
- type Module
- type ModuleDef
- type ModuleParameterGroup
- type MtcSpec
- type Node
- type NodeList
- type ParamExpr
- type ParametrizedIdent
- type ParenExpr
- type PatternExpr
- type PortAttribute
- type PortMapAttribute
- type PortTypeDecl
- type RedirectExpr
- type RefSpec
- type RegexpExpr
- type RestrictionSpec
- type ReturnSpec
- type ReturnStmt
- type RunsOnSpec
- type SelectStmt
- type SelectorExpr
- type SignatureDecl
- type Stmt
- type StructSpec
- type StructTypeDecl
- type SubTypeDecl
- type SystemSpec
- type TemplateDecl
- type Terminal
- type Token
- type Trivia
- type TypeSpec
- type UnaryExpr
- type ValueDecl
- type ValueExpr
- type ValueLiteral
- type Visitor
- type WhileStmt
- type WithSpec
- type WithStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Inspect ¶
Inspect traverses an AST in depth-first order: It starts by calling f(node); node must not be nil. If f returns true, Inspect invokes f recursively for each of the non-nil children of node, followed by a call of f(nil).
func Name ¶
Name returns the name of a Node. If the node has no name (like statements) Name will return an empty string.
func Walk ¶
Walk traverses an AST in depth-first order: It starts by calling v.Visit(node); node must not be nil. If the visitor w returned by v.Visit(node) is not nil, Walk is invoked recursively with visitor w for each of the non-nil children of node, followed by a call of w.Visit(nil).
func WalkModuleDefs ¶
WalkModuleDefs calls fun for every module definition.
Types ¶
type AltStmt ¶
type AltStmt struct { Tok Token // ALT or INTERLEAVE Body *BlockStmt // Block statement with alternations }
A AltStmt represents an alternative statement.
type ApplyFunc ¶
An ApplyFunc is invoked by Apply for each node n, even if n is nil, before and/or after the node's children, using a Cursor describing the current node and providing operations on it.
The return value of ApplyFunc controls the syntax tree traversal. See Apply for details.
type BehaviourSpec ¶
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) End ¶
func (x *BehaviourSpec) End() loc.Pos
func (*BehaviourSpec) LastTok ¶
func (x *BehaviourSpec) LastTok() *Token
func (*BehaviourSpec) Pos ¶
func (x *BehaviourSpec) Pos() loc.Pos
type BehaviourTypeDecl ¶
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) End ¶
func (x *BehaviourTypeDecl) End() loc.Pos
func (*BehaviourTypeDecl) LastTok ¶
func (x *BehaviourTypeDecl) LastTok() *Token
func (*BehaviourTypeDecl) Pos ¶
func (x *BehaviourTypeDecl) Pos() loc.Pos
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) End ¶
func (x *BinaryExpr) End() loc.Pos
func (*BinaryExpr) LastTok ¶
func (x *BinaryExpr) LastTok() *Token
func (*BinaryExpr) Pos ¶
func (x *BinaryExpr) Pos() loc.Pos
type BlockStmt ¶
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.
type BranchStmt ¶
type BranchStmt struct { Tok Token // REPEAT, BREAK, CONTINUE, LABEL, GOTO Label *Ident // Label literal or nil }
A BranchStmt represents a branch statement.
func (*BranchStmt) End ¶
func (x *BranchStmt) End() loc.Pos
func (*BranchStmt) LastTok ¶
func (x *BranchStmt) LastTok() *Token
func (*BranchStmt) Pos ¶
func (x *BranchStmt) Pos() loc.Pos
type CallStmt ¶
type CallStmt struct { Stmt Stmt // "call" statement Body *BlockStmt // Block statement with alternations }
A CallStmt represents a "call" statement with communication-block.
type CaseClause ¶
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) End ¶
func (x *CaseClause) End() loc.Pos
func (*CaseClause) LastTok ¶
func (x *CaseClause) LastTok() *Token
func (*CaseClause) Pos ¶
func (x *CaseClause) Pos() loc.Pos
type CommClause ¶
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) End ¶
func (x *CommClause) End() loc.Pos
func (*CommClause) LastTok ¶
func (x *CommClause) LastTok() *Token
func (*CommClause) Pos ¶
func (x *CommClause) Pos() loc.Pos
type ComponentTypeDecl ¶
type ComponentTypeDecl struct { TypeTok Token CompTok Token Name *Ident TypePars *FormalPars ExtendsTok Token Extends []Expr Body *BlockStmt With *WithSpec }
func (*ComponentTypeDecl) End ¶
func (x *ComponentTypeDecl) End() loc.Pos
func (*ComponentTypeDecl) LastTok ¶
func (x *ComponentTypeDecl) LastTok() *Token
func (*ComponentTypeDecl) Pos ¶
func (x *ComponentTypeDecl) Pos() loc.Pos
type CompositeLiteral ¶
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) End ¶
func (x *CompositeLiteral) End() loc.Pos
func (*CompositeLiteral) LastTok ¶
func (x *CompositeLiteral) LastTok() *Token
func (*CompositeLiteral) Pos ¶
func (x *CompositeLiteral) Pos() loc.Pos
type ControlPart ¶
func (*ControlPart) End ¶
func (x *ControlPart) End() loc.Pos
func (*ControlPart) LastTok ¶
func (x *ControlPart) LastTok() *Token
func (*ControlPart) Pos ¶
func (x *ControlPart) Pos() loc.Pos
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
A Cursor describes a node encountered during Apply. Information about the node and its parent is available from the Node, Parent, Name, and Index methods.
If p is a variable of type and value of the current parent node c.Parent(), and f is the field identifier with name c.Name(), the following invariants hold:
p.f == c.Node() if c.Index() < 0 p.f[c.Index()] == c.Node() if c.Index() >= 0
The methods Replace, Delete, InsertBefore, and InsertAfter can be used to change the AST without disrupting Apply.
func (*Cursor) Delete ¶
func (c *Cursor) Delete()
Delete deletes the current Node from its containing slice. If the current Node is not part of a slice, Delete panics. As a special case, if the current node is a package file, Delete removes it from the package's Files map.
func (*Cursor) Index ¶
Index reports the index >= 0 of the current Node in the slice of Nodes that contains it, or a value < 0 if the current Node is not part of a slice. The index of the current node changes if InsertBefore is called while processing the current node.
func (*Cursor) InsertAfter ¶
InsertAfter inserts n after the current Node in its containing slice. If the current Node is not part of a slice, InsertAfter panics. Apply does not walk n.
func (*Cursor) InsertBefore ¶
InsertBefore inserts n before the current Node in its containing slice. If the current Node is not part of a slice, InsertBefore panics. Apply will not walk n.
func (*Cursor) Name ¶
Name returns the name of the parent Node field that contains the current Node. If the parent is a *Package and the current Node is a *File, Name returns the filename for the current Node.
type Decl ¶
type Decl interface { Node // contains filtered or unexported methods }
All declaration nodes implement the Decl interface.
type DeclStmt ¶
type DeclStmt struct {
Decl Decl
}
A DeclStmt represents a value declaration used as statement, lika a local variable declaration.
type Declarator ¶
A Declarator represents a single varable declaration
func (*Declarator) End ¶
func (x *Declarator) End() loc.Pos
func (*Declarator) LastTok ¶
func (x *Declarator) LastTok() *Token
func (*Declarator) Pos ¶
func (x *Declarator) Pos() loc.Pos
type DecmatchExpr ¶
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) End ¶
func (x *DecmatchExpr) End() loc.Pos
func (*DecmatchExpr) LastTok ¶
func (x *DecmatchExpr) LastTok() *Token
func (*DecmatchExpr) Pos ¶
func (x *DecmatchExpr) Pos() loc.Pos
type DecodedExpr ¶
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) End ¶
func (x *DecodedExpr) End() loc.Pos
func (*DecodedExpr) LastTok ¶
func (x *DecodedExpr) LastTok() *Token
func (*DecodedExpr) Pos ¶
func (x *DecodedExpr) Pos() loc.Pos
type DefKindExpr ¶
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) End ¶
func (x *DefKindExpr) End() loc.Pos
func (*DefKindExpr) LastTok ¶
func (x *DefKindExpr) LastTok() *Token
func (*DefKindExpr) Pos ¶
func (x *DefKindExpr) Pos() loc.Pos
type DoWhileStmt ¶
type DoWhileStmt struct { DoTok Token // Position of "do" Body *BlockStmt // Loop-Body WhileTok Token // Position of "while" Cond *ParenExpr // Conditional expression }
A DoWhileStmt represents a do-while statement.
func (*DoWhileStmt) End ¶
func (x *DoWhileStmt) End() loc.Pos
func (*DoWhileStmt) LastTok ¶
func (x *DoWhileStmt) LastTok() *Token
func (*DoWhileStmt) Pos ¶
func (x *DoWhileStmt) Pos() loc.Pos
type EnumSpec ¶
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.
type EnumTypeDecl ¶
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) End ¶
func (x *EnumTypeDecl) End() loc.Pos
func (*EnumTypeDecl) LastTok ¶
func (x *EnumTypeDecl) LastTok() *Token
func (*EnumTypeDecl) Pos ¶
func (x *EnumTypeDecl) Pos() loc.Pos
type ExceptExpr ¶
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) End ¶
func (x *ExceptExpr) End() loc.Pos
func (*ExceptExpr) LastTok ¶
func (x *ExceptExpr) LastTok() *Token
func (*ExceptExpr) Pos ¶
func (x *ExceptExpr) Pos() loc.Pos
type Expr ¶
type Expr interface { Node // contains filtered or unexported methods }
All expression nodes implement the Expr interface.
type ExprStmt ¶
type ExprStmt struct {
Expr Expr
}
An ExprStmt represents a expression used as statement, like an assignment or function call.
type Field ¶
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
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.
type FormalPar ¶
type FormalPars ¶
func (*FormalPars) End ¶
func (x *FormalPars) End() loc.Pos
func (*FormalPars) LastTok ¶
func (x *FormalPars) LastTok() *Token
func (*FormalPars) Pos ¶
func (x *FormalPars) Pos() loc.Pos
type FriendDecl ¶
func (*FriendDecl) End ¶
func (x *FriendDecl) End() loc.Pos
func (*FriendDecl) LastTok ¶
func (x *FriendDecl) LastTok() *Token
func (*FriendDecl) Pos ¶
func (x *FriendDecl) Pos() loc.Pos
type FromExpr ¶
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".
type FuncDecl ¶
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.
type GroupDecl ¶
type Ident ¶
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.
type IfStmt ¶
type IfStmt struct { Tok Token // Position of "if" Cond Expr // Conditional expression Then *BlockStmt // True branch ElseTok Token // Position of "else" or nil Else Stmt // Else branch }
A IfStmt represents a conditional statement.
type ImportDecl ¶
type ImportDecl struct { ImportTok Token FromTok Token Module *Ident Language *LanguageSpec LBrace Token List []*DefKindExpr RBrace Token With *WithSpec }
func (*ImportDecl) End ¶
func (x *ImportDecl) End() loc.Pos
func (*ImportDecl) LastTok ¶
func (x *ImportDecl) LastTok() *Token
func (*ImportDecl) Pos ¶
func (x *ImportDecl) Pos() loc.Pos
type IndexExpr ¶
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.
type LanguageSpec ¶
func (*LanguageSpec) End ¶
func (x *LanguageSpec) End() loc.Pos
func (*LanguageSpec) LastTok ¶
func (x *LanguageSpec) LastTok() *Token
func (*LanguageSpec) Pos ¶
func (x *LanguageSpec) Pos() loc.Pos
type LengthExpr ¶
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) End ¶
func (x *LengthExpr) End() loc.Pos
func (*LengthExpr) LastTok ¶
func (x *LengthExpr) LastTok() *Token
func (*LengthExpr) Pos ¶
func (x *LengthExpr) Pos() loc.Pos
type ListSpec ¶
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.
type ModifiesExpr ¶
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) End ¶
func (x *ModifiesExpr) End() loc.Pos
func (*ModifiesExpr) LastTok ¶
func (x *ModifiesExpr) LastTok() *Token
func (*ModifiesExpr) Pos ¶
func (x *ModifiesExpr) Pos() loc.Pos
type Module ¶
type ModuleParameterGroup ¶
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) End ¶
func (x *ModuleParameterGroup) End() loc.Pos
func (*ModuleParameterGroup) LastTok ¶
func (x *ModuleParameterGroup) LastTok() *Token
func (*ModuleParameterGroup) Pos ¶
func (x *ModuleParameterGroup) Pos() loc.Pos
type Node ¶
All node types implement the Node interface.
func Apply ¶
Apply traverses a syntax tree recursively, starting with root, and calling pre and post for each node as described below. Apply returns the syntax tree, possibly modified.
If pre is not nil, it is called for each node before the node's children are traversed (pre-order). If pre returns false, no children are traversed, and post is not called for that node.
If post is not nil, and a prior call of pre didn't return false, post is called for each node after its children are traversed (post-order). If post returns false, traversal is terminated and Apply returns immediately.
Only fields that refer to AST nodes are considered children; i.e., token.Pos, Scopes, Objects, and fields of basic types (strings, etc.) are ignored.
Children are traversed in the order in which they appear in the respective node's struct definition. A package's files are traversed in the filenames' alphabetical order.
func FindChildOf ¶ added in v0.16.2
FindChildOfType returns the first direct child of the give node, enclosing given position.
type ParamExpr ¶
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.
type ParametrizedIdent ¶
ParametrizedIdent represents a paremetrized identifier, e.g. "f<charstring>".
func (*ParametrizedIdent) End ¶
func (x *ParametrizedIdent) End() loc.Pos
func (*ParametrizedIdent) LastTok ¶
func (x *ParametrizedIdent) LastTok() *Token
func (*ParametrizedIdent) Pos ¶
func (x *ParametrizedIdent) Pos() loc.Pos
type ParenExpr ¶
type ParenExpr struct { LParen Token // Position of "(", "<", "[" List []Expr // Expression list RParen Token // Position of ")", ">", "]" }
A ParenExpr represents parenthized expression lists.
type PatternExpr ¶
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) End ¶
func (x *PatternExpr) End() loc.Pos
func (*PatternExpr) LastTok ¶
func (x *PatternExpr) LastTok() *Token
func (*PatternExpr) Pos ¶
func (x *PatternExpr) Pos() loc.Pos
type PortAttribute ¶
func (*PortAttribute) End ¶
func (x *PortAttribute) End() loc.Pos
func (*PortAttribute) LastTok ¶
func (x *PortAttribute) LastTok() *Token
func (*PortAttribute) Pos ¶
func (x *PortAttribute) Pos() loc.Pos
type PortMapAttribute ¶
type PortMapAttribute struct { MapTok Token // MAP, UNMAP ParamTok Token Params *FormalPars }
func (*PortMapAttribute) End ¶
func (x *PortMapAttribute) End() loc.Pos
func (*PortMapAttribute) LastTok ¶
func (x *PortMapAttribute) LastTok() *Token
func (*PortMapAttribute) Pos ¶
func (x *PortMapAttribute) Pos() loc.Pos
type PortTypeDecl ¶
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) End ¶
func (x *PortTypeDecl) End() loc.Pos
func (*PortTypeDecl) LastTok ¶
func (x *PortTypeDecl) LastTok() *Token
func (*PortTypeDecl) Pos ¶
func (x *PortTypeDecl) Pos() loc.Pos
type RedirectExpr ¶
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) End ¶
func (x *RedirectExpr) End() loc.Pos
func (*RedirectExpr) LastTok ¶
func (x *RedirectExpr) LastTok() *Token
func (*RedirectExpr) Pos ¶
func (x *RedirectExpr) Pos() loc.Pos
type RegexpExpr ¶
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) End ¶
func (x *RegexpExpr) End() loc.Pos
func (*RegexpExpr) LastTok ¶
func (x *RegexpExpr) LastTok() *Token
func (*RegexpExpr) Pos ¶
func (x *RegexpExpr) Pos() loc.Pos
type RestrictionSpec ¶
func (*RestrictionSpec) End ¶
func (x *RestrictionSpec) End() loc.Pos
func (*RestrictionSpec) LastTok ¶
func (x *RestrictionSpec) LastTok() *Token
func (*RestrictionSpec) Pos ¶
func (x *RestrictionSpec) Pos() loc.Pos
type ReturnSpec ¶
type ReturnSpec struct { Tok Token Restriction *RestrictionSpec Modif Token Type Expr }
func (*ReturnSpec) End ¶
func (x *ReturnSpec) End() loc.Pos
func (*ReturnSpec) LastTok ¶
func (x *ReturnSpec) LastTok() *Token
func (*ReturnSpec) Pos ¶
func (x *ReturnSpec) Pos() loc.Pos
type ReturnStmt ¶
type ReturnStmt struct { Tok Token // Position of "return" Result Expr // Resulting expression of nil }
A ReturnStmt represents a return statement.
func (*ReturnStmt) End ¶
func (x *ReturnStmt) End() loc.Pos
func (*ReturnStmt) LastTok ¶
func (x *ReturnStmt) LastTok() *Token
func (*ReturnStmt) Pos ¶
func (x *ReturnStmt) Pos() loc.Pos
type RunsOnSpec ¶
func (*RunsOnSpec) End ¶
func (x *RunsOnSpec) End() loc.Pos
func (*RunsOnSpec) LastTok ¶
func (x *RunsOnSpec) LastTok() *Token
func (*RunsOnSpec) Pos ¶
func (x *RunsOnSpec) Pos() loc.Pos
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) End ¶
func (x *SelectStmt) End() loc.Pos
func (*SelectStmt) LastTok ¶
func (x *SelectStmt) LastTok() *Token
func (*SelectStmt) Pos ¶
func (x *SelectStmt) Pos() loc.Pos
type SelectorExpr ¶
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) End ¶
func (x *SelectorExpr) End() loc.Pos
func (*SelectorExpr) LastTok ¶
func (x *SelectorExpr) LastTok() *Token
func (*SelectorExpr) Pos ¶
func (x *SelectorExpr) Pos() loc.Pos
type SignatureDecl ¶
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) End ¶
func (x *SignatureDecl) End() loc.Pos
func (*SignatureDecl) LastTok ¶
func (x *SignatureDecl) LastTok() *Token
func (*SignatureDecl) Pos ¶
func (x *SignatureDecl) Pos() loc.Pos
type Stmt ¶
type Stmt interface { Node // contains filtered or unexported methods }
All statement nodes implement the Stmt interface.
type StructSpec ¶
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) End ¶
func (x *StructSpec) End() loc.Pos
func (*StructSpec) LastTok ¶
func (x *StructSpec) LastTok() *Token
func (*StructSpec) Pos ¶
func (x *StructSpec) Pos() loc.Pos
type StructTypeDecl ¶
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) End ¶
func (x *StructTypeDecl) End() loc.Pos
func (*StructTypeDecl) LastTok ¶
func (x *StructTypeDecl) LastTok() *Token
func (*StructTypeDecl) Pos ¶
func (x *StructTypeDecl) Pos() loc.Pos
type SubTypeDecl ¶
type SubTypeDecl struct { TypeTok Token // Position of "type" Field *Field // Field spec With *WithSpec }
A SubTypeDecl represents a named sub type declaration
func (*SubTypeDecl) End ¶
func (x *SubTypeDecl) End() loc.Pos
func (*SubTypeDecl) LastTok ¶
func (x *SubTypeDecl) LastTok() *Token
func (*SubTypeDecl) Pos ¶
func (x *SubTypeDecl) Pos() loc.Pos
type SystemSpec ¶
func (*SystemSpec) End ¶
func (x *SystemSpec) End() loc.Pos
func (*SystemSpec) LastTok ¶
func (x *SystemSpec) LastTok() *Token
func (*SystemSpec) Pos ¶
func (x *SystemSpec) Pos() loc.Pos
type TemplateDecl ¶
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) End ¶
func (x *TemplateDecl) End() loc.Pos
func (*TemplateDecl) LastTok ¶
func (x *TemplateDecl) LastTok() *Token
type Terminal ¶
type Terminal struct { Kind token.Kind // Token kind like TESTCASE, SEMICOLON, COMMENT, ... Lit string // Token values for non-operator tokens // contains filtered or unexported fields }
token functionality shared by Token and Trivia
type Token ¶
A Token represents a TTCN-3 token and implements the Node interface. Tokens are leave-nodes.
func FirstToken ¶
First returns the first valid token of a syntax tree
func (Token) MarshalJSON ¶
type Trivia ¶
type Trivia struct {
Terminal
}
Trivia represent the parts of the source text that are largely insignificant for normal understanding of the code, such as whitespace, comments, and preprocessor directives.
type TypeSpec ¶
type TypeSpec interface { Node // contains filtered or unexported methods }
All nested types implement TypeSpec interface.
type ValueDecl ¶
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.
type ValueExpr ¶
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.
type ValueLiteral ¶
type ValueLiteral struct {
Tok Token
}
A ValueLiteral represents simple literals, like integers, charstrings, ...
func (*ValueLiteral) End ¶
func (x *ValueLiteral) End() loc.Pos
func (*ValueLiteral) LastTok ¶
func (x *ValueLiteral) LastTok() *Token
func (*ValueLiteral) Pos ¶
func (x *ValueLiteral) Pos() loc.Pos
type Visitor ¶
A Visitor's Visit method is invoked for each node encountered by Walk. If the result visitor w is not nil, Walk visits each of the children of node with the visitor w, followed by a call of w.Visit(nil).
type WhileStmt ¶
type WhileStmt struct { Tok Token // Position of "while" Cond *ParenExpr // Conditional expression Body *BlockStmt // Loop-body }
A WhilStmt represents a "while" statement.