blob: 9295fcffb477fabff355e254d5a8bc3b55c2bfaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
|
module Mpeg
class Parser
def parse(string)
root.parse(string)
end
private
def root
alpha.repeat(1, nil) >> comparison_operator >> string
end
def alpha
Re.new('a-zA-Z')
end
def comparison_operator
equal | not_equal
end
def equal
str('eq')
end
def not_equal
str('ne')
end
def string
quote >> (str('\\') >> any | str('"').absent? >> any).repeat >> quote
end
def quote
str('"')
end
def str(string)
Str.new(string)
end
def any
Re.new('.')
end
end
end
|