PageRenderTime 31ms CodeModel.GetById 21ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/scalate-jruby/src/main/resources/haml-3.0.25/lib/sass/scss/script_parser.rb

http://github.com/scalate/scalate
Ruby | 25 lines | 15 code | 2 blank | 8 comment | 0 complexity | 73b35560c2ef260966160dfcfcd7a8eb MD5 | raw file
 1module Sass
 2  module SCSS
 3    # A mixin for subclasses of {Sass::Script::Parser}
 4    # that makes them usable by {SCSS::Parser} to parse SassScript.
 5    # In particular, the parser won't raise an error
 6    # when there's more content in the lexer once lexing is done.
 7    # In addition, the parser doesn't support `!` for a variable prefix.
 8    module ScriptParser
 9      private
10
11      # @private
12      def lexer_class
13        klass = Class.new(super)
14        klass.send(:include, ScriptLexer)
15        klass
16      end
17
18      # Instead of raising an error when the parser is done,
19      # rewind the StringScanner so that it hasn't consumed the final token.
20      def assert_done
21        @lexer.unpeek!
22      end
23    end
24  end
25end