code-ruby-parser 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7be9be5426011877d3bcce30e8d1c79910519029c9af78dcb68f693d634aba6
4
- data.tar.gz: 744449bccfc4e058222b17d27d1402f134012dfb87c2a66239c82ee7802c0003
3
+ metadata.gz: b3e647bf3d41f5621be93a7310057002d71ea02eef1b6a5a6eed283d5ff43939
4
+ data.tar.gz: 79f489764b7917e8692cae7227f7f895b0104c59465fbcf52f34f0886e2c2d3b
5
5
  SHA512:
6
- metadata.gz: 7a6d4f47443b3f99b59b3045c6c375e5013e7b0afc0a7bb1f34d5bf42f668c0830985ee0fe08253691ab09077e035858ae78d21fe46c69489286121731c50402
7
- data.tar.gz: 8a1e76fd57dfad95201f0259b962bdfea907fac4f92704e6af2dc9eee3450d1d0cea35ba55cc348762b91d606152a6fbd1cb30249b31f7993abb5d46eab6aa24
6
+ metadata.gz: b9bc1d2ccda202cc1da972babdcaaf96418f6e17ccce5247d840fad78b478cd300f0780933a5a6b20f659c7c96dcaac4334597610a9162eeb64d453666e744a5
7
+ data.tar.gz: b08df0949e99f19a10f5a932d975bf4d67941987a873214cf5d56d001052cf7f08dbf9732140a3fc6fb852d7df67c82cba1019e49870960c622c1a56b3ccd28d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.1.5 - November 13, 2022
2
+
3
+ - Restrict equal to simplify
4
+
1
5
  ### 0.1.4 - November 13, 2022
2
6
 
3
7
  - Fix a || b
data/bin/parse-docs ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ for f in docs/*.code
4
+ do
5
+ bin/code-parser -i $f
6
+ done
@@ -2,13 +2,13 @@ class Code
2
2
  class Parser
3
3
  class Equal < ::Code::Parser
4
4
  def parse
5
- left = parse_subclass(::Code::Parser::Rescue)
6
-
7
5
  previous_cursor = cursor
8
6
 
7
+ left = parse_left
8
+
9
9
  comments_before = parse_comments
10
10
 
11
- if operator = match(EQUALS)
11
+ if left && operator = match(EQUALS)
12
12
  comments_after = parse_comments
13
13
 
14
14
  right = parse_subclass(::Code::Parser::Equal)
@@ -25,7 +25,36 @@ class Code
25
25
  else
26
26
  @cursor = previous_cursor
27
27
  buffer!
28
- left
28
+ parse_next
29
+ end
30
+ else
31
+ @cursor = previous_cursor
32
+ buffer!
33
+ parse_next
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ def parse_next
40
+ parse_subclass(::Code::Parser::Rescue)
41
+ end
42
+
43
+ def parse_left
44
+ left = parse_subclass(::Code::Parser::Name)
45
+ return unless left
46
+
47
+ previous_cursor = cursor
48
+ comments_before = parse_comments
49
+
50
+ if match(DOT) || match(COLON + COLON)
51
+ right = parse_subclass(::Code::Parser::Name)
52
+ if right
53
+ { left: left, right: right }
54
+ else
55
+ @cursor = previous_cursor
56
+ buffer!
57
+ return
29
58
  end
30
59
  else
31
60
  @cursor = previous_cursor
@@ -1,6 +1,6 @@
1
1
  class Template
2
2
  class Parser < ::Code::Parser
3
- Version = Gem::Version.new("0.1.4")
3
+ Version = Gem::Version.new("0.1.5")
4
4
 
5
5
  def parse
6
6
  parts = []
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
@@ -23,6 +23,7 @@ files:
23
23
  - Gemfile.lock
24
24
  - bin/code-parser
25
25
  - bin/format
26
+ - bin/parse-docs
26
27
  - bin/push
27
28
  - bin/template-parser
28
29
  - code-ruby-parser.gemspec