comments
This commit is contained in:
23
ast/ast.go
23
ast/ast.go
@@ -391,7 +391,6 @@ type AssignmentStatement struct {
|
||||
func (as AssignmentStatement) TokenLiteral() string {
|
||||
return as.Token.Literal
|
||||
}
|
||||
|
||||
func (as AssignmentStatement) String() string {
|
||||
var out bytes.Buffer
|
||||
|
||||
@@ -403,5 +402,25 @@ func (as AssignmentStatement) String() string {
|
||||
|
||||
return out.String()
|
||||
}
|
||||
|
||||
func (as AssignmentStatement) statementNode() {}
|
||||
|
||||
// Comment a comment
|
||||
type Comment struct {
|
||||
Token token.Token // the token.COMMENT token
|
||||
Value string
|
||||
}
|
||||
|
||||
func (c *Comment) statementNode() {}
|
||||
|
||||
// TokenLiteral prints the literal value of the token associated with this node
|
||||
func (c *Comment) TokenLiteral() string { return c.Token.Literal }
|
||||
|
||||
// String returns a stringified version of the AST for debugging
|
||||
func (c *Comment) String() string {
|
||||
var out bytes.Buffer
|
||||
|
||||
out.WriteString(c.TokenLiteral() + " ")
|
||||
out.WriteString(c.Value)
|
||||
|
||||
return out.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user