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

NewScanner with SetWsPattern does not skip whitespace when used with And #40

Open
etsangsplk opened this issue Jan 30, 2020 · 0 comments

Comments

@etsangsplk
Copy link

etsangsplk commented Jan 30, 2020

I was expecting that two should be matched since it should escape the whitespace but it did not. Also the whitespace should be already be set by default which means that there should be no need to call SetWSPattern

	s := NewScanner([]byte("one two three")).SetWSPattern(" ")
	v, e := p(s)
	if v == nil {
		t.Errorf("End() didn't match %q", e)
	}```


Error message:
End() didn't match &{"one two three" '\x00' '\x01' map["^ ":%!q(*regexp.Regexp=&{^  0xc0003bef00 <nil> 0 65536 []  [] 0 0 0 2 false 4 1 false})] " " %!q(bool=false)}

There are few places in tokeniser where it calls SkipWS but not used that Scanner returned by that function. For example
https://github.com/prataprc/goparsec/blob/master/tokeniser.go#L85
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