ecma-re-validator 0.1.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +28 -0
- data/.github/workflows/lint.yml +17 -0
- data/.gitignore +6 -8
- data/.rubocop.yml +6 -0
- data/Gemfile +2 -0
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.md +0 -2
- data/Rakefile +7 -1
- data/ecma-re-validator.gemspec +13 -7
- data/lib/ecma-re-validator/version.rb +3 -1
- data/lib/ecma-re-validator.rb +3 -7
- data/spec/anchors_spec.rb +2 -0
- data/spec/atomic_grouping_spec.rb +2 -0
- data/spec/comments_spec.rb +4 -3
- data/spec/conditionals_spec.rb +2 -0
- data/spec/lookbehind_spec.rb +2 -0
- data/spec/mode_modifiers_spec.rb +2 -0
- data/spec/named_capture_groups_spec.rb +2 -0
- data/spec/possesive_quantifiers_spec.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/unicode_spec.rb +2 -0
- data/spec/validator_spec.rb +3 -1
- metadata +53 -33
- data/.travis.yml +0 -17
- data/vendor/cache/awesome_print-1.6.1.gem +0 -0
- data/vendor/cache/coderay-1.1.0.gem +0 -0
- data/vendor/cache/diff-lcs-1.2.5.gem +0 -0
- data/vendor/cache/method_source-0.8.2.gem +0 -0
- data/vendor/cache/pry-0.10.1.gem +0 -0
- data/vendor/cache/rake-10.4.2.gem +0 -0
- data/vendor/cache/regexp_parser-0.2.0.gem +0 -0
- data/vendor/cache/rspec-3.2.0.gem +0 -0
- data/vendor/cache/rspec-core-3.2.2.gem +0 -0
- data/vendor/cache/rspec-expectations-3.2.0.gem +0 -0
- data/vendor/cache/rspec-mocks-3.2.1.gem +0 -0
- data/vendor/cache/rspec-support-3.2.2.gem +0 -0
- data/vendor/cache/slop-3.6.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5df81fd4c41a74e3a8fa2bde6a020c5c01738742bd118d4a42c67d7aab5cbb79
|
4
|
+
data.tar.gz: d1d84b618d322222355f94e51e1cb5ae074c1554074295a49b240f7bceb9a401
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ad8f0061e7326dbb1fbf9e2d64f166b8e3438f0df702c0d137d279188c94664f1b1db9065bfaaa357f8f8f7777feee8ace3d420a1f893bfd04361ec02d934c
|
7
|
+
data.tar.gz: 58db004cd71b7bd490d00f23edd3210d5daab998292ac14212e4639fa7b9d0278bcf4ce8f5dcae899674aa17433dee2d47c5c3c598d22e3872b61eeefea5e361
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby-version: [3.1.0, 3.0.0, 2.7.5]
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
|
18
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
bundler-cache: true
|
23
|
+
|
24
|
+
- name: Install dependencies
|
25
|
+
run: bundle install
|
26
|
+
|
27
|
+
- name: Run tests
|
28
|
+
run: bundle exec rake spec
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: Linting
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.0
|
14
|
+
bundler-cache: true
|
15
|
+
- run: bundle install
|
16
|
+
- name: Rubocop
|
17
|
+
run: bundle exec rake rubocop
|
data/.gitignore
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
/.bundle/
|
3
|
-
/bin
|
4
|
-
/vendor/ruby
|
5
|
-
/vendor/gems/
|
6
|
-
/vendor/cache/ruby/
|
7
|
-
|
1
|
+
*.gem
|
8
2
|
*.rbc
|
9
3
|
.bundle
|
10
4
|
.config
|
@@ -17,6 +11,7 @@ spec/reports
|
|
17
11
|
test/tmp
|
18
12
|
test/version_tmp
|
19
13
|
tmp
|
14
|
+
vendor/cache
|
20
15
|
|
21
16
|
Gemfile.lock
|
22
17
|
out/
|
@@ -28,5 +23,8 @@ docs/
|
|
28
23
|
# YARD artifacts
|
29
24
|
.yardoc
|
30
25
|
_yardoc
|
31
|
-
|
26
|
+
|
32
27
|
.DS_Store
|
28
|
+
.idea
|
29
|
+
.byebug_history
|
30
|
+
.vscode
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# ecma-re-validator
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/gjtorikian/ecma-re-validator.svg?branch=master)](https://travis-ci.org/gjtorikian/ecma-re-validator)
|
4
|
-
|
5
3
|
Pass in a string to validate if it would work in ECMA-262, aka JavaScript.
|
6
4
|
|
7
5
|
The information for what is valid and what isn't comes from <http://www.regular-expressions.info/javascript.html>.
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler'
|
2
4
|
Bundler::GemHelper.install_tasks
|
3
5
|
|
@@ -5,4 +7,8 @@ require 'rspec/core/rake_task'
|
|
5
7
|
|
6
8
|
RSpec::Core::RakeTask.new(:spec)
|
7
9
|
|
8
|
-
task :
|
10
|
+
task default: [:spec]
|
11
|
+
|
12
|
+
require 'rubocop/rake_task'
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new(:rubocop)
|
data/ecma-re-validator.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
3
4
|
require 'ecma-re-validator/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |gem|
|
@@ -11,14 +12,19 @@ Gem::Specification.new do |gem|
|
|
11
12
|
gem.summary = %(Validate a regular expression string against what ECMA-262 can actually do.)
|
12
13
|
gem.homepage = 'https://github.com/gjtorikian/ecma-re-validator'
|
13
14
|
gem.license = 'MIT'
|
14
|
-
gem.files = `git ls-files -z`.split("\x0")
|
15
|
+
gem.files = `git ls-files -z`.split("\x0").grep_v(%r{^vendor/.*})
|
15
16
|
gem.test_files = gem.files.grep(%r{^(spec)/})
|
16
17
|
gem.require_paths = ['lib']
|
18
|
+
gem.required_ruby_version = ['>= 2.6.0', '< 4.0']
|
17
19
|
|
18
|
-
gem.add_dependency 'regexp_parser', '~>
|
20
|
+
gem.add_dependency 'regexp_parser', '~> 2.2'
|
19
21
|
|
20
|
-
gem.add_development_dependency 'rspec', '~> 3.1'
|
21
|
-
gem.add_development_dependency 'rake'
|
22
22
|
gem.add_development_dependency 'awesome_print'
|
23
|
-
gem.add_development_dependency
|
23
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
24
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
25
|
+
|
26
|
+
gem.add_development_dependency 'rubocop'
|
27
|
+
gem.add_development_dependency 'rubocop-rspec'
|
28
|
+
gem.add_development_dependency 'rubocop-standard'
|
29
|
+
gem.metadata['rubygems_mfa_required'] = 'true'
|
24
30
|
end
|
data/lib/ecma-re-validator.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
require 'awesome_print'
|
3
|
-
require 'pry'
|
4
|
-
rescue LoadError; end
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
3
|
require 'regexp_parser'
|
7
4
|
|
8
5
|
module EcmaReValidator
|
9
|
-
|
10
6
|
# JS doesn't have Unicode matching
|
11
7
|
UNICODE_CHARACTERS = Regexp::Syntax::Token::UnicodeProperty::All
|
12
8
|
|
@@ -22,12 +18,12 @@ module EcmaReValidator
|
|
22
18
|
# JS doesn't have named capture groups
|
23
19
|
:named_ab, :named_sq,
|
24
20
|
# JS doesn't support modifying options
|
25
|
-
:options,
|
21
|
+
:options, :options_switch,
|
26
22
|
# JS doesn't support conditionals
|
27
23
|
:condition_open,
|
28
24
|
# JS doesn't support comments
|
29
25
|
:comment
|
30
|
-
]
|
26
|
+
].freeze
|
31
27
|
|
32
28
|
INVALID_TOKENS = INVALID_REGEXP + UNICODE_CHARACTERS
|
33
29
|
|
data/spec/anchors_spec.rb
CHANGED
data/spec/comments_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe 'EcmaReValidator::Comments' do
|
@@ -8,15 +10,14 @@ describe 'EcmaReValidator::Comments' do
|
|
8
10
|
end
|
9
11
|
|
10
12
|
it 'should fail if regexp has inline comments across lines' do
|
11
|
-
re =
|
13
|
+
re = /
|
12
14
|
start # some text
|
13
15
|
\s # white space char
|
14
16
|
(group) # first group
|
15
17
|
(?:alt1|alt2) # some alternation
|
16
18
|
end
|
17
|
-
|
19
|
+
/x
|
18
20
|
|
19
21
|
expect(EcmaReValidator.valid?(re)).to eql(false)
|
20
22
|
end
|
21
|
-
|
22
23
|
end
|
data/spec/conditionals_spec.rb
CHANGED
data/spec/lookbehind_spec.rb
CHANGED
data/spec/mode_modifiers_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/unicode_spec.rb
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe 'EcmaRe' do
|
@@ -14,7 +16,7 @@ describe 'EcmaRe' do
|
|
14
16
|
end
|
15
17
|
|
16
18
|
it 'passes for a valid regexp string' do
|
17
|
-
re =
|
19
|
+
re = '[Ss]mith\\\\b'
|
18
20
|
|
19
21
|
expect(EcmaReValidator.valid?(re)).to eql(true)
|
20
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecma-re-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: regexp_parser
|
@@ -16,14 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: awesome_print
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rspec
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +67,7 @@ dependencies:
|
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: '3.1'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
70
|
+
name: rubocop
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - ">="
|
@@ -53,7 +81,7 @@ dependencies:
|
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: rubocop-rspec
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - ">="
|
@@ -67,19 +95,19 @@ dependencies:
|
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
98
|
+
name: rubocop-standard
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
103
|
+
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
110
|
+
version: '0'
|
83
111
|
description: Validate a regular expression string against what ECMA-262 can actually
|
84
112
|
do.
|
85
113
|
email:
|
@@ -88,10 +116,12 @@ executables: []
|
|
88
116
|
extensions: []
|
89
117
|
extra_rdoc_files: []
|
90
118
|
files:
|
119
|
+
- ".github/workflows/ci.yml"
|
120
|
+
- ".github/workflows/lint.yml"
|
91
121
|
- ".gitignore"
|
92
|
-
- ".
|
122
|
+
- ".rubocop.yml"
|
93
123
|
- Gemfile
|
94
|
-
- LICENSE
|
124
|
+
- LICENSE.txt
|
95
125
|
- README.md
|
96
126
|
- Rakefile
|
97
127
|
- ecma-re-validator.gemspec
|
@@ -110,24 +140,12 @@ files:
|
|
110
140
|
- spec/spec_helper.rb
|
111
141
|
- spec/unicode_spec.rb
|
112
142
|
- spec/validator_spec.rb
|
113
|
-
- vendor/cache/awesome_print-1.6.1.gem
|
114
|
-
- vendor/cache/coderay-1.1.0.gem
|
115
|
-
- vendor/cache/diff-lcs-1.2.5.gem
|
116
|
-
- vendor/cache/method_source-0.8.2.gem
|
117
|
-
- vendor/cache/pry-0.10.1.gem
|
118
|
-
- vendor/cache/rake-10.4.2.gem
|
119
|
-
- vendor/cache/regexp_parser-0.2.0.gem
|
120
|
-
- vendor/cache/rspec-3.2.0.gem
|
121
|
-
- vendor/cache/rspec-core-3.2.2.gem
|
122
|
-
- vendor/cache/rspec-expectations-3.2.0.gem
|
123
|
-
- vendor/cache/rspec-mocks-3.2.1.gem
|
124
|
-
- vendor/cache/rspec-support-3.2.2.gem
|
125
|
-
- vendor/cache/slop-3.6.0.gem
|
126
143
|
homepage: https://github.com/gjtorikian/ecma-re-validator
|
127
144
|
licenses:
|
128
145
|
- MIT
|
129
|
-
metadata:
|
130
|
-
|
146
|
+
metadata:
|
147
|
+
rubygems_mfa_required: 'true'
|
148
|
+
post_install_message:
|
131
149
|
rdoc_options: []
|
132
150
|
require_paths:
|
133
151
|
- lib
|
@@ -135,16 +153,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
153
|
requirements:
|
136
154
|
- - ">="
|
137
155
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
156
|
+
version: 2.6.0
|
157
|
+
- - "<"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '4.0'
|
139
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
161
|
requirements:
|
141
162
|
- - ">="
|
142
163
|
- !ruby/object:Gem::Version
|
143
164
|
version: '0'
|
144
165
|
requirements: []
|
145
|
-
|
146
|
-
|
147
|
-
signing_key:
|
166
|
+
rubygems_version: 3.3.3
|
167
|
+
signing_key:
|
148
168
|
specification_version: 4
|
149
169
|
summary: Validate a regular expression string against what ECMA-262 can actually do.
|
150
170
|
test_files:
|
data/.travis.yml
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/cache/pry-0.10.1.gem
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/cache/slop-3.6.0.gem
DELETED
Binary file
|