@@ -20,8 +20,6 @@ const (
2020 INDEX // array[index]
2121)
2222
23- var precedences = map [token.TokenType ]int {}
24-
2523type Parser struct {
2624 l * lexer.Lexer
2725 errors []string
@@ -102,6 +100,8 @@ func (p *Parser) parseStatement() ast.Statement {
102100
103101func (p * Parser ) parseBeginGenDocStatement () * ast.GenDocStatement {
104102 stmt := & ast.GenDocStatement {Token : p .curToken }
103+ // do some parsing here perhaps of the name and file name/location etc...
104+ stmt .Name = & ast.EnclosedIdentifier {Token : token.Token {Type : token .BEGIN_DOC_GEN , Literal : "// gendoc" , MetaTags : p .curToken .MetaTags }, Value : "// gendoc" } //p.curToken.MetaTags}
105105 // move past gendoc token
106106 p .nextToken ()
107107
@@ -115,8 +115,8 @@ func (p *Parser) parseBeginGenDocStatement() *ast.GenDocStatement {
115115 }
116116 p .nextToken ()
117117 }
118-
119- stmt .Value = & ast.EnclosedIdentifier {token.Token {token .CONTENT_DOC_GEN , genDocValue , stmt .Token .MetaTags }, genDocValue }
118+
119+ stmt .Value = & ast.EnclosedIdentifier {Token : token.Token {Type : token .CONTENT_DOC_GEN , Literal : genDocValue , MetaTags : stmt .Token .MetaTags }, Value : genDocValue }
120120 // skip end doc
121121 p .nextToken ()
122122 return stmt
@@ -129,31 +129,14 @@ func (p *Parser) parseIgnoreStatement() *ast.IgnoreStatement {
129129 for ! p .curTokenIs (token .EOF ) {
130130 ignoreValue += p .curToken .Literal
131131 if p .peekTokenIs (token .BEGIN_DOC_GEN ) {
132- p .nextToken ()
133132 break
134133 }
135134 p .nextToken ()
136135 }
137- stmt .Value = & ast.UnusedIdentifier {token.Token {Type : token .NEW_LINE , Literal : ignoreValue }, ignoreValue }
136+ stmt .Value = & ast.UnusedIdentifier {Token : token.Token {Type : token .NEW_LINE , Literal : ignoreValue }, Value : ignoreValue }
138137 return stmt
139138}
140139
141140func (p * Parser ) parseExpression (precedence int ) ast.Expression {
142141 return & ast.EnclosedIdentifier {}
143142}
144-
145- func (p * Parser ) peekPrecedence () int {
146- if p , ok := precedences [p .peekToken .Type ]; ok {
147- return p
148- }
149-
150- return LOWEST
151- }
152-
153- func (p * Parser ) curPrecedence () int {
154- if p , ok := precedences [p .curToken .Type ]; ok {
155- return p
156- }
157-
158- return LOWEST
159- }
0 commit comments