gems.sass-3.2.8.lib.sass.script.css_parser.rb Maven / Gradle / Ivy
Go to download
Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector
inheritance, and more. It's translated to well-formatted, standard CSS using the command line tool or a
web-framework plugin.
This is a repackaged GEM in a JAR format of the sass-lang.gem package. The sass-gems package version
follows the sass-lang.gem versions located http://rubyforge.org/frs/?group_id=9702. Simply change
the version of this package to download and repackage the same GEM version.
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
return number unless tok = try_tok(:string)
return tok.value unless @lexer.peek && @lexer.peek.type == :begin_interpolation
end
# Short-circuit all the SassScript-only productions
alias_method :interpolation, :space
alias_method :or_expr, :div
alias_method :unary_div, :ident
alias_method :paren, :string
end
end
end