Sha256: 429dc8f657cbb75b305475b945dc0b7821063e75cda0db44b1ba35cdfb685a3c

Contents?: true

Size: 928 Bytes

Versions: 17

Compression:

Stored size: 928 Bytes

Contents

require 'sass/script'
require 'sass/script/css_lexer'

module Sass
  module Script
    # This is a subclass of {Parser} for use in parsing plain CSS properties.
    #
    # @see Sass::SCSS::CssParser
    class CssParser < Parser
      private

      # @private
      def lexer_class; CssLexer; end

      # We need a production that only does /,
      # since * and % aren't allowed in plain CSS
      production :div, :unary_plus, :div

      def string
        tok = try_tok(:string)
        return number unless tok
        return if @lexer.peek && @lexer.peek.type == :begin_interpolation
        literal_node(tok.value, tok.source_range)
      end

      # Short-circuit all the SassScript-only productions
      def interpolation(first: nil, inner: :space)
        first || send(inner)
      end

      alias_method :or_expr, :div
      alias_method :unary_div, :ident
      alias_method :paren, :string
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/css_parser.rb
sass-3.7.4 lib/sass/script/css_parser.rb
sass-3.7.3 lib/sass/script/css_parser.rb
sass-3.7.2 lib/sass/script/css_parser.rb
sass-3.7.1 lib/sass/script/css_parser.rb
sass-3.7.0 lib/sass/script/css_parser.rb