c_lexer 2.5.1.0.pre2 → 2.5.1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d69239c3a8e5a8d86fab7c3063f55851e09e5f6e2833f3e1ffb6d16e26fea0b6
4
- data.tar.gz: dd48e4a13c3c5a680d66ff07c216c4da3cfa25cc87045c0ff2e28cc91776bb22
3
+ metadata.gz: 2aa70c7302bb2c3d91d446772112620e4a3a0c40050efc61f518d979fd5359ff
4
+ data.tar.gz: 80b00518e752b299c9ad61431eba14b0152f915181b715f2791a4955f46ccac0
5
5
  SHA512:
6
- metadata.gz: 34621afed4269fc3085add014b888c6a73638e3892cf3ce450c7320f1547fc6478b1fec80d7d490d90510c5d480b481c14d31fa53c69bb90b1257f170c1abc1e
7
- data.tar.gz: 966eb6204c101554301a60a36105fc3413226a2332a233d694fd0f340b40fa5d0bc137782ca97312046ae15911570c15e5b800d685642e75cfaa3df63748f574
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.pre2)
4
+ c_lexer (2.5.1.2.0)
5
5
  ast (~> 2.4.0)
6
- parser (= 2.5.1.0)
6
+ parser (= 2.5.1.2)
7
7
 
8
8
  PATH
9
9
  remote: vendor/parser
10
10
  specs:
11
- parser (2.5.1.0)
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
- This project is still under development.
10
+ Can be use on Linux/Mac/Windows, requires MRI.
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```
15
- $ git submodule update --init
16
- $ bundle install
17
- $ rake
15
+ $ gem install c_lexer
18
16
  ```
19
17
 
20
18
  ## Usage
21
19
 
22
- Simply require `c_lexer` after `parser` in your code.
23
- It should print `Using C lexer`.
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.0'
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'