Class: Twig::TokenParser::Extends

Inherits:
Base
  • Object
show all
Defined in:
lib/twig/token_parser/extends.rb

Instance Attribute Summary

Attributes inherited from Base

#parser

Instance Method Summary collapse

Instance Method Details

#parse(token) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/twig/token_parser/extends.rb', line 6

def parse(token)
  stream = parser.stream

  if parser.peek_block_stack
    raise Error::Syntax.new('Cannot raise from inside a block', token.lineno, stream.source)
    # elsif parser.main_scope? @todo
  end

  parser.parent = parser.expression_parser.parse_expression
  stream.expect(Token::BLOCK_END_TYPE)

  Node::Empty.new(token.lineno)
end

#tagObject



20
21
22
# File 'lib/twig/token_parser/extends.rb', line 20

def tag
  'extends'
end