Skip to content

Commit

Permalink
Fix the issue #78
Browse files Browse the repository at this point in the history
  • Loading branch information
arithy committed May 13, 2024
1 parent d985dd2 commit 0aa9a75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/packcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ DECLSPEC_IMPORT HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hTo

#define WEBSITE "https://github.com/arithy/packcc"

#define VERSION "2.0.2"
#define VERSION "2.0.3"

#ifndef BUFFER_MIN_SIZE
#define BUFFER_MIN_SIZE 256
Expand Down Expand Up @@ -3145,7 +3145,8 @@ static bool_t parse(context_t *ctx) {
link_references(ctx, rule->expr);
}
}
mark_rules_if_used(ctx, ctx->rules.buf[0]);
if (ctx->rules.len > 0)
mark_rules_if_used(ctx, ctx->rules.buf[0]);
{
size_t i;
for (i = 0; i < ctx->rules.len; i++) {
Expand Down
1 change: 1 addition & 0 deletions tests/issue_78.d/input.peg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main <- ( "A"
9 changes: 9 additions & 0 deletions tests/issue_78.d/issue_78.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bats

load "$TESTDIR/utils.sh"

@test "Testing issue_78.d - generation" {
run test_generate
[ "$status" -eq 10 ]
[[ "$output" =~ ': input.peg:1:1: Illegal rule syntax'$ ]]
}

0 comments on commit 0aa9a75

Please sign in to comment.