syntax-tree-accessors #2
@ -16,7 +16,7 @@ var validArgumentStartTokens = []lexer.TokenKind {
|
||||
}
|
||||
|
||||
func (parser *ParsingOperation) parseArgument () (argument Argument, err error) {
|
||||
argument.setLocation(parser.token.Location())
|
||||
argument.location = parser.token.Location()
|
||||
|
||||
err = parser.expect(validArgumentStartTokens...)
|
||||
if err != nil { return }
|
||||
@ -44,8 +44,8 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
|
||||
|
||||
declaration := Declaration { }
|
||||
declaration.what = what
|
||||
declaration.setName(identifier.trail[0])
|
||||
declaration.setLocation(argument.Location())
|
||||
declaration.name = identifier.trail[0]
|
||||
declaration.location = argument.Location()
|
||||
|
||||
argument.kind = ArgumentKindDeclaration
|
||||
argument.value = declaration
|
||||
|
@ -12,7 +12,7 @@ func (parser *ParsingOperation) parseDataSection () (
|
||||
if err != nil { return }
|
||||
|
||||
section = &DataSection { }
|
||||
section.setLocation(parser.token.Location())
|
||||
section.location = parser.token.Location()
|
||||
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
if err != nil { return }
|
||||
|
@ -12,7 +12,7 @@ func (parser *ParsingOperation) parseEnumSection () (
|
||||
if err != nil { return }
|
||||
|
||||
section = &EnumSection { }
|
||||
section.setLocation(parser.token.Location())
|
||||
section.location = parser.token.Location()
|
||||
|
||||
// get permission
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
|
@ -15,7 +15,7 @@ func (parser *ParsingOperation) parseFaceSection () (
|
||||
section = &FaceSection {
|
||||
behaviors: make(map[string] FaceBehavior),
|
||||
}
|
||||
section.setLocation(parser.token.Location())
|
||||
section.location = parser.token.Location()
|
||||
|
||||
// get permission
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
|
@ -13,7 +13,7 @@ func (parser *ParsingOperation) parseFuncSection () (
|
||||
if err != nil { return }
|
||||
|
||||
section = &FuncSection { }
|
||||
section.setLocation(parser.token.Location())
|
||||
section.location = parser.token.Location()
|
||||
|
||||
// get permission
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
|
@ -14,11 +14,6 @@ func (trait locatable) Location () (location file.Location) {
|
||||
return
|
||||
}
|
||||
|
||||
// setLocation sets the location of the node.
|
||||
func (trait* locatable) setLocation (location file.Location) {
|
||||
trait.location = location
|
||||
}
|
||||
|
||||
// NewError creates a new error at the node's location.
|
||||
func (trait locatable) NewError (
|
||||
message string,
|
||||
@ -39,11 +34,6 @@ func (trait nameable) Name () (name string) {
|
||||
name = trait.name
|
||||
return
|
||||
}
|
||||
// setName sets the name of the node.
|
||||
func (trait *nameable) setName (name string) {
|
||||
trait.name = name
|
||||
}
|
||||
|
||||
// typeable allows a node to have a type.
|
||||
type typeable struct {
|
||||
what Type
|
||||
@ -53,8 +43,3 @@ type typeable struct {
|
||||
func (trait typeable) Type () (what Type) {
|
||||
return trait.what
|
||||
}
|
||||
|
||||
// setType sets the type of the node.
|
||||
func (trait *typeable) setType (what Type) () {
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ func (parser *ParsingOperation) parseObjtSection () (
|
||||
if err != nil { return }
|
||||
|
||||
section = &ObjtSection { }
|
||||
section.setLocation(parser.token.Location())
|
||||
section.location = parser.token.Location()
|
||||
|
||||
// get permission
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
|
@ -14,7 +14,7 @@ func (parser *ParsingOperation) parseTypeSection () (
|
||||
if err != nil { return }
|
||||
|
||||
section = &TypeSection { }
|
||||
section.setLocation(parser.token.Location())
|
||||
section.location = parser.token.Location()
|
||||
|
||||
// get permission
|
||||
err = parser.nextToken(lexer.TokenKindPermission)
|
||||
|
Reference in New Issue
Block a user