File: rx_modifiers

package info (click to toggle)
nqp 2022.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,436 kB
  • sloc: java: 28,030; perl: 3,394; ansic: 451; makefile: 200; javascript: 68; sh: 1
file content (118 lines) | stat: -rw-r--r-- 6,201 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# todo :jvm<ignorecase+ignoremark doesn't work on jvm>
:i:m st			st	y	ignorecase ignoremark with ligature st (:i:m)
:i:m "All hell is breaking loose"			"All is fine, I am sure of it" 	n	RT128875 :i:m combined matches whole string when a single character match is found
##  modifiers
# todo 6 :jvm<ligature problem>
:i st			st	y	ignorecase with ligature st (:i)
:i st			ST	y	ignorecase with ligature st (:i)
:i st			St	y	ignorecase with ligature st (:i)
:i st			sT	y	ignorecase with ligature st (:i)
:i st			st	y	reversed haystack and needle ignorecase with ligature st (:i)

# todo :moar<ligature problem>
:i abcdefgst			sT	y	ignorecase with ligature st (:i)
:i bcd			abcdef	y	ignorecase (:i)
:i bcd			aBcdef	y	ignorecase (:i)
:i bcd			abCdef	y	ignorecase (:i)
:i bcd			abcDef	y	ignorecase (:i)
:i bcd			abc-ef	n	ignorecase (:i)
:ignorecase bcd		abcdef	y	ignorecase (:ignorecase)
:ignorecase bcd		aBCDef	y	ignorecase (:ignorecase)
:ignorecase bcd		abc-ef	n	ignorecase (:ignorecase)
:i(0) bcd		abcdef	y	ignorecase, repetition (:i(0))
:i(0) bcd		abCdef	n	ignorecase, repetition (:i(0))
:i(1) bcd		abcdef	y	ignorecase, repetition (:i(1))
:i(1) bcd		abCdef	y	ignorecase, repetition (:i(1))
:i(1) bcd		aBxDef	n	ignorecase, repetition (:i(1))
:0i bcd			abcdef	y	ignorecase, repetition (:0i)
:0i bcd			abCdef	n	ignorecase, repetition (:0i)
:1i bcd			abcdef	y	ignorecase, repetition (:1i)
:1i bcd			abCdef	y	ignorecase, repetition (:1i)
:1i bcd			aBCDef	y	ignorecase, repetition (:1i)
:1i bcd			aBxDef	n	ignorecase, repetition (:1i)
A :i B			Ab		y	ignorecase in the middle, literals on both sides
ab [:i cd ] ef		abcdef	y	ignorecase, lexical (:i)
ab [:i cd ] ef		abCdef	y	ignorecase, lexical (:i)
ab [:i cd ] ef		abcDef	y	ignorecase, lexical (:i)
ab [:i cd ] ef		abCDef	y	ignorecase, lexical (:i)
ab [:i cd ] ef		aBCDef	n	ignorecase, lexical (:i)
ab [:i cd ] ef		abCDEf	n	ignorecase, lexical (:i)
:i ab [:i cd ] ef	abCDef	y	ignorecase, lexical (:i)
:i ab [:i cd ] ef	AbCDeF	y	ignorecase, lexical (:i)
:i ab [:i cd ] ef	AbcdeF	y	ignorecase, lexical (:i)
:i a [:i(0) b [:i(1) c [:0i d [:1i e [:i(0) f ] ] ] ] ]		AbCdEf		y	ignorecase, lexical (:i)
:i aa [:i(0) bb [:i(1) cc [:0i dd [:1i ee [:i(0) ff ] ] ] ] ]	AabbCcddEeff	y	ignorecase, lexical (:i)
:i a [:i(0) b [:i(1) c [:0i d [:1i e [:i(0) f ] ] ] ] ]		AbCdEF		n	ignorecase, lexical (:i)
:i aa [:i(0) bb [:i(1) cc [:0i dd [:1i ee [:i(0) ff ] ] ] ] ]	AabbCcddEeFf	n	ignorecase, lexical (:i)
:i ab [:i(0) cd ] ef	AbcdeF	y	ignorecase, lexical repetition (:i)
:i ab [:!i cd ] ef	AbcdeF	y	ignorecase, lexical repetition (:i)
:i ab [:0i cd ] ef	AbcdeF	y	ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef	abCDef	y	ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef	AbCDeF	n	ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef	AbcdeF	n	ignorecase, lexical repetition (:i)
:0i ab [:i(0) cd ] ef	abcdef	y	ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef	AbcdeF	n	ignorecase, lexical repetition (:i)
:i(1) ab [:1i cd ] ef	AbCdeF	y	ignorecase, lexical repetition (:i)
:i(1) ab [:i(0) cd ] ef	AbcdeF	y	ignorecase, lexical repetition (:i)
:i(1) ab [:i(0) cd ] ef	AbcDeF	n	ignorecase, lexical repetition (:i)
:i(2) ab [:i(999) cd ] ef	ABCDEF	y	ignorecase, lexical repetition (:i)
:1i ab [:i(1) cd ] ef		ABCDEF	y	ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef		abcDeF	n	ignorecase, lexical repetition (:i)
:2i ab [:999i cd ] ef		ABCDEF	y	ignorecase, lexical repetition (:i)
ab [:ignorecase cd ] ef		abCDef	y	ignorecase, lexical (:ignorecase)
ab [:ignorecase cd ] ef		aBCDef	n	ignorecase, lexical (:ignorecase)
:1ignorecase ab [:ignorecase(1) cd ] ef	ABCDEF	y	ignorecase, lexical repetition (:ignorecase)
:s bcd			a bcdef		y	sigspace (:s)
:s bcd			a bcd ef	y	sigspace (:s)
:s bcd			abcdef		y	sigspace (:s)
:s bcd			abcd ef		y	sigspace (:s)
:s bcd			ab cdef		n	sigspace (:s)
:s b c d		a b c d ef	y	sigspace (:s)
:s b c d		a b c def	y	sigspace (:s)
:s b c d		ab c d ef	y	sigspace (:s)
:s b c d		a bcdef		n	sigspace (:s)
:s b c d		abcdef		n	sigspace (:s)
:sigspace bcd		a bcdef		y	sigspace (:sigspace)
:sigspace bcd		a bcd ef	y	sigspace (:sigspace)
:sigspace bcd		abcdef		y	sigspace (:sigspace)
:sigspace b c d		a b c d ef	y	sigspace (:sigspace)
:sigspace b c d		a b c def	y	sigspace (:sigspace)
:sigspace b c d		ab c d ef	y	sigspace (:sigspace)
:s(1) b c [:s(0) d \w f ]	a b c def	y	sigspace, lexical repetition (:s)
:s b c [:!s d \w f ]	a b c def	y	sigspace, lexical repetition (:s)
:s(0) b \w [:s(1) d \w f ]	a b c def	n	sigspace, lexical repetition (:s)
:!s b \w [:s d \w f ]	a b c def	n	sigspace, lexical repetition (:s)
:s(0) b \w [:s(0) d \w f ]	a b c def	n	sigspace, lexical repetition (:s)
:!s b \w [:!s d \w f ]	a b c def	n	sigspace, lexical repetition (:s)
:s ab 				ab		y	sigspace, trailing ws
foo\s*'-'?\s*bar		foo\t \n-\n\t bar	y	basic match
foo\s*'-'?\s*bar		foo - bar	y	basic match
foo\s+'-'?\s*bar		foo   bar	y	basic match \s+ \s*
foo\s+'-'?\s*bar		foo  -bar	y	basic match \s+ \s*
foo\s*'-'?\s+bar		foo-  bar	y	basic match \s* \s+
foo '-'? bar			foo-bar		y	basic match \s* \s*
foo '-'? bar			foobar		y	basic match
foo '-'? bar			foo - bar	n	basic non-match
:s foo '-'? bar			foo\n \t- \t\t\nbar	y	basic ws match
:s foo '-'? bar			foo - bar	y	basic ws match
:s foo '-'? bar			foo   bar	y	basic ws match \s+ \s*
:s foo '-'? bar			foo  -bar	y	basic ws match \s+ \s*
:s foo '-'? bar			foo-  bar	y	basic ws match \s* \s+
:s foo '-'? bar			foo-bar		y	basic ws match \s* \s*
:s foo '-'? bar			foobar		n	basic ws non-match
# todo :any<feature>
:s()foo '-'? bar		foo - bar	n	basic ws match
# todo :any<feature>
:s[]foo '-'? bar		foo - bar	y	basic ws match
:s<?wb>foo '-'? bar		foo - bar	y	basic ws match with boundary modifier separation
# todo :any<::>
:s::foo '-'? bar			foo - bar	y	basic ws match with backtrack no-op modifier separation
# todo :any<::>
:s::(\w+) ':=' (\S+)		dog := spot	/mob 0: <dog @ 0>/	sigspace and capture together
# todo :any<::>
:s::(\w+) ':=' (\S+)		dog := spot	/mob 1: <spot @ 7>/	sigspace and capture together
# todo :any<feature>
:perl5 \A.*? bcd\Q$\E..\z	a bcd$ef	y	perl5 syntax (:perl5)
:s^[\d+ ]* abc			11 12 13 abc	y	<?ws> before closing bracket

## vim: noexpandtab tabstop=4 shiftwidth=4