Skip to content

Values for enum YYCONDTYPE are not generated when default rules with conditions are used #145

@sirzooro

Description

@sirzooro

Following code generates empty enum YYCONDTYPE (no values), so compilation fails. When I changed it to use single default rule for all conditions, enum values were generated as expected.

I use re2c 0.16 compiled using gcc 5.3.0 on Cygwin x86_64.

#include <stdio.h>

/*!types:re2c*/

int test(const char* str)
{
    const unsigned char* YYCURSOR = (const unsigned char*)str;
    const unsigned char* YYMARKER;
    const unsigned char *YYCTXMARKER;
    int c = yycinit;

    /*!re2c
        re2c:define:YYCTYPE = "unsigned char";
        re2c:yyfill:enable = 0;
        re2c:define:YYGETCONDITION = "c";
        re2c:define:YYGETCONDITION:naked = 1;
        re2c:define:YYSETCONDITION = "c = @@;";
        re2c:define:YYSETCONDITION:naked = 1;

        //<*>* { return 0; }
        <init>* { return 0; }
        <init>"A" :=> C2
        <C2>* { return 0; }
        <C2>"B" { return 1; }
    */
}

int main()
{
    printf("%d\n", test("AB"));
    return 0;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions