Skip to content

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

@etsangsplk

Description

@etsangsplk

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

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