Class: Twig::TokenParser::Extends
- Defined in:
- lib/twig/token_parser/extends.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Instance Method Details
#parse(token) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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 use "extend" in a block.', token.lineno, stream.source) elsif !parser.main_scope? raise Error::Syntax.new('Cannot use "extend" in a macro.', token.lineno, stream.source) end parser.parent = parser.parse_expression stream.expect(Token::BLOCK_END_TYPE) Node::Empty.new(token.lineno) end |
#tag ⇒ Object
21 22 23 |
# File 'lib/twig/token_parser/extends.rb', line 21 def tag 'extends' end |