Method: CLI#lex
- Defined in:
- lib/crossplane/cli.rb
#lex(filename) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/crossplane/cli.rb', line 114 def lex(filename) payload = CrossPlane::Lexer.new( filename: filename, ).lex() lex = (not ['line_numbers'].nil? and ['line_numbers'] == true) ? payload : payload.map{|e| e[0]} if ['out'] File.open(['out'], 'w') do |f| f.write(JSON.pretty_generate(lex)) end else puts ['pretty'] ? JSON.pretty_generate(lex) : lex.to_json end end |