Closed Bug 974368 Opened 10 years ago Closed 10 years ago

Fix ! operator precedence in manifestparser's expression parser

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla30

People

(Reporter: ted, Assigned: ted)

Details

Attachments

(1 file)

I found a stupid bug in manifestparser's ExpressionParser, the precedence of the ! operator is broken:

>>> import manifestparser
>>> manifestparser.parse("!true || true")
False
>>> manifestparser.parse("true || !true")
True
>>> manifestparser.parse("false || true")
True

Turns out it's a 1-line fix, I missed a point in the original article I was using for reference:
http://effbot.org/zone/simple-top-down-parsing.htm

Search for "To support the unary operators" for an explanation.
Comment on attachment 8378266 [details] [diff] [review]
Fix ! operator precedence in manifestparser's expression parser

Review of attachment 8378266 [details] [diff] [review]:
-----------------------------------------------------------------

thanks for the fix and the tests!!
Attachment #8378266 - Flags: review?(jmaher) → review+
https://hg.mozilla.org/mozilla-central/rev/758c586cde7a
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: