zpl-transformer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/zpl-transformer/reader.rb +10 -3
- data/lib/zpl-transformer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90540d561ecdad6ac549056e73e4d442c06be23b
|
4
|
+
data.tar.gz: e5b8310eeade5270de26ff90cbc7b8756c3ff1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8e603cacc349e32c7fff32306a4a7ad4ceb9c13230454f460c91db6e7f54f06de1770734f77539046901fa8202e3a1174170bec1fc9122bb2a95498ac28bd3f
|
7
|
+
data.tar.gz: 42738573dd5cd741bb954a159889bc65e186e8a611438ea3bd091197a33cf80fdf74e072fdb71ed28242404eeaa6ec13a05b54264b52dbda2a0a5c831fdae6c7
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -14,7 +14,7 @@ module Zpl
|
|
14
14
|
|
15
15
|
# Returns the next zpl command or ignored string if any, or nil.
|
16
16
|
#
|
17
|
-
# The ignored string can be a newlines, ignored chars, spaces.
|
17
|
+
# The ignored string can be a newlines, ignored chars, spaces or unsupported syntax.
|
18
18
|
def next_token
|
19
19
|
return if @scanner.eos?
|
20
20
|
|
@@ -45,13 +45,20 @@ module Zpl
|
|
45
45
|
|
46
46
|
protected
|
47
47
|
|
48
|
+
# Example format: ^XXparam1,param2,,param4
|
49
|
+
# Command name: XX (the command is read as 2 chars, no more no less)
|
50
|
+
# 4 (5) params (param 3 & 5 are not given)
|
51
|
+
#
|
52
|
+
# The command stops at the next `^` or newline.
|
53
|
+
COMMAND_RX = /\^([A-Z0-9@]{2})([^\^\n]*)/
|
54
|
+
|
48
55
|
def parse_zpl_cmd
|
49
56
|
# Example format: ^XXparam1,param2,,param4
|
50
57
|
# Command name: XX (the command is read as 2 chars, no more no less)
|
51
58
|
# 4 (5) params (param 3 & 5 are not given)
|
52
59
|
#
|
53
60
|
# The command stops at the next `^` or newline.
|
54
|
-
@scanner.scan(
|
61
|
+
@scanner.scan(COMMAND_RX)
|
55
62
|
|
56
63
|
cmd_name = @scanner[1]
|
57
64
|
raw_params = @scanner[2]
|
@@ -68,7 +75,7 @@ module Zpl
|
|
68
75
|
|
69
76
|
def parse_ignore_chars
|
70
77
|
# scan until next command (just before the `^`)
|
71
|
-
chars_skipped = @scanner.scan_until(/(
|
78
|
+
chars_skipped = @scanner.scan_until(/(?=(#{ COMMAND_RX }))/)
|
72
79
|
|
73
80
|
if chars_skipped.nil?
|
74
81
|
# No more commands, return the rest
|