Add all the files from the interpreter repo
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
230fe61b12
commit
0acd1d41e8
34 changed files with 3784 additions and 0 deletions
24
pkg/ast/block.go
Normal file
24
pkg/ast/block.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"code.jmug.me/jmug/interpreter-in-go/pkg/token"
|
||||
)
|
||||
|
||||
type BlockStatement struct {
|
||||
Token token.Token // The `{` token.
|
||||
Statements []Statement
|
||||
}
|
||||
|
||||
func (bs *BlockStatement) statementNode() {}
|
||||
func (bs *BlockStatement) TokenLiteral() string {
|
||||
return bs.Token.Literal
|
||||
}
|
||||
func (bs *BlockStatement) String() string {
|
||||
var out bytes.Buffer
|
||||
for _, s := range bs.Statements {
|
||||
out.WriteString(s.String())
|
||||
}
|
||||
return out.String()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue