Method: JSONX.strip_comments
- Defined in:
- lib/json/next/parser/jsonx.rb
.strip_comments(text) ⇒ Object
pass 1
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/json/next/parser/jsonx.rb', line 30 def self.strip_comments( text ) ## pass 1 text.gsub( /#{BACKTICK_ML_QUOTE}|#{SINGLE_QUOTE}|#{DOUBLE_QUOTE}|#{SHELL_COMMENT}|#{CLANG_ML_COMMENT}|#{CLANG_COMMENT}/ox ) do |match| ## puts "match: >>#{match}<< : #{match.class.name}" if match[0] == ?/ || match[0] == ?# ## comments start with // or /* or # ## puts "!!! removing comments" '' ## remove / strip comments else match end end end |