loxxy 0.4.04 → 0.4.05
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +27 -6
- data/CHANGELOG.md +10 -0
- data/lib/loxxy/front_end/grammar.rb +0 -1
- data/lib/loxxy/front_end/scanner.rb +2 -3
- data/lib/loxxy/version.rb +1 -1
- data/loxxy.gemspec +1 -1
- data/spec/front_end/parser_spec.rb +1 -1
- data/spec/front_end/raw_parser_spec.rb +1 -1
- data/spec/front_end/scanner_spec.rb +7 -7
- metadata +4 -5
- data/lib/loxxy/front_end/literal.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36f3b49ca1158cd6922cb5ece2340f53efec793e5877a96f94aebc0eee34235d
|
4
|
+
data.tar.gz: ade953da452fbf9ad6552e8dbfb035161c79c2bffcd0d531c4e79cf6d785c51c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc0ff7ac6da9846a5a70ead053ceeee2eb390f778a70932392fcbe10ce70c7e147f11983baee96dc5aed924de492d744c3b6b61c8d03f389a74432a56b3916a5
|
7
|
+
data.tar.gz: 40e36a53abc6ce121299952ff98f71175198271659f3a7dabf1cbd0f8e79bdc4c76242f47a4707c513f9ca63459bd4495d56de2287136cedb5cadac14ed4fca3
|
data/.rubocop.yml
CHANGED
@@ -84,6 +84,9 @@ Layout/TrailingWhitespace:
|
|
84
84
|
Lint/AmbiguousAssignment:
|
85
85
|
Enabled: true
|
86
86
|
|
87
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
88
|
+
Enabled: true
|
89
|
+
|
87
90
|
Lint/AmbiguousRange:
|
88
91
|
Enabled: true
|
89
92
|
|
@@ -105,6 +108,9 @@ Lint/EmptyClass:
|
|
105
108
|
Lint/EmptyInPattern:
|
106
109
|
Enabled: true
|
107
110
|
|
111
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
112
|
+
Enabled: true
|
113
|
+
|
108
114
|
Lint/LambdaWithoutLiteralBlock:
|
109
115
|
Enabled: true
|
110
116
|
|
@@ -126,6 +132,9 @@ Lint/RaiseException:
|
|
126
132
|
Lint/RedundantDirGlobSort:
|
127
133
|
Enabled: true
|
128
134
|
|
135
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
136
|
+
Enabled: true
|
137
|
+
|
129
138
|
Lint/RescueException:
|
130
139
|
Enabled: true
|
131
140
|
|
@@ -213,6 +222,9 @@ Naming/MethodName:
|
|
213
222
|
Naming/VariableName:
|
214
223
|
Enabled: false
|
215
224
|
|
225
|
+
Security/IoMethods: # new in 1.22
|
226
|
+
Enabled: true
|
227
|
+
|
216
228
|
Style/Alias:
|
217
229
|
Enabled: true
|
218
230
|
|
@@ -293,9 +305,9 @@ Style/InverseMethods:
|
|
293
305
|
|
294
306
|
Style/MissingRespondToMissing:
|
295
307
|
Enabled: false
|
296
|
-
|
308
|
+
|
297
309
|
Style/MultilineInPatternThen:
|
298
|
-
Enabled: true
|
310
|
+
Enabled: true
|
299
311
|
|
300
312
|
Style/NegatedIfElseCondition:
|
301
313
|
Enabled: true
|
@@ -306,11 +318,17 @@ Style/Next:
|
|
306
318
|
Style/NilLambda:
|
307
319
|
Enabled: true
|
308
320
|
|
321
|
+
Style/NumberedParameters: # new in 1.22
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
Style/NumberedParametersLimit: # new in 1.22
|
325
|
+
Enabled: true
|
326
|
+
|
309
327
|
Style/NumericLiterals:
|
310
328
|
Enabled: false
|
311
|
-
|
329
|
+
|
312
330
|
Style/QuotedSymbols:
|
313
|
-
Enabled: true
|
331
|
+
Enabled: true
|
314
332
|
|
315
333
|
Style/RaiseArgs:
|
316
334
|
Enabled: true
|
@@ -323,9 +341,9 @@ Style/RedundantReturn:
|
|
323
341
|
|
324
342
|
Style/RedundantSelf:
|
325
343
|
Enabled: true
|
326
|
-
|
344
|
+
|
327
345
|
Style/RedundantSelfAssignmentBranch:
|
328
|
-
Enabled: true
|
346
|
+
Enabled: true
|
329
347
|
|
330
348
|
Style/RegexpLiteral:
|
331
349
|
Enabled: false
|
@@ -333,6 +351,9 @@ Style/RegexpLiteral:
|
|
333
351
|
Style/PercentLiteralDelimiters:
|
334
352
|
Enabled: false
|
335
353
|
|
354
|
+
Style/SelectByRegexp: # new in 1.22
|
355
|
+
Enabled: true
|
356
|
+
|
336
357
|
Style/StderrPuts:
|
337
358
|
Enabled: false
|
338
359
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [0.4.05] - 2021-10-10
|
2
|
+
- Removal of `Literal` class, code restyling to please Rubocop 1.22
|
3
|
+
|
4
|
+
### Changed
|
5
|
+
- Class `Scanner` remove all dependencies to `Frontend::Literal` class
|
6
|
+
- File `.rubocop.yml` added new cops from Rubocop 1.21 and 1.22
|
7
|
+
- File `parser_spec.rb` use of parentheses in ambiguous expressions
|
8
|
+
- File `raw_parser_spec.rb` use of parentheses in ambiguous expressions
|
9
|
+
- File `loxxy.gemspec` forced dependency to Rley 0.8.06
|
10
|
+
|
1
11
|
## [0.4.04] - 2021-09-11
|
2
12
|
- Grammar optimization (3 rules less, use of match_closest feature from `Rley`)
|
3
13
|
|
@@ -4,7 +4,6 @@ require 'strscan'
|
|
4
4
|
require 'rley'
|
5
5
|
require_relative '../error'
|
6
6
|
require_relative '../datatype/all_datatypes'
|
7
|
-
require_relative 'literal'
|
8
7
|
|
9
8
|
module Loxxy
|
10
9
|
module FrontEnd
|
@@ -142,7 +141,7 @@ module Loxxy
|
|
142
141
|
col = scanner.pos - lex_length - @line_start + 1
|
143
142
|
pos = Rley::Lexical::Position.new(@lineno, col)
|
144
143
|
if value
|
145
|
-
token = Literal.new(value, aLexeme.dup, symb, pos)
|
144
|
+
token = Rley::Lexical::Literal.new(value, aLexeme.dup, symb, pos)
|
146
145
|
else
|
147
146
|
token = Rley::Lexical::Token.new(aLexeme.dup, symb, pos)
|
148
147
|
end
|
@@ -212,7 +211,7 @@ module Loxxy
|
|
212
211
|
pos = Rley::Lexical::Position.new(line, column_start)
|
213
212
|
lox_string = Datatype::LXString.new(literal)
|
214
213
|
lexeme = scanner.string[scan_pos - 1..scanner.pos - 1]
|
215
|
-
Literal.new(lox_string, lexeme, 'STRING', pos)
|
214
|
+
Rley::Lexical::Literal.new(lox_string, lexeme, 'STRING', pos)
|
216
215
|
end
|
217
216
|
|
218
217
|
# Skip non-significant whitespaces and comments.
|
data/lib/loxxy/version.rb
CHANGED
data/loxxy.gemspec
CHANGED
@@ -58,7 +58,7 @@ Gem::Specification.new do |spec|
|
|
58
58
|
PkgExtending.pkg_documentation(spec)
|
59
59
|
|
60
60
|
# Runtime dependencies
|
61
|
-
spec.add_dependency 'rley', '~> 0.8.
|
61
|
+
spec.add_dependency 'rley', '~> 0.8.06'
|
62
62
|
|
63
63
|
# Development dependencies
|
64
64
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
@@ -105,7 +105,7 @@ LOX_END
|
|
105
105
|
it 'should recognize a false boolean token' do
|
106
106
|
subject.start_with('false')
|
107
107
|
token_false = subject.tokens[0]
|
108
|
-
expect(token_false).to be_kind_of(Literal)
|
108
|
+
expect(token_false).to be_kind_of(Rley::Lexical::Literal)
|
109
109
|
expect(token_false.terminal).to eq('FALSE')
|
110
110
|
expect(token_false.lexeme).to eq('false')
|
111
111
|
expect(token_false.value).to be_kind_of(Datatype::False)
|
@@ -115,7 +115,7 @@ LOX_END
|
|
115
115
|
it 'should recognize a true boolean token' do
|
116
116
|
subject.start_with('true')
|
117
117
|
token_true = subject.tokens[0]
|
118
|
-
expect(token_true).to be_kind_of(Literal)
|
118
|
+
expect(token_true).to be_kind_of(Rley::Lexical::Literal)
|
119
119
|
expect(token_true.terminal).to eq('TRUE')
|
120
120
|
expect(token_true.lexeme).to eq('true')
|
121
121
|
expect(token_true.value).to be_kind_of(Datatype::True)
|
@@ -137,7 +137,7 @@ LOX_END
|
|
137
137
|
|
138
138
|
subject.start_with(input)
|
139
139
|
subject.tokens[0..-2].each_with_index do |tok, i|
|
140
|
-
expect(tok).to be_kind_of(Literal)
|
140
|
+
expect(tok).to be_kind_of(Rley::Lexical::Literal)
|
141
141
|
expect(tok.terminal).to eq('NUMBER')
|
142
142
|
(lexeme, val) = expectations[i]
|
143
143
|
expect(tok.lexeme).to eq(lexeme)
|
@@ -177,10 +177,10 @@ LOX_END
|
|
177
177
|
tokens = subject.tokens[0..-2]
|
178
178
|
expect(tokens[0]).to be_kind_of(Rley::Lexical::Token)
|
179
179
|
expect(tokens[0].terminal).to eq('DOT')
|
180
|
-
expect(tokens[1]).to be_kind_of(Literal)
|
180
|
+
expect(tokens[1]).to be_kind_of(Rley::Lexical::Literal)
|
181
181
|
expect(tokens[1].terminal).to eq('NUMBER')
|
182
182
|
expect(tokens[1].value.value).to eq(456)
|
183
|
-
expect(tokens[2]).to be_kind_of(Literal)
|
183
|
+
expect(tokens[2]).to be_kind_of(Rley::Lexical::Literal)
|
184
184
|
expect(tokens[2].terminal).to eq('NUMBER')
|
185
185
|
expect(tokens[2].value.value).to eq(123)
|
186
186
|
expect(tokens[3]).to be_kind_of(Rley::Lexical::Token)
|
@@ -202,7 +202,7 @@ LOX_END
|
|
202
202
|
|
203
203
|
subject.start_with(input)
|
204
204
|
subject.tokens[0..-2].each_with_index do |str, i|
|
205
|
-
expect(str).to be_kind_of(Literal)
|
205
|
+
expect(str).to be_kind_of(Rley::Lexical::Literal)
|
206
206
|
expect(str.terminal).to eq('STRING')
|
207
207
|
val = expectations[i]
|
208
208
|
expect(str.value).to be_kind_of(Datatype::LXString)
|
@@ -236,7 +236,7 @@ LOX_END
|
|
236
236
|
it 'should recognize a nil token' do
|
237
237
|
subject.start_with('nil')
|
238
238
|
token_nil = subject.tokens[0]
|
239
|
-
expect(token_nil).to be_kind_of(Literal)
|
239
|
+
expect(token_nil).to be_kind_of(Rley::Lexical::Literal)
|
240
240
|
expect(token_nil.terminal).to eq('NIL')
|
241
241
|
expect(token_nil.lexeme).to eq('nil')
|
242
242
|
expect(token_nil.value).to be_kind_of(Datatype::Nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loxxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.05
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-10 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.8.
|
19
|
+
version: 0.8.06
|
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.8.
|
26
|
+
version: 0.8.06
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,7 +139,6 @@ files:
|
|
139
139
|
- lib/loxxy/datatype/true.rb
|
140
140
|
- lib/loxxy/error.rb
|
141
141
|
- lib/loxxy/front_end/grammar.rb
|
142
|
-
- lib/loxxy/front_end/literal.rb
|
143
142
|
- lib/loxxy/front_end/parser.rb
|
144
143
|
- lib/loxxy/front_end/raw_parser.rb
|
145
144
|
- lib/loxxy/front_end/scanner.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rley'
|
4
|
-
|
5
|
-
module Loxxy
|
6
|
-
module FrontEnd
|
7
|
-
# The superclass for all tokens that have a data value.
|
8
|
-
class Literal < Rley::Lexical::Token
|
9
|
-
# @return [Datatype] The value expressed in one of the Lox datatype.
|
10
|
-
attr_reader :value
|
11
|
-
|
12
|
-
# Constructor.
|
13
|
-
# @param aValue [Datatype::BuiltinDatatype] the Lox data value
|
14
|
-
# @param aLexeme [String] the lexeme (= piece of text from input)
|
15
|
-
# @param aTerminal [Rley::Syntax::Terminal, String]
|
16
|
-
# The terminal symbol corresponding to the lexeme.
|
17
|
-
# @param aPosition [Rley::Lexical::Position] The position of lexeme
|
18
|
-
# in input text.
|
19
|
-
def initialize(aValue, aLexeme, aTerminal, aPosition)
|
20
|
-
super(aLexeme, aTerminal, aPosition)
|
21
|
-
@value = aValue
|
22
|
-
end
|
23
|
-
end # class
|
24
|
-
end # module
|
25
|
-
end # module
|