def self.build(params, modifiers, directive, top, pos)
@@directives.include? directive or
raise UnknownDirectiveError.new(pos), 'unknown format directive'
idx = directive.chr.upcase[0]
params.size <= @@directives[idx][1] or
raise ParameterError.new(pos),
'too many parameters given, expected no more than ' +
@@directives[idx][1].to_s
@@directives[idx][2].each do |illegal|
if illegal.is_a? Array and (modifiers == illegal or
modifiers.reverse == illegal)
raise ModifierError.new(pos),
'cannot specify both : and @ modifiers'
elsif modifiers.include? illegal
raise ModifierError.new(pos),
'cannot specify the ' + mod.chr + 'modifier'
end
end
return [
@@directives[idx][0].new(params, modifiers, top, pos),
@@directives[idx][3]
]
end