Module: ShowCode::SyntaxException
- Defined in:
- lib/show_code/syntax_exception.rb
Constant Summary collapse
- GENERIC_REGEXPS =
[ /unexpected (\$end|end-of-file|end-of-input|END_OF_FILE)/, # mri, jruby, ruby-2.0, ironruby /embedded document meets end of file/, # =begin /unterminated (quoted string|string|regexp) meets end of file/, # "quoted string" is ironruby /can't find string ".*" anywhere before EOF/, # rbx and jruby /missing 'end' for/, /expecting kWHEN/ # rbx ]
- RBX_ONLY_REGEXPS =
[ /expecting '[})\]]'(?:$|:)/, /expecting keyword_end/ ]
Class Method Summary collapse
Class Method Details
.===(ex) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/show_code/syntax_exception.rb', line 16 def self.===(ex) return false unless SyntaxError === ex case ex. when *GENERIC_REGEXPS true when *RBX_ONLY_REGEXPS rbx? else false end end |
.rbx? ⇒ Boolean
28 29 30 |
# File 'lib/show_code/syntax_exception.rb', line 28 def self.rbx? RbConfig::CONFIG['ruby_install_name'] == 'rbx' end |