c_lexer 2.5.1.0.pre2 → 2.5.1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +42 -6
- data/c_lexer.gemspec +1 -1
- data/ext/lexer/lexer.c +1769 -1762
- data/ext/lexer/lexer.rl +6 -1
- data/lib/c_lexer/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa70c7302bb2c3d91d446772112620e4a3a0c40050efc61f518d979fd5359ff
|
4
|
+
data.tar.gz: 80b00518e752b299c9ad61431eba14b0152f915181b715f2791a4955f46ccac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83be810697851a7a3713d31680a4258972843c01cc572e18504d4108b3a638ade3600c8a0162fd27c4f5f1cc2abfdf56253bafc7f8ec1e0c833ee71109979627
|
7
|
+
data.tar.gz: 42dc3a52977f2ea9d880846a5ee75e8f854b4b9555d89a59eb3244d864de33d5d2b47baa66dd2dd8a17e91f1df2d7e5262b33b4661e0c565c2bcb447fbde4b5d
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
c_lexer (2.5.1.0
|
4
|
+
c_lexer (2.5.1.2.0)
|
5
5
|
ast (~> 2.4.0)
|
6
|
-
parser (= 2.5.1.
|
6
|
+
parser (= 2.5.1.2)
|
7
7
|
|
8
8
|
PATH
|
9
9
|
remote: vendor/parser
|
10
10
|
specs:
|
11
|
-
parser (2.5.1.
|
11
|
+
parser (2.5.1.2)
|
12
12
|
ast (~> 2.4.0)
|
13
13
|
|
14
14
|
GEM
|
data/README.md
CHANGED
@@ -7,21 +7,57 @@ A C port of the whitequark/parser's lexer.
|
|
7
7
|
|
8
8
|
Initially based on [whitequark/parser#248](https://github.com/whitequark/parser/pull/248) (thanks [@alexdowad](https://github.com/alexdowad)).
|
9
9
|
|
10
|
-
|
10
|
+
Can be use on Linux/Mac/Windows, requires MRI.
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
14
14
|
```
|
15
|
-
$
|
16
|
-
$ bundle install
|
17
|
-
$ rake
|
15
|
+
$ gem install c_lexer
|
18
16
|
```
|
19
17
|
|
20
18
|
## Usage
|
21
19
|
|
22
|
-
|
23
|
-
|
20
|
+
`c_lexer` doesn't change any parser classes.
|
21
|
+
|
22
|
+
It provides 2 classes:
|
23
|
+
+ `Parser::CLexer` (C version of the lexer)
|
24
|
+
+ `Parser::Ruby25WithCLexer` (a subclass of `parser/ruby25` that uses `Parser::CLexer` for lexing)
|
25
|
+
|
26
|
+
If you want `CLexer` to be a default lexer you can use the following patch:
|
27
|
+
|
28
|
+
``` ruby
|
29
|
+
require 'parser'
|
30
|
+
require 'c_lexer'
|
31
|
+
|
32
|
+
module Parser
|
33
|
+
dedenter = Lexer::Dedenter
|
34
|
+
|
35
|
+
remove_const(:Lexer)
|
36
|
+
Lexer = CLexer
|
37
|
+
Lexer::Dedenter = dedenter
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
## Versioning
|
42
|
+
|
43
|
+
`c_lexer` follows versioning of the `parser` gem to avoid confusions like
|
44
|
+
"which version of `c_lexer` should be used with the `parser vX.Y.Z`". For `parser 2.5.1.0` you should use `c_lexer 2.5.1.0`.
|
45
|
+
|
46
|
+
`c_lexer` supports all versions of `parser` starting from `2.5.1.0`
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
1. Make sure that you have `ragel` installed.
|
51
|
+
2. Clone the repo and fetch submodules with `git submodule update --init`.
|
52
|
+
3. The parser gem is located under `vendor/parser`.
|
53
|
+
4. `rake ruby_parser:generate` generates `lexer.rb` and parsers for the `parser` gem.
|
54
|
+
5. `rake c_lexer:generate` generates `lexer.c`.
|
55
|
+
6. `rake compile` compiles `lexer.c` to `lexer.so` (or `lexer.bundle` depending on your platform).
|
56
|
+
7. `rake test` runs `parser` tests using `c_lexer` as a default lexer.
|
24
57
|
|
25
58
|
## Contributing
|
26
59
|
|
27
60
|
Bug reports and pull requests are welcome on GitHub at https://github.com/opal/c_lexer.
|
61
|
+
|
62
|
+
Before submitting a bug report, please, make sure that `parser` is not affected by the same issue.
|
63
|
+
If it's a parser bug please report it to the parser repo and we will backport it afterwards.
|
data/c_lexer.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.extensions = ['ext/lexer/extconf.rb']
|
23
23
|
|
24
24
|
spec.add_dependency 'ast', '~> 2.4.0'
|
25
|
-
spec.add_dependency 'parser', '= 2.5.1.
|
25
|
+
spec.add_dependency 'parser', '= 2.5.1.2'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|