feel 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6322abf104787cb946d40a960e6b2a62f373b5446263bdae762fa7a6e1f729e2
4
- data.tar.gz: 2f68cdaca8282046f6764845c8aba4748ac49f5afeb51d33abaa68be753ac204
3
+ metadata.gz: 4c041d0d764fd300706135ed842bce8e932d50b7fad2de3b119cf13775b1c982
4
+ data.tar.gz: b0013be1303f2017df2a2ec9790221be90b4afb2258f000678048476670d6377
5
5
  SHA512:
6
- metadata.gz: baac8070cd82204e80c159e9800755e34919b1a75fd9c1a1f6c618a8d1e6c4d6c36c1cd0cd89ad69580abb3832a2f6c633ab7be1a908fda6683ed9bb5c454bd7
7
- data.tar.gz: f78b9e4e73349fa8cd63ce2294ff0eefe6d7582a3face5e50963a21e6ef20bc3a1cffbd7c67831c8f67849c097cb4ed5ee0039621d38a7b7b0651a4a62cbcc98
6
+ metadata.gz: 9d48ac451b9b8c2613f573ed83c9a0b21ff79fe48d4de635c5a9d017e0dc47b589a9945a9feaa128c9383e0b51c2157a87f28ab163f4e55022035355113f1d09
7
+ data.tar.gz: 9203087aa587f01524c1a3c1424ec454201ca435bd0cfa119c7d1a38094c21f24695c577bd10cd50ded2cb38f3f2ab90fa4efe5ad39374f77722da654e9aad79
@@ -349,7 +349,7 @@ grammar FEEL
349
349
  end
350
350
 
351
351
  #
352
- # 32. additional name symbols = "." | "/" | "-" | "" | "+" | "\*" ;
352
+ # 32. additional name symbols = "." | "/" | "-" | "'" | "+" | "*" ;
353
353
  #
354
354
  rule additional_name_symbols
355
355
  "." / "/" / "-" / "'" / "+" / "*"
@@ -374,7 +374,7 @@ grammar FEEL
374
374
  end
375
375
 
376
376
  #
377
- # 35. string literal = '"' , { character ('"' | vertical space) }, '"' ;
377
+ # 35. string literal = '"' , { character - ('"' | vertical space) }, '"' ;
378
378
  #
379
379
  rule string_literal
380
380
  '"' chars:double_string_character* '"' <StringLiteral> /
data/lib/feel/nodes.rb CHANGED
@@ -225,12 +225,12 @@ module FEEL
225
225
  class QualifiedName < Node
226
226
  def eval(context = {})
227
227
  head_name = head.eval(context)
228
-
228
+
229
229
  if tail.empty?
230
230
  context_get(context, head_name)
231
231
  else
232
232
  initial_value = context_get(context, head_name)
233
-
233
+
234
234
  # Process each segment in the tail, evaluating names to handle backticks
235
235
  tail.elements.inject(initial_value) do |hash, element|
236
236
  return nil unless hash
@@ -318,7 +318,7 @@ module FEEL
318
318
  text_value.strip
319
319
  end
320
320
  end
321
-
321
+
322
322
  class BacktickName < Node
323
323
  def eval(_context = {})
324
324
  # Extract content between backticks
@@ -358,10 +358,10 @@ module FEEL
358
358
  # 35. string literal = '"' , { character – ('"' | vertical space) }, '"' ;
359
359
  #
360
360
  class StringLiteral < Treetop::Runtime::SyntaxNode
361
- def eval(context={})
361
+ def eval(_context={})
362
362
  # Collect all characters and process escape sequences
363
363
  string_value = chars.elements.map do |char|
364
- if char.respond_to?(:text_value) && char.text_value.start_with?('\\')
364
+ if char.respond_to?(:text_value) && char.text_value.start_with?("\\")
365
365
  process_escape_sequence(char.text_value)
366
366
  else
367
367
  char.text_value
@@ -383,10 +383,10 @@ module FEEL
383
383
  "\t"
384
384
  when '\\"'
385
385
  '"'
386
- when '\\\''
386
+ when "\\'"
387
387
  "'"
388
- when '\\\\'
389
- '\\'
388
+ when "\\\\"
389
+ "\\"
390
390
  else
391
391
  # Return the character after the backslash for unknown escape sequences
392
392
  escape_seq[1..-1]
@@ -675,7 +675,7 @@ module FEEL
675
675
  #
676
676
  class Context < Node
677
677
  def eval(context = {})
678
- if entries&.present?
678
+ if entries.present?
679
679
  entries.eval(context)
680
680
  else
681
681
  {}
data/lib/feel/parser.rb CHANGED
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FEEL
4
+ # Load the Treetop grammar which defines FEEL::Parser < Treetop::Runtime::CompiledParser
5
+
6
+ # Special handling because this generated file causes lots of Ruby warnings
7
+ # about formatting.
8
+ verbose, $VERBOSE = $VERBOSE, nil
9
+ Treetop.load(File.expand_path(File.join(File.dirname(__FILE__), "feel.treetop")))
10
+ $VERBOSE = verbose
11
+
12
+ # Reopen the Treetop-generated Parser class to add convenience methods
4
13
  class Parser
5
- # Load the Treetop grammar from the 'feel' file, and create a new
6
- # instance of that parser as a class variable so we don't have to re-create
7
- # it every time we need to parse a string
8
- Treetop.load(File.expand_path(File.join(File.dirname(__FILE__), "feel.treetop")))
9
- @@parser = FEELParser.new
14
+ @@parser = new
10
15
 
11
16
  def self.parse(expression, root: nil)
12
17
  @@parser.parse(expression, root: root).tap do |ast|
data/lib/feel/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FEEL
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/feel.rb CHANGED
@@ -7,7 +7,11 @@ require "active_support"
7
7
  require "active_support/time"
8
8
  require "active_support/core_ext/hash"
9
9
 
10
+ # Special handling because this gem causes lots of Ruby warnings about
11
+ # formatting.
12
+ verbose, $VERBOSE = $VERBOSE, nil
10
13
  require "treetop"
14
+ $VERBOSE = verbose
11
15
 
12
16
  require "feel/configuration"
13
17
  require "feel/nodes"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connected Bits
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-02-02 00:00:00.000000000 Z
10
+ date: 2026-02-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activemodel
@@ -55,14 +55,14 @@ dependencies:
55
55
  name: treetop
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 1.6.12
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: 1.6.12
68
68
  - !ruby/object:Gem::Dependency