ecma-re-validator 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +10 -5
- data/lib/ecma-re-validator/version.rb +1 -1
- data/lib/ecma-re-validator.rb +2 -6
- 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 +54 -20
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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
@@ -12,14 +12,19 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.summary = %(Validate a regular expression string against what ECMA-262 can actually do.)
|
13
13
|
gem.homepage = 'https://github.com/gjtorikian/ecma-re-validator'
|
14
14
|
gem.license = 'MIT'
|
15
|
-
gem.files = `git ls-files -z`.split("\x0").
|
15
|
+
gem.files = `git ls-files -z`.split("\x0").grep_v(%r{^vendor/.*})
|
16
16
|
gem.test_files = gem.files.grep(%r{^(spec)/})
|
17
17
|
gem.require_paths = ['lib']
|
18
|
+
gem.required_ruby_version = ['>= 2.6.0', '< 4.0']
|
18
19
|
|
19
|
-
gem.add_dependency 'regexp_parser', '~> 2.
|
20
|
+
gem.add_dependency 'regexp_parser', '~> 2.2'
|
20
21
|
|
21
|
-
gem.add_development_dependency 'rspec', '~> 3.1'
|
22
|
-
gem.add_development_dependency 'rake', '~> 13.0'
|
23
22
|
gem.add_development_dependency 'awesome_print'
|
24
|
-
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'
|
25
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
|
|
@@ -27,7 +23,7 @@ module EcmaReValidator
|
|
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
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,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
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: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: awesome_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +53,21 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -67,19 +81,33 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop-rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
89
|
+
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-standard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
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
|
@@ -113,7 +143,8 @@ files:
|
|
113
143
|
homepage: https://github.com/gjtorikian/ecma-re-validator
|
114
144
|
licenses:
|
115
145
|
- MIT
|
116
|
-
metadata:
|
146
|
+
metadata:
|
147
|
+
rubygems_mfa_required: 'true'
|
117
148
|
post_install_message:
|
118
149
|
rdoc_options: []
|
119
150
|
require_paths:
|
@@ -122,14 +153,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
153
|
requirements:
|
123
154
|
- - ">="
|
124
155
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
156
|
+
version: 2.6.0
|
157
|
+
- - "<"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '4.0'
|
126
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
161
|
requirements:
|
128
162
|
- - ">="
|
129
163
|
- !ruby/object:Gem::Version
|
130
164
|
version: '0'
|
131
165
|
requirements: []
|
132
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.3.3
|
133
167
|
signing_key:
|
134
168
|
specification_version: 4
|
135
169
|
summary: Validate a regular expression string against what ECMA-262 can actually do.
|