Skip to content

Maximum Call Stack Size Exceeded while parsing custom grammar #10

Description

@fabianfreyer

Parsing the following grammar:

RValue ::= Number | InfixExpression
InfixExpression ::= RValue InfixOperator RValue
InfixOperator ::= "+" | "-" | "*" | "/"
Number ::= "-"? ("0" | [1-9] [0-9]*) ("." [0-9]+)? (("e" | "E") ( "-" | "+" )? ("0" | [1-9] [0-9]*))?

Fails with the following error message:

/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:53
        name: name.replace(decorationRE, '').replace(preDecorationRE, ''),
                   ^

RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at parseRuleName (/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:53:20)
    at options.forEach.phases (/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:256:47)
    at Array.forEach (<anonymous>)
    at Parser.parse (/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:233:25)
    at options.forEach.phases (/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:282:51)
    at Array.forEach (<anonymous>)
    at Parser.parse (/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:233:25)
    at options.forEach.phases (/home/user/service-xsharp/service/node_modules/ebnf/dist/Parser.js:282:51)
    at Array.forEach (<anonymous>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions