posxml_parser 2.7.1 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/RELEASE_NOTES.md +5 -0
- data/lib/posxml_compiler/jump.rb +3 -2
- data/lib/posxml_compiler/parser.rb +26 -6
- data/lib/posxml_compiler/xsd_parser.rb +1 -1
- data/lib/posxml_parser/version.rb +1 -1
- data/out/posxml_parser/main.mrb +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0f79b2e53edf5b30845ed0b52dd45d6a68130c1
|
4
|
+
data.tar.gz: c2aabe64c1d84a47b02a23ae5de401704a4ca432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe118e0b98a77595bbf4f65c71562d17704589ca360d7350a59b36c0d4032a6e41a7785a7e5cf92ebe088aacf3a0da8fb73888a9142912ac2c6c1753e5ecd289
|
7
|
+
data.tar.gz: 9835dc9a42b38bc3f6d90c46bf084a631e32f2e31bf5b1b13074e28e28700e265f88478f15ca2872ee824c76b147e2744234bbe14ecd1a3fb73ce51f02032a9f
|
data/Gemfile.lock
CHANGED
data/RELEASE_NOTES.md
CHANGED
data/lib/posxml_compiler/jump.rb
CHANGED
@@ -56,7 +56,7 @@ module PosxmlCompiler
|
|
56
56
|
stack_while << [index, instruction[:point]]
|
57
57
|
when INSTRUCTION_BREAK
|
58
58
|
reference, point = stack_while.last
|
59
|
-
raise PosxmlCompilerError.new("While not found for <break") unless reference
|
59
|
+
raise PosxmlCompilerError.new("#{instruction[:line_number]}:While not found for <break") unless reference
|
60
60
|
@jumps << JumpPoint.new(self, INSTRUCTION_BREAK, index, reference, point)
|
61
61
|
when INSTRUCTION_WHILE
|
62
62
|
reference, point = stack_while.pop
|
@@ -86,8 +86,9 @@ module PosxmlCompiler
|
|
86
86
|
|
87
87
|
def check_function_tree(tree, instruction)
|
88
88
|
function_name = instruction[:parameters]["name"][:original]
|
89
|
+
line_number = instruction[:line_number]
|
89
90
|
unless function = tree[function_name]
|
90
|
-
raise PosxmlCompilerError.new("Function #{function_name} not found") unless reference
|
91
|
+
raise PosxmlCompilerError.new("#{line_number}:Function #{function_name} not found") unless reference
|
91
92
|
end
|
92
93
|
function_indexed = tree[function_name][0]
|
93
94
|
[function_indexed[1], function_indexed[0][:point]]
|
@@ -25,6 +25,8 @@ module PosxmlCompiler
|
|
25
25
|
puts "Application size limit(#{self.limit}) exceed"
|
26
26
|
end
|
27
27
|
txt
|
28
|
+
rescue => e
|
29
|
+
raise e.class.new("#{number}:#{e.message}")
|
28
30
|
end
|
29
31
|
|
30
32
|
private
|
@@ -54,25 +56,35 @@ module PosxmlCompiler
|
|
54
56
|
def split_instructions(txt)
|
55
57
|
txt_new = ""
|
56
58
|
ignore = false
|
57
|
-
txt.split("\n").compact.
|
59
|
+
txt.split("\n").compact.each_with_index do |str, number|
|
58
60
|
line = str.strip
|
59
61
|
if line[0..3] == "<!--" || ignore # Check comentaries
|
60
62
|
ignore = true
|
61
63
|
ignore = false if line.include?("-->")
|
62
64
|
elsif line.include?("<!--") # Check end of comentaries
|
63
65
|
line_without_comment = line.split("<!--")[0].strip
|
64
|
-
txt_new << instruction_check_close(line_without_comment)
|
66
|
+
txt_new << add_line_number(number, instruction_check_close(line_without_comment))
|
65
67
|
elsif line.include?("<") || line.include?(">")
|
66
|
-
txt_new << instruction_check_close(line)
|
68
|
+
txt_new << add_line_number(number, instruction_check_close(line))
|
67
69
|
else !ignore # For middle of instruction between lines
|
68
70
|
# Avoid this <pinpad.getpindukptmessage="$(sDisplayMsg)"type="3"pan="$(sPAN)"maxlen="12"variablereturnpin="$(sPIN)"variablereturnksn="$(sKSN)"variablereturn="$(iRet)"
|
69
71
|
txt_new << " " if txt_new[-1] != " "
|
70
|
-
txt_new << instruction_check_close(line)
|
72
|
+
txt_new << add_line_number(number, instruction_check_close(line))
|
71
73
|
end
|
72
74
|
end
|
75
|
+
#p txt_new
|
73
76
|
txt_new.split("\n")
|
74
77
|
end
|
75
78
|
|
79
|
+
def add_line_number(line, string)
|
80
|
+
# necessary check to avoid add line on commands devide in two lines
|
81
|
+
if string[0] == "<"
|
82
|
+
"#{line+1}\x00#{string}"
|
83
|
+
else
|
84
|
+
string
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
76
88
|
def instruction_check_close(str)
|
77
89
|
if str[-1] == ">"
|
78
90
|
"#{str[0..-2]}\n"
|
@@ -83,9 +95,15 @@ module PosxmlCompiler
|
|
83
95
|
|
84
96
|
def parse(txt)
|
85
97
|
point = 0
|
98
|
+
number = 0
|
86
99
|
# Split in lines and remove nil's
|
87
100
|
split_instructions(sanitize(txt)).inject([]) do |array, str|
|
88
|
-
|
101
|
+
if str.include?("\x00")
|
102
|
+
number, value = str.split("\x00", 2)
|
103
|
+
else
|
104
|
+
value = str
|
105
|
+
end
|
106
|
+
value = value.strip
|
89
107
|
next(array) if value.empty?
|
90
108
|
# => "if", {"variable" => "$(sKeyTouchScreen)", "operator" => "equalto", "value" => "KEY_CLEAR"}
|
91
109
|
name, parameters = parse_line(value)
|
@@ -96,11 +114,13 @@ module PosxmlCompiler
|
|
96
114
|
line = parse_instruction(name, parameters)
|
97
115
|
size = line.size
|
98
116
|
array << {
|
99
|
-
:name => name, :parameters => parameters, :line => line, :size => size, :point => point
|
117
|
+
:name => name, :parameters => parameters, :line => line, :size => size, :point => point, :line_number => number
|
100
118
|
}
|
101
119
|
point += size
|
102
120
|
array
|
103
121
|
end
|
122
|
+
rescue => e
|
123
|
+
raise e.class.new("#{number}:#{e.message}")
|
104
124
|
end
|
105
125
|
|
106
126
|
# Receive:
|
data/out/posxml_parser/main.mrb
CHANGED
Binary file
|
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.8.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-08-
|
11
|
+
date: 2018-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|