Documentation
¶
Index ¶
- func GetEndPosition(t antlr.Token) (int, int)
- func GetRange(editor *memedit.MemEditor, token CanStartStopToken) *memedit.Range
- type CanStartStopToken
- type IfBuilder
- type Instruction
- type Instructions
- type Interpreter
- func (i *Interpreter) GenerateCode() (err error)
- func (i *Interpreter) GetCurrentLine() int
- func (i *Interpreter) GetGeneratedCode() string
- func (i *Interpreter) GetRangeMap() map[int]*memedit.Range
- func (i *Interpreter) GetTemplate() TemplateRender
- func (i *Interpreter) SetRangeMap()
- func (i *Interpreter) SetStartLine()
- func (i *Interpreter) SetTemplate(template TemplateRender)
- type Opcode
- type TemplateGeneratedInfo
- type TemplateRender
- type TemplateTyp
- type TemplateVisitor
- type Visitor
- func (y *Visitor) EmitDeclarationCode(code string)
- func (y *Visitor) EmitEscapeOutput(variable string)
- func (y *Visitor) EmitIfStatement(builder *IfBuilder)
- func (y *Visitor) EmitImport(path string)
- func (y *Visitor) EmitOutput(variable string)
- func (y *Visitor) EmitPureCode(code string)
- func (y *Visitor) EmitPureText(text string)
- func (y *Visitor) GetInstructions() Instructions
- func (y *Visitor) NewIfBuilder() *IfBuilder
- func (y *Visitor) SetRange(token CanStartStopToken) func()
- type VisitorCreator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEndPosition ¶
Types ¶
type CanStartStopToken ¶
type CanStartStopToken interface {
GetStop() antlr.Token
GetStart() antlr.Token
GetText() string
}
type IfBuilder ¶
type IfBuilder struct {
// contains filtered or unexported fields
}
func (*IfBuilder) SetIfCondition ¶
type Instruction ¶
type Instructions ¶
type Instructions []*Instruction
type Interpreter ¶
type Interpreter struct {
Instructions Instructions
// contains filtered or unexported fields
}
func NewInterpreter ¶
func NewInterpreter(instructions Instructions) *Interpreter
func (*Interpreter) GenerateCode ¶
func (i *Interpreter) GenerateCode() (err error)
func (*Interpreter) GetCurrentLine ¶
func (i *Interpreter) GetCurrentLine() int
func (*Interpreter) GetGeneratedCode ¶
func (i *Interpreter) GetGeneratedCode() string
func (*Interpreter) GetRangeMap ¶
func (i *Interpreter) GetRangeMap() map[int]*memedit.Range
func (*Interpreter) GetTemplate ¶
func (i *Interpreter) GetTemplate() TemplateRender
func (*Interpreter) SetRangeMap ¶
func (i *Interpreter) SetRangeMap()
func (*Interpreter) SetStartLine ¶
func (i *Interpreter) SetStartLine()
func (*Interpreter) SetTemplate ¶
func (i *Interpreter) SetTemplate(template TemplateRender)
type TemplateGeneratedInfo ¶
type TemplateGeneratedInfo interface {
GetContent() string
GetClassName() string
GetPkgName() string
GetTemplateServerName() string // run template server's method name
GetRangeMap() map[int]*memedit.Range // generated code offset -> template language range
}
TemplateGeneratedInfo is the interface for the generated template code
type TemplateRender ¶
type TemplateRender interface {
WritePureText(text string) // Just writing text, usually used to write HTML content in templates
WriteOutput(variable string) // Write output, usually used to write variables in templates
WriteEscapeOutput(variable string) // Write variables to the template output, but they will be HTML escaped
WritePureCode(code string) // Write pure code, usually used to write code in templates
WriteImport(path string) // Write import dependency statement
WriteDeclaration(code string)
String() string
Finish()
}
TemplateRender is the interface for the template render
type TemplateTyp ¶
type TemplateTyp int
const ( TEMPLATE_JAVA_JSP TemplateTyp = iota TEMPLATE_JAVA_FREEMARKER TEMPLATE_JAVA_THYMELEAF )
type TemplateVisitor ¶
type TemplateVisitor interface {
GetInstructions() Instructions
}
type Visitor ¶
type Visitor struct {
Instructions Instructions
CurrentRange *memedit.Range
Editor *memedit.MemEditor
}
func NewVisitor ¶
func NewVisitor() *Visitor
func (*Visitor) EmitDeclarationCode ¶
func (*Visitor) EmitEscapeOutput ¶
func (*Visitor) EmitIfStatement ¶
func (*Visitor) EmitImport ¶
func (*Visitor) EmitOutput ¶
func (*Visitor) EmitPureCode ¶
func (*Visitor) EmitPureText ¶
func (*Visitor) GetInstructions ¶
func (y *Visitor) GetInstructions() Instructions
func (*Visitor) NewIfBuilder ¶
func (*Visitor) SetRange ¶
func (y *Visitor) SetRange(token CanStartStopToken) func()
type VisitorCreator ¶
type VisitorCreator interface {
Create(editor *memedit.MemEditor) (TemplateVisitor, error)
}
Click to show internal directories.
Click to hide internal directories.