Units plugin doesn't handle unit expressions

Bug #333230 reported by Jonathan Hitchcock
2
Affects Status Importance Assigned to Milestone
Ibid
Fix Released
Low
Stefano Rivera

Bug Description

The units plugin has an advanced parser that can parse and interpret compound unit expressions. The regex in the units plugin only handles the simplest of cases:

12:18 <Vhata> Comfrey: convert cm^3 to gallons
12:18 <Comfrey> Vhata: cm^3 = 0.00026417205 gallons

12:18 <Vhata> Comfrey: convert arabicfoot * arabictradepound * force to ft lbf
12:18 <Comfrey> Vhata: What?

12:19 <Vhata> Comfrey: convert furlongs per fortnight to m/s
12:19 <Comfrey> Vhata: Sorry...

12:03 <tumbleweed> Comfrey: convert 30 miles to km/h
12:03 <Comfrey> tumbleweed: What?

Furthermore, by separating "value" out in the regex, it enforces the idea that a unit expression can be, at its most complex, "[n] units", whereas in reality, the quantity is an interal part of the expression:

11:58 <Vhata> Comfrey: convert 3 km to miles
11:58 <Comfrey> Vhata: 3 km = 1.8641136 miles

12:01 <Vhata> Comfrey: convert 2 ft 3 ft 12 ft to stere
12:01 <Comfrey> Vhata: Sorry...

I rather think that we should let GNU units decide what is/is not a valid expression, instead of trying to parse it ourselves.

Related branches

Changed in ibid:
assignee: nobody → stefanor
importance: Undecided → Low
milestone: none → 0.1
status: New → In Progress
Michael Gorven (mgorven)
Changed in ibid:
status: In Progress → Fix Committed
Changed in ibid:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.