tel8618217223380 / oasychev-moodle-plugins

Automatically exported from code.google.com/p/oasychev-moodle-plugins
0 stars 0 forks source link

Ошибки от PCRE #131

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Полный перечень ошибок от PCRE

1  \ at end of pattern
          2  \c at end of pattern
          3  unrecognized character follows \
          4  numbers out of order in {} quantifier
          5  number too big in {} quantifier
          6  missing terminating ] for character class
          7  invalid escape sequence in character class
          8  range out of order in character class
          9  nothing to repeat
         10  [this code is not in use]
         11  internal error: unexpected repeat
         12  unrecognized character after (? or (?-
         13  POSIX named classes are supported only within a class
         14  missing )
         15  reference to non-existent subpattern
         16  erroffset passed as NULL
         17  unknown option bit(s) set
         18  missing ) after comment
         19  [this code is not in use]
         20  regular expression is too large
         21  failed to get memory
         22  unmatched parentheses
         23  internal error: code overflow
         24  unrecognized character after (?<
         25  lookbehind assertion is not fixed length
         26  malformed number or name after (?(
         27  conditional group contains more than two branches
         28  assertion expected after (?(
         29  (?R or (?[+-]digits must be followed by )
         30  unknown POSIX class name
         31  POSIX collating elements are not supported
         32  this version of PCRE is compiled without UTF support
         33  [this code is not in use]
         34  character value in \x{...} sequence is too large
         35  invalid condition (?(0)
         36  \C not allowed in lookbehind assertion
         37  PCRE does not support \L, \l, \N{name}, \U, or \u
         38  number after (?C is > 255
         39  closing ) for (?C expected
         40  recursive call could loop indefinitely
         41  unrecognized character after (?P
         42  syntax error in subpattern name (missing terminator)
         43  two named subpatterns have the same name
         44  invalid UTF-8 string (specifically UTF-8)
         45  support for \P, \p, and \X has not been compiled
         46  malformed \P or \p sequence
         47  unknown property name after \P or \p
         48  subpattern name is too long (maximum 32 characters)
         49  too many named subpatterns (maximum 10000)
         50  [this code is not in use]
         51  octal value is greater than \377 in 8-bit non-UTF-8 mode
         52  internal error: overran compiling workspace
         53  internal error: previously-checked referenced subpattern
               not found
         54  DEFINE group contains more than one branch
         55  repeating a DEFINE group is not allowed
         56  inconsistent NEWLINE options
         57  \g is not followed by a braced, angle-bracketed, or quoted
               name/number or by a plain number
         58  a numbered reference must not be zero
         59  an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)
         60  (*VERB) not recognized
         61  number is too big
         62  subpattern name expected
         63  digit expected after (?+
         64  ] is an invalid data character in JavaScript compatibility mode
         65  different names for subpatterns of the same number are
               not allowed
         66  (*MARK) must have an argument
         67  this version of PCRE is not compiled with Unicode property
               support
         68  \c must be followed by an ASCII character
         69  \k is not followed by a braced, angle-bracketed, or quoted name
         70  internal error: unknown opcode in find_fixedlength()
         71  \N is not supported in a class
         72  too many forward references
         73  disallowed Unicode code point (>= 0xd800 && <= 0xdfff)

Необходимо разобраться, какие из них к нам 
относятся и реализовать выдачу сообщений. 
А также что реализовано, а что - нет...

Original issue reported on code.google.com by oasyc...@gmail.com on 19 Jul 2012 at 3:49

GoogleCodeExporter commented 9 years ago
Квадратными скобками выделено то, что 
реализовано, кое-где написал комментарии 
каким образом. Вроде бы оставил только то, 
что необходимо.

 1    \ at end of pattern
 2    \c at end of pattern
[4]   numbers out of order in {} quantifier
[6]   missing terminating ] for character class
[8]   range out of order in character class
[9]   nothing to repeat (странно, у нас это как раз 
ситуация с квантификатором?)
 12   unrecognized character after (? or (?-
[14]  missing )
 15   reference to non-existent subpattern
 17   unknown option bit(s) set
[22]  unmatched parentheses
 25   lookbehind assertion is not fixed length
 26   malformed number or name after (?(    (можно будет сделать потом, с условными подмасками)
[27]  conditional group contains more than two branches
 28   assertion expected after (?(
 29   (?R or (?[+-]digits must be followed by )
[30]  unknown POSIX class name
[31]  POSIX collating elements are not supported
 35   invalid condition (?(0)   (опять же TODO - условные подмаски)
[46]  malformed \P or \p sequence
[47]  unknown property name after \P or \p
[58]  a numbered reference must not be zero (в правиле в 
лексере первая цифра числа - [1-9])
[59]  an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT) 
(сделано как нераспознанная 
последовательность)
[60]  (*VERB) not recognized (сделано как 
нераспознанная последовательность)
[66]  (*MARK) must have an argument (сделано как 
нераспознанная последовательность)
[68]  \c must be followed by an ASCII character (пока что в виде 
исключения)

Original comment by vostreltsov@gmail.com on 21 Jul 2012 at 7:00

GoogleCodeExporter commented 9 years ago
1, 2 и 15 нужно более чем. На 15 даже тесты в AT&T 
есть...

3 и 7 - по PCRE любой не буквенно-цифровой 
символ после бэкслеш это он сам, а вот буквы 
- только те, которые актуально используются 
в последовательностях. Так что по идее это 
тоже наши ошибки, на случай если там что-то 
нехорошее. Причем вовне и внутри 
символьных классов они разные (например 
внутри симв. классов не могут встречаться 
обратные ссылки начинающиеся с бэкслеша).

13 - ошибка, а у нас будет разобрана как куча 
символов. Может ради совместимости сделать 
ошибку? Тут они впереди нас...

18 у нас не идет по общим правилам как 
незакрытая скобка? Что будет при 
незакрытом комменте - проверить!

24 - к нам относится ИМХО.
34 - тоже вполне возможная ошибка, пределы то 
есть
37 - мы все это поддерживаем или почему ее 
нет в списке?
38-39 что такое (?C и поддерживается ли оно 
лексером?
40 - надо бы на будущее, хотя определить ее не 
так легко. Вокруг рекурсии всегда должен 
быть обход без нее, либо она под 
квантификатором допускающим нулевое 
количество раз должна стоять....
43 точно возможная ошибка которую надо 
искать - вы же делали именнованные 
подмаски, насчет 42 надо посмотреть - видимо 
тоже...
57 - \g - обратные ссылки,тоже надо выводить бы
63 - (?+ - лексером разбирается? что делает?
65 - это не ситуация когда внутри (?| 
находятся именованные подмаски?
69 - \k это вроде обратные ссылки , почему нет 
в списке?
71 - поддерживаем? или мы сделаем по своему?

Original comment by oasyc...@gmail.com on 23 Jul 2012 at 1:46

GoogleCodeExporter commented 9 years ago
Вы напишите новый вариант, что реализовано?

Original comment by oasyc...@gmail.com on 31 Jul 2012 at 2:10

GoogleCodeExporter commented 9 years ago
Обновленный вариант. Внутри [] - то что 
сделано, внутри () - что по моему мнению к нам 
не относится. Внизу комментарии.

[01]  \ at end of pattern
[02]  \c at end of pattern
[03]  unrecognized character follows \
[04]  numbers out of order in {} quantifier
[05]  number too big in {} quantifier
[06]  missing terminating ] for character class
[07]  invalid escape sequence in character class
[08]  range out of order in character class
[09]  nothing to repeat
(10)  [this code is not in use]
(11)  internal error
 12  unrecognized character after (? or (?-
[13]  POSIX named classes are supported only within a class
[14]  missing )
[15]  reference to non-existent subpattern
(16)  erroffset passed as NULL
(17)  unknown option bit(s) set
[18]  missing ) after comment
(19)  [this code is not in use]
[20]  regular expression is too large
(21)  failed to get memory
[22]  unmatched parentheses
(23)  internal error
 24  unrecognized character after (?<
 25  lookbehind assertion is not fixed length
[26]  malformed number or name after (?(
[27]  conditional group contains more than two branches
 28  assertion expected after (?(
[29]  (?R or (?[+-]digits must be followed by )
[30]  unknown POSIX class name
[31]  POSIX collating elements are not supported
(32)  this version of PCRE is compiled without UTF support
(33)  [this code is not in use]
(34)  character value in \x{...} sequence is too large
(35)  invalid condition (?(0)
 36  \C not allowed in lookbehind assertion
 37  PCRE does not support \L, \l, \N{name}, \U, or \u
 38  number after (?C is > 255
[39]  closing ) for (?C expected
 40  recursive call could loop indefinitely
[41]  unrecognized character after (?P
[42]  syntax error in subpattern name (missing terminator)
[43]  two named subpatterns have the same name
(44)  invalid UTF-8 string (specifically UTF-8)
(45)  support for \P, \p, and \X has not been compiled
[46]  malformed \P or \p sequence
[47]  unknown property name after \P or \p
(48)  subpattern name is too long (maximum 32 characters)
(49)  too many named subpatterns (maximum 10000)
(50)  [this code is not in use]
(51)  octal value is greater than \377 in 8-bit non-UTF-8 mode
(52)  internal error
(53)  internal error
 54  DEFINE group contains more than one branch
 55  repeating a DEFINE group is not allowed
(56)  inconsistent NEWLINE options
[57]  \g is not followed by a braced, angle-bracketed, or quoted name/number or 
by a plain number
[58]  a numbered reference must not be zero
[59]  an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)
[60]  (*VERB) not recognized
(61)  number is too big
[62]  subpattern name expected
[63]  digit expected after (?+
(64)  ] is an invalid data character in JavaScript compatibility mode
[65]  different names for subpatterns of the same number are not allowed
[66]  (*MARK) must have an argument
(67)  this version of PCRE is not compiled with Unicode property support
[68]  \c must be followed by an ASCII character
[69]  \k is not followed by a braced, angle-bracketed, or quoted name
(70)  internal error: unknown opcode in find_fixedlength()
(71)  \N is not supported in a class
(72)  too many forward references
 73   disallowed Unicode code point (>= 0xd800 && <= 0xdfff)
(74)  invalid UTF-16 string (specifically UTF-16)

03 и 07: сделал такую ошибку вне символьного 
класса - имхо, внутри СК любой эскейпеный 
символ кроме специальных удобнее считать 
самим собой;
59: распознается как неверная 
последовательность;
71: у нас поддерживается, почему нет;

Некоторые ошибки (например 
эскейп-последовательности вне\внутри 
символьного класса, или 
неоткрытые\незакрытые имена после \g и \k 
делал как одну ошибку, поэтому констант у 
нас меньше чем 74 :) )

Original comment by vostreltsov@gmail.com on 31 Jul 2012 at 2:13

GoogleCodeExporter commented 9 years ago
Я думаю 12, 24, 28, 34, 

61 может сделать разумный предел для 
квантификаторов? А то автоматы еще 
выгребутся на ограничениях, а вот 
бэктрекингу туго придется...

Может быть также 35, 38

40 - когда будем делать рекурсию. Кстати надо 
о ней подумать - возможно это не так уж и 
сложно. При генерации ее всегда надо 
пропускать, если совпадение окончилось не 
внутри нее - тогда просто догенерировать 
что есть. А при совпадении - запускать 
очередную копию автомата - стек автоматов ;).

Original comment by oasyc...@gmail.com on 31 Jul 2012 at 4:33

GoogleCodeExporter commented 9 years ago
12 сделано как 
нераспознанный\неподдерживаемый 
модификатор
28 сделал
34 сделал
35 сделал
38 сделал
73 сделал

Original comment by vostreltsov@gmail.com on 3 Aug 2012 at 8:22

GoogleCodeExporter commented 9 years ago
А с 24 проблема реальна есть? По идее оно 
означает, что после (?< должен идти = или ! - 
начало впередсмотрящего ассерта, 
остальное же будет считаться ошибкой.

Считаете что нам в этом смысле выгодней 
разойтись с PCRE или трудно сделать?

Original comment by oasyc...@gmail.com on 6 Aug 2012 at 2:21

GoogleCodeExporter commented 9 years ago
сделал 24

Original comment by vostreltsov@gmail.com on 6 Aug 2012 at 3:02

GoogleCodeExporter commented 9 years ago
Я пока не буду закрывать, т.к. если мы решим 
сделать рекурсию - а ее польза очевидна - то 
нам придется реализовать ошибку 40. Или 
предпочитаете отдельную задачу?

Original comment by oasyc...@gmail.com on 6 Aug 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Да пусть эта висит...

Original comment by vostreltsov@gmail.com on 7 Aug 2012 at 6:50

GoogleCodeExporter commented 9 years ago
Из коммита: "Убрал ошибку неверной 
escape-последовательности из YYINITIAL, поскольку 
похоже что PCRE игнорирует \ в любом случае и 
кидает ошибку только внутри СК.
Нужно решить, сделать ли ошибку внутри СК 
или игнорировать \ в обоих местах."
Записываю это здесь чтобы не забыть 
разобраться...

Original comment by oasyc...@gmail.com on 7 Aug 2012 at 11:39

GoogleCodeExporter commented 9 years ago
Валерий, у нас 40 теперь реализована?

Original comment by oasyc...@gmail.com on 3 Dec 2014 at 12:32

GoogleCodeExporter commented 9 years ago
нет, нам надо настройку сделать макс. 
уровня рекурсии

Original comment by vostreltsov@gmail.com on 3 Dec 2014 at 8:38

GoogleCodeExporter commented 9 years ago
40 это не глубина рекурсии, а регекс в 
котором бесконечный рекурсивный цикл, т.к. 
нет ветки в обход рекурсии. это статическая 
ошибка, которая сообщается в рамках 
известных нам механизмов

глубину тоже надо, но это отдельный момент 
и может требовать доработки кросс-тестера, 
т.к. влияет на ответы в некоторых тестах...

Original comment by oasyc...@gmail.com on 3 Dec 2014 at 10:37

GoogleCodeExporter commented 9 years ago

Original comment by vostreltsov@gmail.com on 8 Jan 2015 at 9:21

GoogleCodeExporter commented 9 years ago
Done?

Original comment by vostreltsov@gmail.com on 2 Mar 2015 at 8:16