Class: Template::Parser::Template

Inherits:
Language
  • Object
show all
Defined in:
lib/template/parser/template.rb

Instance Method Summary collapse

Instance Method Details

#backslashObject



18
19
20
# File 'lib/template/parser/template.rb', line 18

def backslash
  str('\\')
end

#closing_curly_bracketObject



14
15
16
# File 'lib/template/parser/template.rb', line 14

def closing_curly_bracket
  str("}")
end

#codeObject



6
7
8
# File 'lib/template/parser/template.rb', line 6

def code
  ::Code::Parser::Code
end

#code_partObject



22
23
24
# File 'lib/template/parser/template.rb', line 22

def code_part
  opening_curly_bracket << code << (closing_curly_bracket | any.absent)
end

#opening_curly_bracketObject



10
11
12
# File 'lib/template/parser/template.rb', line 10

def opening_curly_bracket
  str("{")
end

#rootObject



35
36
37
38
# File 'lib/template/parser/template.rb', line 35

def root
  (code_part.aka(:code) | text_part.aka(:text)).repeat |
    str("").aka(:text).repeat(1, 1)
end

#text_characterObject



26
27
28
29
# File 'lib/template/parser/template.rb', line 26

def text_character
  (backslash.ignore << opening_curly_bracket) |
    (opening_curly_bracket.absent << any)
end

#text_partObject



31
32
33
# File 'lib/template/parser/template.rb', line 31

def text_part
  text_character.repeat(1)
end