# HG changeset patch # User Matthew Wild # Date 1245621369 -3600 # Node ID f5bbdcb5b14870c80f4f7b17b7adaad0c423d69d # Parent f59a3859363e0dfde4c22f857f2f34c6dbcc9ca5 Use one_of to improve matching diff -r f59a3859363e -r f5bbdcb5b148 ndp.lua --- 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]);