# Command examples # # parser.rb:30 => line 30 in parser.rb # module FaultInjection class Parser def self.compile src method_pat = '([A-Z][A-Za-z0-9_]*)(?:#|::)([a-z_][a-zA-Z0-9_]*)' src.gsub!(/\s/,'') if src =~ /([A-Za-z0-9_.~-]+):(\d+)/ return FaultConditionLine.new($1,$2.to_i) else methods = src.split(">") methods.map! do |e| unless e =~ Regexp.new(method_pat) raise ArgumentError,"Invalid method name:'#{e}'" end [$1.to_sym,$2.to_sym] end c = FaultConditionCall.new c.stack_pattern = methods.reverse # callee first return c end end end end