Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000605Core InformPhrases and functional programmingpublic2011-03-07 07:062014-05-07 07:33
Reportervimes 
Assigned Tograham 
PrioritynormalSeveritymildReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSMac OS XOS Version10.6
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0000605: Regular expression character classes (\p) misbehave in character alternatives (<>)
DescriptionWhen used in a character alternative context, \p incorrectly matches both punctuation and the letter "p" where it should only match punctuation. The backslash "\" is not similarly affected, and \p behaves properly in ()-grouped alternatives or by itself.

The source and associated transcript demonstrate the problem.

(The category I filed this under may not be 100% accurate, but I didn't see an obviously better one.)
Minimal Source Text To Reproduce
This is a room.

After reading a command: 
	if the player's command matches the regular expression "^\p":
		say "'[the player's command]' matches [fixed letter spacing]^\p[variable letter spacing] [line 
break]";
	if the player's command matches the regular expression "^<\p>":
		say "'[the player's command]' matches [fixed letter spacing]^<\p>[variable letter spacing] 
[line break]";
	if the player's command matches the regular expression "^<b\p>":
		say "'[the player's command]' matches [fixed letter spacing]^<b\p>[variable letter spacing] 
[line break]";
	if the player's command matches the regular expression "^(b|\p)":
		say "'[the player's command]' matches [fixed letter spacing]^(b|\p)[variable letter spacing] [line 
break]".
		

Understand "pingpong" as a mistake ("Pong ping.").
Additional Information


Welcome
An Interactive Fiction
Release 1 / Serial number 110307 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

This

>. foo
". foo" matches ^\p
". foo" matches ^<\p>
". foo" matches ^<b\p>
". foo" matches ^(b|\p)
That's not a verb I recognise.

>b foo
"b foo" matches ^<b\p>
"b foo" matches ^(b|\p)
That's not a verb I recognise.

>x foo
You can't see any such thing.

>pingpong
"pingpong" matches ^<\p>
"pingpong" matches ^<b\p>

Pong ping.

>p foo
"p foo" matches ^<\p>
"p foo" matches ^<b\p>
That's not a verb I recognise.

>\ foo
That's not a verb I recognise.

>
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships

-  Notes
(0002466)
graham (administrator)
2014-02-10 10:44

Fixed. (Interesting that Perl's massive arsenal of regular expression test cases doesn't catch this. But my fault, of course.)

- Issue History
Date Modified Username Field Change
2011-03-07 07:06 vimes New Issue
2011-03-07 10:02 jmcgrew Status new => acknowledged
2011-03-07 16:27 EmacsUser Status acknowledged => confirmed
2014-02-10 10:44 graham Note Added: 0002466
2014-02-10 10:44 graham Status confirmed => resolved
2014-02-10 10:44 graham Resolution open => fixed
2014-02-10 10:44 graham Assigned To => graham
2014-05-07 07:32 jmcgrew Fixed in Version => 6L02
2014-05-07 07:33 jmcgrew Status resolved => closed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker