Skip to content

Jison's advanced grouping options not working #340

@tuliogomesbarbosa

Description

@tuliogomesbarbosa

Hi there, i'm trying to parsing an input with regex using a non-capturing parenthesis (?:). However Jison's lexer is getting the whole match while it should get only the group match. Take a look at the following code:

this.yytext += match[0];

The length of match array is 2 and the group match is at position 1.
The input that i'm trying to parse is

: request --color #ABCDEF'

and i need to get only the 'request' portion.

My regex is :([^\r\n]+)(?:\-\-color\s+\#[0-9A-Za-z]+) and the regex generated by Jison is /^(?:([^\r\n]+)(?:--color\s+#[0-9A-Za-z]+))/

Am i missing something here? I've already readed the Deviations From Flex Bison topic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions