posxml_parser 2.0.0 → 2.1.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 +4 -4
- data/RELEASE_NOTES.md +5 -0
- data/Rakefile +1 -0
- data/lib/posxml_compiler/parameter_not_found_error.rb +5 -0
- data/lib/posxml_compiler/variable.rb +3 -3
- data/lib/posxml_compiler/xsd_parser.rb +11 -1
- data/lib/posxml_parser/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1832f100013a8327eb5bc2af3938f37df654e8da
|
4
|
+
data.tar.gz: f88056150a5fbd972ded5068594da963f2ae7531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b22ad44960174d80ca1c7e9bd22ccf578bd69770540c7ecd738971b34e85cf9b61e61711e44b7058cd6e1f5fd5ee3a9a5cc1336ddefb21676303fb8a8c419ac5
|
7
|
+
data.tar.gz: 1667e63da3a8144d14e72665536bc8c24b7a2800573f789a6cc77dd7276afdedc9dbf40adbf39583e17701c2da2d61e38334b94e8f4e441a89cb38224090a2bf
|
data/RELEASE_NOTES.md
CHANGED
data/Rakefile
CHANGED
@@ -35,6 +35,7 @@ files = [
|
|
35
35
|
"lib/posxml_compiler/variable_undefined_error.rb",
|
36
36
|
"lib/posxml_compiler/instruction_not_found_error.rb",
|
37
37
|
"lib/posxml_compiler/variable_type_error.rb",
|
38
|
+
"lib/posxml_compiler/parameter_not_found_error.rb",
|
38
39
|
"lib/posxml_translate/parser.rb",
|
39
40
|
"lib/posxml_translate/pattern.rb",
|
40
41
|
"lib/posxml_translate/base.rb",
|
@@ -33,11 +33,11 @@ module PosxmlCompiler
|
|
33
33
|
when :string_or_integer # match everything is ok
|
34
34
|
when nil # not defined yet, it's ok for now
|
35
35
|
when :string
|
36
|
-
raise PosxmlCompiler::VariableTypeError.new("
|
36
|
+
raise PosxmlCompiler::VariableTypeError.new("Wrong argument type #{variable_struct[:type]} for instruction #{instruction}, parameter #{parameter_name} (expected #{type})")
|
37
37
|
when :integer
|
38
|
-
raise PosxmlCompiler::VariableTypeError.new("
|
38
|
+
raise PosxmlCompiler::VariableTypeError.new("Wrong argument type #{variable_struct[:type]} for instruction #{instruction}, parameter #{parameter_name} (expected #{type})")
|
39
39
|
else
|
40
|
-
raise PosxmlCompiler::VariableTypeError.new("
|
40
|
+
raise PosxmlCompiler::VariableTypeError.new("Wrong argument type #{variable_struct[:type]} for instruction #{instruction}, parameter #{parameter_name} (expected #{type})")
|
41
41
|
end
|
42
42
|
|
43
43
|
return true
|
@@ -34,7 +34,8 @@ module PosxmlCompiler
|
|
34
34
|
instruction = self.find(name) # => {:bytecode => "I", :order => ["variable", "operator", "value"], :parameters => {"variable" => :string_or_integer, "operator" => :string, "value" => :string_or_integer}
|
35
35
|
raise InstructionNotFoundError.new("Instruction #{name.inspect} not found") unless instruction
|
36
36
|
|
37
|
-
|
37
|
+
parameters_validate(name, instruction, parameters)
|
38
|
+
line = instruction[:order].collect { |param| parameters[param][:value] }
|
38
39
|
|
39
40
|
if line.empty?
|
40
41
|
instruction[:bytecode].chr + DELIMITER_END_INSTRUCTION
|
@@ -47,6 +48,15 @@ module PosxmlCompiler
|
|
47
48
|
self.instructions[name] # => {:bytecode => "I", :order => ["variable", "operator", "value"], :parameters => {"variable" => :string_or_integer, "operator" => :string, "value" => :string_or_integer}
|
48
49
|
end
|
49
50
|
|
51
|
+
def parameters_validate(instruction_name, instruction, parameters)
|
52
|
+
parameters_valid = instruction[:parameters].keys
|
53
|
+
parameters.each do |name, data|
|
54
|
+
unless parameters_valid.include? name
|
55
|
+
raise ParameterNotFoundError.new("invalid parameter '#{name}' for instruction '#{instruction_name}'")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
50
60
|
private
|
51
61
|
def string2byte(str)
|
52
62
|
value = str.gsub(";", "").gsub("true", "").gsub("false", "")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: posxml_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CloudWalk Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- "./lib/posxml_compiler/instruction_not_found_error.rb"
|
65
65
|
- "./lib/posxml_compiler/jump.rb"
|
66
66
|
- "./lib/posxml_compiler/jump_point.rb"
|
67
|
+
- "./lib/posxml_compiler/parameter_not_found_error.rb"
|
67
68
|
- "./lib/posxml_compiler/parser.rb"
|
68
69
|
- "./lib/posxml_compiler/posxml_compiler_error.rb"
|
69
70
|
- "./lib/posxml_compiler/string_size_error.rb"
|