vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/scss/parser.rb
# Expose for the SASS parser.
Expose for the SASS parser.
Expose for the SASS parser .
def tok(rx, last_group_lookahead = false)
        res = @scanner.scan(rx)
        return unless res
        if last_group_lookahead && @scanner[-1]
          @scanner.pos -= @scanner[-1].length
          res.slice!(-@scanner[-1].length..-1)
        end
        newline_count = res.count(NEWLINE)
        if newline_count > 0
          @line += newline_count
          @offset = res[res.rindex(NEWLINE)..-1].size
        else
          @offset += res.size
        end
        @expected = nil
        if !@strs.empty? && rx != COMMENT && rx != SINGLE_LINE_COMMENT
          @strs.each {|s| s << res}
        end
        res
      end
def tok ( rx , last_group_lookahead = false ) res = @scanner . scan ( rx ) return unless res if last_group_lookahead && @scanner [ - 1 ] @scanner . pos -= @scanner [ - 1 ] . length res . slice! ( - @scanner [ - 1 ] . length .. - 1 ) end newline_count = res . count ( NEWLINE ) if newline_count > 0 @line += newline_count @offset = res [ res . rindex ( NEWLINE ) .. - 1 ] . size else @offset += res . size end @expected = nil if ! @strs . empty? && rx != COMMENT && rx != SINGLE_LINE_COMMENT @strs . each { | s | s << res } end res end
Expose for the SASS parser.
Expose for the SASS parser .
# This fixes https://github.com/nex3/sass/issues/104, which affects # Ruby 1.8.7 and REE. This fix is to replace the ?= zero-width # positive lookahead operator in the Regexp (which matches without # consuming the matched group), with a match that does consume the # group, but then rewinds the scanner and removes the group from the # end of the matched string. This fix makes the assumption that the # matched group will always occur at the end of the match.
rx
<not_specific>
last_group_lookahead
<not_specific>