aboutsummaryrefslogtreecommitdiff
path: root/ast
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-11-03 16:17:15 +0000
committerBobby <[email protected]>2023-11-03 16:17:15 +0000
commite8a6c163c9a58b69f6f96c373118ac6996637e25 (patch)
treed16ab60698adbd9491e5904809c67a4ecc41cd0e /ast
parent15f9a15757322221d8bf9a3ecd5d8ce8490ebda6 (diff)
downloadmana-e8a6c163c9a58b69f6f96c373118ac6996637e25.tar.xz
mana-e8a6c163c9a58b69f6f96c373118ac6996637e25.zip
parser:init pratt parser. parser:add prefix, infix and `parseIntegerLiteral`
Diffstat (limited to 'ast')
-rw-r--r--ast/ast.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/ast/ast.go b/ast/ast.go
index fea8b60..ec53a8c 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -128,3 +128,17 @@ func (es *ExpressionStatement) String() string {
}
return ""
}
+
+// IntegerLiteral represents an integer literal.
+type IntegerLiteral struct {
+ Token tokens.Token // the token.INT token
+ Value int64
+}
+
+func (il *IntegerLiteral) expressionNode() {}
+func (il *IntegerLiteral) TokenLiteral() string {
+ return il.Token.Literal
+}
+func (il *IntegerLiteral) String() string {
+ return il.Token.Literal
+}