Use one_of to improve matching

Sun, 21 Jun 2009 22:56:09 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 21 Jun 2009 22:56:09 +0100
changeset 14
f5bbdcb5b148
parent 13
f59a3859363e
child 15
9c9e64488e54

Use one_of to improve matching

ndp.lua file | annotate | diff | comparison | revisions
--- a/ndp.lua	Sun Jun 21 22:55:34 2009 +0100
+++ b/ndp.lua	Sun Jun 21 22:56:09 2009 +0100
@@ -146,7 +146,7 @@
 				
 				time = time + seconds_in_a[unit] * number;
 			end };
-		{ (P"this " + P"in the " + P"at ")^0 * time_of_day /
+		{ lpeg.one_of{"this ", "in the ", "at "} * time_of_day /
 			function (time_of_day)
 					time_of_day = time_of_day:match("%S+$");
 					time = adjust_time(time, "hour", time_of_days[time_of_day]);

mercurial