mike-lischke / antlr4-c3

A grammar agnostic code completion engine for ANTLR4 based parsers
MIT License
408 stars 62 forks source link

Infinite loop in processRule() #74

Open EliotVU opened 1 year ago

EliotVU commented 1 year ago

Hello, your library has been of great use to assist with implementing auto-completion for an old language called "UnrealScript".

However, in UnrealScript we will often stumble on pieces of C++ text blocks, which I solved with the following grammar:

cppText
    : 'cpptext' exportBlockText
    ;

// Skips a C++ block of text: "{ ... | { ... }* }
exportBlockText
    : OPEN_BRACE (~(OPEN_BRACE | CLOSE_BRACE)+ | exportBlockText)* CLOSE_BRACE
    ;

UCParser.g4#L598

This had worked flawlessly except for c3. When c3 hits the first instance of 'exportBlockText' it will run in an infinite loop with 'processRule'. That may seem obvious given the grammar, any chance this could be fixed, or a possible work around?