Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpaired curly inside string confuses nex #48

Open
purpleidea opened this issue Dec 30, 2017 · 1 comment
Open

Unpaired curly inside string confuses nex #48

purpleidea opened this issue Dec 30, 2017 · 1 comment

Comments

@purpleidea
Copy link
Collaborator

Quite hilariously, an unpaired curly brace inside nex golang code causes lex/parse errors with nex itself!

Example:

/\$[a-z][a-z0-9]*{[0-9]+}/
		{
			yylex.pos(lval) // our pos
			s := yylex.Text()
			a := strings.Split(s, "{") // XXX: close match here: }
			lval.str = a[0]
			return IDENTIFIER
		}

Note the comment I added with a close brace. I added that as a workaround so that this works. Remove it and you'll see nex errors:

panic: unmatched '{'

goroutine 16 [running]:
runtime.gopanic
	../../../libgo/go/runtime/panic.go:493
main.$nested34
	/builddir/build/BUILD/nex-5344f151fd3251726650dffd30a531d3f1bddc17/nex.go:1027
main.$nested35
	/builddir/build/BUILD/nex-5344f151fd3251726650dffd30a531d3f1bddc17/nex.go:1094
main.process
	/builddir/build/BUILD/nex-5344f151fd3251726650dffd30a531d3f1bddc17/nex.go:1099
main.main
	/builddir/build/BUILD/nex-5344f151fd3251726650dffd30a531d3f1bddc17/main.go:81
runtime_main
	../../../libgo/runtime/proc.c:606

HTH

@purpleidea purpleidea changed the title Unpaired curly inside string confused nex Unpaired curly inside string confuses nex Dec 30, 2017
@purpleidea
Copy link
Collaborator Author

Interestingly enough as discovered in the source today it seems this is a known issue:

// } [balance out the quoted left brace]

=D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant