Сопоставление строк
2025-11-10 00:58Перепишем на Gist алгоритм сопоставления строк с шаблоном из Снобола-4.
Реализация и три демонстрашки: snobol_patterns.gisp
Запускаем:
Реализация и три демонстрашки: snobol_patterns.gisp
Запускаем:
$ gisp snobol_patterns.gisp
== Snobol-style syllable split ==
syllable:
matched: strand
captures:
onset => str
nucleus => a
coda => nd
== Configuration pairs with ARBNO/BREAK ==
pairs:
matched: name = Alice; age=34; city=Rlyeh;
captures:
key => name
value => Alice
key => age
value => 34
key => city
value => Rlyeh
pairs:
name => Alice
age => 34
city => Rlyeh
== Log line with LEN/POS/RPOS ==
log:
matched: ERROR 2025-11-10 parser: unexpected token ';'
captures:
level => ERROR
year => 2025
month => 11
day => 10
date => 2025-11-10
module => parser
message => unexpected token ';'
decoded date: 2025-11-10
module: parser
message: unexpected token ';'
no subject
Date: 2025-11-10 10:37 (UTC)