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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c374857ea41f937a78a1cb7e694f00a72480f24f
4
- data.tar.gz: fc19bdec4ef355d1e979083fc7b0733e5b305c18
3
+ metadata.gz: 90540d561ecdad6ac549056e73e4d442c06be23b
4
+ data.tar.gz: e5b8310eeade5270de26ff90cbc7b8756c3ff1fe
5
5
  SHA512:
6
- metadata.gz: 2390d41d3903ae20a0ade4104a8a6330988c655136f0a6b8f2a64b84ade36fe766d339901ef35a2a764c0060ec4ca7cebb40d898658b2fdff9b57c55a07bd493
7
- data.tar.gz: 4b6fce1512268556ae97a9df56bdafc9d15df18891e424319d38dfda531f3820caead9a3491513938979d16f16264f4c54ad018d3fcf35e0391ea9c11330bc44
6
+ metadata.gz: b8e603cacc349e32c7fff32306a4a7ad4ceb9c13230454f460c91db6e7f54f06de1770734f77539046901fa8202e3a1174170bec1fc9122bb2a95498ac28bd3f
7
+ data.tar.gz: 42738573dd5cd741bb954a159889bc65e186e8a611438ea3bd091197a33cf80fdf74e072fdb71ed28242404eeaa6ec13a05b54264b52dbda2a0a5c831fdae6c7
data/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - Fix Reader when next '^' is not a command
6
+
3
7
  ## 0.3.0
4
8
 
5
9
  - Feature: Add transformer to remove specific cmds by name
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zpl-transformer (0.3.0)
4
+ zpl-transformer (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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(/\^([A-Z0-9@]{2})([^\^\n]*)/)
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
@@ -1,3 +1,3 @@
1
1
  module Zpl
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zpl-transformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoit de Chezelles