ruby_grammar_builder 1.1.8 → 1.1.10

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
  SHA256:
3
- metadata.gz: e405d22122f7b04d7042eba408692b3f486c6c511296716b94da87b53094648c
4
- data.tar.gz: 280b800dcc65e8a17fabb3c1f4c039fa18f4d89cf77599dbc10bc29e2735bd19
3
+ metadata.gz: c847c5f5b831cc00f4067e4030639263c104b9923a85b42aa96d038355d79a66
4
+ data.tar.gz: e1dd84c95ef84fb92d50ac15b13004c303fa2bee43b328774f2b29773aeb7ddd
5
5
  SHA512:
6
- metadata.gz: 685b012af4dc69acd21609f78f880becdc6aeb411bebb6ed7ecf6876fd1d5c9d2cda37aa05832ec5812fd9b0ea64013b80090f95b306be3622b817d8262a7c59
7
- data.tar.gz: 600cbaacc3e7a5e0f08100ac1a763ea225375b9b6e5ff25a93691f87f1802db1b5e38c3c27a8e46e799abdc7664bf4fe4fcbf74c4ebafb2da21080fa7686d19a
6
+ metadata.gz: 9734da744fd7cc482a30d69a6a51d2104cd7ca019bf7170652094b4114484e2c481839f0b950949955c8f69f6579acdfb0092acbdcd74a8b04fc73ef3008251d
7
+ data.tar.gz: 51214dc748e1e93d60e815cd5ad14c43dc07313a8194d9df89fbf88696e485f2574b234f86177ed39f3907c98de0e5a2b600088bd103fd91a114c515b5a6abc9
@@ -51,6 +51,28 @@ end
51
51
  # forward slash "/" at the beginning and
52
52
  # @return [Boolean] if the string represents an single regex entity
53
53
  def string_single_entity?(regex_string)
54
+ normal_char = '[a-zA-Z0-9_\-@&%#\'"<>=\/\.,`~\s;:!]'
55
+ # normal char
56
+ if regex_string =~ /^#{normal_char}$/
57
+ return true
58
+ end
59
+ # escape sequence (all are valid, even stuff like \@ ("\\@") or "\\" + "\n" )
60
+ if regex_string =~ /^\\[\w\W]$/
61
+ return true
62
+ end
63
+ # character class that doesn't contain ]
64
+ if regex_string =~ /^\[[^\]]*\]$/
65
+ return true
66
+ end
67
+
68
+ # fail if more than one of any of the above
69
+ if regex_string =~ /^(#{normal_char}|\\[\w\W]|\[[^\]]*\]){2,}$/
70
+ return false
71
+ end
72
+
73
+ #
74
+ # more complicated cases
75
+ #
54
76
  escaped = false
55
77
  in_set = false
56
78
  depth = 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_grammar_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Hykin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-12-13 00:00:00.000000000 Z
12
+ date: 2023-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deep_clone