packcr 0.0.7 → 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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +73 -0
  4. data/lib/packcr/context.rb +1 -1
  5. data/lib/packcr/generated/context.rb +121 -78
  6. data/lib/packcr/generated/node/action_node.rb +2 -2
  7. data/lib/packcr/generated/node/alternate_node.rb +2 -2
  8. data/lib/packcr/generated/node/capture_node.rb +1 -1
  9. data/lib/packcr/generated/node/charclass_node.rb +9 -9
  10. data/lib/packcr/generated/node/eof_node.rb +1 -1
  11. data/lib/packcr/generated/node/error_node.rb +2 -2
  12. data/lib/packcr/generated/node/expand_node.rb +2 -2
  13. data/lib/packcr/generated/node/predicate_node.rb +2 -2
  14. data/lib/packcr/generated/node/quantity_node.rb +30 -31
  15. data/lib/packcr/generated/node/reference_node.rb +2 -2
  16. data/lib/packcr/generated/node/rule_node.rb +7 -7
  17. data/lib/packcr/generated/node/string_node.rb +4 -4
  18. data/lib/packcr/parser.rb +619 -613
  19. data/lib/packcr/templates/context/header.c.erb +3 -3
  20. data/lib/packcr/templates/context/source.c.erb +417 -403
  21. data/lib/packcr/templates/context/source.rb.erb +42 -25
  22. data/lib/packcr/templates/node/action.c.erb +2 -2
  23. data/lib/packcr/templates/node/alternate.c.erb +2 -2
  24. data/lib/packcr/templates/node/capture.c.erb +2 -2
  25. data/lib/packcr/templates/node/charclass.c.erb +4 -4
  26. data/lib/packcr/templates/node/charclass_any.c.erb +2 -2
  27. data/lib/packcr/templates/node/charclass_one.c.erb +4 -4
  28. data/lib/packcr/templates/node/charclass_utf8.c.erb +2 -2
  29. data/lib/packcr/templates/node/eof.c.erb +1 -1
  30. data/lib/packcr/templates/node/error.c.erb +4 -4
  31. data/lib/packcr/templates/node/expand.c.erb +2 -2
  32. data/lib/packcr/templates/node/predicate.c.erb +1 -1
  33. data/lib/packcr/templates/node/predicate_neg.c.erb +1 -1
  34. data/lib/packcr/templates/node/quantity_many.c.erb +9 -7
  35. data/lib/packcr/templates/node/quantity_one.c.erb +9 -7
  36. data/lib/packcr/templates/node/quantity_one.rb.erb +4 -4
  37. data/lib/packcr/templates/node/reference.c.erb +6 -6
  38. data/lib/packcr/templates/node/rule.c.erb +9 -9
  39. data/lib/packcr/templates/node/string_many.c.erb +2 -2
  40. data/lib/packcr/templates/node/string_one.c.erb +2 -2
  41. data/lib/packcr/util.rb +1 -1
  42. data/lib/packcr/version.rb +1 -1
  43. metadata +5 -3
@@ -5,7 +5,7 @@ class Packcr
5
5
  case gen.lang
6
6
  when :c
7
7
  erbout = +""
8
- erbout << "{\n char c;\n if (pcc_refill_buffer(ctx, 1) < 1) goto L#{format("%04d", onfail)};\n c = ctx->buffer.buf[ctx->position_offset];\n".freeze
8
+ erbout << "{\n char c;\n if (packcr_refill_buffer(ctx, 1) < 1) goto L#{format("%04d", onfail)};\n c = ctx->buffer.buf[ctx->position_offset];\n".freeze
9
9
  if !a && charclass =~ /\A[^\\]-.\z/
10
10
 
11
11
  if a
@@ -45,7 +45,7 @@ class Packcr
45
45
  end
46
46
  end
47
47
  if gen.location
48
- erbout << " pcc_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
48
+ erbout << " packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
49
49
  end
50
50
  erbout << " ctx->position_offset++;\n}\n".freeze
51
51
 
@@ -99,10 +99,10 @@ class Packcr
99
99
  case gen.lang
100
100
  when :c
101
101
  erbout = +""
102
- erbout << "if (pcc_refill_buffer(ctx, 1) < 1) goto L#{format("%04d", onfail)};\n".freeze
102
+ erbout << "if (packcr_refill_buffer(ctx, 1) < 1) goto L#{format("%04d", onfail)};\n".freeze
103
103
 
104
104
  if gen.location
105
- erbout << "pcc_location_forward(&ctx->position_offset, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
105
+ erbout << "packcr_location_forward(&ctx->position_offset, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
106
106
  end
107
107
  erbout << "ctx->position_offset++;\n".freeze
108
108
 
@@ -140,14 +140,14 @@ class Packcr
140
140
  when :c
141
141
  erbout = +""
142
142
  if a
143
- erbout << "if (\n pcc_refill_buffer(ctx, 1) < 1 ||\n ctx->buffer.buf[ctx->position_offset] == '#{Packcr.escape_character(charclass[i])}'\n) goto L#{format("%04d", onfail)};\n".freeze
143
+ erbout << "if (\n packcr_refill_buffer(ctx, 1) < 1 ||\n ctx->buffer.buf[ctx->position_offset] == '#{Packcr.escape_character(charclass[i])}'\n) goto L#{format("%04d", onfail)};\n".freeze
144
144
 
145
145
  else
146
- erbout << "if (\n pcc_refill_buffer(ctx, 1) < 1 ||\n ctx->buffer.buf[ctx->position_offset] != '#{Packcr.escape_character(charclass[0])}'\n) goto L#{format("%04d", onfail)};\n".freeze
146
+ erbout << "if (\n packcr_refill_buffer(ctx, 1) < 1 ||\n ctx->buffer.buf[ctx->position_offset] != '#{Packcr.escape_character(charclass[0])}'\n) goto L#{format("%04d", onfail)};\n".freeze
147
147
 
148
148
  end
149
149
  if gen.location
150
- erbout << " pcc_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
150
+ erbout << " packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
151
151
  end
152
152
  erbout << "ctx->position_offset++;\n".freeze
153
153
  erbout
@@ -174,7 +174,7 @@ class Packcr
174
174
  erbout = +""
175
175
  a = charclass && charclass[0] == "^"
176
176
  i = a ? 1 : 0
177
- erbout << "{\n int u;\n const size_t n = pcc_get_char_as_utf32(ctx, &u);\n if (n == 0) goto L#{format("%04d", onfail)};\n".freeze
177
+ erbout << "{\n int u;\n const size_t n = packcr_get_char_as_utf32(ctx, &u);\n if (n == 0) goto L#{format("%04d", onfail)};\n".freeze
178
178
 
179
179
  if charclass && !(a && n == 1) # not '.' or '[^]'
180
180
  u0 = 0
@@ -227,7 +227,7 @@ class Packcr
227
227
  end
228
228
  end
229
229
  if gen.location
230
- erbout << " pcc_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, n);\n".freeze
230
+ erbout << " packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, n);\n".freeze
231
231
  end
232
232
  erbout << " ctx->position_offset += n;\n}\n".freeze
233
233
 
@@ -5,7 +5,7 @@ class Packcr
5
5
  case gen.lang
6
6
  when :c
7
7
  erbout = +""
8
- erbout << "if (pcc_refill_buffer(ctx, 1) >= 1) goto L#{format("%04d", onfail)};\n".freeze
8
+ erbout << "if (packcr_refill_buffer(ctx, 1) >= 1) goto L#{format("%04d", onfail)};\n".freeze
9
9
 
10
10
  erbout
11
11
  when :rb
@@ -10,7 +10,7 @@ class Packcr
10
10
  l = gen.next_label
11
11
  m = gen.next_label
12
12
 
13
- erbout << "#{gen.generate_code(expr, l, 4, true)} goto L#{format("%04d", m)};\nL#{format("%04d", l)}:;\n {\n pcc_value_t null;\n pcc_thunk_t *const thunk = pcc_thunk__create_leaf(ctx->auxil, pcc_action_#{gen.rule.name}_#{index}, #{gen.rule.vars.length}, #{gen.rule.capts.length});\n".freeze
13
+ erbout << "#{gen.generate_code(expr, l, 4, true)} goto L#{format("%04d", m)};\nL#{format("%04d", l)}:;\n {\n packcr_value_t null;\n packcr_thunk_t *const thunk = packcr_thunk__create_leaf(ctx->auxil, packcr_action_#{gen.rule.name}_#{index}, #{gen.rule.vars.length}, #{gen.rule.capts.length});\n".freeze
14
14
 
15
15
  vars.each do |var|
16
16
  erbout << " thunk->data.leaf.values.buf[#{var.index}] = &(chunk->values.buf[#{var.index}]);\n".freeze
@@ -23,7 +23,7 @@ class Packcr
23
23
  if gen.location
24
24
  erbout << " thunk->data.leaf.capt0.range.start_loc = chunk->pos_loc;\n thunk->data.leaf.capt0.range.end_loc = ctx->position_offset_loc;\n".freeze
25
25
  end
26
- erbout << " memset(&null, 0, sizeof(pcc_value_t)); /* in case */\n thunk->data.leaf.action(ctx, thunk, &null);\n pcc_thunk__destroy(ctx->auxil, thunk);\n }\n goto L#{format("%04d", onfail)};\nL#{format("%04d", m)}:;\n}\n".freeze
26
+ erbout << " memset(&null, 0, sizeof(packcr_value_t)); /* in case */\n thunk->data.leaf.action(ctx, thunk, &null);\n packcr_thunk__destroy(ctx->auxil, thunk);\n }\n goto L#{format("%04d", onfail)};\nL#{format("%04d", m)}:;\n}\n".freeze
27
27
 
28
28
  erbout
29
29
  when :rb
@@ -5,10 +5,10 @@ class Packcr
5
5
  case gen.lang
6
6
  when :c
7
7
  erbout = +""
8
- erbout << "{\n const size_t n = chunk->capts.buf[#{index}].range.end - chunk->capts.buf[#{index}].range.start;\n if (pcc_refill_buffer(ctx, n) < n) goto L#{format("%04d", onfail)};\n if (n > 0) {\n const char *const p = ctx->buffer.buf + ctx->position_offset;\n const char *const q = ctx->buffer.buf + chunk->capts.buf[#{index}].range.start;\n size_t i;\n for (i = 0; i < n; i++) {\n if (p[i] != q[i]) goto L#{format("%04d", onfail)};\n }\n".freeze
8
+ erbout << "{\n const size_t n = chunk->capts.buf[#{index}].range.end - chunk->capts.buf[#{index}].range.start;\n if (packcr_refill_buffer(ctx, n) < n) goto L#{format("%04d", onfail)};\n if (n > 0) {\n const char *const p = ctx->buffer.buf + ctx->position_offset;\n const char *const q = ctx->buffer.buf + chunk->capts.buf[#{index}].range.start;\n size_t i;\n for (i = 0; i < n; i++) {\n if (p[i] != q[i]) goto L#{format("%04d", onfail)};\n }\n".freeze
9
9
 
10
10
  if gen.location
11
- erbout << " pcc_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, n);\n".freeze
11
+ erbout << " packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, n);\n".freeze
12
12
  end
13
13
  erbout << " ctx->position_offset += n;\n }\n}\n".freeze
14
14
 
@@ -11,7 +11,7 @@ class Packcr
11
11
  erbout << "{\n const size_t p = ctx->position_offset;\n".freeze
12
12
 
13
13
  if gen.location
14
- erbout << " const pcc_location_t p_loc = ctx->position_offset_loc;\n".freeze
14
+ erbout << " const packcr_location_t p_loc = ctx->position_offset_loc;\n".freeze
15
15
  end
16
16
  erbout << "#{gen.generate_code(expr, l, 4, false)}".freeze
17
17
  if r != Packcr::CODE_REACH__ALWAYS_FAIL
@@ -84,7 +84,7 @@ class Packcr
84
84
  erbout << "{\n const size_t p = ctx->position_offset;\n".freeze
85
85
 
86
86
  if gen.location
87
- erbout << " const pcc_location_t p_loc = ctx->position_offset_loc;\n".freeze
87
+ erbout << " const packcr_location_t p_loc = ctx->position_offset_loc;\n".freeze
88
88
  end
89
89
  erbout << "#{gen.generate_code(expr, l, 4, false)}".freeze
90
90
  if r != Packcr::CODE_REACH__ALWAYS_FAIL
@@ -7,11 +7,12 @@ class Packcr
7
7
  erbout = +""
8
8
  erbout << "{\n".freeze
9
9
 
10
+ r = expr.reachability
10
11
  if min > 0
11
12
  erbout << " const size_t p0 = ctx->position_offset;\n".freeze
12
13
 
13
14
  if gen.location
14
- erbout << " const pcc_location_t p0_loc = ctx->position_offset_loc;\n".freeze
15
+ erbout << " const packcr_location_t p0_loc = ctx->position_offset_loc;\n".freeze
15
16
  end
16
17
  erbout << " const size_t n0 = chunk->thunks.len;\n".freeze
17
18
  end
@@ -25,13 +26,13 @@ class Packcr
25
26
  end
26
27
  erbout << " const size_t p = ctx->position_offset;\n".freeze
27
28
 
28
- if gen.location
29
- erbout << " const pcc_location_t p_loc = ctx->position_offset_loc;\n".freeze
29
+ if r != Packcr::CODE_REACH__ALWAYS_SUCCEED
30
+ if gen.location
31
+ erbout << " const packcr_location_t p_loc = ctx->position_offset_loc;\n".freeze
32
+ end
33
+ erbout << " const size_t n = chunk->thunks.len;\n".freeze
30
34
  end
31
- erbout << " const size_t n = chunk->thunks.len;\n".freeze
32
-
33
35
  l = gen.next_label
34
- r = expr.reachability
35
36
  erbout << "#{gen.generate_code(expr, l, 8, false)} if (ctx->position_offset == p) break;\n".freeze
36
37
 
37
38
  if r != Packcr::CODE_REACH__ALWAYS_SUCCEED
@@ -40,7 +41,7 @@ class Packcr
40
41
  if gen.location
41
42
  erbout << " ctx->position_offset_loc = p_loc;\n".freeze
42
43
  end
43
- erbout << " pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n);\n break;\n".freeze
44
+ erbout << " packcr_thunk_array__revert(ctx->auxil, &chunk->thunks, n);\n break;\n".freeze
44
45
  end
45
46
  erbout << " }\n".freeze
46
47
 
@@ -50,7 +51,7 @@ class Packcr
50
51
  if gen.location
51
52
  erbout << " ctx->position_offset_loc = p0_loc;\n".freeze
52
53
  end
53
- erbout << " pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n0);\n goto L#{format("%04d", onfail)};\n }\n".freeze
54
+ erbout << " packcr_thunk_array__revert(ctx->auxil, &chunk->thunks, n0);\n goto L#{format("%04d", onfail)};\n }\n".freeze
54
55
  end
55
56
  erbout << "}\n".freeze
56
57
 
@@ -112,45 +113,43 @@ class Packcr
112
113
  case gen.lang
113
114
  when :c
114
115
  erbout = +""
115
- erbout << "{\n".freeze
116
-
117
- l = gen.next_label
118
- erbout << " const size_t p = ctx->position_offset;\n".freeze
116
+ r = expr.reachability
117
+ if r == Packcr::CODE_REACH__ALWAYS_SUCCEED
118
+ erbout << "#{gen.generate_code(expr, nil, 0, true)}".freeze
119
+ else
120
+ erbout << "{\n".freeze
119
121
 
120
- if gen.location
121
- erbout << " const pcc_location_t p_loc = ctx->position_offset_loc;\n".freeze
122
- end
123
- erbout << " const size_t n = chunk->thunks.len;\n".freeze
122
+ l = gen.next_label
123
+ erbout << " const size_t p = ctx->position_offset;\n".freeze
124
124
 
125
- r = expr.reachability
126
- erbout << "#{gen.generate_code(expr, l, 4, false)}".freeze
127
- if r != Packcr::CODE_REACH__ALWAYS_SUCCEED
125
+ if gen.location
126
+ erbout << " const packcr_location_t p_loc = ctx->position_offset_loc;\n".freeze
127
+ end
128
+ erbout << " const size_t n = chunk->thunks.len;\n#{gen.generate_code(expr, l, 4, false)}".freeze
128
129
  m = gen.next_label
129
130
  erbout << " goto L#{format("%04d", m)};\nL#{format("%04d", l)}:;\n".freeze
130
131
 
131
132
  if gen.location
132
133
  erbout << " ctx->position_offset_loc = p_loc;\n".freeze
133
134
  end
134
- erbout << " ctx->position_offset = p;\n pcc_thunk_array__revert(ctx->auxil, &chunk->thunks, n);\nL#{format("%04d", m)}:;\n".freeze
135
+ erbout << " ctx->position_offset = p;\n packcr_thunk_array__revert(ctx->auxil, &chunk->thunks, n);\nL#{format("%04d", m)}:;\n}\n".freeze
135
136
  end
136
- erbout << "}\n".freeze
137
-
138
137
  erbout
139
138
  when :rb
140
139
  erbout = +""
141
- l = gen.next_label
142
- erbout << "pos#{gen.level} = @position_offset\n".freeze
143
-
144
- if gen.location
145
- erbout << "p_loc#{gen.level} = @position_offset_loc\n".freeze
146
- end
147
- erbout << "n#{gen.level} = answer.thunks.length\n".freeze
148
-
149
140
  r = expr.reachability
150
141
  if r == Packcr::CODE_REACH__ALWAYS_SUCCEED
151
142
 
152
- erbout << "#{gen.generate_code(expr, l, 0, false)}".freeze
143
+ erbout << "#{gen.generate_code(expr, nil, 0, true)}".freeze
153
144
  else
145
+ l = gen.next_label
146
+ erbout << "pos#{gen.level} = @position_offset\n".freeze
147
+
148
+ if gen.location
149
+ erbout << "p_loc#{gen.level} = @position_offset_loc\n".freeze
150
+ end
151
+ erbout << "n#{gen.level} = answer.thunks.length\n".freeze
152
+
154
153
  m = gen.next_label
155
154
  erbout << "catch(#{m}) do\n catch(#{l}) do\n#{gen.generate_code(expr, l, 4, false)} throw(#{m})\n end\n".freeze
156
155
 
@@ -6,9 +6,9 @@ class Packcr
6
6
  when :c
7
7
  erbout = +""
8
8
  if index.nil?
9
- erbout << "{\n pcc_rule_set_t *l = NULL;\n if (limits && ctx->position_offset == offset && pcc_rule_set__index(ctx->auxil, limits, pcc_evaluate_rule_#{name}) == PCC_VOID_VALUE) {\n l = limits;\n }\n if (!pcc_apply_rule(ctx, pcc_evaluate_rule_#{name}, &chunk->thunks, NULL, offset".freeze
9
+ erbout << "{\n packcr_rule_set_t *l = NULL;\n if (limits && ctx->position_offset == offset && packcr_rule_set__index(ctx->auxil, limits, packcr_evaluate_rule_#{name}) == PACKCR_VOID_VALUE) {\n l = limits;\n }\n if (!packcr_apply_rule(ctx, packcr_evaluate_rule_#{name}, &chunk->thunks, NULL, offset".freeze
10
10
  else
11
- erbout << "{\n pcc_rule_set_t *l = NULL;\n if (limits && ctx->position_offset == offset && pcc_rule_set__index(ctx->auxil, limits, pcc_evaluate_rule_#{name}) == PCC_VOID_VALUE) {\n l = limits;\n }\n if (!pcc_apply_rule(ctx, pcc_evaluate_rule_#{name}, &chunk->thunks, &(chunk->values.buf[#{index}]), offset".freeze
11
+ erbout << "{\n packcr_rule_set_t *l = NULL;\n if (limits && ctx->position_offset == offset && packcr_rule_set__index(ctx->auxil, limits, packcr_evaluate_rule_#{name}) == PACKCR_VOID_VALUE) {\n l = limits;\n }\n if (!packcr_apply_rule(ctx, packcr_evaluate_rule_#{name}, &chunk->thunks, &(chunk->values.buf[#{index}]), offset".freeze
12
12
 
13
13
  end
14
14
  if gen.location
@@ -5,26 +5,26 @@ class Packcr
5
5
  case gen.lang
6
6
  when :c
7
7
  erbout = +""
8
- erbout << "static pcc_thunk_chunk_t *pcc_evaluate_rule_#{name}(pcc_context_t *ctx, size_t offset".freeze
8
+ erbout << "static packcr_thunk_chunk_t *packcr_evaluate_rule_#{name}(packcr_context_t *ctx, size_t offset".freeze
9
9
  if gen.location
10
- erbout << ", pcc_location_t offset_loc".freeze
10
+ erbout << ", packcr_location_t offset_loc".freeze
11
11
  end
12
- erbout << ", pcc_rule_set_t *limits) {\n pcc_thunk_chunk_t *const chunk = pcc_thunk_chunk__create(ctx);\n chunk->pos = ctx->position_offset;\n".freeze
12
+ erbout << ", packcr_rule_set_t *limits) {\n packcr_thunk_chunk_t *const chunk = packcr_thunk_chunk__create(ctx);\n chunk->pos = ctx->position_offset;\n".freeze
13
13
 
14
14
  if gen.location
15
15
  erbout << " chunk->pos_loc = ctx->position_offset_loc;\n".freeze
16
16
  end
17
- erbout << " PCC_DEBUG(ctx->auxil, PCC_DBG_EVALUATE, \"#{name}\", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->buffer.len - chunk->pos));\n ctx->level++;\n pcc_value_table__resize(ctx->auxil, &chunk->values, #{vars.length});\n pcc_capture_table__resize(ctx->auxil, &chunk->capts, #{capts.length});\n".freeze
17
+ erbout << " PACKCR_DEBUG(ctx->auxil, PACKCR_DBG_EVALUATE, \"#{name}\", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->buffer.len - chunk->pos));\n ctx->level++;\n packcr_value_table__resize(ctx->auxil, &chunk->values, #{vars.length});\n packcr_capture_table__resize(ctx->auxil, &chunk->capts, #{capts.length});\n".freeze
18
18
 
19
19
  if !vars.empty?
20
- erbout << " pcc_value_table__clear(ctx->auxil, &chunk->values);\n".freeze
20
+ erbout << " packcr_value_table__clear(ctx->auxil, &chunk->values);\n".freeze
21
21
  end
22
22
  r = expr.reachability
23
23
 
24
- erbout << "#{gen.generate_code(expr, 0, 4, false)} ctx->level--;\n PCC_DEBUG(ctx->auxil, PCC_DBG_MATCH, \"#{name}\", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->position_offset - chunk->pos));\n return chunk;\n".freeze
24
+ erbout << "#{gen.generate_code(expr, 0, 4, false)} ctx->level--;\n PACKCR_DEBUG(ctx->auxil, PACKCR_DBG_MATCH, \"#{name}\", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->position_offset - chunk->pos));\n return chunk;\n".freeze
25
25
 
26
26
  if r != Packcr::CODE_REACH__ALWAYS_SUCCEED
27
- erbout << "L0000:;\n ctx->level--;\n PCC_DEBUG(ctx->auxil, PCC_DBG_NOMATCH, \"#{name}\", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->position_offset - chunk->pos));\n pcc_thunk_chunk__destroy(ctx, chunk);\n return NULL;\n".freeze
27
+ erbout << "L0000:;\n ctx->level--;\n PACKCR_DEBUG(ctx->auxil, PACKCR_DBG_NOMATCH, \"#{name}\", ctx->level, chunk->pos, (ctx->buffer.buf + chunk->pos), (ctx->position_offset - chunk->pos));\n packcr_thunk_chunk__destroy(ctx, chunk);\n return NULL;\n".freeze
28
28
  end
29
29
  erbout << "}\n".freeze
30
30
 
@@ -5,7 +5,7 @@ class Packcr
5
5
  case gen.lang
6
6
  when :c
7
7
  erbout = +""
8
- erbout << "if (\n pcc_refill_buffer(ctx, #{n}) < #{n} ||\n".freeze
8
+ erbout << "if (\n packcr_refill_buffer(ctx, #{n}) < #{n} ||\n".freeze
9
9
 
10
10
  (n - 1).times do |i|
11
11
  erbout << " (ctx->buffer.buf + ctx->position_offset)[#{i}] != '#{Packcr.escape_character(value[i])}' ||\n".freeze
@@ -13,7 +13,7 @@ class Packcr
13
13
  erbout << " (ctx->buffer.buf + ctx->position_offset)[#{n - 1}] != '#{Packcr.escape_character(value[n - 1])}'\n) goto L#{format("%04d", onfail)};\n".freeze
14
14
 
15
15
  if gen.location
16
- erbout << "pcc_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, n);\n".freeze
16
+ erbout << "packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, #{n});\n".freeze
17
17
  end
18
18
  erbout << "ctx->position_offset += #{n};\n".freeze
19
19
 
@@ -35,10 +35,10 @@ class Packcr
35
35
  case gen.lang
36
36
  when :c
37
37
  erbout = +""
38
- erbout << "if (\n pcc_refill_buffer(ctx, 1) < 1 ||\n ctx->buffer.buf[ctx->position_offset] != '#{Packcr.escape_character(value[0])}'\n) goto L#{format("%04d", onfail)};\n".freeze
38
+ erbout << "if (\n packcr_refill_buffer(ctx, 1) < 1 ||\n ctx->buffer.buf[ctx->position_offset] != '#{Packcr.escape_character(value[0])}'\n) goto L#{format("%04d", onfail)};\n".freeze
39
39
 
40
40
  if gen.location
41
- erbout << " pcc_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
41
+ erbout << " packcr_location_forward(&ctx->position_offset_loc, ctx->buffer.buf + ctx->position_offset, 1);\n".freeze
42
42
  end
43
43
  erbout << "ctx->position_offset++;\n".freeze
44
44