Code Monkey home page Code Monkey logo

packcc's People

Contributors

codacy-badger avatar lil-lila avatar masatake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packcc's Issues

Wrong parsing

Repetition of rule in parentheses is handled incorrectly. Rule rule <- A (A B C)* succeeds even if only A A B or A A was matched

Unicode support in character classes

Hello,

I'd like to ask if this parser generator supports unicode in character classes? From my testing so far it seems that unicode escapes (e.g. \u1234) work fine in strings (at least for UTF-8 encoding), but if I use it in character class, it generates wrong code.

For example, if my grammar contains rule TEST <- [\u1234], this is generated:

static pcc_thunk_chunk_t *pcc_evaluate_rule_TEST(pkotlin_context_t *ctx) {
    pcc_thunk_chunk_t *chunk = pcc_thunk_chunk__create(ctx->auxil);
    chunk->pos = ctx->pos;
    {
        char c;
        if (pcc_refill_buffer(ctx, 1) < 1) goto L0000;
        c = ctx->buffer.buf[ctx->pos];
        if (!(
            c == '\xe1' ||
            c == '\x88' ||
            c == '\xb4'
        )) goto L0000;
        ctx->pos++;
    }
    return chunk;
L0000:;
    pcc_thunk_chunk__destroy(ctx->auxil, chunk);
    return NULL;
}

It looks like the character class specification is passed to unescape_string function and the matching is done on the bytes it returns (because E1 88 B4 is UTF-8 hex representation of \u1234).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.