module support
This commit is contained in:
22
ast/ast.go
22
ast/ast.go
@@ -428,3 +428,25 @@ func (c *Comment) String() string {
|
||||
|
||||
return out.String()
|
||||
}
|
||||
|
||||
// ImportExpression represents an `import` expression and holds the name
|
||||
// of the module being imported.
|
||||
type ImportExpression struct {
|
||||
Token token.Token // The 'import' token
|
||||
Name Expression
|
||||
}
|
||||
|
||||
func (ie *ImportExpression) TokenLiteral() string {
|
||||
return ie.Token.Literal
|
||||
}
|
||||
func (ie *ImportExpression) String() string {
|
||||
var out bytes.Buffer
|
||||
|
||||
out.WriteString(ie.TokenLiteral())
|
||||
out.WriteString("(")
|
||||
out.WriteString(fmt.Sprintf("\"%s\"", ie.Name))
|
||||
out.WriteString(")")
|
||||
|
||||
return out.String()
|
||||
}
|
||||
func (ie *ImportExpression) expressionNode() {}
|
||||
|
||||
Reference in New Issue
Block a user