Skip to content

Commit

Permalink
fix precedence mistake related to extern visible
Browse files Browse the repository at this point in the history
  • Loading branch information
NotLe0n committed Feb 3, 2025
1 parent 5d72919 commit c557b62
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parser/declarations.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (p *parser) assignRhs(withComma bool) ast.Expression {
return expr
}

func (p *parser) matchExternSichtbar() bool {
if p.matchAny(token.COMMA) || p.matchAny(token.EXTERN) {
func (p *parser) matchExternSichtbar(isPublic bool) bool {
if isPublic && p.matchAny(token.COMMA) || p.matchAny(token.EXTERN) {
if p.previous().Type == token.COMMA {
p.consumeSeq(token.EXTERN)
}
Expand All @@ -86,7 +86,7 @@ func (p *parser) constDeclaration(startDepth int) ast.Declaration {
comment := p.parseDeclComment(begin.Range)

isPublic := p.peekN(startDepth+1).Type == token.OEFFENTLICHE || p.peekN(startDepth+1).Type == token.OEFFENTLICHEN
isExternVisible := isPublic && p.matchExternSichtbar()
isExternVisible := p.matchExternSichtbar(isPublic)

p.consumeSeq(token.KONSTANTE)

Expand Down Expand Up @@ -139,7 +139,7 @@ func (p *parser) varDeclaration(startDepth int, isField bool) ast.Declaration {
comment := p.parseDeclComment(begin.Range)

isPublic := p.peekN(startDepth+1).Type == token.OEFFENTLICHE || p.peekN(startDepth+1).Type == token.OEFFENTLICHEN
isExternVisible := isPublic && p.matchExternSichtbar()
isExternVisible := p.matchExternSichtbar(isPublic)

type_start := p.peek()
typ := p.parseType()
Expand Down

0 comments on commit c557b62

Please sign in to comment.