--- parser3/tests/059.html 2003/03/04 10:14:24 1.1.2.1 +++ parser3/tests/059.html 2010/07/25 06:23:41 1.5 @@ -1,14 +1,34 @@ @main[] -...^oneOf[a;a,b,c]...
-#...^oneOf[a;ax,b,c]...
-...^oneWord[word]...
-#...^oneWord[wo rd]...
+^windows-1251[] +...^oneOf[a;a,b,c]...
+...^oneOf[a;ax,b,c]...
+...^oneWord[Word]...
+...^oneWord[wo rd]...
@oneOf[s;list][t] выдаёт строку, если строка она есть в списке(разделенном запятыми) $t[^list.lsplit[,]] -^if(!^t.locate[piece;$s]){^throw[user;$s;unknown]} -$result[$s] +^try{ + ^if(!^t.locate[piece;$s]){ + ^throw[user;$s;unknown] + } + $result[$s] +}{ + ^if($exception.type eq "user"){ + $exception.handled(1) + $result['$s' not in list '$list'] + } +} @oneWord[s] -^if(^s.match[\W]){^throw[user.data;$s;not word]}{$s} +^try{ + ^if(^s.match[\W]){ + ^throw[user;$s;not word] + } + $result[$s] +}{ + ^if($exception.type eq "user"){ + $exception.handled(1) + $result['$s' not a word] + } +}