Sha256: 8001508a2d3cbe566f60eabd47e8cc02ca4179416fa9188cb584bab052041031

Contents?: true

Size: 358 Bytes

Versions: 30

Compression:

Stored size: 358 Bytes

Contents

module Babelyoda
  class StringsLexer
    TOKENS = [ :multiline_comment, :singleline_comment, :string, :reserved0, :equal_sign, :semicolon ].freeze

    def lex(str)
      str.scan(/(\/\*.*\*\/)|(\s*\/\/.*\n)|((["])(?:\\?+.)*?\4)|(\s*=\s*)|(;)/).each do |m|
        idx = m.index { |x| x }
        yield TOKENS[idx], m[idx].strip
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
babelyoda-2.2.0 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.20 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.19 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.18 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.17 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.16 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.15 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.14 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.13 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.12 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.11 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.10 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.9 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.8 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.7 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.6 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.5 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.4 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.3 lib/babelyoda/strings_lexer.rb
babelyoda-2.1.2 lib/babelyoda/strings_lexer.rb