fabulator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +41 -0
  3. data/README.rdoc +61 -0
  4. data/Rakefile +54 -0
  5. data/lib/fabulator.rb +5 -0
  6. data/lib/fabulator/action.rb +46 -0
  7. data/lib/fabulator/action_lib.rb +438 -0
  8. data/lib/fabulator/context.rb +39 -0
  9. data/lib/fabulator/core.rb +8 -0
  10. data/lib/fabulator/core/actions.rb +514 -0
  11. data/lib/fabulator/core/actions/choose.rb +167 -0
  12. data/lib/fabulator/core/actions/for_each.rb +105 -0
  13. data/lib/fabulator/core/actions/variables.rb +52 -0
  14. data/lib/fabulator/core/constraint.rb +117 -0
  15. data/lib/fabulator/core/filter.rb +41 -0
  16. data/lib/fabulator/core/group.rb +123 -0
  17. data/lib/fabulator/core/parameter.rb +128 -0
  18. data/lib/fabulator/core/state.rb +91 -0
  19. data/lib/fabulator/core/state_machine.rb +153 -0
  20. data/lib/fabulator/core/transition.rb +164 -0
  21. data/lib/fabulator/expr.rb +37 -0
  22. data/lib/fabulator/expr/axis.rb +133 -0
  23. data/lib/fabulator/expr/axis_descendent_or_self.rb +26 -0
  24. data/lib/fabulator/expr/bin_expr.rb +178 -0
  25. data/lib/fabulator/expr/context.rb +368 -0
  26. data/lib/fabulator/expr/for_expr.rb +74 -0
  27. data/lib/fabulator/expr/function.rb +52 -0
  28. data/lib/fabulator/expr/if_expr.rb +22 -0
  29. data/lib/fabulator/expr/let_expr.rb +17 -0
  30. data/lib/fabulator/expr/literal.rb +39 -0
  31. data/lib/fabulator/expr/node.rb +216 -0
  32. data/lib/fabulator/expr/node_logic.rb +99 -0
  33. data/lib/fabulator/expr/parser.rb +1470 -0
  34. data/lib/fabulator/expr/path_expr.rb +49 -0
  35. data/lib/fabulator/expr/predicates.rb +45 -0
  36. data/lib/fabulator/expr/statement_list.rb +96 -0
  37. data/lib/fabulator/expr/step.rb +43 -0
  38. data/lib/fabulator/expr/unary_expr.rb +30 -0
  39. data/lib/fabulator/expr/union_expr.rb +21 -0
  40. data/lib/fabulator/template.rb +9 -0
  41. data/lib/fabulator/template/context.rb +51 -0
  42. data/lib/fabulator/template/parse_result.rb +153 -0
  43. data/lib/fabulator/template/parser.rb +17 -0
  44. data/lib/fabulator/template/standard_tags.rb +95 -0
  45. data/lib/fabulator/template/taggable.rb +88 -0
  46. data/lib/fabulator/version.rb +14 -0
  47. data/test/test_fabulator.rb +17 -0
  48. data/test/test_helper.rb +24 -0
  49. data/xslt/form.xsl +2161 -0
  50. metadata +182 -0
@@ -0,0 +1,22 @@
1
+ module Fabulator
2
+ module Expr
3
+ class IfExpr
4
+ def initialize(t, a, b)
5
+ @test = t
6
+ @then_expr = a
7
+ @else_expr = b
8
+ end
9
+
10
+ def run(context, autovivify = false)
11
+ res = @test.run(context.merge)
12
+
13
+ if res.nil? || res.empty? || !res.first.value
14
+ res = @else_expr.nil? ? [] : @else_expr.run(context.merge, autovivify)
15
+ else
16
+ res = @then_expr.run(context.merge, autovivify)
17
+ end
18
+ return res
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module Fabulator
2
+ module Expr
3
+ class LetExpr
4
+ def initialize(dqname, expr)
5
+ @expr = expr
6
+ dqname =~ /^\$?(.*)$/
7
+ @name = $1
8
+ end
9
+
10
+ def run(context, autovivify = false)
11
+ result = @expr.run(context, autovivify)
12
+ context.set_var(@name, result)
13
+ return [ ]
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,39 @@
1
+ module Fabulator
2
+ module Expr
3
+ class Literal
4
+ def initialize(e, t = nil)
5
+ @lit = e
6
+ @type = t
7
+ end
8
+
9
+ def expr_type(context)
10
+ @type
11
+ end
12
+
13
+ def run(context, autovivify = false)
14
+ return [ context.root.anon_node(@lit, @type) ]
15
+ end
16
+ end
17
+
18
+ class Var
19
+ def initialize(v)
20
+ @var = v
21
+ end
22
+
23
+ def expr_type(context)
24
+ v = context.get_var(@var)
25
+ if( v.is_a?(Array) )
26
+ ActionLib.unify_types(v.collect{ |i| i.vtype })
27
+ else
28
+ v.vtype
29
+ end
30
+ end
31
+
32
+ def run(context, autovivify = false)
33
+ v = context.get_var(@var)
34
+ return [] if v.nil?
35
+ return v.is_a?(Array) ? v : [ v ]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,216 @@
1
+ module Fabulator
2
+ module Expr
3
+ class Node
4
+ include Fabulator::Expr::NodeLogic
5
+
6
+ attr_accessor :axis, :value, :name, :roots, :vtype, :attributes, :is_attribute
7
+
8
+ def initialize(a,r,v,c,p = nil) #,f={})
9
+ @roots = r
10
+ @axis = a
11
+ @children = []
12
+ @children = @children + c if c.is_a?(Array)
13
+ @value = v
14
+ @vtype = nil
15
+ @parent = p
16
+ @name = nil
17
+ # @e_ctx = f
18
+ @attributes = [ ]
19
+ @is_attribute = false
20
+
21
+ if @value.is_a?(String)
22
+ @vtype = [ FAB_NS, 'string' ]
23
+ elsif @value.is_a?(Numeric)
24
+ @vtype = [ FAB_NS, 'numeric' ]
25
+ elsif @value.is_a?(TrueClass) || @value.is_a?(FalseClass)
26
+ @vtype = [ FAB_NS, 'boolean' ]
27
+ end
28
+ end
29
+
30
+ def is_attribute?
31
+ @is_attribute
32
+ end
33
+
34
+ def set_attribute(k, v)
35
+ if v.is_a?(Fabulator::Expr::Node)
36
+ v = v.clone
37
+ else
38
+ v = Fabulator::Expr::Node.new(self.axis, self.roots, v, [], self)
39
+ end
40
+ v.name = k
41
+ v.is_attribute = true
42
+ @attributes.delete_if{|a| a.name == k }
43
+ @attributes << v
44
+ end
45
+
46
+ def get_attribute(k)
47
+ (@attributes.select{ |a| a.name == k }.first rescue nil)
48
+ end
49
+
50
+ def attributes
51
+ @attributes
52
+ end
53
+
54
+ def self.new_context_environment
55
+ r = { }
56
+ d = Fabulator::Expr::Node.new('data', r, nil, [])
57
+ r['data'] = d
58
+ d
59
+ end
60
+
61
+ def anon_node(v, t = nil)
62
+ if v.is_a?(Array)
63
+ n = self.class.new(self.axis, self.roots, nil, v.collect{ |vv| self.anon_node(vv, t) })
64
+ else
65
+ n = self.class.new(self.axis, self.roots, v, [])
66
+ n.vtype = t unless t.nil?
67
+ end
68
+ n
69
+ end
70
+
71
+ def clone(deep = false)
72
+ node = self.anon_node(self.value, self.vtype)
73
+ node.name = self.name
74
+ node.attributes = self.attributes.collect { |a| a.clone(deep) }
75
+ node.copy(self) if deep
76
+ node
77
+ end
78
+
79
+ def create_child(n,v = nil,t=nil)
80
+ node = self.class.new(@axis, @roots, v, [], self)
81
+ node.name = n
82
+ node.vtype = t unless t.nil?
83
+ @children << node
84
+ node
85
+ end
86
+
87
+ def merge_data(d,p = nil)
88
+ # we have a hash or array based on root (r)
89
+ if p.nil?
90
+ root_context = [ self ]
91
+ else
92
+ root_context = self.traverse_path(p,true)
93
+ end
94
+ if root_context.size > 1
95
+ # see if we need to prune
96
+ new_rc = [ ]
97
+ root_context.each do |c|
98
+ if c.children.size == 0 && c.value.nil?
99
+ c.parent.prune(c) if c.parent
100
+ else
101
+ new_rc << c
102
+ end
103
+ end
104
+ if new_rc.size > 0
105
+ raise "Unable to merge data into multiple places simultaneously"
106
+ else
107
+ root_context = new_rc
108
+ end
109
+ else
110
+ root_context = root_context.first
111
+ end
112
+ if d.is_a?(Array)
113
+ node_name = root_context.name
114
+ root_context = root_context.parent
115
+ # get rid of empty children so we don't have problems later
116
+ root_context.children.each do |c|
117
+ if c.children.size == 0 && c.name == node_name && c.value.nil?
118
+ c.parent.prune(c)
119
+ end
120
+ end
121
+ d.each do |i|
122
+ c = root_context.create_child(node_name)
123
+ c.merge_data(i)
124
+ end
125
+ elsif d.is_a?(Hash)
126
+ d.each_pair do |k,v|
127
+ bits = k.split('.')
128
+ c = root_context.traverse_path(bits,true).first
129
+ if v.is_a?(Hash) || v.is_a?(Array)
130
+ c.merge_data(v)
131
+ else
132
+ c.value = v
133
+ end
134
+ end
135
+ else
136
+ c = root_context.parent.create_child(root_context.name, d)
137
+ end
138
+ end
139
+
140
+ def parent=(p)
141
+ @parent = p
142
+ @axis = p.axis
143
+ end
144
+
145
+ def parent
146
+ @parent.nil? ? self : @parent
147
+ end
148
+
149
+ def children(n = nil)
150
+ op = ActionLib.find_op(@vtype, :children)
151
+ possible = op.nil? ? @children : op.call(self)
152
+ if n.nil?
153
+ possible
154
+ else
155
+ possible.select{|c| c.name == n }
156
+ end
157
+ end
158
+
159
+ def prune(c = nil)
160
+ if c.nil?
161
+ @children = [ ]
162
+ elsif c.is_a?(Array)
163
+ @children = @children - c
164
+ else
165
+ @children = @children - [ c ]
166
+ end
167
+ end
168
+
169
+ def add_child(c)
170
+ c.parent.prune(c) if c.parent
171
+ c.parent = self
172
+ c.axis = self.axis
173
+ @children << c
174
+ end
175
+ end
176
+
177
+ class CurrentContext
178
+ def initialize
179
+ end
180
+
181
+ def run(context, autovivify = false)
182
+ context.nil? ? [] : [ context.root ]
183
+ end
184
+
185
+ def create_node(context)
186
+ context.root
187
+ end
188
+ end
189
+
190
+ class RootContext
191
+ def initialize(axis = nil)
192
+ @axis = axis
193
+ end
194
+
195
+ def run(context, autovivify = false)
196
+ c = nil
197
+ if @axis.is_a?(String)
198
+ c = context.root.root(@axis)
199
+ elsif !@axis.nil?
200
+ c = @axis.run(context, autovivify).first
201
+ else
202
+ c = context.root.root
203
+ end
204
+ return [ ] if c.nil?
205
+ return [ c ]
206
+ end
207
+
208
+ def create_node(context)
209
+ if context.root.root(@axis).nil?
210
+ context.root.roots[@axis] = Fabulator::Expr::Node.new(@axis,context.root.roots,nil,[])
211
+ end
212
+ context.root.root(@axis)
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,99 @@
1
+ module Fabulator
2
+ module Expr
3
+ module NodeLogic
4
+ def to_s
5
+ self.to([ FAB_NS, 'string' ]).value
6
+ end
7
+
8
+ def to_h
9
+ r = { }
10
+ # :attributes => { },
11
+
12
+ r[:name] = self.name unless self.name.nil?
13
+ cs = self.children.collect { |c| c.to_h }
14
+ r[:children] = cs unless cs.empty?
15
+ r[:value] = self.value unless self.value.nil?
16
+ r[:type] = self.vtype.join('') unless self.vtype.nil?
17
+
18
+ r
19
+ end
20
+
21
+ def to(t)
22
+ if @vtype.nil? || t.nil?
23
+ return self.anon_node(self.value, self.vtype)
24
+ end
25
+ if self.vtype.join('') == t.join('')
26
+ return self
27
+ end
28
+ # see if there's a path between @vtype and t
29
+ # if so, do the conversion
30
+ # otherwise, return nil
31
+ path = Fabulator::ActionLib.type_path(self.vtype, t)
32
+ return self.anon_node(nil,nil) if path.empty?
33
+ v = self
34
+ path.each do |p|
35
+ vv = nil
36
+ begin
37
+ vv = p.call(v)
38
+ rescue => e
39
+ raise "Converting to #{t[1]} raised #{e}"
40
+ end
41
+ if vv.is_a?(Fabulator::Expr::Node)
42
+ v = vv
43
+ else
44
+ v = self.anon_node(vv)
45
+ end
46
+ end
47
+ v.vtype = t
48
+ return v
49
+ end
50
+
51
+ def in_context(&block)
52
+ yield
53
+ end
54
+
55
+ def path
56
+ if self.parent.nil? || self.parent == self
57
+ return ''
58
+ else
59
+ return self.parent.path + '/' + (self.is_attribute? ? '@' : '') + self.name
60
+ end
61
+ end
62
+
63
+ def copy(c)
64
+ self.value = c.value
65
+ self.vtype = c.vtype
66
+ # TODO: attributes
67
+
68
+ c.attributes.each do |a|
69
+ self.set_attribute(a.name,a.value)
70
+ end
71
+ c.children.each do |cc|
72
+ n = self.create_child(cc.name, cc.value)
73
+ n.copy(cc)
74
+ end
75
+ end
76
+
77
+ def empty?
78
+ self.value.nil? && self.children.empty?
79
+ end
80
+
81
+ def root(a = nil)
82
+ if(a.nil? || a == '')
83
+ a = self.axis
84
+ end
85
+ if a.nil? || a == '' || self.roots[a].nil?
86
+ p = self
87
+ while !p.parent.nil? && p.parent != self
88
+ p = p.parent
89
+ end
90
+ self.roots[a] = p unless a.nil? || a == ''
91
+ return p
92
+ else
93
+ self.roots[a.nil? ? self.axis : a]
94
+ end
95
+ end
96
+
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,1470 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by Racc 1.4.6
4
+ # from Racc grammer file "".
5
+ #
6
+
7
+ require 'racc/parser.rb'
8
+ module Fabulator
9
+ module Expr
10
+ class Parser < Racc::Parser
11
+
12
+ module_eval(<<'...end xsm_expression_parser.racc/module_eval...', 'xsm_expression_parser.racc', 176)
13
+ require 'fabulator/expr'
14
+ require 'rational'
15
+ require 'bigdecimal'
16
+ require 'bigdecimal/util'
17
+
18
+ def parse(t, ctx)
19
+ @source = t
20
+ @curpos = 0
21
+ @context = ctx #.class.new(ctx)
22
+ @line = 0
23
+ @col = 0
24
+
25
+ @yydebug = true
26
+
27
+ @last_token = nil
28
+
29
+ do_parse
30
+ end
31
+
32
+ def on_error(*args)
33
+ raise Fabulator::Expr::ParserError.new("unable to parse '#{args[1]}' near line #{@line + 1}, column #{@col}")
34
+ end
35
+
36
+
37
+ @@regex = {
38
+ :simple_tokens => %r{\.\.|::|!=|>=|<=|\/\/|:=|\.|@|[*]|\(|\)|\[|\]|\{|\}|\/|\||\+|-|=|>|<|&|,|;},
39
+ :ncname => %r{(?:[a-zA-Z_][-a-zA-Z0-9_.]*)},
40
+ :event_type => %r{(?:processing-instruction|comment|text|node)},
41
+ :axis_name => %r{(?:attribute|child|child-or-self|descendant|descendant-or-self|method|self)},
42
+ :namespace_name => %r{(?:context|global|local|session|universal)},
43
+ :number => %r{(-?\d+(?:\.\d+)?|\.\d+)},
44
+ }
45
+
46
+ @@regex[:axis] = %r{(#{@@regex[:ncname]})\s*(?=::)}
47
+ @@regex[:name_colon_star] = %r{(#{@@regex[:ncname]}:\*)}
48
+ @@regex[:qname] = %r{((?:#{@@regex[:ncname]}:)?#{@@regex[:ncname]})}
49
+ @@regex[:dollar_qname] = %r{\$#{@@regex[:qname]}}
50
+ @@regex[:dollar_int] = %r{\$([0-9]+)}
51
+ @@regex[:function_name] = %r{#{@@regex[:qname]}\s*(?=\([^:])}
52
+
53
+ @@ops = {
54
+ '..' => :DOT_DOT,
55
+ '::' => :COLON_COLON,
56
+ '!=' => :NEQ,
57
+ '>=' => :GTE,
58
+ '<=' => :LTE,
59
+ '//' => :SLASH_SLASH,
60
+ ':=' => :COLON_EQUAL,
61
+ '.' => :DOT,
62
+ '@' => :AT,
63
+ '*' => :STAR,
64
+ '(' => :LP,
65
+ ')' => :RP,
66
+ '[' => :LB,
67
+ ']' => :RB,
68
+ '{' => :LC,
69
+ '}' => :RC,
70
+ '/' => :SLASH,
71
+ '|' => :PIPE,
72
+ '+' => :PLUS,
73
+ '-' => :MINUS,
74
+ '=' => :EQ,
75
+ '>' => :GT,
76
+ '<' => :LT,
77
+ '&' => :AMP,
78
+ ',' => :COMMA,
79
+ ';' => :SEMI
80
+ }
81
+
82
+ @@preceding_tokens = { }
83
+ [%{
84
+ @ :: (
85
+ and or mod div
86
+ *
87
+ / // | + - = != < <= > >=
88
+ == & && ||
89
+ }.split(/\s*/), '[', ',', '$' ].each { |t| @@preceding_tokens[t] = true }
90
+
91
+ @@regex[:general] = Regexp.compile(%{^(?:#{@@regex[:function_name]}|#{@@regex[:axis]}|#{@@regex[:name_colon_star]}|#{@@regex[:qname]}|('[^']*'|"[^"]*")|#{@@regex[:number]}|#{@@regex[:dollar_qname]}|#{@@regex[:dollar_int]}|(#{@@regex[:simple_tokens]}))})
92
+
93
+ def next_token
94
+ @token = nil
95
+ white_space = 0
96
+ new_line = 0
97
+ while @curpos < @source.length && @source[@curpos..@curpos] =~ /\s/ do
98
+ if @source[@curpos..@curpos] =~ /\n/
99
+ new_line = new_line + 1
100
+ @line = @line + 1
101
+ @col = 0
102
+ else
103
+ @col = @col + 1
104
+ end
105
+ @curpos = @curpos + 1
106
+ white_space = white_space + 1
107
+ end
108
+
109
+ # skip comments delimited by (: :)
110
+ # comments can be nested
111
+ # these are XPath 2.0 comments
112
+ #
113
+ if @curpos < @source.length && @source[@curpos..@curpos+1] == '(:'
114
+ comment_depth = 1
115
+ @curpos = @curpos + 2
116
+ @col = @col + 2
117
+ while comment_depth > 0 && @curpos < @source.length
118
+ if @source[@curpos..@curpos+1] == '(:'
119
+ comment_depth = comment_depth + 1
120
+ @curpos = @curpos + 1
121
+ @col = @col + 1
122
+ end
123
+ if @source[@curpos..@curpos+1] == ':)'
124
+ comment_depth = comment_depth - 1
125
+ @curpos = @curpos + 1
126
+ @col = @col + 1
127
+ end
128
+ @curpos = @curpos + 1
129
+ @col = @col + 1
130
+ end
131
+ white_space = white_space + 1
132
+ end
133
+
134
+ while @curpos < @source.length && @source[@curpos..@curpos] =~ /\s/ do
135
+ if @source[@curpos..@curpos] =~ /\n/
136
+ new_line = new_line + 1
137
+ @line = @line + 1
138
+ @col = 0
139
+ else
140
+ @col = @col + 1
141
+ end
142
+ @curpos = @curpos + 1
143
+ white_space = white_space + 1
144
+ end
145
+
146
+ if @curpos >= @source.length
147
+ @last_token = nil
148
+ return [ false, false ]
149
+ end
150
+
151
+ #if new_line > 0 || white_space > 0
152
+ # @token = [ :SP, '' ]
153
+ #end
154
+
155
+ if @token.nil? && @last_token && ! @@preceding_tokens[@last_token[1]]
156
+ if @source[@curpos..@curpos] == '*'
157
+ @token = [ :STAR, '*' ]
158
+ else
159
+ if @source[@curpos..@source.length-1] =~ /^(#{@@regex[:ncname]})/
160
+ ncname = $1
161
+ case ncname
162
+ when 'for':
163
+ @token = [ :FOR, 'for' ]
164
+ when 'return':
165
+ @token = [ :RETURN, 'return' ]
166
+ when 'in':
167
+ @token = [ :IN, 'in' ]
168
+ when 'let':
169
+ @token = [ :LET, 'let' ]
170
+ when 'except':
171
+ @token = [ :EXCEPT, 'except' ]
172
+ when 'every':
173
+ @token = [ :EVERY, 'every' ]
174
+ when 'some':
175
+ @token = [ :SOME, 'some' ]
176
+ when 'satisfies':
177
+ @token = [ :SATISFIES, 'satisfies' ]
178
+ when 'if':
179
+ @token = [ :IF, 'if' ]
180
+ when 'then':
181
+ @token = [ :THEN, 'then' ]
182
+ when 'else':
183
+ @token = [ :ELSE, 'else' ]
184
+ when 'to':
185
+ @token = [ :TO, 'to' ]
186
+ when 'and':
187
+ @token = [ :AND, 'and' ]
188
+ when 'or':
189
+ @token = [ :OR, 'or' ]
190
+ when 'mod':
191
+ @token = [ :MOD, 'mod' ]
192
+ when 'div':
193
+ @token = [ :DIV, 'div' ]
194
+ #when '*doh*':
195
+ # # do nothing
196
+ # @token = nil
197
+ else
198
+ @token = nil
199
+ end
200
+ end
201
+ end
202
+ end
203
+
204
+ if @token.nil? && @source[@curpos..@curpos+1] == '..'
205
+ @token = [ :DOT_DOT, '..' ]
206
+ end
207
+
208
+ if @token.nil?
209
+ if @curpos >= @source.length
210
+ @token = [false, false]
211
+ return @token
212
+ end
213
+
214
+ res = @@regex[:general].match(@source[@curpos..@source.length-1])
215
+ #@source[@curpos..@source.length-1] =~ @@regex[:general]
216
+ #res = [ nil, $1, $2, $3, $4, $5, $6, $7, $8 ]
217
+ if res.nil?
218
+ raise "Failed to parse '#{@source}' at #{@curpos}': #{@source[@curpos..@source.length-1]}"
219
+ else
220
+ if !res[1].nil?
221
+ if res[1] == 'if'
222
+ @token = [ :IF, 'if' ]
223
+ else
224
+ @token = [ :FUNCTION_NAME, res[1] ]
225
+ end
226
+ elsif !res[2].nil?
227
+ @token = [ res[2] == 'method' ? :AXIS_METHOD : :AXIS_NAME, res[2] ]
228
+ elsif !res[3].nil?
229
+ @token = [ :NAME_COLON_STAR, res[3] ]
230
+ elsif !res[4].nil?
231
+ qname = res[4]
232
+ case qname
233
+ when 'for':
234
+ @token = [ :FOR, 'for' ]
235
+ when 'return':
236
+ @token = [ :RETURN, 'return' ]
237
+ when 'in':
238
+ @token = [ :IN, 'in' ]
239
+ when 'let':
240
+ @token = [ :LET, 'let' ]
241
+ when 'except':
242
+ @token = [ :EXCEPT, 'except' ]
243
+ when 'every':
244
+ @token = [ :EVERY, 'every' ]
245
+ when 'some':
246
+ @token = [ :SOME, 'some' ]
247
+ when 'satisfies':
248
+ @token = [ :SATISFIES, 'satisfies' ]
249
+ when 'if':
250
+ @token = [ :IF, 'if' ]
251
+ when 'then':
252
+ @token = [ :THEN, 'then' ]
253
+ when 'else':
254
+ @token = [ :ELSE, 'else' ]
255
+ when 'with':
256
+ @token = [ :WITH, 'with' ]
257
+ else
258
+ @token = [ :QNAME, res[4] ]
259
+ end
260
+ elsif !res[5].nil?
261
+ s = res[5]
262
+ s = s[1..s.length-2]
263
+ @curpos = @curpos + s.length
264
+ @col = @col + s.length
265
+ s.gsub!(/\\n/, "\n")
266
+ @curpos = @curpos - s.length
267
+ @col = @col - s.length
268
+ @token = [ :LITERAL, s ]
269
+ @curpos = @curpos + 2 # the quotes
270
+ @col = @col + 2
271
+ elsif !res[6].nil?
272
+ @token = [ :NUMBER, res[6] ]
273
+ elsif !res[7].nil?
274
+ @curpos = @curpos + 1
275
+ @col = @col + 1
276
+ @token = [ :DOLLAR_QNAME, res[7] ]
277
+ elsif !res[8].nil?
278
+ @curpos = @curpos + 1
279
+ @col = @col + 1
280
+ @token = [ :DOLLAR_QNAME, res[8] ]
281
+ elsif !res[9].nil?
282
+ @token = [ @@ops[res[9]] || res[9], res[9] ]
283
+ else
284
+ raise "Failed to parse '#{@source}' at #{@curpos}: #{@source[@curpos..@source.length-1]}"
285
+ end
286
+ end
287
+ end
288
+
289
+ if !@token[1].nil?
290
+ @curpos = @curpos + @token[1].length
291
+ @col = @col + @token[1].length
292
+ end
293
+ @last_token = @token
294
+ return @token
295
+ end
296
+ ...end xsm_expression_parser.racc/module_eval...
297
+ ##### State transition tables begin ###
298
+
299
+ racc_action_table = [
300
+ 88, 28, 29, 39, 44, 164, 109, 88, 12, 88,
301
+ 74, 23, 75, 32, 109, 162, 174, 130, 161, 116,
302
+ 28, 29, 39, 44, 108, 35, 163, 12, 3, 5,
303
+ 23, 165, 32, 20, 26, 30, 34, 41, 159, 1,
304
+ 6, 10, 14, 17, 35, 58, 113, 3, 5, 29,
305
+ 104, 44, 20, 26, 30, 34, 41, 88, 1, 6,
306
+ 10, 14, 17, 130, 106, 107, 88, 128, 29, 39,
307
+ 44, 88, 35, 158, 12, 3, 5, 23, 131, 32,
308
+ 20, 26, 30, 34, 41, 109, 1, 6, 10, 14,
309
+ 17, 35, 98, 89, 3, 5, 59, 60, 120, 20,
310
+ 26, 30, 34, 41, 5, 1, 6, 10, 14, 17,
311
+ 29, 39, 44, 5, 104, 62, 12, 14, 17, 23,
312
+ 121, 32, 65, 66, 62, 117, 14, 17, 110, 29,
313
+ 39, 44, -17, 35, 88, 12, 3, 5, 23, 82,
314
+ 32, 20, 26, 30, 34, 41, 81, 1, 6, 10,
315
+ 14, 17, 35, 65, 66, 3, 5, 78, 79, 80,
316
+ 20, 26, 30, 34, 41, 77, 1, 6, 10, 14,
317
+ 17, 29, 39, 44, 5, 98, 89, 12, 70, 71,
318
+ 23, 88, 32, 65, 66, 62, 88, 14, 17, 88,
319
+ 29, 39, 44, 88, 35, 88, 12, 3, 5, 23,
320
+ 166, 32, 20, 26, 30, 34, 41, 167, 1, 6,
321
+ 10, 14, 17, 35, 65, 66, 3, 5, 78, 79,
322
+ 80, 20, 26, 30, 34, 41, 88, 1, 6, 10,
323
+ 14, 17, 29, 39, 44, 78, 79, 80, 12, 59,
324
+ 60, 23, 58, 32, 96, 97, 98, 89, 65, 66,
325
+ 69, 29, 58, 44, 58, 35, 65, 66, 3, 5,
326
+ 98, 89, 88, 20, 26, 30, 34, 41, 54, 1,
327
+ 6, 10, 14, 17, 35, 98, 89, 3, 5, 65,
328
+ 66, 52, 20, 26, 30, 34, 41, 50, 1, 6,
329
+ 10, 14, 17, 29, 39, 44, 98, 89, 88, 12,
330
+ 98, 89, 23, nil, 32, 98, 89, 98, 89, nil,
331
+ nil, nil, 29, 39, 44, nil, 35, nil, 12, 3,
332
+ 5, 23, nil, 32, 20, 26, 30, 34, 41, nil,
333
+ 1, 6, 10, 14, 17, 35, nil, nil, 3, 5,
334
+ nil, nil, nil, 20, 26, 30, 34, 41, nil, 1,
335
+ 6, 10, 14, 17, 29, 39, 44, nil, nil, nil,
336
+ 12, nil, nil, 23, nil, 32, nil, nil, nil, nil,
337
+ nil, nil, nil, 29, nil, 44, nil, 35, nil, nil,
338
+ 3, 5, nil, nil, nil, 20, 26, 30, 34, 41,
339
+ nil, 1, 6, 10, 14, 17, 35, 29, nil, 44,
340
+ 5, nil, nil, nil, 20, 26, 30, 34, 41, nil,
341
+ 1, 6, 10, 14, 17, nil, 29, nil, 44, nil,
342
+ 35, nil, nil, 3, 5, nil, nil, nil, 20, 26,
343
+ 30, 34, 41, nil, 1, 6, 10, 14, 17, 35,
344
+ nil, nil, 3, 5, 29, nil, 44, 20, 26, 30,
345
+ 34, 41, nil, 1, 6, 10, 14, 17, nil, nil,
346
+ nil, nil, nil, 29, nil, 44, nil, 35, nil, nil,
347
+ 3, 5, nil, nil, nil, 20, 26, 30, 34, 41,
348
+ nil, 1, 6, 10, 14, 17, 35, nil, nil, 3,
349
+ 5, nil, nil, nil, 20, 26, 30, 34, 41, nil,
350
+ 1, 6, 10, 14, 17, 29, 39, 44, nil, nil,
351
+ nil, 12, nil, nil, 23, nil, 32, nil, nil, nil,
352
+ nil, nil, nil, nil, 29, nil, 44, nil, 35, nil,
353
+ nil, 3, 5, nil, nil, nil, 20, 26, 30, 34,
354
+ 41, nil, 1, 6, 10, 14, 17, 35, nil, nil,
355
+ 3, 5, 29, nil, 44, 20, 26, 30, 34, 41,
356
+ nil, 1, 6, 10, 14, 17, nil, nil, nil, nil,
357
+ nil, 29, nil, 44, nil, 35, nil, nil, 3, 5,
358
+ nil, nil, nil, 20, 26, 30, 34, 41, nil, 1,
359
+ 6, 10, 14, 17, 35, nil, nil, 3, 5, 29,
360
+ nil, 44, 20, 26, 30, 34, 41, nil, 1, 6,
361
+ 10, 14, 17, nil, nil, nil, nil, nil, 29, nil,
362
+ 44, nil, 35, nil, nil, 3, 5, nil, nil, nil,
363
+ 20, 26, 30, 34, 41, nil, 1, 6, 10, 14,
364
+ 17, 35, 29, nil, 44, 5, nil, nil, nil, 20,
365
+ 26, 30, 34, 41, nil, 1, 6, 10, 14, 17,
366
+ nil, 29, 39, 44, nil, 35, nil, 12, 3, 5,
367
+ 23, nil, 32, 20, 26, 30, 34, 41, nil, 1,
368
+ 6, 10, 14, 17, 35, nil, nil, 3, 5, 29,
369
+ nil, 44, 20, 26, 30, 34, 41, nil, 1, 6,
370
+ 10, 14, 17, nil, nil, nil, nil, nil, 29, nil,
371
+ 44, nil, 35, nil, nil, 3, 5, nil, nil, nil,
372
+ 20, 26, 30, 34, 41, nil, 1, 6, 10, 14,
373
+ 17, 35, nil, nil, 3, 5, 29, nil, 44, 20,
374
+ 26, 30, 34, 41, nil, 1, 6, 10, 14, 17,
375
+ nil, nil, nil, nil, nil, 29, nil, 44, nil, 35,
376
+ nil, nil, nil, 5, nil, nil, nil, 20, 26, 30,
377
+ 34, 41, nil, 1, 6, 10, 14, 17, 35, nil,
378
+ nil, 3, 5, 29, nil, 44, 20, 26, 30, 34,
379
+ 41, nil, 1, 6, 10, 14, 17, nil, nil, nil,
380
+ nil, nil, 29, 39, 44, nil, 35, nil, 12, 3,
381
+ 5, 23, nil, 32, 20, 26, 30, 34, 41, nil,
382
+ 1, 6, 10, 14, 17, 35, nil, nil, 3, 5,
383
+ nil, nil, nil, 20, 26, 30, 34, 41, nil, 1,
384
+ 6, 10, 14, 17, 29, 39, 44, nil, nil, nil,
385
+ 12, nil, nil, 23, nil, 32, nil, nil, nil, nil,
386
+ nil, nil, nil, 29, 39, 44, nil, 35, nil, 12,
387
+ 3, 5, 23, nil, 32, 20, 26, 30, 34, 41,
388
+ nil, 1, 6, 10, 14, 17, 35, nil, nil, 3,
389
+ 5, 29, nil, 44, 20, 26, 30, 34, 41, nil,
390
+ 1, 6, 10, 14, 17, nil, nil, nil, nil, nil,
391
+ 29, nil, 44, nil, 35, nil, nil, 3, 5, nil,
392
+ nil, nil, 20, 26, 30, 34, 41, nil, 1, 6,
393
+ 10, 14, 17, 35, nil, nil, 3, 5, 29, nil,
394
+ 44, 20, 26, 30, 34, 41, nil, 1, 6, 10,
395
+ 14, 17, nil, nil, nil, nil, nil, 29, nil, 44,
396
+ nil, 35, nil, nil, 3, 5, nil, nil, nil, 20,
397
+ 26, 30, 34, 41, nil, 1, 6, 10, 14, 17,
398
+ 35, nil, nil, nil, 5, nil, nil, nil, 20, 26,
399
+ 30, 34, 41, nil, 1, 6, 10, 14, 17, 29,
400
+ 39, 44, 35, nil, nil, 12, 5, nil, 23, nil,
401
+ 32, nil, 30, 34, 41, nil, 85, 62, nil, 14,
402
+ 17, nil, 35, -16, nil, 3, 5, nil, nil, nil,
403
+ 20, 26, 30, 34, 41, nil, 1, 6, 10, 14,
404
+ 17, 90, 91, nil, -16, 92, 93, 94, 95, 96,
405
+ 97, 98, 89, 35, nil, nil, nil, 5, nil, nil,
406
+ nil, nil, 35, 30, 34, 41, 5, nil, 62, nil,
407
+ 14, 17, 30, 34, 41, nil, nil, 62, 35, 14,
408
+ 17, nil, 5, nil, nil, nil, nil, 35, 30, 34,
409
+ 41, 5, nil, 62, nil, 14, 17, 30, 34, 41,
410
+ nil, nil, 62, 35, 14, 17, nil, 5, nil, nil,
411
+ nil, nil, 35, 30, 34, 41, 5, nil, 62, nil,
412
+ 14, 17, 30, 34, 41, nil, nil, 62, 35, 14,
413
+ 17, nil, 5, nil, nil, nil, nil, nil, 30, 34,
414
+ 41, nil, nil, 62, nil, 14, 17, 90, 91, nil,
415
+ nil, 92, 93, 94, 95, 96, 97, 98, 89, 90,
416
+ 91, nil, nil, 92, 93, 94, 95, nil, nil, 98,
417
+ 89 ]
418
+
419
+ racc_action_check = [
420
+ 61, 0, 0, 0, 0, 145, 67, 173, 0, 148,
421
+ 33, 0, 33, 0, 56, 134, 173, 129, 132, 67,
422
+ 75, 75, 75, 75, 56, 0, 145, 75, 0, 0,
423
+ 75, 148, 75, 0, 0, 0, 0, 0, 129, 0,
424
+ 0, 0, 0, 0, 75, 109, 61, 75, 75, 94,
425
+ 55, 94, 75, 75, 75, 75, 75, 102, 75, 75,
426
+ 75, 75, 75, 86, 55, 55, 127, 84, 120, 120,
427
+ 120, 87, 94, 127, 120, 94, 94, 120, 87, 120,
428
+ 94, 94, 94, 94, 94, 73, 94, 94, 94, 94,
429
+ 94, 120, 139, 139, 120, 120, 100, 100, 73, 120,
430
+ 120, 120, 120, 120, 34, 120, 120, 120, 120, 120,
431
+ 166, 166, 166, 64, 83, 34, 166, 34, 34, 166,
432
+ 74, 166, 151, 151, 64, 69, 64, 64, 58, 117,
433
+ 117, 117, 146, 166, 45, 117, 166, 166, 117, 41,
434
+ 117, 166, 166, 166, 166, 166, 39, 166, 166, 166,
435
+ 166, 166, 117, 150, 150, 117, 117, 135, 135, 135,
436
+ 117, 117, 117, 117, 117, 37, 117, 117, 117, 117,
437
+ 117, 17, 17, 17, 31, 140, 140, 17, 31, 31,
438
+ 17, 152, 17, 21, 21, 31, 154, 31, 31, 155,
439
+ 116, 116, 116, 156, 17, 157, 116, 17, 17, 116,
440
+ 158, 116, 17, 17, 17, 17, 17, 159, 17, 17,
441
+ 17, 17, 17, 116, 63, 63, 116, 116, 144, 144,
442
+ 144, 116, 116, 116, 116, 116, 160, 116, 116, 116,
443
+ 116, 116, 110, 110, 110, 38, 38, 38, 110, 15,
444
+ 15, 110, 32, 110, 172, 172, 172, 172, 118, 118,
445
+ 28, 164, 23, 164, 12, 110, 119, 119, 110, 110,
446
+ 141, 141, 169, 110, 110, 110, 110, 110, 10, 110,
447
+ 110, 110, 110, 110, 164, 142, 142, 164, 164, 68,
448
+ 68, 4, 164, 164, 164, 164, 164, 2, 164, 164,
449
+ 164, 164, 164, 108, 108, 108, 143, 143, 175, 108,
450
+ 137, 137, 108, nil, 108, 136, 136, 138, 138, nil,
451
+ nil, nil, 162, 162, 162, nil, 108, nil, 162, 108,
452
+ 108, 162, nil, 162, 108, 108, 108, 108, 108, nil,
453
+ 108, 108, 108, 108, 108, 162, nil, nil, 162, 162,
454
+ nil, nil, nil, 162, 162, 162, 162, 162, nil, 162,
455
+ 162, 162, 162, 162, 104, 104, 104, nil, nil, nil,
456
+ 104, nil, nil, 104, nil, 104, nil, nil, nil, nil,
457
+ nil, nil, nil, 161, nil, 161, nil, 104, nil, nil,
458
+ 104, 104, nil, nil, nil, 104, 104, 104, 104, 104,
459
+ nil, 104, 104, 104, 104, 104, 161, 98, nil, 98,
460
+ 161, nil, nil, nil, 161, 161, 161, 161, 161, nil,
461
+ 161, 161, 161, 161, 161, nil, 97, nil, 97, nil,
462
+ 98, nil, nil, 98, 98, nil, nil, nil, 98, 98,
463
+ 98, 98, 98, nil, 98, 98, 98, 98, 98, 97,
464
+ nil, nil, 97, 97, 96, nil, 96, 97, 97, 97,
465
+ 97, 97, nil, 97, 97, 97, 97, 97, nil, nil,
466
+ nil, nil, nil, 95, nil, 95, nil, 96, nil, nil,
467
+ 96, 96, nil, nil, nil, 96, 96, 96, 96, 96,
468
+ nil, 96, 96, 96, 96, 96, 95, nil, nil, 95,
469
+ 95, nil, nil, nil, 95, 95, 95, 95, 95, nil,
470
+ 95, 95, 95, 95, 95, 130, 130, 130, nil, nil,
471
+ nil, 130, nil, nil, 130, nil, 130, nil, nil, nil,
472
+ nil, nil, nil, nil, 93, nil, 93, nil, 130, nil,
473
+ nil, 130, 130, nil, nil, nil, 130, 130, 130, 130,
474
+ 130, nil, 130, 130, 130, 130, 130, 93, nil, nil,
475
+ 93, 93, 3, nil, 3, 93, 93, 93, 93, 93,
476
+ nil, 93, 93, 93, 93, 93, nil, nil, nil, nil,
477
+ nil, 92, nil, 92, nil, 3, nil, nil, 3, 3,
478
+ nil, nil, nil, 3, 3, 3, 3, 3, nil, 3,
479
+ 3, 3, 3, 3, 92, nil, nil, 92, 92, 91,
480
+ nil, 91, 92, 92, 92, 92, 92, nil, 92, 92,
481
+ 92, 92, 92, nil, nil, nil, nil, nil, 50, nil,
482
+ 50, nil, 91, nil, nil, 91, 91, nil, nil, nil,
483
+ 91, 91, 91, 91, 91, nil, 91, 91, 91, 91,
484
+ 91, 50, 52, nil, 52, 50, nil, nil, nil, 50,
485
+ 50, 50, 50, 50, nil, 50, 50, 50, 50, 50,
486
+ nil, 54, 54, 54, nil, 52, nil, 54, 52, 52,
487
+ 54, nil, 54, 52, 52, 52, 52, 52, nil, 52,
488
+ 52, 52, 52, 52, 54, nil, nil, 54, 54, 90,
489
+ nil, 90, 54, 54, 54, 54, 54, nil, 54, 54,
490
+ 54, 54, 54, nil, nil, nil, nil, nil, 89, nil,
491
+ 89, nil, 90, nil, nil, 90, 90, nil, nil, nil,
492
+ 90, 90, 90, 90, 90, nil, 90, 90, 90, 90,
493
+ 90, 89, nil, nil, 89, 89, 88, nil, 88, 89,
494
+ 89, 89, 89, 89, nil, 89, 89, 89, 89, 89,
495
+ nil, nil, nil, nil, nil, 59, nil, 59, nil, 88,
496
+ nil, nil, nil, 88, nil, nil, nil, 88, 88, 88,
497
+ 88, 88, nil, 88, 88, 88, 88, 88, 59, nil,
498
+ nil, 59, 59, 60, nil, 60, 59, 59, 59, 59,
499
+ 59, nil, 59, 59, 59, 59, 59, nil, nil, nil,
500
+ nil, nil, 174, 174, 174, nil, 60, nil, 174, 60,
501
+ 60, 174, nil, 174, 60, 60, 60, 60, 60, nil,
502
+ 60, 60, 60, 60, 60, 174, nil, nil, 174, 174,
503
+ nil, nil, nil, 174, 174, 174, 174, 174, nil, 174,
504
+ 174, 174, 174, 174, 85, 85, 85, nil, nil, nil,
505
+ 85, nil, nil, 85, nil, 85, nil, nil, nil, nil,
506
+ nil, nil, nil, 81, 81, 81, nil, 85, nil, 81,
507
+ 85, 85, 81, nil, 81, 85, 85, 85, 85, 85,
508
+ nil, 85, 85, 85, 85, 85, 81, nil, nil, 81,
509
+ 81, 80, nil, 80, 81, 81, 81, 81, 81, nil,
510
+ 81, 81, 81, 81, 81, nil, nil, nil, nil, nil,
511
+ 79, nil, 79, nil, 80, nil, nil, 80, 80, nil,
512
+ nil, nil, 80, 80, 80, 80, 80, nil, 80, 80,
513
+ 80, 80, 80, 79, nil, nil, 79, 79, 78, nil,
514
+ 78, 79, 79, 79, 79, 79, nil, 79, 79, 79,
515
+ 79, 79, nil, nil, nil, nil, nil, 77, nil, 77,
516
+ nil, 78, nil, nil, 78, 78, nil, nil, nil, 78,
517
+ 78, 78, 78, 78, nil, 78, 78, 78, 78, 78,
518
+ 77, nil, nil, nil, 77, nil, nil, nil, 77, 77,
519
+ 77, 77, 77, nil, 77, 77, 77, 77, 77, 44,
520
+ 44, 44, 66, nil, nil, 44, 66, nil, 44, nil,
521
+ 44, nil, 66, 66, 66, nil, 44, 66, nil, 66,
522
+ 66, nil, 44, 149, nil, 44, 44, nil, nil, nil,
523
+ 44, 44, 44, 44, 44, nil, 44, 44, 44, 44,
524
+ 44, 149, 149, nil, 149, 149, 149, 149, 149, 149,
525
+ 149, 149, 149, 106, nil, nil, nil, 106, nil, nil,
526
+ nil, nil, 70, 106, 106, 106, 70, nil, 106, nil,
527
+ 106, 106, 70, 70, 70, nil, nil, 70, 26, 70,
528
+ 70, nil, 26, nil, nil, nil, nil, 65, 26, 26,
529
+ 26, 65, nil, 26, nil, 26, 26, 65, 65, 65,
530
+ nil, nil, 65, 71, 65, 65, nil, 71, nil, nil,
531
+ nil, nil, 20, 71, 71, 71, 20, nil, 71, nil,
532
+ 71, 71, 20, 20, 20, nil, nil, 20, 107, 20,
533
+ 20, nil, 107, nil, nil, nil, nil, nil, 107, 107,
534
+ 107, nil, nil, 107, nil, 107, 107, 48, 48, nil,
535
+ nil, 48, 48, 48, 48, 48, 48, 48, 48, 101,
536
+ 101, nil, nil, 101, 101, 101, 101, nil, nil, 101,
537
+ 101 ]
538
+
539
+ racc_action_pointer = [
540
+ -5, nil, 250, 545, 262, nil, nil, nil, nil, nil,
541
+ 259, nil, 247, nil, nil, 219, nil, 164, nil, nil,
542
+ 1082, 145, nil, 245, nil, nil, 1048, nil, 243, nil,
543
+ nil, 140, 235, 10, 70, nil, nil, 128, 201, 137,
544
+ nil, 96, nil, nil, 992, 131, nil, nil, 1125, nil,
545
+ 611, nil, 635, nil, 654, 26, 10, nil, 113, 748,
546
+ 776, -3, nil, 176, 79, 1057, 972, 2, 241, 120,
547
+ 1032, 1073, nil, 81, 120, 14, nil, 950, 931, 903,
548
+ 884, 856, nil, 90, 57, 837, 59, 68, 729, 701,
549
+ 682, 592, 564, 517, 42, 456, 437, 409, 390, nil,
550
+ 76, 1137, 54, nil, 347, nil, 1023, 1098, 286, 38,
551
+ 225, nil, nil, nil, nil, nil, 183, 122, 210, 218,
552
+ 61, nil, nil, nil, nil, nil, nil, 63, nil, 13,
553
+ 498, nil, 14, nil, 10, 123, 273, 268, 275, 60,
554
+ 143, 228, 243, 264, 184, 1, 128, nil, 6, 1019,
555
+ 115, 84, 178, nil, 183, 186, 190, 192, 189, 197,
556
+ 223, 366, 305, nil, 244, nil, 103, nil, nil, 259,
557
+ nil, nil, 214, 4, 795, 295 ]
558
+
559
+ racc_action_default = [
560
+ -3, -88, -55, -100, -6, -99, -89, -86, -58, -7,
561
+ -100, -80, -100, -8, -96, -29, -9, -100, -31, -10,
562
+ -65, -63, -34, -100, -11, -87, -100, -64, -100, -84,
563
+ -74, -100, -100, -100, -100, -75, -70, -54, -45, -100,
564
+ -1, -100, -80, -48, -92, -4, -76, -52, -38, -5,
565
+ -100, -53, -100, -90, -92, -60, -100, -24, -100, -100,
566
+ -100, -100, -97, -66, -100, -100, -100, -100, -67, -100,
567
+ -100, -100, -77, -100, -100, -3, -78, -100, -100, -100,
568
+ -100, -100, -79, -73, -100, -100, -93, -94, -100, -100,
569
+ -100, -100, -100, -100, -100, -100, -100, -100, -100, -57,
570
+ -30, -38, -94, -81, -100, -59, -100, -100, -100, -100,
571
+ -100, -32, -33, -98, -71, -72, -100, -100, -68, -69,
572
+ -100, 176, -2, -56, -49, -50, -51, -100, -91, -100,
573
+ -100, -85, -12, -13, -100, -47, -35, -36, -39, -40,
574
+ -41, -42, -43, -44, -46, -100, -7, -18, -100, -38,
575
+ -61, -62, -23, -25, -26, -27, -20, -28, -100, -100,
576
+ -95, -100, -100, -83, -100, -82, -100, -37, -14, -15,
577
+ -17, -19, -16, -22, -100, -21 ]
578
+
579
+ racc_goto_table = [
580
+ 61, 99, 101, 51, 133, 147, 40, 146, 63, 101,
581
+ 101, 64, 56, 135, 68, 72, 100, 64, 76, 55,
582
+ 114, 115, 144, 67, 111, 112, 129, 87, 123, 105,
583
+ 153, 145, 73, 132, 33, 53, nil, 102, nil, 134,
584
+ 136, 137, 138, 139, 140, 141, 142, 143, 72, nil,
585
+ 83, nil, nil, nil, 149, nil, 64, 64, 118, 119,
586
+ nil, 64, 64, nil, 127, 171, nil, 170, 102, nil,
587
+ nil, nil, nil, nil, nil, nil, nil, 168, 124, 125,
588
+ 126, 122, nil, nil, nil, nil, nil, 148, nil, nil,
589
+ nil, 152, nil, 154, 150, 151, nil, 64, 64, 155,
590
+ 156, nil, nil, 157, nil, nil, nil, nil, nil, nil,
591
+ nil, nil, 134, 160, 172, nil, nil, nil, nil, nil,
592
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
593
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
594
+ nil, nil, nil, nil, nil, 169, nil, nil, nil, 173,
595
+ nil, nil, nil, nil, nil, nil, nil, 175 ]
596
+
597
+ racc_goto_check = [
598
+ 3, 13, 15, 25, 12, 14, 2, 6, 32, 15,
599
+ 15, 34, 17, 24, 32, 37, 19, 34, 37, 30,
600
+ 35, 35, 24, 17, 20, 20, 23, 3, 13, 31,
601
+ 18, 16, 17, 11, 1, 39, nil, 3, nil, 13,
602
+ 15, 15, 15, 15, 15, 15, 15, 15, 37, nil,
603
+ 30, nil, nil, nil, 15, nil, 34, 34, 32, 32,
604
+ nil, 34, 34, nil, 3, 14, nil, 6, 3, nil,
605
+ nil, nil, nil, nil, nil, nil, nil, 12, 25, 25,
606
+ 25, 2, nil, nil, nil, nil, nil, 3, nil, nil,
607
+ nil, 3, nil, 3, 32, 32, nil, 34, 34, 3,
608
+ 3, nil, nil, 3, nil, nil, nil, nil, nil, nil,
609
+ nil, nil, 13, 3, 15, nil, nil, nil, nil, nil,
610
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
611
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
612
+ nil, nil, nil, nil, nil, 3, nil, nil, nil, 3,
613
+ nil, nil, nil, nil, nil, nil, nil, 3 ]
614
+
615
+ racc_goto_pointer = [
616
+ nil, 34, 6, -17, nil, nil, -97, nil, nil, nil,
617
+ nil, -55, -84, -49, -99, -50, -73, 0, -79, -36,
618
+ -35, nil, nil, -59, -76, 0, nil, nil, nil, nil,
619
+ 8, -26, -12, nil, -9, -45, nil, -16, nil, 25,
620
+ nil ]
621
+
622
+ racc_goto_default = [
623
+ nil, nil, nil, 45, 49, 4, 9, 13, 16, 19,
624
+ 24, nil, nil, 37, nil, 48, nil, nil, 57, 15,
625
+ 18, 22, 25, 86, 38, 43, 47, 2, 8, 11,
626
+ nil, nil, 21, 27, 31, 36, 42, 46, 103, 7,
627
+ 84 ]
628
+
629
+ racc_reduce_table = [
630
+ 0, 0, :racc_error,
631
+ 1, 51, :_reduce_1,
632
+ 3, 51, :_reduce_2,
633
+ 0, 52, :_reduce_none,
634
+ 1, 52, :_reduce_none,
635
+ 1, 52, :_reduce_none,
636
+ 1, 53, :_reduce_none,
637
+ 1, 53, :_reduce_none,
638
+ 1, 53, :_reduce_none,
639
+ 1, 53, :_reduce_none,
640
+ 1, 53, :_reduce_none,
641
+ 1, 53, :_reduce_none,
642
+ 3, 60, :_reduce_12,
643
+ 1, 61, :_reduce_13,
644
+ 3, 61, :_reduce_14,
645
+ 3, 62, :_reduce_15,
646
+ 1, 64, :_reduce_none,
647
+ 1, 64, :_reduce_none,
648
+ 1, 66, :_reduce_18,
649
+ 3, 66, :_reduce_19,
650
+ 4, 54, :_reduce_20,
651
+ 8, 57, :_reduce_21,
652
+ 6, 57, :_reduce_22,
653
+ 4, 58, :_reduce_23,
654
+ 1, 67, :_reduce_24,
655
+ 3, 67, :_reduce_25,
656
+ 3, 68, :_reduce_26,
657
+ 4, 59, :_reduce_27,
658
+ 4, 59, :_reduce_28,
659
+ 1, 55, :_reduce_none,
660
+ 3, 55, :_reduce_30,
661
+ 1, 69, :_reduce_none,
662
+ 3, 69, :_reduce_32,
663
+ 3, 69, :_reduce_33,
664
+ 1, 70, :_reduce_none,
665
+ 3, 70, :_reduce_35,
666
+ 3, 70, :_reduce_36,
667
+ 5, 72, :_reduce_37,
668
+ 1, 71, :_reduce_none,
669
+ 3, 71, :_reduce_39,
670
+ 3, 71, :_reduce_40,
671
+ 3, 71, :_reduce_41,
672
+ 3, 71, :_reduce_42,
673
+ 3, 56, :_reduce_43,
674
+ 3, 56, :_reduce_44,
675
+ 1, 65, :_reduce_none,
676
+ 3, 65, :_reduce_46,
677
+ 3, 65, :_reduce_47,
678
+ 1, 74, :_reduce_none,
679
+ 3, 74, :_reduce_49,
680
+ 3, 74, :_reduce_50,
681
+ 3, 74, :_reduce_51,
682
+ 1, 75, :_reduce_none,
683
+ 2, 75, :_reduce_53,
684
+ 1, 76, :_reduce_none,
685
+ 1, 76, :_reduce_55,
686
+ 3, 77, :_reduce_56,
687
+ 3, 77, :_reduce_57,
688
+ 1, 63, :_reduce_58,
689
+ 3, 63, :_reduce_59,
690
+ 0, 81, :_reduce_none,
691
+ 2, 81, :_reduce_61,
692
+ 2, 81, :_reduce_62,
693
+ 1, 78, :_reduce_none,
694
+ 1, 78, :_reduce_none,
695
+ 1, 83, :_reduce_65,
696
+ 2, 83, :_reduce_66,
697
+ 2, 83, :_reduce_67,
698
+ 3, 83, :_reduce_68,
699
+ 3, 83, :_reduce_69,
700
+ 1, 82, :_reduce_70,
701
+ 3, 82, :_reduce_71,
702
+ 3, 82, :_reduce_72,
703
+ 2, 85, :_reduce_73,
704
+ 1, 85, :_reduce_74,
705
+ 1, 85, :_reduce_75,
706
+ 1, 86, :_reduce_76,
707
+ 2, 86, :_reduce_77,
708
+ 2, 86, :_reduce_78,
709
+ 2, 84, :_reduce_79,
710
+ 0, 80, :_reduce_80,
711
+ 2, 80, :_reduce_81,
712
+ 3, 88, :_reduce_82,
713
+ 3, 88, :_reduce_83,
714
+ 1, 79, :_reduce_84,
715
+ 3, 79, :_reduce_85,
716
+ 1, 79, :_reduce_none,
717
+ 1, 79, :_reduce_none,
718
+ 1, 79, :_reduce_88,
719
+ 1, 79, :_reduce_89,
720
+ 2, 79, :_reduce_90,
721
+ 3, 89, :_reduce_91,
722
+ 0, 90, :_reduce_92,
723
+ 1, 90, :_reduce_none,
724
+ 1, 73, :_reduce_94,
725
+ 3, 73, :_reduce_95,
726
+ 1, 87, :_reduce_none,
727
+ 1, 87, :_reduce_97,
728
+ 3, 87, :_reduce_98,
729
+ 1, 87, :_reduce_none ]
730
+
731
+ racc_reduce_n = 100
732
+
733
+ racc_shift_n = 176
734
+
735
+ racc_token_table = {
736
+ false => 0,
737
+ :error => 1,
738
+ :SEMI => 2,
739
+ :WITH => 3,
740
+ :COMMA => 4,
741
+ :COLON_EQUAL => 5,
742
+ :LET => 6,
743
+ :DOLLAR_QNAME => 7,
744
+ :IF => 8,
745
+ :LP => 9,
746
+ :RP => 10,
747
+ :THEN => 11,
748
+ :ELSE => 12,
749
+ :FOR => 13,
750
+ :RETURN => 14,
751
+ :IN => 15,
752
+ :SOME => 16,
753
+ :SATISFIES => 17,
754
+ :EVERY => 18,
755
+ :OR => 19,
756
+ :AND => 20,
757
+ :EXCEPT => 21,
758
+ :EQ => 22,
759
+ :NEQ => 23,
760
+ :LB => 24,
761
+ :RB => 25,
762
+ :LT => 26,
763
+ :GT => 27,
764
+ :LTE => 28,
765
+ :GTE => 29,
766
+ :DOT_DOT => 30,
767
+ :TO => 31,
768
+ :PLUS => 32,
769
+ :MINUS => 33,
770
+ :STAR => 34,
771
+ :DIV => 35,
772
+ :MOD => 36,
773
+ :PIPE => 37,
774
+ :SLASH => 38,
775
+ :SLASH_SLASH => 39,
776
+ :DOT => 40,
777
+ :AT => 41,
778
+ :AXIS_NAME => 42,
779
+ :COLON_COLON => 43,
780
+ :LITERAL => 44,
781
+ :NUMBER => 45,
782
+ :FUNCTION_NAME => 46,
783
+ :QNAME => 47,
784
+ :LC => 48,
785
+ :RC => 49 }
786
+
787
+ racc_nt_base = 50
788
+
789
+ racc_use_result_var = true
790
+
791
+ Racc_arg = [
792
+ racc_action_table,
793
+ racc_action_check,
794
+ racc_action_default,
795
+ racc_action_pointer,
796
+ racc_goto_table,
797
+ racc_goto_check,
798
+ racc_goto_default,
799
+ racc_goto_pointer,
800
+ racc_nt_base,
801
+ racc_reduce_table,
802
+ racc_token_table,
803
+ racc_shift_n,
804
+ racc_reduce_n,
805
+ racc_use_result_var ]
806
+
807
+ Racc_token_to_s_table = [
808
+ "$end",
809
+ "error",
810
+ "SEMI",
811
+ "WITH",
812
+ "COMMA",
813
+ "COLON_EQUAL",
814
+ "LET",
815
+ "DOLLAR_QNAME",
816
+ "IF",
817
+ "LP",
818
+ "RP",
819
+ "THEN",
820
+ "ELSE",
821
+ "FOR",
822
+ "RETURN",
823
+ "IN",
824
+ "SOME",
825
+ "SATISFIES",
826
+ "EVERY",
827
+ "OR",
828
+ "AND",
829
+ "EXCEPT",
830
+ "EQ",
831
+ "NEQ",
832
+ "LB",
833
+ "RB",
834
+ "LT",
835
+ "GT",
836
+ "LTE",
837
+ "GTE",
838
+ "DOT_DOT",
839
+ "TO",
840
+ "PLUS",
841
+ "MINUS",
842
+ "STAR",
843
+ "DIV",
844
+ "MOD",
845
+ "PIPE",
846
+ "SLASH",
847
+ "SLASH_SLASH",
848
+ "DOT",
849
+ "AT",
850
+ "AXIS_NAME",
851
+ "COLON_COLON",
852
+ "LITERAL",
853
+ "NUMBER",
854
+ "FUNCTION_NAME",
855
+ "QNAME",
856
+ "LC",
857
+ "RC",
858
+ "$start",
859
+ "statements",
860
+ "statement",
861
+ "expr",
862
+ "let_expr",
863
+ "or_expr",
864
+ "range_expr",
865
+ "if_expr",
866
+ "for_expr",
867
+ "quant_expr",
868
+ "with_expr",
869
+ "expr_set_list",
870
+ "expr_set",
871
+ "path_expr",
872
+ "num_expr",
873
+ "additive_expr",
874
+ "num_list",
875
+ "for_vars",
876
+ "for_var",
877
+ "and_expr",
878
+ "equality_expr",
879
+ "relational_expr",
880
+ "tuple",
881
+ "args",
882
+ "multiplicative_expr",
883
+ "unary_expr",
884
+ "union_expr",
885
+ "union_expr_x",
886
+ "location_path",
887
+ "primary_expr",
888
+ "predicates",
889
+ "segment",
890
+ "relative_location_path",
891
+ "absolute_location_path",
892
+ "axis_name",
893
+ "step",
894
+ "axis",
895
+ "node_test",
896
+ "predicate",
897
+ "list",
898
+ "opt_args" ]
899
+
900
+ Racc_debug_parser = false
901
+
902
+ ##### State transition tables end #####
903
+
904
+ # reduce 0 omitted
905
+
906
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 10)
907
+ def _reduce_1(val, _values, result)
908
+ result = Fabulator::Expr::StatementList.new; result.add_statement(val[0])
909
+ result
910
+ end
911
+ .,.,
912
+
913
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 11)
914
+ def _reduce_2(val, _values, result)
915
+ result = val[0]; result.add_statement(val[2])
916
+ result
917
+ end
918
+ .,.,
919
+
920
+ # reduce 3 omitted
921
+
922
+ # reduce 4 omitted
923
+
924
+ # reduce 5 omitted
925
+
926
+ # reduce 6 omitted
927
+
928
+ # reduce 7 omitted
929
+
930
+ # reduce 8 omitted
931
+
932
+ # reduce 9 omitted
933
+
934
+ # reduce 10 omitted
935
+
936
+ # reduce 11 omitted
937
+
938
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 24)
939
+ def _reduce_12(val, _values, result)
940
+ result = Fabulator::Expr::WithExpr.new(val[0], val[2])
941
+ result
942
+ end
943
+ .,.,
944
+
945
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 26)
946
+ def _reduce_13(val, _values, result)
947
+ result = Fabulator::Expr::StatementList.new; result.add_statement(val[0])
948
+ result
949
+ end
950
+ .,.,
951
+
952
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 27)
953
+ def _reduce_14(val, _values, result)
954
+ result = val[0]; result.add_statement(val[2])
955
+ result
956
+ end
957
+ .,.,
958
+
959
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 29)
960
+ def _reduce_15(val, _values, result)
961
+ result = Fabulator::Expr::DataSet.new(val[0], val[2])
962
+ result
963
+ end
964
+ .,.,
965
+
966
+ # reduce 16 omitted
967
+
968
+ # reduce 17 omitted
969
+
970
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 36)
971
+ def _reduce_18(val, _values, result)
972
+ result = [ val[0] ]
973
+ result
974
+ end
975
+ .,.,
976
+
977
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 37)
978
+ def _reduce_19(val, _values, result)
979
+ result = val[0] + [ val[2] ]
980
+ result
981
+ end
982
+ .,.,
983
+
984
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 39)
985
+ def _reduce_20(val, _values, result)
986
+ result = Fabulator::Expr::LetExpr.new(val[1], val[3])
987
+ result
988
+ end
989
+ .,.,
990
+
991
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 41)
992
+ def _reduce_21(val, _values, result)
993
+ result = Fabulator::Expr::IfExpr.new(val[2], val[5], val[7])
994
+ result
995
+ end
996
+ .,.,
997
+
998
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 42)
999
+ def _reduce_22(val, _values, result)
1000
+ result = Fabulator::Expr::IfExpr.new(val[2], val[5], nil)
1001
+ result
1002
+ end
1003
+ .,.,
1004
+
1005
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 44)
1006
+ def _reduce_23(val, _values, result)
1007
+ result = Fabulator::Expr::ForExpr.new(val[1], val[3])
1008
+ result
1009
+ end
1010
+ .,.,
1011
+
1012
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 46)
1013
+ def _reduce_24(val, _values, result)
1014
+ result = [ val[0] ]
1015
+ result
1016
+ end
1017
+ .,.,
1018
+
1019
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 47)
1020
+ def _reduce_25(val, _values, result)
1021
+ result = val[0] + [ val[2] ]
1022
+ result
1023
+ end
1024
+ .,.,
1025
+
1026
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 49)
1027
+ def _reduce_26(val, _values, result)
1028
+ result = Fabulator::Expr::ForVar.new(val[0], val[2])
1029
+ result
1030
+ end
1031
+ .,.,
1032
+
1033
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 51)
1034
+ def _reduce_27(val, _values, result)
1035
+ result = Fabulator::Expr::SomeExpr.new(val[1], val[3])
1036
+ result
1037
+ end
1038
+ .,.,
1039
+
1040
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 52)
1041
+ def _reduce_28(val, _values, result)
1042
+ result = Fabulator::Expr::EveryExpr.new(val[1], val[3])
1043
+ result
1044
+ end
1045
+ .,.,
1046
+
1047
+ # reduce 29 omitted
1048
+
1049
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 55)
1050
+ def _reduce_30(val, _values, result)
1051
+ result = Fabulator::Expr::OrExpr.new(val[0], val[2])
1052
+ result
1053
+ end
1054
+ .,.,
1055
+
1056
+ # reduce 31 omitted
1057
+
1058
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 58)
1059
+ def _reduce_32(val, _values, result)
1060
+ result = Fabulator::Expr::AndExpr.new(val[0], val[2])
1061
+ result
1062
+ end
1063
+ .,.,
1064
+
1065
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 59)
1066
+ def _reduce_33(val, _values, result)
1067
+ result = Fabulator::Expr::ExceptExpr.new(val[0], val[2])
1068
+ result
1069
+ end
1070
+ .,.,
1071
+
1072
+ # reduce 34 omitted
1073
+
1074
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 62)
1075
+ def _reduce_35(val, _values, result)
1076
+ result = Fabulator::Expr::EqExpr.new(val[0], val[2])
1077
+ result
1078
+ end
1079
+ .,.,
1080
+
1081
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 63)
1082
+ def _reduce_36(val, _values, result)
1083
+ result = Fabulator::Expr::NeqExpr.new(val[0], val[2])
1084
+ result
1085
+ end
1086
+ .,.,
1087
+
1088
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 65)
1089
+ def _reduce_37(val, _values, result)
1090
+ result = Fabulator::Expr::Tuple.new(val[2])
1091
+ result
1092
+ end
1093
+ .,.,
1094
+
1095
+ # reduce 38 omitted
1096
+
1097
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 70)
1098
+ def _reduce_39(val, _values, result)
1099
+ result = Fabulator::Expr::LtExpr.new(val[0], val[2])
1100
+ result
1101
+ end
1102
+ .,.,
1103
+
1104
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 71)
1105
+ def _reduce_40(val, _values, result)
1106
+ result = Fabulator::Expr::LtExpr.new(val[2], val[0])
1107
+ result
1108
+ end
1109
+ .,.,
1110
+
1111
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 72)
1112
+ def _reduce_41(val, _values, result)
1113
+ result = Fabulator::Expr::LteExpr.new(val[0], val[2])
1114
+ result
1115
+ end
1116
+ .,.,
1117
+
1118
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 73)
1119
+ def _reduce_42(val, _values, result)
1120
+ result = Fabulator::Expr::LteExpr.new(val[2], val[0])
1121
+ result
1122
+ end
1123
+ .,.,
1124
+
1125
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 84)
1126
+ def _reduce_43(val, _values, result)
1127
+ result = Fabulator::Expr::RangeExpr.new(val[0], val[2])
1128
+ result
1129
+ end
1130
+ .,.,
1131
+
1132
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 85)
1133
+ def _reduce_44(val, _values, result)
1134
+ result = Fabulator::Expr::RangeExpr.new(val[0], val[2])
1135
+ result
1136
+ end
1137
+ .,.,
1138
+
1139
+ # reduce 45 omitted
1140
+
1141
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 88)
1142
+ def _reduce_46(val, _values, result)
1143
+ result = Fabulator::Expr::AddExpr.new(val[0], val[2])
1144
+ result
1145
+ end
1146
+ .,.,
1147
+
1148
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 89)
1149
+ def _reduce_47(val, _values, result)
1150
+ result = Fabulator::Expr::SubExpr.new(val[0], val[2])
1151
+ result
1152
+ end
1153
+ .,.,
1154
+
1155
+ # reduce 48 omitted
1156
+
1157
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 92)
1158
+ def _reduce_49(val, _values, result)
1159
+ result = Fabulator::Expr::MpyExpr.new(val[0], val[2])
1160
+ result
1161
+ end
1162
+ .,.,
1163
+
1164
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 93)
1165
+ def _reduce_50(val, _values, result)
1166
+ result = Fabulator::Expr::DivExpr.new(val[0], val[2])
1167
+ result
1168
+ end
1169
+ .,.,
1170
+
1171
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 94)
1172
+ def _reduce_51(val, _values, result)
1173
+ result = Fabulator::Expr::ModExpr.new(val[0], val[2])
1174
+ result
1175
+ end
1176
+ .,.,
1177
+
1178
+ # reduce 52 omitted
1179
+
1180
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 97)
1181
+ def _reduce_53(val, _values, result)
1182
+ result = Fabulator::Expr::NegExpr.new(val[1])
1183
+ result
1184
+ end
1185
+ .,.,
1186
+
1187
+ # reduce 54 omitted
1188
+
1189
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 100)
1190
+ def _reduce_55(val, _values, result)
1191
+ result = Fabulator::Expr::UnionExpr.new(val[0])
1192
+ result
1193
+ end
1194
+ .,.,
1195
+
1196
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 102)
1197
+ def _reduce_56(val, _values, result)
1198
+ result = [ val[0], val[2] ]
1199
+ result
1200
+ end
1201
+ .,.,
1202
+
1203
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 103)
1204
+ def _reduce_57(val, _values, result)
1205
+ result = val[0] + [ val[2] ]
1206
+ result
1207
+ end
1208
+ .,.,
1209
+
1210
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 105)
1211
+ def _reduce_58(val, _values, result)
1212
+ result = Fabulator::Expr::PathExpr.new(nil, [], val[0])
1213
+ result
1214
+ end
1215
+ .,.,
1216
+
1217
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 106)
1218
+ def _reduce_59(val, _values, result)
1219
+ result = Fabulator::Expr::PathExpr.new(val[0], val[1], val[2])
1220
+ result
1221
+ end
1222
+ .,.,
1223
+
1224
+ # reduce 60 omitted
1225
+
1226
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 109)
1227
+ def _reduce_61(val, _values, result)
1228
+ result = val[1]
1229
+ result
1230
+ end
1231
+ .,.,
1232
+
1233
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 110)
1234
+ def _reduce_62(val, _values, result)
1235
+ result = [ Fabulator::Expr::AxisDescendentOrSelf.new ] + val[1]
1236
+ result
1237
+ end
1238
+ .,.,
1239
+
1240
+ # reduce 63 omitted
1241
+
1242
+ # reduce 64 omitted
1243
+
1244
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 118)
1245
+ def _reduce_65(val, _values, result)
1246
+ result = Fabulator::Expr::RootContext.new
1247
+ result
1248
+ end
1249
+ .,.,
1250
+
1251
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 119)
1252
+ def _reduce_66(val, _values, result)
1253
+ result = Fabulator::Expr::PathExpr.new(Fabulator::Expr::RootContext.new, [], val[1])
1254
+ result
1255
+ end
1256
+ .,.,
1257
+
1258
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 120)
1259
+ def _reduce_67(val, _values, result)
1260
+ result = [ Fabulator::Expr::RootContext.new, Fabulator::Expr::AxisDescendentOrSelf.new(val[1][0]) ] + val[1][1..val[1].size-1]
1261
+ result
1262
+ end
1263
+ .,.,
1264
+
1265
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 121)
1266
+ def _reduce_68(val, _values, result)
1267
+ result = [ Fabulator::Expr::RootContext.new(val[0]) ] + val[2]
1268
+ result
1269
+ end
1270
+ .,.,
1271
+
1272
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 122)
1273
+ def _reduce_69(val, _values, result)
1274
+ result = [ Fabulator::Expr::RootContext.new(val[0]), Fabulator::Expr::AxisDescendentOrSelf.new(val[2][0]) ] + val[2][1..val[2].size-1]
1275
+ result
1276
+ end
1277
+ .,.,
1278
+
1279
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 124)
1280
+ def _reduce_70(val, _values, result)
1281
+ result = [ val[0] ]
1282
+ result
1283
+ end
1284
+ .,.,
1285
+
1286
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 125)
1287
+ def _reduce_71(val, _values, result)
1288
+ result = val[0] + [ val[2] ]
1289
+ result
1290
+ end
1291
+ .,.,
1292
+
1293
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 126)
1294
+ def _reduce_72(val, _values, result)
1295
+ result = val[0] + [ Fabulator::Expr::AxisDescendentOrSelf.new(val[2]) ]
1296
+ result
1297
+ end
1298
+ .,.,
1299
+
1300
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 128)
1301
+ def _reduce_73(val, _values, result)
1302
+ result = val[1].nil? || val[1].empty? ? val[0] : Fabulator::Expr::Predicates.new(val[0], val[1])
1303
+ result
1304
+ end
1305
+ .,.,
1306
+
1307
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 129)
1308
+ def _reduce_74(val, _values, result)
1309
+ result = Fabulator::Expr::CurrentContext.new
1310
+ result
1311
+ end
1312
+ .,.,
1313
+
1314
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 130)
1315
+ def _reduce_75(val, _values, result)
1316
+ result = Fabulator::Expr::AxisParent.new
1317
+ result
1318
+ end
1319
+ .,.,
1320
+
1321
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 136)
1322
+ def _reduce_76(val, _values, result)
1323
+ result = Fabulator::Expr::AxisChild.new(val[0])
1324
+ result
1325
+ end
1326
+ .,.,
1327
+
1328
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 137)
1329
+ def _reduce_77(val, _values, result)
1330
+ result = Fabulator::Expr::Axis.new(val[0], val[1])
1331
+ result
1332
+ end
1333
+ .,.,
1334
+
1335
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 138)
1336
+ def _reduce_78(val, _values, result)
1337
+ result = Fabulator::Expr::AxisAttribute.new(val[1])
1338
+ result
1339
+ end
1340
+ .,.,
1341
+
1342
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 140)
1343
+ def _reduce_79(val, _values, result)
1344
+ result = Fabulator::Expr::Axis.new(val[0])
1345
+ result
1346
+ end
1347
+ .,.,
1348
+
1349
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 142)
1350
+ def _reduce_80(val, _values, result)
1351
+ result = [ ]
1352
+ result
1353
+ end
1354
+ .,.,
1355
+
1356
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 143)
1357
+ def _reduce_81(val, _values, result)
1358
+ result = val[0] + [ val[1] ]
1359
+ result
1360
+ end
1361
+ .,.,
1362
+
1363
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 145)
1364
+ def _reduce_82(val, _values, result)
1365
+ result = val[1]
1366
+ result
1367
+ end
1368
+ .,.,
1369
+
1370
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 146)
1371
+ def _reduce_83(val, _values, result)
1372
+ result = Fabulator::Expr::IndexPredicate.new(val[1])
1373
+ result
1374
+ end
1375
+ .,.,
1376
+
1377
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 150)
1378
+ def _reduce_84(val, _values, result)
1379
+ result = Fabulator::Expr::Var.new(val[0])
1380
+ result
1381
+ end
1382
+ .,.,
1383
+
1384
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 151)
1385
+ def _reduce_85(val, _values, result)
1386
+ result = val[1]
1387
+ result
1388
+ end
1389
+ .,.,
1390
+
1391
+ # reduce 86 omitted
1392
+
1393
+ # reduce 87 omitted
1394
+
1395
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 154)
1396
+ def _reduce_88(val, _values, result)
1397
+ result = Fabulator::Expr::Literal.new(val[0], [ Fabulator::FAB_NS, 'string' ])
1398
+ result
1399
+ end
1400
+ .,.,
1401
+
1402
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 155)
1403
+ def _reduce_89(val, _values, result)
1404
+ result = Fabulator::Expr::Literal.new(val[0] =~ /\./ ? val[0].to_d.to_r : val[0].to_i.to_r, [ Fabulator::FAB_NS, 'numeric' ])
1405
+ result
1406
+ end
1407
+ .,.,
1408
+
1409
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 156)
1410
+ def _reduce_90(val, _values, result)
1411
+ result = Fabulator::Expr::Function.new(@context, val[0], val[1])
1412
+ result
1413
+ end
1414
+ .,.,
1415
+
1416
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 158)
1417
+ def _reduce_91(val, _values, result)
1418
+ result = Fabulator::Expr::List.new(val[1])
1419
+ result
1420
+ end
1421
+ .,.,
1422
+
1423
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 161)
1424
+ def _reduce_92(val, _values, result)
1425
+ result = [ ]
1426
+ result
1427
+ end
1428
+ .,.,
1429
+
1430
+ # reduce 93 omitted
1431
+
1432
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 164)
1433
+ def _reduce_94(val, _values, result)
1434
+ result = [ val[0] ]
1435
+ result
1436
+ end
1437
+ .,.,
1438
+
1439
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 165)
1440
+ def _reduce_95(val, _values, result)
1441
+ result = val[0] + [ val[2] ]
1442
+ result
1443
+ end
1444
+ .,.,
1445
+
1446
+ # reduce 96 omitted
1447
+
1448
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 168)
1449
+ def _reduce_97(val, _values, result)
1450
+ result = val[0].to_s
1451
+ result
1452
+ end
1453
+ .,.,
1454
+
1455
+ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 169)
1456
+ def _reduce_98(val, _values, result)
1457
+ result = val[1]
1458
+ result
1459
+ end
1460
+ .,.,
1461
+
1462
+ # reduce 99 omitted
1463
+
1464
+ def _reduce_none(val, _values, result)
1465
+ val[0]
1466
+ end
1467
+
1468
+ end # class Parser
1469
+ end # module Expr
1470
+ end # module Fabulator