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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/operations.rb', line 6
def process_operation l
line = l
return false if @raw
op = nil
op2 = nil
op = l[Operator]
if line[0] == op
op1 = @node
op2 = line[1..-1]
elsif line[-1] == op
op1 = line[0..-2]
else
op1, op2 = parse_op line, op
end
if not op2 or op2 == ""
if @nodes[@node][-1]
op2 = @nodes[@node][-1]
else
op2 = @node
end
end
if op == "*"
ins op1
@nodes[op1].each do |n|
ins n, op2
end
return true
end
if op == "+"
ins op1
ins op2
@nodes[op1] += @nodes[op2]
return true
end
if op == "."
ins op2
if is_node? op2
@path << @node
edit op2
end
return true
end
if op == "-"
ins op1
ins op2
@nodes[op2].each do |l|
@nodes[op1].delete l
end
return true
end
if op == "="
ins op1
op2="" unless op2
@nodes[op1][0] = op2
return true
end
if op == ">"
ins op2, op1
return true
end
if op == "<"
ins op1, op2
return true
end
if op == "/"
ins op1
delete op1, op2
return true
end
if op == "|"
ins op1
return true unless op2
@nodes[@node] += `cat #{@Dir+op1}|#{op2}`.split("\n")
return true
end
if op == "!"
ins op1
return true unless op2
@nodes[@node] = `cat #{@Dir+op1}|#{op2}`.split("\n")
return true
end
return false
end
|