fabulator 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +8 -0
- data/TODO +7 -0
- data/VERSION +1 -1
- data/lib/fabulator/action.rb +9 -1
- data/lib/fabulator/core/actions.rb +7 -3
- data/lib/fabulator/core/constraint.rb +16 -1
- data/lib/fabulator/expr/context.rb +35 -6
- data/lib/fabulator/expr/node.rb +11 -1
- data/lib/fabulator/expr/parser.rb +103 -78
- data/lib/fabulator/lib.rb +5 -4
- data/lib/fabulator/lib/action.rb +45 -0
- data/lib/fabulator/lib/attribute.rb +11 -0
- data/lib/fabulator/lib/function.rb +36 -0
- data/lib/fabulator/lib/lib.rb +78 -5
- data/lib/fabulator/structural.rb +39 -11
- data/lib/fabulator/tag_lib.rb +2 -6
- data/xsm_expression_parser.racc +33 -6
- metadata +7 -4
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 0.0.8
|
2
|
+
|
3
|
+
* 1 major enhancement:
|
4
|
+
* Extensions can now define structural elements to be contained within
|
5
|
+
other structural elements outside the extension. See the grammar
|
6
|
+
extension for an example of it allowing the grammar element within
|
7
|
+
the library top-level element.
|
8
|
+
|
1
9
|
=== 0.0.7 2010-09-07
|
2
10
|
|
3
11
|
* 5 major enhancement:
|
data/TODO
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/lib/fabulator/action.rb
CHANGED
@@ -46,6 +46,10 @@ module Fabulator
|
|
46
46
|
!@@has_actions.nil? && @@has_actions.has_key?(self.name)
|
47
47
|
end
|
48
48
|
|
49
|
+
def has_actions?
|
50
|
+
self.class.has_actions? && !@actions.empty?
|
51
|
+
end
|
52
|
+
|
49
53
|
def run_actions(ctx)
|
50
54
|
self.has_actions? ? @actions.run(ctx) : [ ]
|
51
55
|
end
|
@@ -56,7 +60,11 @@ module Fabulator
|
|
56
60
|
end
|
57
61
|
|
58
62
|
def select(ctx)
|
59
|
-
self.class.has_select? && !@select.nil? ? @select.run(ctx) : [ ]
|
63
|
+
self.class.has_select? && !@select.nil? ? @select.run(ctx,false) : [ ]
|
64
|
+
end
|
65
|
+
|
66
|
+
def has_select?
|
67
|
+
self.class.has_select? && !@select.nil?
|
60
68
|
end
|
61
69
|
|
62
70
|
def self.has_select?
|
@@ -403,9 +403,13 @@ module Fabulator
|
|
403
403
|
|
404
404
|
mapping 'eval' do |ctx, arg|
|
405
405
|
p = Fabulator::Expr::Parser.new
|
406
|
-
|
407
|
-
|
408
|
-
|
406
|
+
if arg.vtype.join('') == FAB_NS+'expression'
|
407
|
+
return arg.value.run(ctx)
|
408
|
+
else
|
409
|
+
e = arg.to_s
|
410
|
+
pe = e.nil? ? nil : p.parse(e,ctx)
|
411
|
+
return pe.nil? ? [] : pe.run(ctx)
|
412
|
+
end
|
409
413
|
end
|
410
414
|
|
411
415
|
###
|
@@ -105,7 +105,22 @@ module Fabulator
|
|
105
105
|
end
|
106
106
|
return sense.call(r)
|
107
107
|
else
|
108
|
-
|
108
|
+
# convert @c_type to ns:name
|
109
|
+
bits = @c_type.split(/:/, 2)
|
110
|
+
ns = nil
|
111
|
+
name = nil
|
112
|
+
if bits.size == 2
|
113
|
+
ns = @context.get_ns(bits[0])
|
114
|
+
name = bits[1]
|
115
|
+
else
|
116
|
+
ns = FAB_NS
|
117
|
+
name = bits[0]
|
118
|
+
end
|
119
|
+
if ctx.run_constraint(ns, name)
|
120
|
+
return sense.call(r)
|
121
|
+
else
|
122
|
+
return not_sense.call(r)
|
123
|
+
end
|
109
124
|
end
|
110
125
|
end
|
111
126
|
end
|
@@ -2,8 +2,8 @@ module Fabulator
|
|
2
2
|
module Expr
|
3
3
|
class Context
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@parent =
|
5
|
+
def initialize(parent_context = nil, xml = nil)
|
6
|
+
@parent = parent_context
|
7
7
|
@run_time_parent = nil
|
8
8
|
@ns = { }
|
9
9
|
@attributes = { }
|
@@ -12,7 +12,7 @@ module Fabulator
|
|
12
12
|
@last = nil
|
13
13
|
@line_num = nil
|
14
14
|
|
15
|
-
if
|
15
|
+
if parent_context.nil?
|
16
16
|
if xml.nil? || (xml.root rescue nil).nil?
|
17
17
|
roots = { }
|
18
18
|
roots['data'] = Fabulator::Expr::Node.new('data', roots, nil, [])
|
@@ -113,6 +113,18 @@ module Fabulator
|
|
113
113
|
elsif value.size == 1
|
114
114
|
value = value.first
|
115
115
|
end
|
116
|
+
case opts[:type]
|
117
|
+
when :boolean:
|
118
|
+
if value =~ /^[YyTt1]/ || value =~ /^on/i
|
119
|
+
value = true
|
120
|
+
else
|
121
|
+
value = false
|
122
|
+
end
|
123
|
+
when :numeric:
|
124
|
+
value = value.to_f
|
125
|
+
when :integer:
|
126
|
+
value = value.to_i
|
127
|
+
end
|
116
128
|
end
|
117
129
|
end
|
118
130
|
|
@@ -250,7 +262,7 @@ module Fabulator
|
|
250
262
|
tgts = pp.is_a?(Fabulator::Expr::Node) ? [ pp ] : pp.run(self, true)
|
251
263
|
src = nil
|
252
264
|
if !v.nil?
|
253
|
-
src = v.is_a?(Fabulator::Expr::Node) ? [ v ] : v.run(self)
|
265
|
+
src = v.is_a?(Fabulator::Expr::Node) ? [ v ] : ( v.is_a?(Array) ? v : v.run(self) )
|
254
266
|
end
|
255
267
|
|
256
268
|
tgts.each do |tgt|
|
@@ -390,16 +402,22 @@ module Fabulator
|
|
390
402
|
Fabulator::TagLib.namespaces[ns].compile_structural(e, self)
|
391
403
|
end
|
392
404
|
|
405
|
+
# Runs the block with a new context based on this context. This
|
406
|
+
# provides a new scope for variables and current nodes.
|
393
407
|
def in_context(&block)
|
394
408
|
ctx = self.merge
|
395
409
|
yield ctx
|
396
410
|
end
|
397
411
|
|
398
|
-
|
399
|
-
|
412
|
+
# Runs the block with a new context resulting from merging this
|
413
|
+
# context with the given context.
|
414
|
+
def with(context, &block)
|
415
|
+
ctx = self.merge(context)
|
400
416
|
yield ctx
|
401
417
|
end
|
402
418
|
|
419
|
+
# Iterates through the list of items running the given block with
|
420
|
+
# a new context with the current node set to the item.
|
403
421
|
def with_roots(items, &block)
|
404
422
|
idx = 1
|
405
423
|
items.each do |i|
|
@@ -411,12 +429,23 @@ module Fabulator
|
|
411
429
|
end
|
412
430
|
end
|
413
431
|
|
432
|
+
# Runs the request filter against the current node. The value
|
433
|
+
# of the current node is replaced with the result of the filter.
|
414
434
|
def run_filter(ns, name)
|
415
435
|
handler = Fabulator::TagLib.namespaces[ns]
|
416
436
|
return [] if handler.nil?
|
417
437
|
handler.run_filter(self, name)
|
418
438
|
end
|
419
439
|
|
440
|
+
# Runs the requested constraint against the current node and returns
|
441
|
+
# a boolean. Returns false if no object can be found to handle the
|
442
|
+
# specified namespace.
|
443
|
+
def run_constraint(namespace, name)
|
444
|
+
handler = Fabulator::TagLib.namespaces[namespace]
|
445
|
+
return false if handler.nil?
|
446
|
+
handler.run_constraint(self, name)
|
447
|
+
end
|
448
|
+
|
420
449
|
end
|
421
450
|
end
|
422
451
|
end
|
data/lib/fabulator/expr/node.rb
CHANGED
@@ -3,7 +3,7 @@ module Fabulator
|
|
3
3
|
class Node
|
4
4
|
include Fabulator::Expr::NodeLogic
|
5
5
|
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :value, :name, :roots, :vtype, :attributes, :is_attribute
|
7
7
|
|
8
8
|
def initialize(a,r,v,c,p = nil) #,f={})
|
9
9
|
@roots = r
|
@@ -31,6 +31,15 @@ module Fabulator
|
|
31
31
|
@is_attribute
|
32
32
|
end
|
33
33
|
|
34
|
+
def axis
|
35
|
+
@axis
|
36
|
+
end
|
37
|
+
|
38
|
+
def axis=(a)
|
39
|
+
@axis = a
|
40
|
+
self.children.each { |c| c.axis=a }
|
41
|
+
end
|
42
|
+
|
34
43
|
def set_attribute(k, v)
|
35
44
|
if v.is_a?(Fabulator::Expr::Node)
|
36
45
|
v = v.clone
|
@@ -158,6 +167,7 @@ module Fabulator
|
|
158
167
|
end
|
159
168
|
context.root.root(@axis)
|
160
169
|
end
|
170
|
+
|
161
171
|
end
|
162
172
|
end
|
163
173
|
end
|
@@ -9,16 +9,39 @@ module Fabulator
|
|
9
9
|
module Expr
|
10
10
|
class Parser < Racc::Parser
|
11
11
|
|
12
|
-
module_eval(<<'...end xsm_expression_parser.racc/module_eval...', 'xsm_expression_parser.racc',
|
12
|
+
module_eval(<<'...end xsm_expression_parser.racc/module_eval...', 'xsm_expression_parser.racc', 189)
|
13
|
+
# == Fabulator Expression Parser
|
14
|
+
#
|
15
|
+
# <tt>Fabulator::Expr::Parser</tt> provides a parser for Fabulator
|
16
|
+
# expressions operating on a DOM-like data model provided by
|
17
|
+
# Fabulator::Expr::Context and Fabulator::Expr::Node.
|
18
|
+
#
|
19
|
+
# The expression language is based on XQuery and XPath.
|
20
|
+
#
|
21
|
+
|
13
22
|
require 'fabulator/expr'
|
14
23
|
require 'rational'
|
15
24
|
require 'bigdecimal'
|
16
25
|
require 'bigdecimal/util'
|
17
26
|
|
18
|
-
|
19
|
-
|
27
|
+
# Within the context of a Fabulator::Expr::Context object, this will
|
28
|
+
# parse the given string and return an object that can be run to return
|
29
|
+
# an array if Fabulator::Expr::Node objects.
|
30
|
+
#
|
31
|
+
# Example:
|
32
|
+
#
|
33
|
+
# parser = Fabulator::Expr::Parser.new
|
34
|
+
# context = Fabulator::Expr::Context.new
|
35
|
+
# expr = parser.parse('//foo', context)
|
36
|
+
# foos = expr.run(context)
|
37
|
+
#
|
38
|
+
# Results in 'foos' being an array of all of the nodes in the
|
39
|
+
# context that are named 'foo' regardless of their depth in the
|
40
|
+
# node tree.
|
41
|
+
def parse(text, context)
|
42
|
+
@source = text
|
20
43
|
@curpos = 0
|
21
|
-
@context =
|
44
|
+
@context = context
|
22
45
|
@line = 0
|
23
46
|
@col = 0
|
24
47
|
|
@@ -29,6 +52,8 @@ module_eval(<<'...end xsm_expression_parser.racc/module_eval...', 'xsm_expressio
|
|
29
52
|
do_parse
|
30
53
|
end
|
31
54
|
|
55
|
+
# Used internally by the parser to raise a Fabulator::Expr::ParserError
|
56
|
+
# when the parse fails.
|
32
57
|
def on_error(*args)
|
33
58
|
raise Fabulator::Expr::ParserError.new("unable to parse '#{args[1]}' near line #{@line + 1}, column #{@col}")
|
34
59
|
end
|
@@ -222,8 +247,8 @@ module_eval(<<'...end xsm_expression_parser.racc/module_eval...', 'xsm_expressio
|
|
222
247
|
if res[1] == 'if'
|
223
248
|
@token = [ :IF, 'if' ]
|
224
249
|
else
|
225
|
-
if @source[@curpos+res[1].length .. @curpos+res[1].length]
|
226
|
-
@token = [ :FUNCTION_NAME, res[1]
|
250
|
+
if @source[@curpos+res[1].length .. @curpos+res[1].length + 1] =~ /^(\??\*?)/
|
251
|
+
@token = [ :FUNCTION_NAME, res[1]+$1 ]
|
227
252
|
else
|
228
253
|
@token = [ :FUNCTION_NAME, res[1] ]
|
229
254
|
end
|
@@ -908,14 +933,14 @@ Racc_debug_parser = false
|
|
908
933
|
|
909
934
|
# reduce 0 omitted
|
910
935
|
|
911
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
936
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 12)
|
912
937
|
def _reduce_1(val, _values, result)
|
913
938
|
result = Fabulator::Expr::StatementList.new; result.add_statement(val[0])
|
914
939
|
result
|
915
940
|
end
|
916
941
|
.,.,
|
917
942
|
|
918
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
943
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 13)
|
919
944
|
def _reduce_2(val, _values, result)
|
920
945
|
result = val[0]; result.add_statement(val[2])
|
921
946
|
result
|
@@ -940,28 +965,28 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 11)
|
|
940
965
|
|
941
966
|
# reduce 11 omitted
|
942
967
|
|
943
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
968
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 26)
|
944
969
|
def _reduce_12(val, _values, result)
|
945
970
|
result = Fabulator::Expr::WithExpr.new(val[0], val[2])
|
946
971
|
result
|
947
972
|
end
|
948
973
|
.,.,
|
949
974
|
|
950
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
975
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 28)
|
951
976
|
def _reduce_13(val, _values, result)
|
952
977
|
result = Fabulator::Expr::StatementList.new; result.add_statement(val[0])
|
953
978
|
result
|
954
979
|
end
|
955
980
|
.,.,
|
956
981
|
|
957
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
982
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 29)
|
958
983
|
def _reduce_14(val, _values, result)
|
959
984
|
result = val[0]; result.add_statement(val[2])
|
960
985
|
result
|
961
986
|
end
|
962
987
|
.,.,
|
963
988
|
|
964
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
989
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 31)
|
965
990
|
def _reduce_15(val, _values, result)
|
966
991
|
result = Fabulator::Expr::DataSet.new(val[0], val[2])
|
967
992
|
result
|
@@ -972,77 +997,77 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 29)
|
|
972
997
|
|
973
998
|
# reduce 17 omitted
|
974
999
|
|
975
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1000
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 38)
|
976
1001
|
def _reduce_18(val, _values, result)
|
977
1002
|
result = [ val[0] ]
|
978
1003
|
result
|
979
1004
|
end
|
980
1005
|
.,.,
|
981
1006
|
|
982
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1007
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 39)
|
983
1008
|
def _reduce_19(val, _values, result)
|
984
1009
|
result = val[0] + [ val[2] ]
|
985
1010
|
result
|
986
1011
|
end
|
987
1012
|
.,.,
|
988
1013
|
|
989
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1014
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 41)
|
990
1015
|
def _reduce_20(val, _values, result)
|
991
1016
|
result = Fabulator::Expr::LetExpr.new(val[1], val[3])
|
992
1017
|
result
|
993
1018
|
end
|
994
1019
|
.,.,
|
995
1020
|
|
996
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1021
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 43)
|
997
1022
|
def _reduce_21(val, _values, result)
|
998
1023
|
result = Fabulator::Expr::IfExpr.new(val[2], val[5], val[7])
|
999
1024
|
result
|
1000
1025
|
end
|
1001
1026
|
.,.,
|
1002
1027
|
|
1003
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1028
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 44)
|
1004
1029
|
def _reduce_22(val, _values, result)
|
1005
1030
|
result = Fabulator::Expr::IfExpr.new(val[2], val[5], nil)
|
1006
1031
|
result
|
1007
1032
|
end
|
1008
1033
|
.,.,
|
1009
1034
|
|
1010
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1035
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 46)
|
1011
1036
|
def _reduce_23(val, _values, result)
|
1012
1037
|
result = Fabulator::Expr::ForExpr.new(val[1], val[3])
|
1013
1038
|
result
|
1014
1039
|
end
|
1015
1040
|
.,.,
|
1016
1041
|
|
1017
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1042
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 48)
|
1018
1043
|
def _reduce_24(val, _values, result)
|
1019
1044
|
result = [ val[0] ]
|
1020
1045
|
result
|
1021
1046
|
end
|
1022
1047
|
.,.,
|
1023
1048
|
|
1024
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1049
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 49)
|
1025
1050
|
def _reduce_25(val, _values, result)
|
1026
1051
|
result = val[0] + [ val[2] ]
|
1027
1052
|
result
|
1028
1053
|
end
|
1029
1054
|
.,.,
|
1030
1055
|
|
1031
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1056
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 51)
|
1032
1057
|
def _reduce_26(val, _values, result)
|
1033
1058
|
result = Fabulator::Expr::ForVar.new(val[0], val[2])
|
1034
1059
|
result
|
1035
1060
|
end
|
1036
1061
|
.,.,
|
1037
1062
|
|
1038
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1063
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 53)
|
1039
1064
|
def _reduce_27(val, _values, result)
|
1040
1065
|
result = Fabulator::Expr::SomeExpr.new(val[1], val[3])
|
1041
1066
|
result
|
1042
1067
|
end
|
1043
1068
|
.,.,
|
1044
1069
|
|
1045
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1070
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 54)
|
1046
1071
|
def _reduce_28(val, _values, result)
|
1047
1072
|
result = Fabulator::Expr::EveryExpr.new(val[1], val[3])
|
1048
1073
|
result
|
@@ -1051,7 +1076,7 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 52)
|
|
1051
1076
|
|
1052
1077
|
# reduce 29 omitted
|
1053
1078
|
|
1054
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1079
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 57)
|
1055
1080
|
def _reduce_30(val, _values, result)
|
1056
1081
|
result = Fabulator::Expr::OrExpr.new(val[0], val[2])
|
1057
1082
|
result
|
@@ -1060,14 +1085,14 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 55)
|
|
1060
1085
|
|
1061
1086
|
# reduce 31 omitted
|
1062
1087
|
|
1063
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1088
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 60)
|
1064
1089
|
def _reduce_32(val, _values, result)
|
1065
1090
|
result = Fabulator::Expr::AndExpr.new(val[0], val[2])
|
1066
1091
|
result
|
1067
1092
|
end
|
1068
1093
|
.,.,
|
1069
1094
|
|
1070
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1095
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 61)
|
1071
1096
|
def _reduce_33(val, _values, result)
|
1072
1097
|
result = Fabulator::Expr::ExceptExpr.new(val[0], val[2])
|
1073
1098
|
result
|
@@ -1076,21 +1101,21 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 59)
|
|
1076
1101
|
|
1077
1102
|
# reduce 34 omitted
|
1078
1103
|
|
1079
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1104
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 64)
|
1080
1105
|
def _reduce_35(val, _values, result)
|
1081
1106
|
result = Fabulator::Expr::EqExpr.new(val[0], val[2])
|
1082
1107
|
result
|
1083
1108
|
end
|
1084
1109
|
.,.,
|
1085
1110
|
|
1086
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1111
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 65)
|
1087
1112
|
def _reduce_36(val, _values, result)
|
1088
1113
|
result = Fabulator::Expr::NeqExpr.new(val[0], val[2])
|
1089
1114
|
result
|
1090
1115
|
end
|
1091
1116
|
.,.,
|
1092
1117
|
|
1093
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1118
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 67)
|
1094
1119
|
def _reduce_37(val, _values, result)
|
1095
1120
|
result = Fabulator::Expr::Tuple.new(val[2])
|
1096
1121
|
result
|
@@ -1099,42 +1124,42 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 65)
|
|
1099
1124
|
|
1100
1125
|
# reduce 38 omitted
|
1101
1126
|
|
1102
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1127
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 72)
|
1103
1128
|
def _reduce_39(val, _values, result)
|
1104
1129
|
result = Fabulator::Expr::LtExpr.new(val[0], val[2])
|
1105
1130
|
result
|
1106
1131
|
end
|
1107
1132
|
.,.,
|
1108
1133
|
|
1109
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1134
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 73)
|
1110
1135
|
def _reduce_40(val, _values, result)
|
1111
1136
|
result = Fabulator::Expr::LtExpr.new(val[2], val[0])
|
1112
1137
|
result
|
1113
1138
|
end
|
1114
1139
|
.,.,
|
1115
1140
|
|
1116
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1141
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 74)
|
1117
1142
|
def _reduce_41(val, _values, result)
|
1118
1143
|
result = Fabulator::Expr::LteExpr.new(val[0], val[2])
|
1119
1144
|
result
|
1120
1145
|
end
|
1121
1146
|
.,.,
|
1122
1147
|
|
1123
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1148
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 75)
|
1124
1149
|
def _reduce_42(val, _values, result)
|
1125
1150
|
result = Fabulator::Expr::LteExpr.new(val[2], val[0])
|
1126
1151
|
result
|
1127
1152
|
end
|
1128
1153
|
.,.,
|
1129
1154
|
|
1130
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1155
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 86)
|
1131
1156
|
def _reduce_43(val, _values, result)
|
1132
1157
|
result = Fabulator::Expr::RangeExpr.new(val[0], val[2])
|
1133
1158
|
result
|
1134
1159
|
end
|
1135
1160
|
.,.,
|
1136
1161
|
|
1137
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1162
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 87)
|
1138
1163
|
def _reduce_44(val, _values, result)
|
1139
1164
|
result = Fabulator::Expr::RangeExpr.new(val[0], val[2])
|
1140
1165
|
result
|
@@ -1143,14 +1168,14 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 85)
|
|
1143
1168
|
|
1144
1169
|
# reduce 45 omitted
|
1145
1170
|
|
1146
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1171
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 90)
|
1147
1172
|
def _reduce_46(val, _values, result)
|
1148
1173
|
result = Fabulator::Expr::AddExpr.new(val[0], val[2])
|
1149
1174
|
result
|
1150
1175
|
end
|
1151
1176
|
.,.,
|
1152
1177
|
|
1153
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1178
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 91)
|
1154
1179
|
def _reduce_47(val, _values, result)
|
1155
1180
|
result = Fabulator::Expr::SubExpr.new(val[0], val[2])
|
1156
1181
|
result
|
@@ -1159,21 +1184,21 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 89)
|
|
1159
1184
|
|
1160
1185
|
# reduce 48 omitted
|
1161
1186
|
|
1162
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1187
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 94)
|
1163
1188
|
def _reduce_49(val, _values, result)
|
1164
1189
|
result = Fabulator::Expr::MpyExpr.new(val[0], val[2])
|
1165
1190
|
result
|
1166
1191
|
end
|
1167
1192
|
.,.,
|
1168
1193
|
|
1169
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1194
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 95)
|
1170
1195
|
def _reduce_50(val, _values, result)
|
1171
1196
|
result = Fabulator::Expr::DivExpr.new(val[0], val[2])
|
1172
1197
|
result
|
1173
1198
|
end
|
1174
1199
|
.,.,
|
1175
1200
|
|
1176
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1201
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 96)
|
1177
1202
|
def _reduce_51(val, _values, result)
|
1178
1203
|
result = Fabulator::Expr::ModExpr.new(val[0], val[2])
|
1179
1204
|
result
|
@@ -1182,7 +1207,7 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 94)
|
|
1182
1207
|
|
1183
1208
|
# reduce 52 omitted
|
1184
1209
|
|
1185
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1210
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 99)
|
1186
1211
|
def _reduce_53(val, _values, result)
|
1187
1212
|
result = Fabulator::Expr::NegExpr.new(val[1])
|
1188
1213
|
result
|
@@ -1191,35 +1216,35 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 97)
|
|
1191
1216
|
|
1192
1217
|
# reduce 54 omitted
|
1193
1218
|
|
1194
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1219
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 102)
|
1195
1220
|
def _reduce_55(val, _values, result)
|
1196
1221
|
result = Fabulator::Expr::UnionExpr.new(val[0])
|
1197
1222
|
result
|
1198
1223
|
end
|
1199
1224
|
.,.,
|
1200
1225
|
|
1201
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1226
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 104)
|
1202
1227
|
def _reduce_56(val, _values, result)
|
1203
1228
|
result = [ val[0], val[2] ]
|
1204
1229
|
result
|
1205
1230
|
end
|
1206
1231
|
.,.,
|
1207
1232
|
|
1208
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1233
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 105)
|
1209
1234
|
def _reduce_57(val, _values, result)
|
1210
1235
|
result = val[0] + [ val[2] ]
|
1211
1236
|
result
|
1212
1237
|
end
|
1213
1238
|
.,.,
|
1214
1239
|
|
1215
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1240
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 107)
|
1216
1241
|
def _reduce_58(val, _values, result)
|
1217
1242
|
result = Fabulator::Expr::PathExpr.new(nil, [], val[0])
|
1218
1243
|
result
|
1219
1244
|
end
|
1220
1245
|
.,.,
|
1221
1246
|
|
1222
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1247
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 108)
|
1223
1248
|
def _reduce_59(val, _values, result)
|
1224
1249
|
result = Fabulator::Expr::PathExpr.new(val[0], val[1], val[2])
|
1225
1250
|
result
|
@@ -1228,14 +1253,14 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 106)
|
|
1228
1253
|
|
1229
1254
|
# reduce 60 omitted
|
1230
1255
|
|
1231
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1256
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 111)
|
1232
1257
|
def _reduce_61(val, _values, result)
|
1233
1258
|
result = val[1]
|
1234
1259
|
result
|
1235
1260
|
end
|
1236
1261
|
.,.,
|
1237
1262
|
|
1238
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1263
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 112)
|
1239
1264
|
def _reduce_62(val, _values, result)
|
1240
1265
|
result = [ Fabulator::Expr::AxisDescendentOrSelf.new ] + val[1]
|
1241
1266
|
result
|
@@ -1246,147 +1271,147 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 110)
|
|
1246
1271
|
|
1247
1272
|
# reduce 64 omitted
|
1248
1273
|
|
1249
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1274
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 120)
|
1250
1275
|
def _reduce_65(val, _values, result)
|
1251
1276
|
result = Fabulator::Expr::RootContext.new
|
1252
1277
|
result
|
1253
1278
|
end
|
1254
1279
|
.,.,
|
1255
1280
|
|
1256
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1281
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 121)
|
1257
1282
|
def _reduce_66(val, _values, result)
|
1258
1283
|
result = Fabulator::Expr::PathExpr.new(Fabulator::Expr::RootContext.new, [], val[1])
|
1259
1284
|
result
|
1260
1285
|
end
|
1261
1286
|
.,.,
|
1262
1287
|
|
1263
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1288
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 122)
|
1264
1289
|
def _reduce_67(val, _values, result)
|
1265
1290
|
result = [ Fabulator::Expr::RootContext.new, Fabulator::Expr::AxisDescendentOrSelf.new(val[1][0]) ] + val[1][1..val[1].size-1]
|
1266
1291
|
result
|
1267
1292
|
end
|
1268
1293
|
.,.,
|
1269
1294
|
|
1270
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1295
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 123)
|
1271
1296
|
def _reduce_68(val, _values, result)
|
1272
1297
|
result = [ Fabulator::Expr::RootContext.new(val[0]) ] + val[2]
|
1273
1298
|
result
|
1274
1299
|
end
|
1275
1300
|
.,.,
|
1276
1301
|
|
1277
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1302
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 124)
|
1278
1303
|
def _reduce_69(val, _values, result)
|
1279
1304
|
result = [ Fabulator::Expr::RootContext.new(val[0]), Fabulator::Expr::AxisDescendentOrSelf.new(val[2][0]) ] + val[2][1..val[2].size-1]
|
1280
1305
|
result
|
1281
1306
|
end
|
1282
1307
|
.,.,
|
1283
1308
|
|
1284
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1309
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 126)
|
1285
1310
|
def _reduce_70(val, _values, result)
|
1286
1311
|
result = [ val[0] ]
|
1287
1312
|
result
|
1288
1313
|
end
|
1289
1314
|
.,.,
|
1290
1315
|
|
1291
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1316
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 127)
|
1292
1317
|
def _reduce_71(val, _values, result)
|
1293
1318
|
result = val[0] + [ val[2] ]
|
1294
1319
|
result
|
1295
1320
|
end
|
1296
1321
|
.,.,
|
1297
1322
|
|
1298
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1323
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 128)
|
1299
1324
|
def _reduce_72(val, _values, result)
|
1300
1325
|
result = val[0] + [ Fabulator::Expr::AxisDescendentOrSelf.new(val[2]) ]
|
1301
1326
|
result
|
1302
1327
|
end
|
1303
1328
|
.,.,
|
1304
1329
|
|
1305
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1330
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 130)
|
1306
1331
|
def _reduce_73(val, _values, result)
|
1307
1332
|
result = val[1].nil? || val[1].empty? ? val[0] : Fabulator::Expr::Predicates.new(val[0], val[1])
|
1308
1333
|
result
|
1309
1334
|
end
|
1310
1335
|
.,.,
|
1311
1336
|
|
1312
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1337
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 131)
|
1313
1338
|
def _reduce_74(val, _values, result)
|
1314
1339
|
result = Fabulator::Expr::CurrentContext.new
|
1315
1340
|
result
|
1316
1341
|
end
|
1317
1342
|
.,.,
|
1318
1343
|
|
1319
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1344
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 132)
|
1320
1345
|
def _reduce_75(val, _values, result)
|
1321
1346
|
result = Fabulator::Expr::AxisParent.new
|
1322
1347
|
result
|
1323
1348
|
end
|
1324
1349
|
.,.,
|
1325
1350
|
|
1326
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1351
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 138)
|
1327
1352
|
def _reduce_76(val, _values, result)
|
1328
1353
|
result = Fabulator::Expr::AxisChild.new(val[0])
|
1329
1354
|
result
|
1330
1355
|
end
|
1331
1356
|
.,.,
|
1332
1357
|
|
1333
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1358
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 139)
|
1334
1359
|
def _reduce_77(val, _values, result)
|
1335
1360
|
result = Fabulator::Expr::Axis.new(val[0], val[1])
|
1336
1361
|
result
|
1337
1362
|
end
|
1338
1363
|
.,.,
|
1339
1364
|
|
1340
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1365
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 140)
|
1341
1366
|
def _reduce_78(val, _values, result)
|
1342
1367
|
result = Fabulator::Expr::AxisAttribute.new(val[1])
|
1343
1368
|
result
|
1344
1369
|
end
|
1345
1370
|
.,.,
|
1346
1371
|
|
1347
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1372
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 142)
|
1348
1373
|
def _reduce_79(val, _values, result)
|
1349
1374
|
result = Fabulator::Expr::Axis.new(val[0])
|
1350
1375
|
result
|
1351
1376
|
end
|
1352
1377
|
.,.,
|
1353
1378
|
|
1354
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1379
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 144)
|
1355
1380
|
def _reduce_80(val, _values, result)
|
1356
1381
|
result = [ ]
|
1357
1382
|
result
|
1358
1383
|
end
|
1359
1384
|
.,.,
|
1360
1385
|
|
1361
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1386
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 145)
|
1362
1387
|
def _reduce_81(val, _values, result)
|
1363
1388
|
result = val[0] + [ val[1] ]
|
1364
1389
|
result
|
1365
1390
|
end
|
1366
1391
|
.,.,
|
1367
1392
|
|
1368
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1393
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 147)
|
1369
1394
|
def _reduce_82(val, _values, result)
|
1370
1395
|
result = val[1]
|
1371
1396
|
result
|
1372
1397
|
end
|
1373
1398
|
.,.,
|
1374
1399
|
|
1375
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1400
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 148)
|
1376
1401
|
def _reduce_83(val, _values, result)
|
1377
1402
|
result = val[1]
|
1378
1403
|
result
|
1379
1404
|
end
|
1380
1405
|
.,.,
|
1381
1406
|
|
1382
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1407
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 155)
|
1383
1408
|
def _reduce_84(val, _values, result)
|
1384
1409
|
result = Fabulator::Expr::Var.new(val[0])
|
1385
1410
|
result
|
1386
1411
|
end
|
1387
1412
|
.,.,
|
1388
1413
|
|
1389
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1414
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 156)
|
1390
1415
|
def _reduce_85(val, _values, result)
|
1391
1416
|
result = val[1]
|
1392
1417
|
result
|
@@ -1397,21 +1422,21 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 154)
|
|
1397
1422
|
|
1398
1423
|
# reduce 87 omitted
|
1399
1424
|
|
1400
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1425
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 159)
|
1401
1426
|
def _reduce_88(val, _values, result)
|
1402
1427
|
result = Fabulator::Expr::Literal.new(val[0], [ Fabulator::FAB_NS, 'string' ])
|
1403
1428
|
result
|
1404
1429
|
end
|
1405
1430
|
.,.,
|
1406
1431
|
|
1407
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1432
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 160)
|
1408
1433
|
def _reduce_89(val, _values, result)
|
1409
1434
|
result = Fabulator::Expr::Literal.new(val[0] =~ /\./ ? val[0].to_d.to_r : val[0].to_i.to_r, [ Fabulator::FAB_NS, 'numeric' ])
|
1410
1435
|
result
|
1411
1436
|
end
|
1412
1437
|
.,.,
|
1413
1438
|
|
1414
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1439
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 162)
|
1415
1440
|
def _reduce_90(val, _values, result)
|
1416
1441
|
result = Fabulator::Expr::Function.new(@context, val[0], val[1])
|
1417
1442
|
# when 'any' : Fabulator::Expr::AnyExpr.new(@context, val[1])
|
@@ -1425,14 +1450,14 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 160)
|
|
1425
1450
|
end
|
1426
1451
|
.,.,
|
1427
1452
|
|
1428
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1453
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 171)
|
1429
1454
|
def _reduce_91(val, _values, result)
|
1430
1455
|
result = Fabulator::Expr::List.new(val[1])
|
1431
1456
|
result
|
1432
1457
|
end
|
1433
1458
|
.,.,
|
1434
1459
|
|
1435
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1460
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 174)
|
1436
1461
|
def _reduce_92(val, _values, result)
|
1437
1462
|
result = [ ]
|
1438
1463
|
result
|
@@ -1441,14 +1466,14 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 172)
|
|
1441
1466
|
|
1442
1467
|
# reduce 93 omitted
|
1443
1468
|
|
1444
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1469
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 177)
|
1445
1470
|
def _reduce_94(val, _values, result)
|
1446
1471
|
result = [ val[0] ]
|
1447
1472
|
result
|
1448
1473
|
end
|
1449
1474
|
.,.,
|
1450
1475
|
|
1451
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1476
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 178)
|
1452
1477
|
def _reduce_95(val, _values, result)
|
1453
1478
|
result = val[0] + [ val[2] ]
|
1454
1479
|
result
|
@@ -1457,14 +1482,14 @@ module_eval(<<'.,.,', 'xsm_expression_parser.racc', 176)
|
|
1457
1482
|
|
1458
1483
|
# reduce 96 omitted
|
1459
1484
|
|
1460
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1485
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 181)
|
1461
1486
|
def _reduce_97(val, _values, result)
|
1462
1487
|
result = val[0].to_s
|
1463
1488
|
result
|
1464
1489
|
end
|
1465
1490
|
.,.,
|
1466
1491
|
|
1467
|
-
module_eval(<<'.,.,', 'xsm_expression_parser.racc',
|
1492
|
+
module_eval(<<'.,.,', 'xsm_expression_parser.racc', 182)
|
1468
1493
|
def _reduce_98(val, _values, result)
|
1469
1494
|
result = val[1]
|
1470
1495
|
result
|