Class: Code::Parser::Whitespace
Instance Method Summary
collapse
Methods inherited from Language
<<, >>, absent, aka, #any, ignore, #inspect, maybe, parse, #parse, repeat, #str, then, #to_s, |
Instance Method Details
20
21
22
|
# File 'lib/code/parser/whitespace.rb', line 20
def asterisk
str("*")
end
|
28
29
30
|
# File 'lib/code/parser/whitespace.rb', line 28
def
slash << slash << (newline.absent << any).repeat << newline.maybe
end
|
24
25
26
|
# File 'lib/code/parser/whitespace.rb', line 24
def
hashtag << (newline.absent << any).repeat << newline.maybe
end
|
12
13
14
|
# File 'lib/code/parser/whitespace.rb', line 12
def hashtag
str("#")
end
|
32
33
34
35
|
# File 'lib/code/parser/whitespace.rb', line 32
def
slash << asterisk << ((asterisk << slash).absent << any).repeat <<
asterisk.maybe << slash.maybe
end
|
8
9
10
|
# File 'lib/code/parser/whitespace.rb', line 8
def newline
str("\n")
end
|
41
42
43
44
45
46
|
# File 'lib/code/parser/whitespace.rb', line 41
def root
(
space | newline | | |
).repeat(1)
end
|
16
17
18
|
# File 'lib/code/parser/whitespace.rb', line 16
def slash
str("/")
end
|
4
5
6
|
# File 'lib/code/parser/whitespace.rb', line 4
def space
str(" ")
end
|
#without_newline ⇒ Object
37
38
39
|
# File 'lib/code/parser/whitespace.rb', line 37
def without_newline
(space | ).repeat(1)
end
|