Class: Sass::Script::Parser

Inherits:
Object show all
Defined in:
lib/sass/script/parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, line, offset, filename = nil) ⇒ Parser

Returns a new instance of Parser.



6
7
8
9
# File 'lib/sass/script/parser.rb', line 6

def initialize(str, line, offset, filename = nil)
  @filename = filename
  @lexer = Lexer.new(str, line, offset)
end

Class Method Details

.parse(*args) ⇒ Object



23
24
25
# File 'lib/sass/script/parser.rb', line 23

def self.parse(*args)
  new(*args).parse
end

Instance Method Details

#parseObject

Raises:



17
18
19
20
21
# File 'lib/sass/script/parser.rb', line 17

def parse
  expr = assert_expr :expr
  raise Sass::SyntaxError.new("Unexpected #{@lexer.peek.type} token.") unless @lexer.done?
  expr
end

#parse_interpolatedObject



11
12
13
14
15
# File 'lib/sass/script/parser.rb', line 11

def parse_interpolated
  expr = assert_expr :expr
  assert_tok :right_bracket
  expr
end