Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ func (p *parser) negation(t *Token) (Pattern, Error) {
return nil, _err
}

// remove trailing whitespace tokens
_length := len(_tokens)
for _length > 0 {
// if we have a non-whitespace token, we can stop
_length--
if _tokens[_length].Type != WHITESPACE {
break
}

// otherwise, truncate the token list
_tokens = _tokens[:_length]
}

// include the "negation" token at the front of the sequence
_tokens = append([]*Token{t}, _tokens...)

Expand Down Expand Up @@ -442,3 +455,4 @@ func (p *parser) errors(e Error) bool {
// - if this returns false, parsing will stop
return p._error(e)
} // errors()