lib/ruco/syntax_parser.rb in ruco-0.2.17 vs lib/ruco/syntax_parser.rb in ruco-0.2.18
- old
+ new
@@ -11,11 +11,16 @@
end
cmemoize :syntax_for_line
def self.syntax_for_lines(lines, languages)
if syntax = syntax_node(languages)
- processor = syntax.parse(lines.join("\n"), Ruco::ArrayProcessor.new)
- processor.lines
+ begin
+ processor = syntax.parse(lines.join("\n"), Ruco::ArrayProcessor.new)
+ processor.lines
+ rescue RegexpError
+ $stderr.puts $!
+ []
+ end
else
[]
end
end