Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Failure with an escaped '-' #1

Closed
umitanuki opened this Issue · 1 comment

2 participants

@umitanuki

golex fails if regex contains '-', which is escaped.

golex test.l
golex: runtime error: invalid memory address or nil pointer dereference

And test.l looks like the following. Note '-' is escaped in xcstart, but apparently golex interprets as character class range from '+' to '*', which is invalid.

%{
package main

func (l *lexer) Lex(lval *yySymType) int {

%}

%x xc

xcstart [\+\-\*]
xcstop \*+\/

other .

%%
{xcstart}
    BEGIN(xc)

<xc>{xcstop}
    BEGIN(INITIAL)

other

%%
}

If you move '-' to the beginning of bracket, if passes.

@cznic cznic was assigned
@cznic cznic referenced this issue from a commit
@cznic Fix issue #1 2629dde
@cznic
Owner

Thanks for reporting, fixed and now closing (all tests pass). Please reopen or re-report if it doesn't work for you.

@cznic cznic closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.