Opened 7 years ago

Closed 5 years ago

#11531 closed Bugs (fixed)

Spirit X3: char_(ch1, ch2) is matching an exclusive range

Reported by: Adrian Vogelsgesang <vogelsgesang@…> Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost Development Trunk Severity: Problem
Keywords: x3 char_ Cc:

Description

In X3 the char_(ch1, ch2) parser is currently matching all characters wich are within the given boundaries but exludes the boundary characters.

This is inconsistent with the documentation which states "Matches a range of chars from ch to ch2 (inclusive)".

In addition, I think that qi::char_ is including the range boundaries, too. (I am not sure about this; I did not actually use QI so far and just had a short glance at its source code.)

I think, the error is at this position: https://github.com/boostorg/spirit/blob/9c5dd09880f24b99e8e694534e532b1bb4a8851a/include/boost/spirit/home/x3/char/char_set.hpp#L45. The comparisions should be ">= 0" respectively "<= 0".

The testcase in https://github.com/boostorg/spirit/blob/master/test/x3/char1.cpp do not test the matching of the boundary characters.

Change History (2)

comment:1 by Adrian Vogelsgesang <vogelsgesang@…>, 7 years ago

I have a pull request which should fix this behaviour: https://github.com/boostorg/spirit/pull/147

comment:2 by Joel de Guzman, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.