We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38268db commit aa76852Copy full SHA for aa76852
src/ast/ast.go
@@ -83,7 +83,7 @@ func (a *AstGenerator) readTypeDeclaration() TypeDeclaration {
83
84
next, _ = a.nextToken(true)
85
86
- if next.Type != token.IntType {
+ if next.Type == token.IntType {
87
d.Kind = Int
88
} else {
89
d.Kind = String
@@ -134,6 +134,8 @@ func (a *AstGenerator) readConstDeclaration() ConstDeclaration {
134
if a.currentToken.Type == token.RightParentheses {
135
break
136
}
137
+
138
+ a.backToken()
139
140
141
a.matchNextLine()
@@ -188,3 +190,7 @@ func (a *AstGenerator) Gen() File {
188
190
189
191
return file
192
193
194
+func NewAstGenerator(tokens []token.Token) AstGenerator {
195
+ return AstGenerator{Tokens: tokens, index: -1}
196
+}
0 commit comments