lexical_analyzer 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -5
- data/images/lexical_process.png +0 -0
- data/lexical_analyzer.gemspec +1 -1
- data/lib/lexical_analyzer/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd35696f4d5750cc7ea28dbd6da1fea8ac798bb
|
4
|
+
data.tar.gz: 62643fad63d6447ff424591674a15b86e9e380ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d712d947aba827f92e780b4dc8a2d0b2cc8d65eb58cc31857b1c6521f9402e02b95c0059259de969bad5896c1946d3080b7cdd5da950fdb76c8ba8b20e4d167
|
7
|
+
data.tar.gz: efee0aedb08edeaed16acced97b2531c95ffced80ef42b2806bb6caf2e40ae90e5a584ac6ff72ff9cc4bf7d46cf3528656cb9fc837747f6c868ee4b2cb9af013
|
data/README.md
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
# LexicalAnalyzer
|
2
2
|
|
3
|
-
The lexical analyzer is a component of the Ruby Compiler Toolkit Project
|
4
|
-
scans an input text against an array of rules and generating the lexical
|
5
|
-
tokens that it detects.
|
6
|
-
|
7
|
-
|
3
|
+
The lexical analyzer is a component of the Ruby Compiler Toolkit Project (rctp)
|
4
|
+
that scans an input text against an array of rules and generating the lexical
|
5
|
+
tokens that it detects. This process is shown below:
|
6
|
+
|
7
|
+
![The Lexical Process](./images/lexical_process.png)
|
8
|
+
|
9
|
+
In general, each time the lexical_analyzer receives the "get" message, it tries
|
10
|
+
to extract another token from the source text. As such, the lexical analyzer
|
11
|
+
gem component is the first stage of the compilation process for a compiler
|
12
|
+
built using the rctp. With its array of lexical rules it provides the language
|
13
|
+
tokens needed to operate the compiler's parser.
|
14
|
+
|
15
|
+
The lexical analyzer is normally used in conjunction with a parse queue object
|
16
|
+
which handles queuing of tokens and back tracking of the compile process when
|
17
|
+
needed. In the rcpt this is done by the gem
|
18
|
+
[parse_queue](https://github.com/PeterCamilleri/parse_queue).
|
8
19
|
|
9
20
|
## Installation
|
10
21
|
|
@@ -76,10 +87,14 @@ Notes:
|
|
76
87
|
|
77
88
|
* The regular expression must begin with a \A clause to ensure correct
|
78
89
|
operation of the analyzer.
|
90
|
+
* An exception to the above is the use of the expression /.+/ at the end of the
|
91
|
+
rule list as a sort of lexical "else" catch-all clause.
|
79
92
|
* The order of rules is important. For example, if there are two rules
|
80
93
|
looking for "==" and "=" respectively, if the "=" is ahead of the "==" rule
|
81
94
|
in the array the "==" rule will never trigger and the analysis will be
|
82
95
|
incorrect.
|
96
|
+
* The method LexicalRule#symbol is a read accessor for the symbol property of
|
97
|
+
the lexical rule.
|
83
98
|
|
84
99
|
#### Tokens
|
85
100
|
|
Binary file
|
data/lexical_analyzer.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.required_ruby_version = '>=2.3.0'
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.15"
|
23
|
-
spec.add_development_dependency "rake", "
|
23
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
24
24
|
spec.add_development_dependency "minitest", "~> 5.0"
|
25
25
|
spec.add_development_dependency 'minitest_visible', "~> 0.1"
|
26
26
|
spec.add_development_dependency 'reek', "~> 5.0.2"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lexical_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PeterCamilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
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: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- Gemfile
|
93
93
|
- LICENSE.txt
|
94
94
|
- README.md
|
95
|
+
- images/lexical_process.png
|
95
96
|
- lexical_analyzer.gemspec
|
96
97
|
- lib/lexical_analyzer.rb
|
97
98
|
- lib/lexical_analyzer/lexical_rule.rb
|