mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
561 B
32 lines
561 B
package common
|
|
|
|
type Directive struct {
|
|
Name Ident
|
|
Args ArgumentList
|
|
}
|
|
|
|
func ParseDirectives(l *Lexer) DirectiveList {
|
|
var directives DirectiveList
|
|
for l.Peek() == '@' {
|
|
l.ConsumeToken('@')
|
|
d := &Directive{}
|
|
d.Name = l.ConsumeIdentWithLoc()
|
|
d.Name.Loc.Column--
|
|
if l.Peek() == '(' {
|
|
d.Args = ParseArguments(l)
|
|
}
|
|
directives = append(directives, d)
|
|
}
|
|
return directives
|
|
}
|
|
|
|
type DirectiveList []*Directive
|
|
|
|
func (l DirectiveList) Get(name string) *Directive {
|
|
for _, d := range l {
|
|
if d.Name.Name == name {
|
|
return d
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|