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
46
47
48
49
50
51
|
# File 'lib/rbf/parser.rb', line 19
def self.syntax (keys)
klass = self.clone
klass.class_eval {
rule(:forward) { str(keys[:forward]).as(?>) }
rule(:backward) { str(keys[:backward]).as(?<) }
rule(:increase) { str(keys[:increase]).as(?+) }
rule(:decrease) { str(keys[:decrease]).as(?-) }
rule(:output) { str(keys[:output]).as(?.) }
rule(:input) { str(keys[:input]).as(?,) }
rule(:while_start) { str(keys[:while_start]) }
rule(:while_end) { str(keys[:while_end]) }
rule(:comment) { (
str(keys[:forward]) |
str(keys[:backward]) |
str(keys[:increase]) |
str(keys[:decrease]) |
str(keys[:output]) |
str(keys[:input]) |
str(keys[:while_start]) |
str(keys[:while_end])
).absent? >> any }
}
klass
end
|