Commit 15a84ba0 authored by Volker Krause's avatar Volker Krause Committed by David Faure
Browse files

Add Russian language support for states and sun-based events

This is a bit ugly in parts as Flex isn't using Unicode but working on
an 8bit input stream, and we need to match Cyrillic letters here.

BUG: 445785
parent cd735858
Pipeline #105444 passed with stage
in 1 minute and 32 seconds
......@@ -316,6 +316,13 @@ private Q_SLOTS:
T2("Пон-Пт 08:00-20:00, Суб 08:00-19:00", "Mo-Fr 08:00-20:00, Sa 08:00-19:00");
T2("Ноябрь-Март", "Nov-Mar");
T2("с 08:30 до 23:00", "08:30-23:00");
T2("рассвет - сумерки", "dawn-dusk");
T2("от рассвета до сумерек", "dawn-dusk");
T2("восход - закат", "sunrise-sunset");
T2("с восхода пo закат", "sunrise-sunset");
T2("от восхода дo заката", "sunrise-sunset");
T2("Среда открыто; Пятница закрыто; Суббота неизвестно", "We open; Fr closed; Sa unknown");
T2("Вт Выходной", "Tu closed");
// recovery from wrong rule separators
T2("Fr,Sa 10:00-02:00,Su 10:00-20:00", "Fr,Sa 10:00-02:00, Su 10:00-20:00");
......
......@@ -26,6 +26,7 @@
SPACE ([ \t\r\n]| | | )+
INTEGER [0-9]+
CYRILLIC (а|б|в|г|д|е|ё|ж|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ъ|ы|ь|э|ю|я)
YEAR [1-2][019][0-9][0-9]
......@@ -194,10 +195,12 @@ Dec\.? { yylval->num = 12; return T_MONTH; }
h|時 { return T_ALT_TIME_SEP_OR_SUFFIX; }
/* alternative range separators */
~|~|〜|to|à|bis|a|ás|às|as|au|al|→|до { return T_ALT_RANGE_SEP; }
~|~|〜|to|à|bis|a|ás|às|as|au|al|→|до|дo|пo { return T_ALT_RANGE_SEP; }
/* localized state names */
ferm(e|é)|geschlossen|ruhetag|encerrado|chiuso { yylval->state = State::Closed; return T_STATE; }
ferm(e|é)|geschlossen|ruhetag|encerrado|chiuso|закры{CYRILLIC}*|Вых{CYRILLIC}* { yylval->state = State::Closed; return T_STATE; }
откры{CYRILLIC}* { yylval->state = State::Open; return T_STATE; }
неизв{CYRILLIC}* { yylval->state = State::Unknown; return T_STATE; }
/* German localized day names. */
Montags? { yylval->num = 1; return T_WEEKDAY; }
......@@ -297,7 +300,13 @@ Minggu { yylval->num = 7; return T_WEEKDAY; }
/* skip filler words */
/* Note: the 'с' is not an ASCII 'c'! */
from|von|du|de|le|das|分|uhr|"en continu"|с {}
from|von|du|de|le|das|分|uhr|"en continu"|с|от {}
/* localized time event names */
рассвет{CYRILLIC}* { yylval->time = { Time::Dawn, 0, 0 }; return T_EVENT; }
сумер{CYRILLIC}?к{CYRILLIC}* { yylval->time = { Time::Dusk, 0, 0 }; return T_EVENT; }
восход{CYRILLIC}* { yylval->time = { Time::Sunrise, 0, 0 }; return T_EVENT; }
закат{CYRILLIC}* { yylval->time = { Time::Sunset , 0, 0 }; return T_EVENT; }
. {
//printf("unexpected character: %s at %d:%d\n", yytext, yylloc->first_line, yylloc->first_column);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment