Correct (I think) notation to make optional phrases optional

Sun, 21 Jun 2009 23:12:23 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 21 Jun 2009 23:12:23 +0100
changeset 17
3a7672943895
parent 16
35fb87e8289c
child 18
d6f0c12c152a

Correct (I think) notation to make optional phrases optional

ndp.lua file | annotate | diff | comparison | revisions
--- a/ndp.lua	Sun Jun 21 22:59:47 2009 +0100
+++ b/ndp.lua	Sun Jun 21 23:12:23 2009 +0100
@@ -130,16 +130,17 @@
 			function (year)
 				time = adjust_time(time, "year", tonumber(year));
 			end };
-		{ Pi"in "^0 * month_name /
+		{ (Pi"in " + true) * month_name /
 			function (month_name)
 				time = find_next_month_by_name(time, month_name:match("%S+$"));
 			end };
-		{ Pi"on "^0 * day_name /
+		{ (Pi"on " + true) * day_name /
 			function (day_name)
 				time = find_next_day_by_name(time, day_name:match("%S+$"));
 			end };
-		{ Pi"in "^0 * ( quantity * P" " * unit_of_time ) * (P"s"^-1) /
+		{ (Pi"in " + true) * ( quantity * P" " * unit_of_time ) * (P"s"^-1) /
 			function (number_and_unit)
+				print("m", number_and_unit..".");
 				local number, unit = number_and_unit:gsub("^in ", ""):match("^(.+)%s+(.-)s?$");
 				
 				number = quantities[number] or tonumber(number);

mercurial