ruby_grammar_builder 1.1.7 → 1.1.10

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: 56dfb466636e1129250201678d584ea52657d7a89a6fd3d6d1a9b345074df2c3
4
- data.tar.gz: d31f097e6d6cf9db18ad9c1d965d7c4ea4b666ce9ccecb7a560990716b2bfe46
3
+ metadata.gz: c847c5f5b831cc00f4067e4030639263c104b9923a85b42aa96d038355d79a66
4
+ data.tar.gz: e1dd84c95ef84fb92d50ac15b13004c303fa2bee43b328774f2b29773aeb7ddd
5
5
  SHA512:
6
- metadata.gz: 3bf2133a31d655e8ab263e1bfc151ba485e029d34f91631d1e590da2930d284e8713a040fe68a10b9b2b6bd00f33e6a6272a4d32a2784ce247ef7af9b02bbf9c
7
- data.tar.gz: 7f06a5c4e2e9ae5fc7381987ab13630337675a6349302f4001205c2af560b0539121d8e6f1c7e848f67bbbdc73627c67aa3b5697f58cc9e0b3f05861ee65b494
6
+ metadata.gz: 9734da744fd7cc482a30d69a6a51d2104cd7ca019bf7170652094b4114484e2c481839f0b950949955c8f69f6579acdfb0092acbdcd74a8b04fc73ef3008251d
7
+ data.tar.gz: 51214dc748e1e93d60e815cd5ad14c43dc07313a8194d9df89fbf88696e485f2574b234f86177ed39f3907c98de0e5a2b600088bd103fd91a114c515b5a6abc9
@@ -194,7 +194,11 @@ class StandardNaming < GrammarLinter
194
194
 
195
195
  valid_prefix = (pos > 0) ? tag[0..(pos-1)].join(".") + "." : ""
196
196
 
197
- puts "The prefix `#{tag[0..pos].join('.')}' does not follow the standard format"
197
+ joined_tag = "#{tag[0..pos].join('.')}"
198
+ if joined_tag.start_with? "meta."
199
+ return
200
+ end
201
+ puts "The prefix `#{joined_tag}' does not follow the standard format"
198
202
  puts "The expected prefixes at this level are:"
199
203
  root.keys.each do |key|
200
204
  if root[:key] == false
@@ -723,11 +723,7 @@ class PatternBase
723
723
  end
724
724
 
725
725
  # if the reference does exist, then replace it with it's number
726
- if references[match_reference] < 10
727
- "\\#{references[match_reference]}"
728
- else
729
- "\\k<#{references[match_reference]}>"
730
- end
726
+ "(?:\\#{references[match_reference]})"
731
727
  end
732
728
 
733
729
  # check for a subroutine to the Nth group, replace it with `\N`
@@ -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.7
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-12 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