Documentation
¶
Overview ¶
Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Index ¶
- func Print(node Node)
- func Write(node Node, w io.Writer)
- type AssignStmt
- type BinaryExpr
- type BlockStmt
- type CallExpr
- type CallStmt
- type Command
- type Comment
- type CommentGroup
- type DblQuote
- type Expr
- type ExprStmt
- type File
- type ForStmt
- type FuncDecl
- type GotoStmt
- type IfStmt
- type LabelStmt
- type Lit
- type Node
- type SglQuote
- type Stmt
- type UnaryExpr
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssignStmt ¶
type AssignStmt struct { Docs *CommentGroup // associated documentation; or nil Set token.Pos // position of "set" keyword Lhs Expr // left-hand side of assignment Assign token.Pos // position of "=" Rhs Expr // right-hand side of assignment }
AssignStmt represents an assignment statement.
func (*AssignStmt) End ¶
func (s *AssignStmt) End() token.Pos
func (*AssignStmt) Pos ¶
func (s *AssignStmt) Pos() token.Pos
type BinaryExpr ¶
type BinaryExpr struct { X Expr // left operand Op token.Token // operator Y Expr // right operand }
BinaryExpr represents a binary expression.
func (*BinaryExpr) End ¶
func (b *BinaryExpr) End() token.Pos
func (*BinaryExpr) Pos ¶
func (b *BinaryExpr) Pos() token.Pos
func (*BinaryExpr) String ¶
func (b *BinaryExpr) String() string
type BlockStmt ¶
type BlockStmt struct {
List []Stmt // list of statements
}
BlockStmt represents a block of statements.
type CallStmt ¶
type CallStmt struct { Docs *CommentGroup // associated documentation; or nil Call token.Pos // position of "call" keyword Colon token.Pos // position of ":" Name string // name of the function to call Recv []Expr // arguments to the function }
CallStmt represents a call statement.
type Command ¶
type Command struct { Docs *CommentGroup // associated documentation; or nil Name Expr // command name Recv []Expr // command arguments }
Command represents a command statement.
type Comment ¶
type Comment struct { TokPos token.Pos // position of comment token Tok token.Token // token.DOUBLE_COLON | token.REM Text string // comment text }
Comment represents a single comment.
type CommentGroup ¶
type CommentGroup struct {
Comments []*Comment // list of comments
}
CommentGroup represents a sequence of comments.
func (*CommentGroup) End ¶
func (c *CommentGroup) End() token.Pos
func (*CommentGroup) Pos ¶
func (c *CommentGroup) Pos() token.Pos
type DblQuote ¶
type DblQuote struct { DelayedExpansion bool // whether to use delayed expansion (!var!) Left token.Pos // position of "%" Val Expr // quoted expression Right token.Pos // position of "%" }
DblQuote represents a double quote expression.
type Expr ¶
Expr represents an expression node in the AST. All expression types implement the Expr interface.
type ExprStmt ¶
type ExprStmt struct { Docs *CommentGroup // associated documentation; or nil X Expr // expression }
ExprStmt represents an expression statement.
type File ¶
type File struct { Docs []*CommentGroup // list of documentation comments Stmts []Stmt // list of statements }
File represents a batch script file.
type ForStmt ¶
type ForStmt struct { Docs *CommentGroup // associated documentation; or nil For token.Pos // position of "for" keyword X Expr // variable to iterate over In token.Pos // position of "in" keyword List Expr // list to iterate over Do token.Pos // position of "do" keyword Lparen token.Pos // position of "(" Body *BlockStmt // body of the for statement Rparen token.Pos // position of ")" }
ForStmt represents a for statement.
type FuncDecl ¶
type FuncDecl struct { Docs *CommentGroup // associated documentation; or nil Colon token.Pos // position of ":" Name string // function name Body *BlockStmt // function body }
FuncDecl represents a function declaration.
type GotoStmt ¶
type GotoStmt struct { Docs *CommentGroup // associated documentation; or nil GoTo token.Pos // position of "goto" keyword Colon token.Pos // position of ":" Label string // label to jump to }
GotoStmt represents a goto statement.
type IfStmt ¶
type IfStmt struct { Docs *CommentGroup // associated documentation; or nil If token.Pos // position of "if" keyword Cond Expr // condition Lparen token.Pos // position of "(" Body Stmt // body of the if statement Rparen token.Pos // position of ")" Else Stmt // else branch; or nil }
IfStmt represents an if statement.
type LabelStmt ¶
type LabelStmt struct { Docs *CommentGroup // associated documentation; or nil Colon token.Pos // position of ":" Name string // label name }
LabelStmt represents a label statement.
type Node ¶
type Node interface { Pos() token.Pos // position of first character belonging to the node End() token.Pos // position of first character immediately after the node }
Node represents a node in the AST. All node types implement the Node interface.
type Stmt ¶
type Stmt interface { Node // contains filtered or unexported methods }
Stmt represents a statement node in the AST. All statement types implement the Stmt interface.