I was über lazy at first, so took libs from SM. But actually it's quite easy to compile, so let's update to latest version \o/.
		
			
				
	
	
		
			344 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			344 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/-- This set of tests is run only with the 8-bit library. They do not require 
 | 
						|
    UTF-8 or Unicode property support. The file starts with all the tests of
 | 
						|
    the POSIX interface, because that is supported only with the 8-bit library.
 | 
						|
    --/
 | 
						|
    
 | 
						|
< forbid 8W 
 | 
						|
 | 
						|
/abc/P
 | 
						|
    abc
 | 
						|
    *** Failers
 | 
						|
 | 
						|
/^abc|def/P
 | 
						|
    abcdef
 | 
						|
    abcdef\B
 | 
						|
 | 
						|
/.*((abc)$|(def))/P
 | 
						|
    defabc
 | 
						|
    \Zdefabc
 | 
						|
 | 
						|
/the quick brown fox/P
 | 
						|
    the quick brown fox
 | 
						|
    *** Failers
 | 
						|
    The Quick Brown Fox
 | 
						|
 | 
						|
/the quick brown fox/Pi
 | 
						|
    the quick brown fox
 | 
						|
    The Quick Brown Fox
 | 
						|
 | 
						|
/abc.def/P
 | 
						|
    *** Failers
 | 
						|
    abc\ndef
 | 
						|
 | 
						|
/abc$/P
 | 
						|
    abc
 | 
						|
    abc\n
 | 
						|
 | 
						|
/(abc)\2/P
 | 
						|
 | 
						|
/(abc\1)/P
 | 
						|
    abc
 | 
						|
 | 
						|
/a*(b+)(z)(z)/P
 | 
						|
    aaaabbbbzzzz
 | 
						|
    aaaabbbbzzzz\O0
 | 
						|
    aaaabbbbzzzz\O1
 | 
						|
    aaaabbbbzzzz\O2
 | 
						|
    aaaabbbbzzzz\O3
 | 
						|
    aaaabbbbzzzz\O4
 | 
						|
    aaaabbbbzzzz\O5
 | 
						|
 | 
						|
/ab.cd/P
 | 
						|
    ab-cd
 | 
						|
    ab=cd
 | 
						|
    ** Failers
 | 
						|
    ab\ncd
 | 
						|
 | 
						|
/ab.cd/Ps
 | 
						|
    ab-cd
 | 
						|
    ab=cd
 | 
						|
    ab\ncd
 | 
						|
 | 
						|
/a(b)c/PN
 | 
						|
    abc
 | 
						|
 | 
						|
/a(?P<name>b)c/PN
 | 
						|
    abc
 | 
						|
 | 
						|
/a?|b?/P
 | 
						|
    abc
 | 
						|
    ** Failers
 | 
						|
    ddd\N   
 | 
						|
 | 
						|
/\w+A/P
 | 
						|
   CDAAAAB 
 | 
						|
 | 
						|
/\w+A/PU
 | 
						|
   CDAAAAB 
 | 
						|
   
 | 
						|
/\Biss\B/I+P
 | 
						|
    Mississippi
 | 
						|
 | 
						|
/abc/\P
 | 
						|
 | 
						|
/-- End of POSIX tests --/ 
 | 
						|
 | 
						|
/a\Cb/
 | 
						|
    aXb
 | 
						|
    a\nb
 | 
						|
    ** Failers (too big char) 
 | 
						|
    A\x{123}B 
 | 
						|
    A\o{443}B 
 | 
						|
  
 | 
						|
/\x{100}/I
 | 
						|
 | 
						|
/\o{400}/I
 | 
						|
 | 
						|
/  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*                          # optional leading comment
 | 
						|
(?:    (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|
 | 
						|
" (?:                      # opening quote...
 | 
						|
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
 | 
						|
|                     #    or
 | 
						|
\\ [^\x80-\xff]           #   Escaped something (something != CR)
 | 
						|
)* "  # closing quote
 | 
						|
)                    # initial word
 | 
						|
(?:  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  \.  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*   (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|
 | 
						|
" (?:                      # opening quote...
 | 
						|
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
 | 
						|
|                     #    or
 | 
						|
\\ [^\x80-\xff]           #   Escaped something (something != CR)
 | 
						|
)* "  # closing quote
 | 
						|
)  )* # further okay, if led by a period
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  @  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*    (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                           # initial subdomain
 | 
						|
(?:                                  #
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  \.                        # if led by a period...
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*   (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                     #   ...further okay
 | 
						|
)*
 | 
						|
# address
 | 
						|
|                     #  or
 | 
						|
(?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|
 | 
						|
" (?:                      # opening quote...
 | 
						|
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
 | 
						|
|                     #    or
 | 
						|
\\ [^\x80-\xff]           #   Escaped something (something != CR)
 | 
						|
)* "  # closing quote
 | 
						|
)             # one word, optionally followed by....
 | 
						|
(?:
 | 
						|
[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
 | 
						|
\(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)       |  # comments, or...
 | 
						|
 | 
						|
" (?:                      # opening quote...
 | 
						|
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
 | 
						|
|                     #    or
 | 
						|
\\ [^\x80-\xff]           #   Escaped something (something != CR)
 | 
						|
)* "  # closing quote
 | 
						|
# quoted strings
 | 
						|
)*
 | 
						|
<  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*                     # leading <
 | 
						|
(?:  @  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*    (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                           # initial subdomain
 | 
						|
(?:                                  #
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  \.                        # if led by a period...
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*   (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                     #   ...further okay
 | 
						|
)*
 | 
						|
 | 
						|
(?:  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  ,  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  @  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*    (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                           # initial subdomain
 | 
						|
(?:                                  #
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  \.                        # if led by a period...
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*   (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                     #   ...further okay
 | 
						|
)*
 | 
						|
)* # further okay, if led by comma
 | 
						|
:                                # closing colon
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  )? #       optional route
 | 
						|
(?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|
 | 
						|
" (?:                      # opening quote...
 | 
						|
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
 | 
						|
|                     #    or
 | 
						|
\\ [^\x80-\xff]           #   Escaped something (something != CR)
 | 
						|
)* "  # closing quote
 | 
						|
)                    # initial word
 | 
						|
(?:  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  \.  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*   (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|
 | 
						|
" (?:                      # opening quote...
 | 
						|
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
 | 
						|
|                     #    or
 | 
						|
\\ [^\x80-\xff]           #   Escaped something (something != CR)
 | 
						|
)* "  # closing quote
 | 
						|
)  )* # further okay, if led by a period
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  @  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*    (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                           # initial subdomain
 | 
						|
(?:                                  #
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  \.                        # if led by a period...
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*   (?:
 | 
						|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
 | 
						|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
 | 
						|
|   \[                         # [
 | 
						|
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
 | 
						|
\]                        #           ]
 | 
						|
)                     #   ...further okay
 | 
						|
)*
 | 
						|
#       address spec
 | 
						|
(?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*  > #                  trailing >
 | 
						|
# name and address
 | 
						|
)  (?: [\040\t] |  \(
 | 
						|
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
 | 
						|
\)  )*                       # optional trailing comment
 | 
						|
/xSI
 | 
						|
 | 
						|
/-- Although this saved pattern was compiled with link-size=2, it does no harm
 | 
						|
to run this test with other link sizes because it is going to generated a
 | 
						|
"compiled in wrong mode" error as soon as it is loaded, so the link size does 
 | 
						|
not matter. --/
 | 
						|
 | 
						|
<!testsaved16
 | 
						|
 | 
						|
<!testsaved32
 | 
						|
 | 
						|
/\h/SI
 | 
						|
 | 
						|
/\H/SI
 | 
						|
 | 
						|
/\v/SI
 | 
						|
 | 
						|
/\V/SI
 | 
						|
 | 
						|
/\R/SI
 | 
						|
 | 
						|
/[\h]/BZ
 | 
						|
    >\x09<
 | 
						|
 | 
						|
/[\h]+/BZ
 | 
						|
    >\x09\x20\xa0<
 | 
						|
 | 
						|
/[\v]/BZ
 | 
						|
 | 
						|
/[\H]/BZ
 | 
						|
 | 
						|
/[^\h]/BZ
 | 
						|
 | 
						|
/[\V]/BZ
 | 
						|
 | 
						|
/[\x0a\V]/BZ
 | 
						|
 | 
						|
/\777/I
 | 
						|
 | 
						|
/(*:0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF)XX/K
 | 
						|
    XX
 | 
						|
     
 | 
						|
/(*:0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDE)XX/K
 | 
						|
    XX
 | 
						|
 | 
						|
/\u0100/<JS>
 | 
						|
 | 
						|
/[\u0100-\u0200]/<JS>
 | 
						|
 | 
						|
/[^\x00-a]{12,}[^b-\xff]*/BZ
 | 
						|
 | 
						|
/[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/BZ
 | 
						|
 | 
						|
/-- End of testinput14 --/
 |