diff --git a/opening_hours.js b/opening_hours.js index 28d8a0a7..1f377757 100644 --- a/opening_hours.js +++ b/opening_hours.js @@ -4986,7 +4986,7 @@ } else if (matchTokens(tokens, at - 1, ',')) { // additional rule throw formatWarnErrorMessage( nrule, - at, + at - 1, 'An additional rule does not make sense here. Just use a ";" as rule separator.' + ' See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator'); } else { @@ -5186,7 +5186,7 @@ } else if (matchTokens(tokens, at - 1, ',')) { // additional rule throw formatWarnErrorMessage( nrule, - at, + at - 1, 'An additional rule does not make sense here. Just use a ";" as rule separator.' + ' See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator'); } else { @@ -5489,7 +5489,7 @@ } else if (matchTokens(tokens, at - 1, ',')) { // additional rule throw formatWarnErrorMessage( nrule, - at, + at - 1, 'An additional rule does not make sense here. Just use a ";" as rule separator.' + ' See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator'); } else { @@ -5594,7 +5594,7 @@ } else if (matchTokens(tokens, at - 1, ',')) { // additional rule throw formatWarnErrorMessage( nrule, - at, + at - 1, 'An additional rule does not make sense here. Just use a ";" as rule separator.' + ' See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator'); } else { diff --git a/test.log b/test.log index b6913a21..20ad7b76 100644 --- a/test.log +++ b/test.log @@ -1758,7 +1758,7 @@ week 2-53 00:00-24:00::: <--- (Unexpected token: "timesep" This means that the s week 2-53 00: <--- (Missing minutes in time range after: "timesep") "Incorrect syntax which should throw an error" for "week 2-52/2 We, week 1-53/2 Sa 0:00-24:00; 00:23-00:42 unknown "warning at correct position?"": PASSED -week 2-52/2 We, week <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +week 2-52/2 We, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "(sunrise+01:00-sunset; 00:23-00:42 unknown "warning at correct position?"": PASSED (sunrise+01:00- <--- (Calculcation with variable time is not in the right syntax. Missing ")".) @@ -1836,7 +1836,7 @@ PH + 2 day <--- (There should be no reason to differ more than 1 days from a pub Su- <--- (Unexpected token: "-" This means that the syntax is not valid at that point or it is currently not supported.) "Incorrect syntax which should throw an error" for "2012, Jan; 00:23-00:42 unknown "warning at correct position?"": PASSED -2012, Jan <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +2012, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "easter + 370 days; 00:23-00:42 unknown "warning at correct position?"": PASSED easter + 370 days <--- (There should be no reason to differ more than 200 days from a event like easter. If so tell us …) @@ -1851,7 +1851,7 @@ easter - 2 days - <--- (Unexpected token: "-" This means that the syntax is not Jan,, <--- (Unexpected token in month range: ,) "Incorrect syntax which should throw an error" for "Mo,,Th; 00:23-00:42 unknown "warning at correct position?"": PASSED -Mo,, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +Mo, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "12:00-15:00/60; 00:23-00:42 unknown "warning at correct position?"": PASSED 12:00-15:00/60 <--- (opening_hours is running in "time range mode". Found point in time.) @@ -1971,19 +1971,19 @@ Tu 23:59-48:00+ <--- (Time spanning more than two midnights not supported) || <--- (Rule before fallback rule does not contain anything useful) "Incorrect syntax which should throw an error" for "PH, Aug-Sep 00:00-24:00; 00:23-00:42 unknown "warning at correct position?"": PASSED -PH, Aug <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +PH, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "We off, Mo,Tu,Th-Su,PH, Jun-Aug We 11:00-14:00,17:00+; 00:23-00:42 unknown "warning at correct position?"": PASSED -We off, Mo,Tu,Th-Su,PH, Jun <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +We off, Mo,Tu,Th-Su,PH, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "We, Aug Mo; 00:23-00:42 unknown "warning at correct position?"": PASSED -We, Aug <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +We, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "2014, Aug Mo; 00:23-00:42 unknown "warning at correct position?"": PASSED -2014, Aug <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +2014, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "week 5, Aug Mo; 00:23-00:42 unknown "warning at correct position?"": PASSED -week 5, Aug <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) +week 5, <--- (An additional rule does not make sense here. Just use a ";" as rule separator. See https://wiki.openstreetmap.org/wiki/Key:opening_hours/specification#explain:additional_rule_separator) "Incorrect syntax which should throw an error" for "Jun 2-5, week 5 00:00-24:00; 00:23-00:42 unknown "warning at correct position?"": FAILED "Missing information (e.g. country or holidays not defined in this lib)" for "PH": PASSED