comments
Some checks failed
Build / build (push) Failing after 1m10s
Test / build (push) Failing after 11m40s

This commit is contained in:
Chuck Smith
2024-03-16 19:31:23 -04:00
parent 7463b3af39
commit 83ad72a7fc
7 changed files with 106 additions and 6 deletions

View File

@@ -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()
}