redata 1.1.5 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a976331f30dc7e730906d9693f75626828a484cd
4
- data.tar.gz: a743b61b55f2b6f2aa9c43dc142bae7f131a41e7
3
+ metadata.gz: e6e1de52d263974cc4da4464f9a26dcebdcba333
4
+ data.tar.gz: a49643f43494b8aae5ebf9863e0b3d64680c8a09
5
5
  SHA512:
6
- metadata.gz: f268047d184ded7f878df370944388469f6afa56a0ee2e44622b7875241e19d1fefae340c050b0c09e29ecc076320b46ac0fe8a66ec005be586641a149f9daf7
7
- data.tar.gz: 4cebe76f7b08e4a675e7bcc43da1395fe99e638f36ce623bde075391b95552394a74e92c0723e8243cd4536695ce11c54598a4964130cd9b0e0f0cae144e83ae
6
+ metadata.gz: f02a0898b34172272c8a2920d805a23bfb8c572d3b1e1edd11b1821af6bdd8cc4c0fe946ec161b5ea834a61ebfacbf60935e5aa4842e1301b58b675ae8601ce2
7
+ data.tar.gz: 6eecdd93c35af246598885510459f8804669e59e96bb6d0dfafce4baedffbec98cc93079f6b60b185cb20f9405d63f70c4378ca5c9049559b40cbcd8e3042799
@@ -1,7 +1,8 @@
1
1
  module Redata
2
2
  class Parser
3
3
  COMMENT_REGEX = /-{2}.*/
4
- LOAD_REGEX = /#load (.*)->(.*)/
4
+ LOAD_REGEX = /#load (.*)->([^,]*),?/
5
+ LOAD_PARAMS_REGEX = /,([^,>]*)>([^,>]*)/
5
6
  IF_REGEX = /\[\s*if ([^\s]*) is ([^\]]*)\]/
6
7
  IFNUL_REGEX = /\[\s*if ([^\s]*) is null\s*\]/
7
8
  ENDIF_REGEX = /\[\s*endif\s*\]/
@@ -134,6 +135,13 @@ module Redata
134
135
  name = res[1].gsub /[\s|:]+/, ''
135
136
  Log.error! "QUERY ERROR: syntax error for load query: #{line}" if sub.empty? || name.empty?
136
137
 
138
+ local_params = {}
139
+ line.scan(LOAD_PARAMS_REGEX).each do |res|
140
+ key = res[0].gsub(/\s/, '').to_sym
141
+ val = res[1].gsub /\s/, ''
142
+ local_params[key] = RED.locals[key]
143
+ RED.locals[key] = val
144
+ end
137
145
  sub_file = in_file.parent.join "_#{sub}.red.sql"
138
146
  sub_file = RED.root.join 'red_query', 'shared', "_#{sub}.rea.sql" unless sub_file.exist?
139
147
  sub_temp_tables = self.parse sub_file, out_file.dirname.join("#{name}.resql")
@@ -141,7 +149,11 @@ module Redata
141
149
  temp_tables.push n unless temp_tables.include? n
142
150
  end
143
151
  temp_tables.push name unless temp_tables.include? name
144
- next # load query line can not contain other content
152
+ local_params.each do |key, val|
153
+ RED.locals[key] = val
154
+ end
155
+ local_params = {}
156
+ next # load query line, can not contain other content
145
157
  end
146
158
 
147
159
  # parse [start_time] syntax
@@ -1,3 +1,3 @@
1
1
  module Redata
2
- VERSION = "1.1.5"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - goshan