Sha256: a228e804669463693e2a9951fda40b6e9d0df9bb5a4c9bb7737e6bb8b53fa79a

Contents?: true

Size: 789 Bytes

Versions: 66

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

require "thread"

module Nokogiri
  module CSS
    class Parser < Racc::Parser # :nodoc:
      def initialize
        @tokenizer = Tokenizer.new
        super
      end

      def parse(string)
        @tokenizer.scan_setup(string)
        do_parse
      end

      def next_token
        @tokenizer.next_token
      end

      # Get the xpath for +selector+ using +visitor+
      def xpath_for(selector, visitor)
        parse(selector).map do |ast|
          ast.to_xpath(visitor)
        end
      end

      # On CSS parser error, raise an exception
      def on_error(error_token_id, error_value, value_stack)
        after = value_stack.compact.last
        raise SyntaxError, "unexpected '#{error_value}' after '#{after}'"
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
nokogiri-1.18.1-x86_64-linux-musl lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-x86_64-linux-gnu lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-x86_64-darwin lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-x64-mingw-ucrt lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-java lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1 lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-arm-linux-musl lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-arm-linux-gnu lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-arm64-darwin lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-aarch64-linux-musl lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.1-aarch64-linux-gnu lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-x86_64-linux-musl lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-x86_64-linux-gnu lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-x86_64-darwin lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-x64-mingw-ucrt lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-java lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0 lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-arm-linux-musl lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-arm-linux-gnu lib/nokogiri/css/parser_extras.rb
nokogiri-1.18.0-arm64-darwin lib/nokogiri/css/parser_extras.rb