31 lines
787 B
Go
31 lines
787 B
Go
|
package parser
|
||
|
|
||
|
import "git.tebibyte.media/sashakoshka/arf/types"
|
||
|
import "git.tebibyte.media/sashakoshka/arf/lexer"
|
||
|
// import "git.tebibyte.media/sashakoshka/arf/infoerr"
|
||
|
|
||
|
// parseFunc parses a function section.
|
||
|
func (parser *ParsingOperation) parseFuncSection () (
|
||
|
section *FuncSection,
|
||
|
err error,
|
||
|
) {
|
||
|
err = parser.expect(lexer.TokenKindName)
|
||
|
if err != nil { return }
|
||
|
|
||
|
section = &FuncSection { location: parser.token.Location() }
|
||
|
|
||
|
err = parser.nextToken(lexer.TokenKindPermission)
|
||
|
if err != nil { return }
|
||
|
section.permission = parser.token.Value().(types.Permission)
|
||
|
|
||
|
err = parser.nextToken(lexer.TokenKindName)
|
||
|
if err != nil { return }
|
||
|
section.name = parser.token.Value().(string)
|
||
|
|
||
|
err = parser.nextToken(lexer.TokenKindNewline)
|
||
|
if err != nil { return }
|
||
|
|
||
|
return
|
||
|
}
|
||
|
|