16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/todo_time_patterns/parser.rb', line 16
def parse(input)
i = 0
buffer = ""
tokens = []
while input[i]
break if input[i] == nil
while input[i] == " "
i += 1
end
@parser_checks.each do |check_method, check_class|
token_start_index = i
while input[i] != nil and input[i] != " " and input[i].send check_method
buffer << input[i]
i += 1
end
unless buffer.empty?
tokens << (check_class.new buffer, token_start_index)
buffer = ""
end
end
end
tokens.extend(TokensStringRepresentation)
tokens
end
|