Sha256: 04a519e911a0964f96bdd9d81eed6ebce627eada7405406786d8d0889df2e2fd
Contents?: true
Size: 585 Bytes
Versions: 3
Compression:
Stored size: 585 Bytes
Contents
# frozen_string_literal: true module ThemeCheck module ParsingHelpers # Yield each chunk outside of "...", '...' def outside_of_strings(markup) scanner = StringScanner.new(markup) while scanner.scan(/.*?("|')/) yield scanner.matched[0..-2] quote = scanner.matched[-1] == "'" ? "'" : "\"" # Skip to the end of the string # Check for empty string first, since follow regexp uses lookahead scanner.skip(/#{quote}/) || scanner.skip_until(/[^\\]#{quote}/) end yield scanner.rest if scanner.rest? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
theme-check-1.2.0 | lib/theme_check/parsing_helpers.rb |
theme-check-1.1.0 | lib/theme_check/parsing_helpers.rb |
theme-check-1.0.0 | lib/theme_check/parsing_helpers.rb |