srl_ruby 0.4.3 → 0.4.4
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 +4 -4
- data/CHANGELOG.md +13 -1
- data/lib/srl_ruby/tokenizer.rb +3 -3
- data/lib/srl_ruby/version.rb +1 -1
- data/spec/acceptance/support/rule_file_tokenizer.rb +3 -4
- data/spec/srl_ruby/tokenizer_spec.rb +1 -1
- data/srl_ruby.gemspec +1 -1
- metadata +4 -6
- data/lib/srl_ruby/srl_token.rb +0 -23
- data/spec/acceptance/support/rule_file_token.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fb6ab4f66212ea614cfbfab2f7b17049425844e
|
4
|
+
data.tar.gz: 634718cf4229710eed018512b44f29781acebc4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ef6aead6683f95d965f2b9882f929af3d1b4f73cc8948982161d8f05843e196b39e21868c2620bab825f88697174b4b82378fc548e5f0f21b920717685378a
|
7
|
+
data.tar.gz: bb3c755844c7ad3e655d423de9956c3ccafde8c9efc2df5841b995546f0cf83b7b3880afa8ded4cd888944eaae53d7c889e96e7e09b743ece728aa7041734727
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
## [0.4.
|
1
|
+
## [0.4.4] - 2018-11-24
|
2
|
+
### Changed
|
3
|
+
- File `srl_ruby.gemspec` Updated Rley dependency.
|
4
|
+
|
5
|
+
### Removed
|
6
|
+
- Class `SrlRuby::SrlToken` since it became completely redundant with `Token` class from Rley.
|
7
|
+
- Class `Acceptance::RuleFileToken` since it became completely redundant with `Token` class from Rley.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- Method `SrlRuby::Tokenizer#build_token` now instantiates a `Rley::Lexical::Token`
|
11
|
+
- Method `Acceptance::RuleFileTokenizer#build_token` now instantiates a `Rley::Lexical::Token`
|
12
|
+
|
13
|
+
## [0.4.3] - 2018-06-24
|
2
14
|
### Changed
|
3
15
|
- File `srl_ruby.gemspec` Updated Rley dependency.
|
4
16
|
|
data/lib/srl_ruby/tokenizer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# File: srl_tokenizer.rb
|
2
2
|
# Tokenizer for SRL (Simple Regex Language)
|
3
3
|
require 'strscan'
|
4
|
-
|
4
|
+
require 'rley'
|
5
5
|
|
6
6
|
|
7
7
|
module SrlRuby
|
@@ -149,8 +149,8 @@ module SrlRuby
|
|
149
149
|
def build_token(aSymbolName, aLexeme)
|
150
150
|
begin
|
151
151
|
col = scanner.pos - aLexeme.size - @line_start + 1
|
152
|
-
pos = Position.new(@lineno, col)
|
153
|
-
token =
|
152
|
+
pos = Rley::Lexical::Position.new(@lineno, col)
|
153
|
+
token = Rley::Lexical::Token.new(aLexeme, aSymbolName, pos)
|
154
154
|
rescue StandardError => exc
|
155
155
|
puts "Failing with '#{aSymbolName}' and '#{aLexeme}'"
|
156
156
|
raise exc
|
data/lib/srl_ruby/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# [File format](https://github.com/SimpleRegex/Test-Rules/blob/master/README.md)
|
4
4
|
require 'strscan'
|
5
5
|
require 'pp'
|
6
|
-
|
6
|
+
require 'rley'
|
7
7
|
|
8
8
|
module Acceptance
|
9
9
|
# The tokenizer should recognize:
|
@@ -74,7 +74,6 @@ module Acceptance
|
|
74
74
|
curr_ch = scanner.peek(1)
|
75
75
|
token = nil
|
76
76
|
|
77
|
-
|
78
77
|
if '-:'.include? curr_ch
|
79
78
|
# Delimiters, separators => single character token
|
80
79
|
token = build_token(@@lexeme2name[curr_ch], scanner.getch)
|
@@ -110,8 +109,8 @@ module Acceptance
|
|
110
109
|
def build_token(aSymbolName, aLexeme)
|
111
110
|
begin
|
112
111
|
col = scanner.pos - aLexeme.size - @line_start + 1
|
113
|
-
pos = Position.new(@lineno, col)
|
114
|
-
token =
|
112
|
+
pos = Rley::Lexical::Position.new(@lineno, col)
|
113
|
+
token = Rley::Lexical::Token.new(aLexeme, aSymbolName, pos)
|
115
114
|
rescue StandardError => exc
|
116
115
|
puts "Failing with '#{aSymbolName}' and '#{aLexeme}'"
|
117
116
|
raise exc
|
@@ -14,7 +14,7 @@ module SrlRuby
|
|
14
14
|
subject { Tokenizer.new('') }
|
15
15
|
|
16
16
|
context 'Initialization:' do
|
17
|
-
it 'should be initialized with a text to tokenize
|
17
|
+
it 'should be initialized with a text to tokenize' do
|
18
18
|
expect { Tokenizer.new('anything') }.not_to raise_error
|
19
19
|
end
|
20
20
|
|
data/srl_ruby.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: srl_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.7'
|
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: '0.
|
26
|
+
version: '0.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,6 @@ files:
|
|
146
146
|
- lib/srl_ruby/ast_builder.rb
|
147
147
|
- lib/srl_ruby/grammar.rb
|
148
148
|
- lib/srl_ruby/regex_repr.rb
|
149
|
-
- lib/srl_ruby/srl_token.rb
|
150
149
|
- lib/srl_ruby/tokenizer.rb
|
151
150
|
- lib/srl_ruby/version.rb
|
152
151
|
- spec/acceptance/srl_test_suite_spec.rb
|
@@ -154,7 +153,6 @@ files:
|
|
154
153
|
- spec/acceptance/support/rule_file_grammar.rb
|
155
154
|
- spec/acceptance/support/rule_file_nodes.rb
|
156
155
|
- spec/acceptance/support/rule_file_parser.rb
|
157
|
-
- spec/acceptance/support/rule_file_token.rb
|
158
156
|
- spec/acceptance/support/rule_file_tokenizer.rb
|
159
157
|
- spec/regex/atomic_expression_spec.rb
|
160
158
|
- spec/regex/character_spec.rb
|
data/lib/srl_ruby/srl_token.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rley' # Load the Rley gem
|
2
|
-
|
3
|
-
|
4
|
-
module SrlRuby
|
5
|
-
Position = Struct.new(:line, :column) do
|
6
|
-
def to_s
|
7
|
-
"line #{line}, column #{column}"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
# Specialization of Token class.
|
12
|
-
# It stores the position in (line, row) of the token
|
13
|
-
class SrlToken < Rley::Lexical::Token
|
14
|
-
attr_reader(:position)
|
15
|
-
|
16
|
-
def initialize(theLexeme, aTerminal, aPosition)
|
17
|
-
super(theLexeme, aTerminal)
|
18
|
-
@position = aPosition
|
19
|
-
end
|
20
|
-
end # class
|
21
|
-
end # module
|
22
|
-
|
23
|
-
# End of file
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rley' # Load the Rley gem
|
2
|
-
|
3
|
-
module Acceptance
|
4
|
-
Position = Struct.new(:line, :column) do
|
5
|
-
def to_s
|
6
|
-
"line #{line}, column #{column}"
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
# Specialization of Token class.
|
11
|
-
# It stores the position in (line, row) of the token
|
12
|
-
class RuleFileToken < Rley::Lexical::Token
|
13
|
-
attr_reader(:position)
|
14
|
-
|
15
|
-
def initialize(theLexeme, aTerminal, aPosition)
|
16
|
-
super(theLexeme, aTerminal)
|
17
|
-
@position = aPosition
|
18
|
-
end
|
19
|
-
end # class
|
20
|
-
end # module
|
21
|
-
|
22
|
-
# End of file
|