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 +4 -4
- data/lib/ruby_grammar_builder/util.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c847c5f5b831cc00f4067e4030639263c104b9923a85b42aa96d038355d79a66
|
4
|
+
data.tar.gz: e1dd84c95ef84fb92d50ac15b13004c303fa2bee43b328774f2b29773aeb7ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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:
|
12
|
+
date: 2023-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: deep_clone
|