The last item of object sections is now saved.
This commit is contained in:
parent
5271876196
commit
b878017b81
@ -42,6 +42,7 @@ func (parser *ParsingOperation) parseObjtSection () (
|
||||
|
||||
// parse members
|
||||
err = parser.parseObjtMembers(section)
|
||||
if err != nil { return }
|
||||
|
||||
if len(section.members) == 0 {
|
||||
infoerr.NewError (
|
||||
@ -52,6 +53,8 @@ func (parser *ParsingOperation) parseObjtSection () (
|
||||
return
|
||||
}
|
||||
|
||||
// parseObjtMembers parses a list of members for an object section. Indentation
|
||||
// level is assumed.
|
||||
func (parser *ParsingOperation) parseObjtMembers (
|
||||
into *ObjtSection,
|
||||
) (
|
||||
@ -62,10 +65,23 @@ func (parser *ParsingOperation) parseObjtMembers (
|
||||
if !parser.token.Is(lexer.TokenKindIndent) { return }
|
||||
if parser.token.Value().(int) != 1 { return }
|
||||
|
||||
// add member to object section
|
||||
var member ObjtMember
|
||||
member, err = parser.parseObjtMember()
|
||||
into.members[member.name] = member
|
||||
if err != nil { return }
|
||||
}
|
||||
}
|
||||
|
||||
// parseObjtMember parses a single member of an object section. Indentation
|
||||
// level is assumed.
|
||||
func (parser *ParsingOperation) parseObjtMember () (
|
||||
member ObjtMember,
|
||||
err error,
|
||||
) {
|
||||
// get permission
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
if err != nil { return }
|
||||
member := ObjtMember { }
|
||||
member.permission = parser.token.Value().(types.Permission)
|
||||
|
||||
// get name
|
||||
@ -99,7 +115,5 @@ func (parser *ParsingOperation) parseObjtMembers (
|
||||
if err != nil { return }
|
||||
}
|
||||
|
||||
// add member to object section
|
||||
into.members[member.name] = member
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user