Skip to content

Commit

Permalink
Expose paren Position on DefStmt (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvigee committed Sep 11, 2023
1 parent c9e9adf commit 95963e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions syntax/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,17 @@ func (p *parser) parseStmt(stmts []Stmt) []Stmt {
func (p *parser) parseDefStmt() Stmt {
defpos := p.nextToken() // consume DEF
id := p.parseIdent()
p.consume(LPAREN)
lparen := p.consume(LPAREN)
params := p.parseParams()
p.consume(RPAREN)
rparen := p.consume(RPAREN)
p.consume(COLON)
body := p.parseSuite()
return &DefStmt{
Def: defpos,
Name: id,
Lparen: lparen,
Params: params,
Rparen: rparen,
Body: body,
}
}
Expand Down
2 changes: 2 additions & 0 deletions syntax/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ type DefStmt struct {
commentsRef
Def Position
Name *Ident
Lparen Position
Params []Expr // param = ident | ident=expr | * | *ident | **ident
Rparen Position
Body []Stmt

Function interface{} // a *resolve.Function, set by resolver
Expand Down

0 comments on commit 95963e0

Please sign in to comment.