tina4ruby 3.10.2 → 3.10.3

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
  SHA256:
3
- metadata.gz: b49886a65ba68f1102f4c03b3054c6f0efd4cc576a1083e627981a8832986902
4
- data.tar.gz: b5a5cf59633ba153be413a974bd32d6128d6e56e6f901e4a16afce9380f30e94
3
+ metadata.gz: cfe8b7f49e17e2a703725d23ce90791acca6e078dc7747a0eebaf97091121330
4
+ data.tar.gz: a6a2e0c2e48b69e332d6bc0358929a141f91919b19062639259d7c51cb390a39
5
5
  SHA512:
6
- metadata.gz: 85339a87b7bd1c5769cde431f56111d787d80091ba96872aba477b160084bdd18c416a469f1cd05677f0caec667a897e4908503914fc969fe536eb1f26e9a095
7
- data.tar.gz: ae31dff4f46df762ca97ba74e26077b75885809e094848cbaf37cdc65fc9035e1fdf0543c7220d49707cf4d11f883ef38f60644ed1edf6d7d0efa8d54036aa50
6
+ metadata.gz: 24a17f01e57ffda9278e80e0451e54f82111921c1066f21ab30436391e05c475c613c6948824f4fe8d94ddc17f39796240ca47f6ecda8bfe166f805b54335b22
7
+ data.tar.gz: 2b0c24c5dbef5d4f4d2c3e5337f7dce2bc1f8a89a90cbb149484fe375914cf8465e604ccc6f30e264a78922e4132ad27f7f4d7189e7f589450cf3baa5361c0f1
@@ -431,24 +431,60 @@ module Tina4
431
431
  value
432
432
  end
433
433
 
434
- # Split expression on dots, but not dots inside parentheses
434
+ # Split expression on dots, respecting quotes, parentheses and brackets.
435
+ # Dots inside quoted strings or nested parens/brackets are NOT separators.
436
+ # Bracket access like foo["bar"] is emitted as a separate part.
435
437
  def split_dot_parts(expr)
436
438
  parts = []
437
439
  current = +""
438
- depth = 0
439
- expr.each_char do |ch|
440
- if ch == "("
441
- depth += 1
440
+ paren_depth = 0
441
+ bracket_depth = 0
442
+ in_quote = nil
443
+
444
+ i = 0
445
+ chars = expr.chars
446
+ while i < chars.length
447
+ ch = chars[i]
448
+
449
+ if in_quote
450
+ current << ch
451
+ # End quote only when matching unescaped closer
452
+ in_quote = nil if ch == in_quote && (i == 0 || chars[i - 1] != "\\")
453
+ elsif ch == '"' || ch == "'"
454
+ in_quote = ch
455
+ current << ch
456
+ elsif ch == "("
457
+ paren_depth += 1
442
458
  current << ch
443
459
  elsif ch == ")"
444
- depth -= 1
460
+ paren_depth -= 1
461
+ current << ch
462
+ elsif ch == "[" && paren_depth == 0
463
+ if bracket_depth == 0 && !current.empty?
464
+ # Start of bracket access on an existing part -- split here
465
+ parts << current
466
+ current = +""
467
+ end
468
+ bracket_depth += 1
445
469
  current << ch
446
- elsif ch == "." && depth == 0
447
- parts << current
470
+ elsif ch == "]"
471
+ bracket_depth -= 1
472
+ current << ch
473
+ if bracket_depth == 0 && paren_depth == 0
474
+ # End of top-level bracket access -- emit as its own part
475
+ parts << current
476
+ current = +""
477
+ # Skip a trailing dot that merely chains the next segment
478
+ i += 1 if i + 1 < chars.length && chars[i + 1] == "."
479
+ end
480
+ elsif ch == "." && paren_depth == 0 && bracket_depth == 0
481
+ parts << current unless current.empty?
448
482
  current = +""
449
483
  else
450
484
  current << ch
451
485
  end
486
+
487
+ i += 1
452
488
  end
453
489
  parts << current unless current.empty?
454
490
  parts
data/lib/tina4/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tina4
4
- VERSION = "3.10.2"
4
+ VERSION = "3.10.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.2
4
+ version: 3.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team