PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/samples/M/pcre.m

https://gitlab.com/Aaeinstein54/linguist
Objective C | 511 lines | 479 code | 32 blank | 0 comment | 31 complexity | 1b6a4d46b7fd2d6d85bba6f4faba9818 MD5 | raw file
  1. ;
  2. ; GT.M PCRE Extension
  3. ; Copyright (C) 2012 Piotr Koper <piotr.koper@gmail.com>
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU Affero General Public License as
  7. ; published by the Free Software Foundation, either version 3 of the
  8. ; License, or (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU Affero General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU Affero General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ; GT.M is a trademark of Fidelity Information Services, Inc.
  19. ; "GT.M™ is a vetted industrial strength, transaction processing application
  20. ; platform consisting of a key-value database engine optimized for extreme
  21. ; transaction processing throughput & business continuity."
  22. ; -- http://sourceforge.net/projects/fis-gtm/
  23. ; GT.M PCRE Extension
  24. ;
  25. ; This extension tries to deliver the best possible PCRE interface for the
  26. ; M world by providing a support for PCRE with M arrays, stringified parameter
  27. ; names, simplified API, locales, exceptions and Perl5 Global Match.
  28. ;
  29. ; See pcreexamples.m for comprehensive examples on ^pcre routines usage and
  30. ; beginner level tips on match limits, exception handling and UTF-8 in GT.M.
  31. ;
  32. ; Try out the best known book on regular expressions: http://regex.info/
  33. ; For more information on PCRE see: http://pcre.org/
  34. ;
  35. ; Please feel free to contact me if you have any questions or comments,
  36. ; Piotr Koper <piotr.koper@gmail.com>
  37. ;
  38. pcre ;GT.M PCRE Extension
  39. ;1.0;Initial release;pkoper
  40. q
  41. version()
  42. q $&pcre.version()
  43. config(name)
  44. ; name is one of: (case insensitive)
  45. ; "UTF8", "NEWLINE", "LINK_SIZE", "POSIX_MALLOC_THRESHOLD",
  46. ; "MATCH_LIMIT", "MATCH_LIMIT_RECURSION", "STACKRECURSE",
  47. ; "BSR", "UNICODE_PROPERTIES", "JIT", "JITTARGET"
  48. ;
  49. d protect
  50. ;
  51. n erropt,isstring,s,n,code
  52. s code=$&pcre.config(.name,.erropt,.isstring,.s,.n)
  53. s:code $ec=",U"_(-code)_","
  54. q $s(isstring:s,1:n)
  55. compile(pattern,options,locale,mlimit,reclimit)
  56. ; options is case insensitive and optional string with "|" joined:
  57. ; "ANCHORED", "CASELESS", "DOLLAR_ENDONLY", "DOTALL", "EXTENDED",
  58. ; "FIRSTLINE", "MULTILINE", "NO_AUTO_CAPTURE", "DUPNAMES",
  59. ; "UNGREEDY", "BSR_ANYCRLF", "BSR_UNICODE", "JAVASCRIPT_COMPAT",
  60. ; "NL_ANY", "NL_ANYCRLF", "NL_CR", "NL_CRLF","NL_LF",
  61. ; "UTF8", "UCP", "NO_UTF8_CHECK"
  62. ;
  63. ; locale is an optional Unix locale name used for pcre_maketables(),
  64. ; cases:
  65. ; undefined or "":
  66. ; pcre_maketables() will not be called
  67. ; "ENV" (case insensitive):
  68. ; use locale in program environment defined by the
  69. ; environment variables LANG or LC_*
  70. ; specified:
  71. ; "pl_PL.iso88592", "pl_PL.utf8", "C", ...
  72. ; see locale(1), locale(2) and the output of command:
  73. ; $ locale -a
  74. ; Debian tip: use
  75. ; $ dpkg-reconfigure locales
  76. ; to enable or set system-wide locale
  77. ;
  78. ; mlimit (optional) limits the number of internal matching function
  79. ; calls in pcre_exec() execution, see PCRE manual for details
  80. ;
  81. ; reclimit (optional) limit for the depth of recursion when calling
  82. ; the internal matching function in a pcre_exec() execution,
  83. ; see PCRE manual for details
  84. ;
  85. d protect
  86. ;
  87. n erropt,ref,err,erroffset,code
  88. s code=$&pcre.compile(.pattern,$g(options),.erropt,.ref,.err,.erroffset,$g(locale),$g(mlimit,0),$g(reclimit,0))
  89. s:code $ec=",U"_(-code)_","
  90. q ref
  91. exec(ref,subject,options,startoffset,length)
  92. ; options is case insensitive and optional string with "|" joined:
  93. ; "ANCHORED", "BSR_ANYCRLF", "BSR_UNICODE",
  94. ; "NL_ANY", "NL_ANYCRLF", "NL_CR", "NL_CRLF", "NL_LF",
  95. ; "NOTBOL", "NOTEOL", "NOTEMPTY", "NOTEMPTY_ATSTART",
  96. ; "NO_START_OPTIMIZE", "NO_UTF8_CHECK",
  97. ; "PARTIAL_SOFT", "PARTIAL_HARD"
  98. ;
  99. ; startoffset is in octets, starts with 1 (like in M) (optional)
  100. ;
  101. ; length is subject length in octets, not chars (optional)
  102. ;
  103. d protect
  104. ;
  105. n erropt,code,start
  106. s start=$g(startoffset,1)-1
  107. s code=$&pcre.exec(.ref,.subject,$g(length,$zl(subject)),start,$g(options),.erropt)
  108. s:code<0 $ec=",U"_(-code)_","
  109. q code
  110. ovector(ref,i) ; return i-element from ovector
  111. d protect
  112. ;
  113. n n,code
  114. s code=$&pcre.ovector(.ref,.i,.n)
  115. s:code $ec=",U"_(-code)_","
  116. ;s $ec=",U123,"
  117. q n
  118. ovecsize(ref) ; return ovecsize
  119. d protect
  120. ;
  121. n n,code
  122. s code=$&pcre.ovecsize(.ref,.n)
  123. s:code $ec=",U"_(-code)_","
  124. q n
  125. fullinfo(ref,name)
  126. ; name is one of: (case insensitive)
  127. ; "OPTIONS", "SIZE", "CAPTURECOUNT", "BACKREFMAX", "FIRSTBYTE",
  128. ; "FIRSTTABLE", "LASTLITERAL", "NAMEENTRYSIZE", "NAMECOUNT",
  129. ; "STUDYSIZE", "OKPARTIAL", "JCHANGED", "HASCRORLF", "MINLENGTH",
  130. ; "JIT", "JITSIZE"
  131. ; for NAME* options see also $$nametable^pcre()
  132. ;
  133. d protect
  134. ;
  135. n erropt,isstring,s,n,code
  136. s code=$&pcre.fullinfo(.ref,.name,.erropt,.isstring,.s,.n)
  137. s:code $ec=",U"_(-code)_","
  138. q $s(isstring:s,1:n)
  139. nametable(ref,i,n) ; returns index (n) and name, or { 0, "" } for invalid i
  140. ; i is indexed from 1
  141. ;
  142. d protect
  143. ;
  144. n s,code
  145. s code=$&pcre.nametable(.ref,.i,.n,.s)
  146. s:code $ec=",U"_(-code)_","
  147. q s
  148. substring(ref,i,begin,end)
  149. s begin=$$ovector(.ref,i*2)+1,end=$$ovector(.ref,i*2+1)
  150. ; ovector contains octet indexed data not UNICODE chars, so $ze is used
  151. q:'begin ""
  152. q $s($g(o,0):begin_","_end,1:$ze(subject,begin,end))
  153. store(ref,i,n,o,key) ; same as above but stores captured data in n array
  154. n begin,end
  155. s begin=$$ovector(.ref,i*2)+1,end=$$ovector(.ref,i*2+1)
  156. q:'begin
  157. s key=$g(key,i)
  158. s:o n(key,0)=begin,n(key,1)=end
  159. s n(key)=$ze(subject,begin,end)
  160. q
  161. gstore(ref,i,n,round,byref,o,key) ; store for global match
  162. n begin,end
  163. s begin=$$ovector(.ref,i*2)+1,end=$$ovector(.ref,i*2+1)
  164. q:'begin
  165. s key=$g(key,i)
  166. i byref d
  167. . s:o n(key,round,0)=begin,n(key,round,1)=end
  168. . s n(key,round)=$ze(subject,begin,end)
  169. e d
  170. . s:o n(round,key,0)=begin,n(round,key,1)=end
  171. . s n(round,key)=$ze(subject,begin,end)
  172. q
  173. test(subject,pattern,options,locale,mlimit,reclimit)
  174. ; see $$compile^pcre for options, locale, mlimit and reclimit
  175. ;
  176. d protect
  177. n ref,l
  178. s ref=$$compile(.pattern,$g(options),$g(locale),$g(mlimit,0),$g(reclimit,0))
  179. s l=$$exec(.ref,.subject)
  180. d free(.ref)
  181. q l
  182. match(subject,pattern,match,capture,options,locale,mlimit,reclimit)
  183. ; see $$compile^pcre for options, locale, mlimit and reclimit
  184. ;
  185. ; capture is case insensitive and optional string with "|" joined
  186. ; names or indexes to be capture
  187. ;
  188. ; extended options:
  189. ; "NAMED_ONLY" - capture only named groups
  190. ; "OVECTOR" - return additional ovector data
  191. ;
  192. d protect
  193. ;
  194. n namedonly,ovector,ref,o,l,i,j,s,c,begin
  195. ;
  196. s options=$g(options),(namedonly,ovector)=0
  197. f i=1:1:$l(options,"|") d
  198. . s o=$zco($p(options,"|",i),"u")
  199. . i o="NAMED_ONLY" s namedonly=1,$p(options,"|",i)=""
  200. . i o="OVECTOR" s ovector=1,$p(options,"|",i)=""
  201. s:namedonly options=options_"|NO_AUTO_CAPTURE"
  202. ;
  203. k match
  204. s ref=$$compile(.pattern,.options,$g(locale),$g(mlimit,0),$g(reclimit,0))
  205. s l=$$exec(.ref,.subject)
  206. i $d(capture) d
  207. . s c="|"_capture_"|"
  208. . ; ovector indexed data
  209. . i 'namedonly f i=0:1:l-1 d:c[("|"_i_"|") store(.ref,.i,.match,.ovector)
  210. . ; named matches data
  211. . f i=1:1 s s=$$nametable(.ref,.i,.j) q:s="" d:c[("|"_s_"|") store(.ref,.j,.match,.ovector,.s)
  212. e d
  213. . i 'namedonly f i=0:1:l-1 d store(.ref,.i,.match,.ovector)
  214. . f i=1:1 s s=$$nametable(.ref,.i,.j) q:s="" d store(.ref,.j,.match,.ovector,.s)
  215. d free(.ref)
  216. q:$q l q
  217. global(subject,pattern,match,capture,options,locale,mlimit,reclimit)
  218. ; options is the same as for match^pcre, extended options:
  219. ; "OVECTOR" - return additional ovector data
  220. ; "GROUPED" - group the result in match array by pattern groups
  221. ; "NAMED_ONLY" - capture only named patterns
  222. ;
  223. ; see pcredemo.c and pcreccp.cc from PCRE for comments on procedure
  224. ; for Perl like global matching
  225. ;
  226. d protect
  227. ;
  228. n ref,c,o,ovector,byref,namedonly,utf8,crlf,start,end,matches,empty,skip,round,i,j,s,n,q
  229. k match
  230. ;
  231. ; determine additional options and remove them before calling the compile^pcre
  232. s options=$g(options),(ovector,byref,namedonly)=0
  233. f i=1:1:$l(options,"|") d
  234. . s o=$zco($p(options,"|",i),"u")
  235. . i o="NAMED_ONLY" s namedonly=1,$p(options,"|",i)=""
  236. . i o="GROUPED" s byref=1,$p(options,"|",i)=""
  237. . i o="OVECTOR" s ovector=1,$p(options,"|",i)=""
  238. s:namedonly options=options_"|NO_AUTO_CAPTURE"
  239. ;
  240. ; compile the pattern
  241. s ref=$$compile(.pattern,.options,$g(locale),$g(mlimit,0),$g(reclimit,0))
  242. ;
  243. s:$d(capture) c="|"_capture_"|"
  244. s byref=$g(byref,0)
  245. ;
  246. ; check pattern options for UTF8 and double char new line
  247. s o="|"_$$fullinfo(.ref,"OPTIONS")_"|"
  248. s utf8=$s(o["|UTF8|":1,1:0)
  249. s crlf=$s(o["|NL_CRLF|":1,o["|NL_ANY|":1,o["|NL_ANYCRLF|":1,1:0)
  250. ;
  251. ; if none check the PCRE build options
  252. i crlf=0 d
  253. . s o=$$config("NEWLINE")
  254. . s crlf=$s(o="NL_CRLF":1,o="NL_ANY":1,o="NL_ANYCRLF":1,1:0)
  255. ;
  256. s (start,round,i)=1,(empty,skip,q)=0
  257. s end=$l(subject)+1
  258. f d q:start>end!q
  259. . i empty d
  260. .. s matches=$$exec(.ref,.subject,"NOTEMPTY_ATSTART|ANCHORED",.start) ; unwind this call to optimize
  261. .. q:matches ; quit this do, leave empty=1, store the matches
  262. ..
  263. .. ; advance if no match & clear empty
  264. .. s start=start+1
  265. .. i start>end s q=1 q
  266. ..
  267. .. ; skip LF if CR was before and CRLF mode
  268. .. s:crlf&(($ze(subject,start-1)=$c(13))&($ze(subject,start)=$c(10))) start=start+1
  269. ..
  270. .. ; skip if in a middle of UTF char
  271. .. i utf8 f q:start'<end!($zbitand($c(0)_$ze(subject,start),$c(0)_$c(192))=$c(0)_$c(128)) s start=start+1
  272. ..
  273. .. ; take into account skipped chars
  274. .. s skip=1,empty=0
  275. . e d
  276. .. s matches=$$exec(.ref,.subject,,.start)
  277. .. i 'matches s q=1 q
  278. .
  279. . q:q
  280. . i skip s skip=0 q
  281. .
  282. . i $d(c) d
  283. .. ; ovector indexed data
  284. .. i 'namedonly f i=0:1:matches-1 d:c[("|"_i_"|") gstore(.ref,.i,.match,.round,.byref,.ovector)
  285. .. ; named matches data
  286. .. f i=1:1 s s=$$nametable(.ref,.i,.n) q:s="" d:c[("|"_s_"|") gstore(.ref,.n,.match,.round,.byref,.ovector,.s)
  287. . e d
  288. .. i 'namedonly f i=0:1:matches-1 d gstore(.ref,.i,.match,.round,.byref,.ovector)
  289. .. f i=1:1 s s=$$nametable(.ref,.i,.n) q:s="" d gstore(.ref,.n,.match,.round,.byref,.ovector,.s)
  290. . s round=round+1
  291. .
  292. . s start=$$ovector(.ref,1)+1
  293. . s empty=(($$ovector(.ref,0)+1)=start)
  294. d free(.ref)
  295. q:$q round-1 q
  296. replace(subject,pattern,subst,first,last,options,locale,mlimit,reclimit)
  297. ; see $$match^pcre and $$compile^pcre for options, locale, mlimit and
  298. ; reclimit
  299. ;
  300. ; subst is a string to replace with all occurrences of matched data
  301. ; \n (like \1, \2, ..) is a back ref for the n-th captured group
  302. ; \{name} is back ref for a named captured data
  303. ; \\ is replaced with \
  304. ;
  305. ; first is the n-th match in the subject where the substitution begins,
  306. ; 1 .. n-1 matches are not substituted
  307. ; defaults to 1
  308. ;
  309. ; last is the n-th match in the subject where the substitution ends,
  310. ; n+1 .. matches are not substituted
  311. ; defaults to 0 (no limit)
  312. ;
  313. n ref,o,n,i,j,begin,end,offset,backref,boffset,value,s
  314. s ref=$$compile(.pattern,,$g(locale),$g(mlimit,0),$g(reclimit,0))
  315. ;
  316. ; prepare back reference stack
  317. d global^pcre(.subst,"\\(?:(?<ref>(?:\d+|\\))|{(?<ref>[^}]+)})",.backref,,"ovector|dupnames")
  318. ;
  319. s options=$g(options)_"|ovector"
  320. ; silently remove "NAMED_ONLY" and "GROUPPED" options
  321. f i=1:1:$l(options,"|") d
  322. . s o=$zco($p(options,"|",i),"u")
  323. . s:o="NAMED_ONLY"!(o="GROUPED") $p(options,"|",i)=""
  324. q:'$$global(.subject,.pattern,.n,,.options,$g(locale),$g(mlimit,0),$g(reclimit,0)) subject
  325. ;
  326. ; perform the substitution on matched subject parts
  327. s first=$g(first,1),last=$g(last,0)
  328. s offset=0,i=""
  329. f s i=$o(n(i)) q:i="" d:i'<first q:last>0&(i'<last)
  330. .
  331. . ; replace back refs in subst (s) with captured data
  332. . s s=subst,boffset=0,j=""
  333. . f s j=$o(backref(j)) q:j="" d
  334. ..
  335. .. ; determine the back ref type and get the value
  336. .. ; silently ignore invalid refs
  337. .. s value=$s(backref(j,"ref")="\":"\\",1:$g(n(i,backref(j,"ref"))))
  338. ..
  339. .. ; replace back ref with the value
  340. .. s begin=backref(j,0,0)
  341. .. s end=backref(j,0,1)
  342. .. s $ze(s,begin+boffset,end+boffset)=value
  343. .. s boffset=boffset-(end+1-begin)+$l(value)
  344. .
  345. . ; replace matched data with prepared s
  346. . s begin=n(i,0,0)
  347. . s end=n(i,0,1)
  348. .
  349. . s $ze(subject,begin+offset,end+offset)=s
  350. .
  351. . ; substitute empty matches also (Perl style)
  352. . ;
  353. . ; perl -e '$_ = "aa"; s/(b*|a)/Xy/g; print "$_\n"'
  354. . ; w $$replace^pcre("aa","(b*|a)","Xy")
  355. . ;
  356. . ; perl -e '$_ = "aa"; s/(b*|aa)/Xy/g; print "$_\n"'
  357. . ; w $$replace^pcre("aa","(b*|aa)","Xy")
  358. . ;
  359. . ; perl -e '$_ = "aaa"; s/(b*|aa)/Xy/g; print "$_\n"'
  360. . ; w $$replace^pcre("aaa","(b*|aa)","Xy")
  361. . ;
  362. . s:begin>end $ze(subject,begin+offset,begin+offset+1)=s_$ze(subject,begin+offset,begin+offset+1)
  363. .
  364. . s offset=offset-(end+1-begin)+$l(s)
  365. q:$q subject q
  366. free(ref)
  367. d protect
  368. n code
  369. s code=$&pcre.free(.ref)
  370. s:code $ec=",U"_(-code)_","
  371. q
  372. stackusage()
  373. ; return the approximate amount of stack (in bytes) used per
  374. ; recursion in pcre_exec()
  375. q -$&pcre.stackusage()
  376. ; Exception Handling
  377. ;
  378. ; Error conditions are handled by setting the $zc to user codes, see labels
  379. ; at the end of this file. When neither $zt nor $et are set by the user,
  380. ; the default handler (trap^pcre) is used within $zt mechanism.
  381. ;
  382. ; The default handler will write out the details of the exception, and
  383. ; depending on the caller type, it will re raise the exception. This will
  384. ; lead to:
  385. ; a) writing the exception details, when called from the GT.M prompt,
  386. ; b) writing the exception details, the M code place when the pcre routine
  387. ; was called, and terminating the GT.M image.
  388. ;
  389. ; The user should define own exception handler using $zt or $et, see
  390. ; pcreexample.m for example exception handlers.
  391. ;
  392. protect ; try setup $zt with default handler
  393. ;
  394. ; "n protect" in the $zt is a marker for trap^pcre
  395. s:'$l($et)&(($zt="B")!'$l($zt)) $zt="n protect d trap zg "_($zl-2)
  396. q
  397. trap(stack)
  398. ; see U* labels at the bottom of this file, some lvns are mandatory
  399. ; all exceptions are passed through if we wasn't called from direct mode
  400. ;
  401. n zl,ref,msg,place
  402. ;
  403. ; take the $zl if in default handler setup by protect^trap
  404. s zl=$p($zt,"n protect d trap zg ",2)
  405. ;
  406. ; clear the $zt
  407. s $zt=""
  408. ;
  409. ; source location from either stack argument, zl (default handler), or $st-2
  410. s place=$st($g(stack,$g(zl,$st-1)-1),"PLACE")
  411. ;
  412. ; clear location if called from direct mode
  413. s:place["^GTM$DMOD" place=""
  414. ;
  415. s ref=$p($ec,",",$l($ec,",")-1)
  416. i $l($t(@ref)) d
  417. . u $p
  418. . w @$p($t(@ref),";",2)
  419. . ; %PCRE-E-COMPILE additional message
  420. . w:ref="U16392"&$g(erroffset) " in "_$e($g(pattern),1,erroffset)_" <-- HERE"
  421. . w !
  422. . ; write the location it has any meaning
  423. . w:$l(place) "%PCRE-I-RTSLOC, At M source location ",place,!
  424. e d
  425. . w $p($zs,",",3,4),!
  426. . w "%GTM-I-RTSLOC, At M source location ",$p($zs,",",2),!
  427. ;
  428. ; re raise the exception if in a default handler and not called from the direct mode
  429. s:$l(place)&$g(zl,0) $ec=$ec
  430. q
  431. ; XC API specific
  432. ;
  433. U16384 ;"%PCRE-E-ARGSMALL, Actual argument count is too small"
  434. U16385 ;"%PCRE-E-OPTNAME, Unknown option name "_$p($g(erropt),"|")
  435. U16386 ;"%PCRE-E-OBJLIMIT, Maximum number of objects exceeded"
  436. U16387 ;"%PCRE-E-INVREF, Invalid object reference"
  437. U16388 ;"%PCRE-E-INTBUF, Internal buffer too small"
  438. U16389 ;"%PCRE-E-MALLOC, Could not allocate memory"
  439. U16390 ;"%PCRE-E-STUDY, Pattern study failed: "_$g(err,"unknown reason")
  440. U16391 ;"%PCRE-E-LOCALE, Invalid locale name "_$g(locale)
  441. U16392 ;"%PCRE-E-COMPILE, Pattern compilation failed, "_$g(err,"unknown reason")
  442. U16393 ;"%PCRE-E-LENGTH, Invalid length value specified"
  443. ; PCRE specific
  444. ;
  445. ; NOTES:
  446. ;
  447. ; U16401 exception is never raised; when pcre_exec() returns -1
  448. ; (i.e. NOMATCH) the pcre.exec returns 0, so no exception will
  449. ; ever raise, NOMATCH is not an uncommon situation
  450. ;
  451. ; U16388 is raised when pcre_exec() returns 0, i.e. the ovector
  452. ; was too small; considering that ovector size is not controlled
  453. ; in M world, it is an exception here
  454. ;
  455. U16401 ;"%PCRE-E-NOMATCH, The subject string did not match the pattern"
  456. U16402 ;"%PCRE-E-NULL, Either compiled code or subject was passed as NULL, or ovector was NULL"
  457. U16403 ;"%PCRE-E-BADOPTION, An unrecognized bit was set in the options argument"
  458. U16404 ;"%PCRE-E-BADMAGIC, The magic number is not present in compiled code"
  459. U16405 ;"%PCRE-E-UNKNOWNOPCODE, While running the pattern match, an unknown item was encountered in the compiled pattern"
  460. U16406 ;"%PCRE-E-NOMEMORY, Call via pcre_malloc() or pcre_stack_malloc() failed"
  461. U16407 ;"%PCRE-E-NOSUBSTRING, No substring"
  462. U16408 ;"%PCRE-E-MATCHLIMIT, Match limit was reached"
  463. U16409 ;"%PCRE-E-CALLOUT, Callout function wanted to yield a distinctive error code"
  464. U16410 ;"%PCRE-E-BADUTF8, A string that contains an invalid UTF-8 byte sequence was passed as a subject"
  465. U16411 ;"%PCRE-E-BADUTF8OFFSET, The value of startoffset did not point to the beginning of a UTF-8 character or the end of the subject"
  466. U16412 ;"%PCRE-E-PARTIAL, The subject string did not match, but it did match partially"
  467. U16414 ;"%PCRE-E-INTERNAL, An unexpected internal error has occurred"
  468. U16415 ;"%PCRE-E-BADCOUNT, The value of the ovecsize argument is negative"
  469. U16416 ;"%PCRE-E-DFAUITEM, Unsupported item in the pattern, for e.g. \C o a back reference"
  470. U16417 ;"%PCRE-E-DFAUCOND, Unsupported condition item, for e.g. a back reference for a condition, or a test for recursion in a specific group"
  471. U16418 ;"%PCRE-E-DFAUMLIMIT, Match limits are unsupported for DTA matching"
  472. U16419 ;"%PCRE-E-DFAWSSIZE, Out of space in the workspace vector"
  473. U16420 ;"%PCRE-E-DFARECURSE, The output vector was not large enough while processing recursive subpattern"
  474. U16421 ;"%PCRE-E-RECURSIONLIMIT, The internal recursion limit was reached"
  475. U16423 ;"%PCRE-E-BADNEWLINE, An invalid combination of NL_xxx options was given"
  476. U16424 ;"%PCRE-E-BADOFFSET, The startoffset was negative or greater than the length of the value in length"
  477. U16425 ;"%PCRE-E-SHORTUTF8, The subject string ends with a truncated UTF-8 character and the PCRE_PARTIAL_HARD option is set"
  478. U16426 ;"%PCRE-E-RECURSELOOP, A recursion loop within the pattern was detected"
  479. U16427 ;"%PCRE-E-JITSTACKLIMIT, The memory available for the just-in-time processing stack is not large enough"