Class: Template::Parser::Template
Instance Method Summary
collapse
Methods inherited from Language
<<, >>, absent, aka, #any, ignore, #inspect, maybe, parse, #parse, repeat, #str, then, #to_s, |
Instance Method Details
#backslash ⇒ Object
16
17
18
|
# File 'lib/template/parser/template.rb', line 16
def backslash
str("\\")
end
|
#closing_curly_bracket ⇒ Object
12
13
14
|
# File 'lib/template/parser/template.rb', line 12
def closing_curly_bracket
str("}")
end
|
#code ⇒ Object
4
5
6
|
# File 'lib/template/parser/template.rb', line 4
def code
::Code::Parser::Code
end
|
#code_part ⇒ Object
20
21
22
|
# File 'lib/template/parser/template.rb', line 20
def code_part
opening_curly_bracket << code << (closing_curly_bracket | any.absent)
end
|
#opening_curly_bracket ⇒ Object
8
9
10
|
# File 'lib/template/parser/template.rb', line 8
def opening_curly_bracket
str("{")
end
|
#root ⇒ Object
33
34
35
36
|
# File 'lib/template/parser/template.rb', line 33
def root
(code_part.aka(:code) | text_part.aka(:text)).repeat |
str("").aka(:text).repeat(1, 1)
end
|
#text_character ⇒ Object
24
25
26
27
|
# File 'lib/template/parser/template.rb', line 24
def text_character
(backslash.ignore << opening_curly_bracket) |
(opening_curly_bracket.absent << any)
end
|
#text_part ⇒ Object
29
30
31
|
# File 'lib/template/parser/template.rb', line 29
def text_part
text_character.repeat(1)
end
|