packcr 0.0.6 → 0.0.8

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +73 -0
  4. data/lib/packcr/cli.rb +18 -16
  5. data/lib/packcr/code_block.rb +0 -1
  6. data/lib/packcr/context.rb +20 -18
  7. data/lib/packcr/generated/context.rb +483 -0
  8. data/lib/packcr/generated/node/action_node.rb +60 -0
  9. data/lib/packcr/generated/node/alternate_node.rb +98 -0
  10. data/lib/packcr/generated/node/capture_node.rb +39 -0
  11. data/lib/packcr/generated/node/charclass_node.rb +372 -0
  12. data/lib/packcr/generated/node/eof_node.rb +20 -0
  13. data/lib/packcr/generated/node/error_node.rb +67 -0
  14. data/lib/packcr/generated/node/expand_node.rb +30 -0
  15. data/lib/packcr/generated/node/predicate_node.rb +140 -0
  16. data/lib/packcr/generated/node/quantity_node.rb +166 -0
  17. data/lib/packcr/generated/node/reference_node.rb +70 -0
  18. data/lib/packcr/generated/node/rule_node.rb +63 -0
  19. data/lib/packcr/generated/node/sequence_node.rb +42 -0
  20. data/lib/packcr/generated/node/string_node.rb +60 -0
  21. data/lib/packcr/generator.rb +2 -1
  22. data/lib/packcr/node/action_node.rb +4 -2
  23. data/lib/packcr/node/alternate_node.rb +3 -1
  24. data/lib/packcr/node/capture_node.rb +3 -1
  25. data/lib/packcr/node/charclass_node.rb +24 -28
  26. data/lib/packcr/node/eof_node.rb +4 -2
  27. data/lib/packcr/node/error_node.rb +3 -1
  28. data/lib/packcr/node/expand_node.rb +8 -5
  29. data/lib/packcr/node/predicate_node.rb +4 -2
  30. data/lib/packcr/node/quantity_node.rb +12 -10
  31. data/lib/packcr/node/reference_node.rb +11 -5
  32. data/lib/packcr/node/root_node.rb +1 -0
  33. data/lib/packcr/node/rule_node.rb +7 -4
  34. data/lib/packcr/node/sequence_node.rb +3 -1
  35. data/lib/packcr/node/string_node.rb +9 -6
  36. data/lib/packcr/node.rb +3 -5
  37. data/lib/packcr/parser.rb +4389 -4064
  38. data/lib/packcr/stream.rb +17 -12
  39. data/lib/packcr/templates/context/header.c.erb +3 -3
  40. data/lib/packcr/templates/context/source.c.erb +481 -690
  41. data/lib/packcr/templates/context/source.rb.erb +123 -171
  42. data/lib/packcr/templates/node/action.c.erb +5 -5
  43. data/lib/packcr/templates/node/action.rb.erb +2 -2
  44. data/lib/packcr/templates/node/alternate.c.erb +9 -9
  45. data/lib/packcr/templates/node/alternate.rb.erb +4 -5
  46. data/lib/packcr/templates/node/capture.c.erb +7 -7
  47. data/lib/packcr/templates/node/capture.rb.erb +4 -4
  48. data/lib/packcr/templates/node/charclass.c.erb +12 -12
  49. data/lib/packcr/templates/node/charclass.rb.erb +6 -6
  50. data/lib/packcr/templates/node/charclass_any.c.erb +3 -3
  51. data/lib/packcr/templates/node/charclass_any.rb.erb +2 -2
  52. data/lib/packcr/templates/node/charclass_fail.c.erb +1 -1
  53. data/lib/packcr/templates/node/charclass_one.c.erb +10 -10
  54. data/lib/packcr/templates/node/charclass_one.rb.erb +6 -6
  55. data/lib/packcr/templates/node/charclass_utf8.c.erb +8 -8
  56. data/lib/packcr/templates/node/charclass_utf8.rb.erb +3 -3
  57. data/lib/packcr/templates/node/charclass_utf8_reverse.rb.erb +5 -5
  58. data/lib/packcr/templates/node/eof.c.erb +1 -1
  59. data/lib/packcr/templates/node/error.c.erb +11 -11
  60. data/lib/packcr/templates/node/error.rb.erb +2 -2
  61. data/lib/packcr/templates/node/expand.c.erb +5 -5
  62. data/lib/packcr/templates/node/expand.rb.erb +3 -3
  63. data/lib/packcr/templates/node/predicate.c.erb +10 -10
  64. data/lib/packcr/templates/node/predicate.rb.erb +6 -6
  65. data/lib/packcr/templates/node/predicate_neg.c.erb +8 -8
  66. data/lib/packcr/templates/node/predicate_neg.rb.erb +6 -6
  67. data/lib/packcr/templates/node/quantity_many.c.erb +47 -0
  68. data/lib/packcr/templates/node/{quantify_many.rb.erb → quantity_many.rb.erb} +9 -9
  69. data/lib/packcr/templates/node/quantity_one.c.erb +23 -0
  70. data/lib/packcr/templates/node/{quantify_one.rb.erb → quantity_one.rb.erb} +8 -8
  71. data/lib/packcr/templates/node/reference.c.erb +14 -2
  72. data/lib/packcr/templates/node/reference.rb.erb +16 -4
  73. data/lib/packcr/templates/node/reference_reverse.rb.erb +16 -4
  74. data/lib/packcr/templates/node/rule.c.erb +14 -7
  75. data/lib/packcr/templates/node/rule.rb.erb +26 -19
  76. data/lib/packcr/templates/node/string_many.c.erb +6 -6
  77. data/lib/packcr/templates/node/string_many.rb.erb +3 -3
  78. data/lib/packcr/templates/node/string_one.c.erb +5 -5
  79. data/lib/packcr/templates/node/string_one.rb.erb +3 -3
  80. data/lib/packcr/util.rb +21 -16
  81. data/lib/packcr/version.rb +1 -1
  82. data/lib/packcr.rb +8 -11
  83. metadata +40 -10
  84. data/lib/packcr/templates/node/quantify_many.c.erb +0 -45
  85. data/lib/packcr/templates/node/quantify_one.c.erb +0 -21
  86. data/lib/packcr/tokenizer.rb +0 -2948
@@ -1,19 +1,26 @@
1
- PCC_DEBUG(ctx->auxil, PCC_DBG_EVALUATE, "<%= name %>", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->buffer.len - chunk->pos));
1
+ static packcr_thunk_chunk_t *packcr_evaluate_rule_<%= name %>(packcr_context_t *ctx, size_t offset<% if gen.location %>, packcr_location_t offset_loc<% end %>, packcr_rule_set_t *limits) {
2
+ packcr_thunk_chunk_t *const chunk = packcr_thunk_chunk__create(ctx);
3
+ chunk->pos = ctx->position_offset;
4
+ <%- if gen.location -%>
5
+ chunk->pos_loc = ctx->position_offset_loc;
6
+ <%- end -%>
7
+ PACKCR_DEBUG(ctx->auxil, PACKCR_DBG_EVALUATE, "<%= name %>", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->buffer.len - chunk->pos));
2
8
  ctx->level++;
3
- pcc_value_table__resize(ctx->auxil, &chunk->values, <%= vars.length %>);
4
- pcc_capture_table__resize(ctx->auxil, &chunk->capts, <%= capts.length %>);
9
+ packcr_value_table__resize(ctx->auxil, &chunk->values, <%= vars.length %>);
10
+ packcr_capture_table__resize(ctx->auxil, &chunk->capts, <%= capts.length %>);
5
11
  <%- if vars.length > 0 -%>
6
- pcc_value_table__clear(ctx->auxil, &chunk->values);
12
+ packcr_value_table__clear(ctx->auxil, &chunk->values);
7
13
  <%- end -%>
8
14
  <%- r = expr.reachability -%>
9
15
  <%- -%><%= gen.generate_code(expr, 0, 4, false) -%>
10
16
  ctx->level--;
11
- PCC_DEBUG(ctx->auxil, PCC_DBG_MATCH, "<%= name %>", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->cur - chunk->pos));
17
+ PACKCR_DEBUG(ctx->auxil, PACKCR_DBG_MATCH, "<%= name %>", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->position_offset - chunk->pos));
12
18
  return chunk;
13
19
  <%- if r != Packcr::CODE_REACH__ALWAYS_SUCCEED -%>
14
20
  L0000:;
15
21
  ctx->level--;
16
- PCC_DEBUG(ctx->auxil, PCC_DBG_NOMATCH, "<%= name %>", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->cur - chunk->pos));
17
- pcc_thunk_chunk__destroy(ctx, chunk);
22
+ PACKCR_DEBUG(ctx->auxil, PACKCR_DBG_NOMATCH, "<%= name %>", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->position_offset - chunk->pos));
23
+ packcr_thunk_chunk__destroy(ctx, chunk);
18
24
  return NULL;
19
25
  <%- end -%>
26
+ }
@@ -1,23 +1,30 @@
1
- debug { warn "#{ " " * @level}EVAL <%= name %> #{answer.pos} #{@buffer[answer.pos..-1].inspect}" }
2
- @level += 1
3
- answer.resize_captures(<%= capts.length %>)
4
- <%- if vars.length > 0 -%>
5
- answer.values = {}
6
- <%- end -%>
7
- <%- r = expr.reachability -%>
8
- <%- if r == Packcr::CODE_REACH__ALWAYS_SUCCEED -%>
9
- <%- -%><%= gen.generate_code(expr, 0, 0, false) -%>
10
- @level -= 1
11
- debug { warn "#{ " " * @level}MATCH <%= name %> #{answer.pos} #{@buffer[answer.pos...@cur].inspect}" }
12
- return answer
13
- <%- else -%>
14
- catch(0) do
1
+ def evaluate_rule_<%= name %>(offset<% if gen.location %>, offset_loc<% end %>, limits: nil)
2
+ answer = ThunkChunk.new
3
+ answer.pos = @position_offset
4
+ <%- if gen.location -%>
5
+ answer.pos_loc = @position_offset_loc
6
+ <%- end -%>
7
+ debug { warn "#{ " " * @level}EVAL <%= name %> #{answer.pos} #{@buffer[answer.pos..-1].inspect}" }
8
+ @level += 1
9
+ answer.resize_captures(<%= capts.length %>)
10
+ <%- if vars.length > 0 -%>
11
+ answer.values = {}
12
+ <%- end -%>
13
+ <%- r = expr.reachability -%>
14
+ <%- if r == Packcr::CODE_REACH__ALWAYS_SUCCEED -%>
15
15
  <%- -%><%= gen.generate_code(expr, 0, 2, false) -%>
16
16
  @level -= 1
17
- debug { warn "#{ " " * @level}MATCH <%= name %> #{answer.pos} #{@buffer[answer.pos...@cur].inspect}" }
17
+ debug { warn "#{ " " * @level}MATCH <%= name %> #{answer.pos} #{@buffer[answer.pos...@position_offset].inspect}" }
18
18
  return answer
19
+ <%- else -%>
20
+ catch(0) do
21
+ <%- -%><%= gen.generate_code(expr, 0, 4, false) -%>
22
+ @level -= 1
23
+ debug { warn "#{ " " * @level}MATCH <%= name %> #{answer.pos} #{@buffer[answer.pos...@position_offset].inspect}" }
24
+ return answer
25
+ end
26
+ @level -= 1
27
+ debug { warn "#{ " " * @level}NOMATCH <%= name %> #{answer.pos} #{@buffer[answer.pos...@position_offset].inspect}" }
28
+ return nil
29
+ <%- end -%>
19
30
  end
20
- @level -= 1
21
- debug { warn "#{ " " * @level}NOMATCH <%= name %> #{answer.pos} #{@buffer[answer.pos...@cur].inspect}" }
22
- return nil
23
- <%- end -%>
@@ -1,11 +1,11 @@
1
1
  if (
2
- pcc_refill_buffer(ctx, <%= n %>) < <%= n %> ||
2
+ packcr_refill_buffer(ctx, <%= n %>) < <%= n %> ||
3
3
  <%- (n - 1).times do |i| -%>
4
- (ctx->buffer.buf + ctx->cur)[<%= i %>] != '<%= Packcr.escape_character(value[i]) %>' ||
4
+ (ctx->buffer.buf + ctx->position_offset)[<%= i %>] != '<%= Packcr.escape_character(value[i]) %>' ||
5
5
  <%- end -%>
6
- (ctx->buffer.buf + ctx->cur)[<%= n - 1 %>] != '<%= s = Packcr.escape_character(value[n - 1]) %>'
7
- ) goto L<%= "%04d" % onfail %>;
6
+ (ctx->buffer.buf + ctx->position_offset)[<%= n - 1 %>] != '<%= Packcr.escape_character(value[n - 1]) %>'
7
+ ) goto L<%= format("%04d", onfail) %>;
8
8
  <%- if gen.location -%>
9
- pcc_location_forward(&ctx->cur_loc, ctx->buffer.buf + ctx->cur, n);
9
+ packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, <%= n %>);
10
10
  <%- end -%>
11
- ctx->cur += <%= n %>;
11
+ ctx->position_offset += <%= n %>;
@@ -1,10 +1,10 @@
1
1
  if (
2
2
  refill_buffer(<%= n %>) < <%= n %> ||
3
- @buffer[@cur, <%= n %>] != <%= value[0, n].dump %>
3
+ @buffer[@position_offset, <%= n %>] != <%= value[0, n].dump %>
4
4
  )
5
5
  throw(<%= onfail %>)
6
6
  end
7
7
  <%- if gen.location -%>
8
- @cur_loc = @cur_loc.forward(@buffer, @cur, <%= n %>)
8
+ @position_offset_loc = @position_offset_loc.forward(@buffer, @position_offset, <%= n %>)
9
9
  <%- end -%>
10
- @cur += <%= n %>
10
+ @position_offset += <%= n %>
@@ -1,8 +1,8 @@
1
1
  if (
2
- pcc_refill_buffer(ctx, 1) < 1 ||
3
- ctx->buffer.buf[ctx->cur] != '<%= Packcr.escape_character(value[0]) %>'
4
- ) goto L<%= "%04d" % onfail %>;
2
+ packcr_refill_buffer(ctx, 1) < 1 ||
3
+ ctx->buffer.buf[ctx->position_offset] != '<%= Packcr.escape_character(value[0]) %>'
4
+ ) goto L<%= format("%04d", onfail) %>;
5
5
  <%- if gen.location -%>
6
- pcc_location_forward(&ctx->cur_loc, ctx->buffer.buf + ctx->cur, 1);
6
+ packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);
7
7
  <%- end -%>
8
- ctx->cur++;
8
+ ctx->position_offset++;
@@ -1,10 +1,10 @@
1
1
  if (
2
2
  refill_buffer(1) < 1 ||
3
- @buffer[@cur] != "<%= Packcr.escape_character(value[0]) %>"
3
+ @buffer[@position_offset] != "<%= Packcr.escape_character(value[0]) %>"
4
4
  )
5
5
  throw(<%= onfail %>)
6
6
  end
7
7
  <%- if gen.location -%>
8
- @cur_loc = @cur_loc.forward(@buffer, @cur, 1)
8
+ @position_offset_loc = @position_offset_loc.forward(@buffer, @position_offset, 1)
9
9
  <%- end -%>
10
- @cur += 1
10
+ @position_offset += 1
data/lib/packcr/util.rb CHANGED
@@ -5,10 +5,10 @@ class Packcr
5
5
  def unescape_string(str, is_charclass)
6
6
  if is_charclass
7
7
  str.gsub!("\\" * 2) { "\\" * 4 }
8
- str.gsub!("\"" ) { "\\\"" }
9
8
  end
9
+ str.gsub!("\"") { "\\\"" }
10
10
  str.gsub!(/\\(.)/) do
11
- c = $1
11
+ c = ::Regexp.last_match(1)
12
12
  case c
13
13
  when "0"
14
14
  "\\x00"
@@ -19,7 +19,7 @@ class Packcr
19
19
  end
20
20
  end
21
21
  str.gsub!(/[^\x00-\x7f]/) do
22
- "\\x%02x" % $&.ord
22
+ format("\\x%02x", ::Regexp.last_match(0).ord)
23
23
  end
24
24
  str.replace "\"#{str}\"".undump
25
25
  end
@@ -31,19 +31,20 @@ class Packcr
31
31
  def escape_string(str)
32
32
  str = str.b
33
33
  str.gsub(/(\0+)|(\e+)|("+)|('+)|(\\+)|((?:(?![\0\e"'\\])[ -~])+)|([\x01-\x1a\x1c-\x1f\x7f-\xff]+)/n) do
34
- n = $&.size
35
- next "\\0" * n if $1
36
- next "\\x1b" * n if $2
37
- next "\\\"" * n if $3
38
- next "\\\'" * n if $4
39
- next "\\\\" * n if $5
40
- next $6 if $6
41
- $7.dump[1..-2].downcase
34
+ n = ::Regexp.last_match(0).size
35
+ next "\\0" * n if ::Regexp.last_match(1)
36
+ next "\\x1b" * n if ::Regexp.last_match(2)
37
+ next "\\\"" * n if ::Regexp.last_match(3)
38
+ next "\\'" * n if ::Regexp.last_match(4)
39
+ next "\\\\" * n if ::Regexp.last_match(5)
40
+ next ::Regexp.last_match(6) if ::Regexp.last_match(6)
41
+
42
+ ::Regexp.last_match(7).dump[1..-2].downcase
42
43
  end
43
44
  end
44
45
 
45
46
  def dump_integer_value(value)
46
- if value == nil
47
+ if value.nil?
47
48
  $stdout.print "void"
48
49
  else
49
50
  $stdout.print value
@@ -62,8 +63,8 @@ class Packcr
62
63
  offset = 0
63
64
  spaces.tr!("\v\f", " ")
64
65
  spaces.gsub!(/\t+/) do
65
- chars = $`.length
66
- o = 8 * $&.length - (offset + chars) % 8
66
+ chars = ::Regexp.last_match.pre_match.length
67
+ o = (8 * ::Regexp.last_match(0).length) - ((offset + chars) % 8)
67
68
  offset = (7 - chars) % 8
68
69
  " " * o
69
70
  end
@@ -75,15 +76,19 @@ class Packcr
75
76
  erb = ERB.new(File.read(template_path), trim_mode: "%-")
76
77
  erb.filename = template_path
77
78
  result = erb.result(b)
79
+ format_code(result, indent: indent, unwrap: unwrap)
80
+ end
81
+
82
+ def format_code(result, indent: 0, unwrap: false)
78
83
  if unwrap
79
84
  result.gsub!(/\A\{|\}\z/, "")
80
85
  indent -= 4
81
86
  end
82
87
  result.gsub!(/^(?!$)/, " " * indent)
83
- result.gsub!(/^( *?) {0,4}<<<</) { $1 }
88
+ result.gsub!(/^( *?) {0,4}<<<</) { ::Regexp.last_match(1) }
84
89
  result
85
90
  end
86
91
  end
87
92
 
88
93
  extend Util
89
- end
94
+ end
@@ -1,3 +1,3 @@
1
1
  class Packcr
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.8".freeze
3
3
  end
data/lib/packcr.rb CHANGED
@@ -1,14 +1,3 @@
1
- class Packcr
2
- end
3
-
4
- require "packcr/util"
5
- require "packcr/code_block"
6
- require "packcr/stream"
7
- require "packcr/generator"
8
- require "packcr/node"
9
- require "packcr/context"
10
- require "packcr/version"
11
-
12
1
  class Packcr
13
2
  CODE_REACH__BOTH = 0
14
3
  CODE_REACH__ALWAYS_SUCCEED = 1
@@ -30,3 +19,11 @@ class Packcr
30
19
  end
31
20
  end
32
21
  end
22
+
23
+ require "packcr/util"
24
+ require "packcr/code_block"
25
+ require "packcr/stream"
26
+ require "packcr/generator"
27
+ require "packcr/node"
28
+ require "packcr/context"
29
+ require "packcr/version"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packcr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - wanabe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-19 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.43.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.43.0
55
69
  description:
56
70
  email:
57
71
  executables:
@@ -59,12 +73,28 @@ executables:
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
76
+ - LICENSE
77
+ - README.md
62
78
  - exe/packcr
63
79
  - lib/packcr.rb
64
80
  - lib/packcr/broadcast.rb
65
81
  - lib/packcr/cli.rb
66
82
  - lib/packcr/code_block.rb
67
83
  - lib/packcr/context.rb
84
+ - lib/packcr/generated/context.rb
85
+ - lib/packcr/generated/node/action_node.rb
86
+ - lib/packcr/generated/node/alternate_node.rb
87
+ - lib/packcr/generated/node/capture_node.rb
88
+ - lib/packcr/generated/node/charclass_node.rb
89
+ - lib/packcr/generated/node/eof_node.rb
90
+ - lib/packcr/generated/node/error_node.rb
91
+ - lib/packcr/generated/node/expand_node.rb
92
+ - lib/packcr/generated/node/predicate_node.rb
93
+ - lib/packcr/generated/node/quantity_node.rb
94
+ - lib/packcr/generated/node/reference_node.rb
95
+ - lib/packcr/generated/node/rule_node.rb
96
+ - lib/packcr/generated/node/sequence_node.rb
97
+ - lib/packcr/generated/node/string_node.rb
68
98
  - lib/packcr/generator.rb
69
99
  - lib/packcr/node.rb
70
100
  - lib/packcr/node/action_node.rb
@@ -113,10 +143,10 @@ files:
113
143
  - lib/packcr/templates/node/predicate.rb.erb
114
144
  - lib/packcr/templates/node/predicate_neg.c.erb
115
145
  - lib/packcr/templates/node/predicate_neg.rb.erb
116
- - lib/packcr/templates/node/quantify_many.c.erb
117
- - lib/packcr/templates/node/quantify_many.rb.erb
118
- - lib/packcr/templates/node/quantify_one.c.erb
119
- - lib/packcr/templates/node/quantify_one.rb.erb
146
+ - lib/packcr/templates/node/quantity_many.c.erb
147
+ - lib/packcr/templates/node/quantity_many.rb.erb
148
+ - lib/packcr/templates/node/quantity_one.c.erb
149
+ - lib/packcr/templates/node/quantity_one.rb.erb
120
150
  - lib/packcr/templates/node/reference.c.erb
121
151
  - lib/packcr/templates/node/reference.rb.erb
122
152
  - lib/packcr/templates/node/reference_reverse.rb.erb
@@ -128,13 +158,13 @@ files:
128
158
  - lib/packcr/templates/node/string_many.rb.erb
129
159
  - lib/packcr/templates/node/string_one.c.erb
130
160
  - lib/packcr/templates/node/string_one.rb.erb
131
- - lib/packcr/tokenizer.rb
132
161
  - lib/packcr/util.rb
133
162
  - lib/packcr/version.rb
134
163
  homepage: https://github.com/wanabe/packcr
135
164
  licenses:
136
165
  - MIT
137
- metadata: {}
166
+ metadata:
167
+ rubygems_mfa_required: 'true'
138
168
  post_install_message:
139
169
  rdoc_options: []
140
170
  require_paths:
@@ -143,14 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
173
  requirements:
144
174
  - - ">="
145
175
  - !ruby/object:Gem::Version
146
- version: '0'
176
+ version: 2.7.0
147
177
  required_rubygems_version: !ruby/object:Gem::Requirement
148
178
  requirements:
149
179
  - - ">="
150
180
  - !ruby/object:Gem::Version
151
181
  version: '0'
152
182
  requirements: []
153
- rubygems_version: 3.4.1
183
+ rubygems_version: 3.4.6
154
184
  signing_key:
155
185
  specification_version: 4
156
186
  summary: Parser generator for C or Ruby
@@ -1,45 +0,0 @@
1
- {
2
- <%- if min > 0 -%>
3
- const size_t p0 = ctx->cur;
4
- <%- if gen.location -%>
5
- const pcc_location_t p0_loc = ctx->cur_loc;
6
- <%- end -%>
7
- const size_t n0 = chunk->thunks.len;
8
- <%- end -%>
9
- int i;
10
- <%- if max < 0 -%>
11
- for (i = 0;; i++) {
12
- <%- else -%>
13
- for (i = 0; i < <%= max %>; i++) {
14
- <%- end -%>
15
- const size_t p = ctx->cur;
16
- <%- if gen.location -%>
17
- const pcc_location_t p_loc = ctx->cur_loc;
18
- <%- end -%>
19
- const size_t n = chunk->thunks.len;
20
- <%- l = gen.next_label -%>
21
- <%- r = expr.reachability -%>
22
- <%= gen.generate_code(expr, l, 8, false) -%>
23
- if (ctx->cur == p) break;
24
- <%- if r != Packcr::CODE_REACH__ALWAYS_SUCCEED -%>
25
- continue;
26
- L<%= "%04d" % l %>:;
27
- ctx->cur = p;
28
- <%- if gen.location -%>
29
- ctx->cur_loc = p_loc;
30
- <%- end -%>
31
- pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n);
32
- break;
33
- <%- end -%>
34
- }
35
- <%- if min > 0 -%>
36
- if (i < <%= min %>) {
37
- ctx->cur = p0;
38
- <%- if gen.location -%>
39
- ctx->cur_loc = p0_loc;
40
- <%- end -%>
41
- pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n0);
42
- goto L<%= "%04d" % onfail %>;
43
- }
44
- <%- end -%>
45
- }
@@ -1,21 +0,0 @@
1
- {
2
- <%- l = gen.next_label -%>
3
- const size_t p = ctx->cur;
4
- <%- if gen.location -%>
5
- const pcc_location_t p_loc = ctx->cur_loc;
6
- <%- end -%>
7
- const size_t n = chunk->thunks.len;
8
- <%- r = expr.reachability -%>
9
- <%= gen.generate_code(expr, l, 4, false) -%>
10
- <%- if r != Packcr::CODE_REACH__ALWAYS_SUCCEED -%>
11
- <%- m = gen.next_label -%>
12
- goto L<%= "%04d" % m %>;
13
- L<%= "%04d" % l %>:;
14
- <%- if gen.location -%>
15
- ctx->cur_loc = p_loc;
16
- <%- end -%>
17
- ctx->cur = p;
18
- pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n);
19
- L<%= "%04d" % m %>:;
20
- <%- end -%>
21
- }