Skip to content
Newer
Older
100644 411 lines (361 sloc) 10.4 KB
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
1
2
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
3 .namespace [ "PGE";"P5Regex" ]
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
4
5 .sub "compile_p5regex"
6 .param pmc source
7 .param pmc adverbs :slurpy :named
8
9 $I0 = exists adverbs['grammar']
8e57fe8 @allisonrandal [pdd15oo] Merging the pdd15oo branch at r22176 back into trunk.
allisonrandal authored Oct 17, 2007
10 if $I0 goto have_grammar
1c757c9 @pmichaud [PGE]:
pmichaud authored May 11, 2006
11 adverbs['grammar'] = 'PGE::Grammar'
8e57fe8 @allisonrandal [pdd15oo] Merging the pdd15oo branch at r22176 back into trunk.
allisonrandal authored Oct 17, 2007
12 have_grammar:
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
13
14 .local string target
15 target = adverbs['target']
e1f7b0c @pmichaud [PGE]:
pmichaud authored Nov 8, 2006
16 target = downcase target
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
17
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
18 ## If we're passed the results of a previous parse, use it.
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
19 .local pmc match
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
20 $I0 = isa source, ['PGE';'Match']
21 if $I0 == 0 goto parse
22 $P0 = source['expr']
23 if null $P0 goto parse
24 $I0 = isa $P0, ['PGE';'Exp']
25 if $I0 == 0 goto parse
26 match = source
27 goto analyze
28
29 parse:
e1f7b0c @pmichaud [PGE]:
pmichaud authored Nov 8, 2006
30 $P0 = get_global "p5regex"
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
31 match = $P0(source, adverbs :flat :named)
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
32 if target != 'parse' goto check
33 .return (match)
34
35 check:
36 unless match goto check_1
37 $S0 = source
38 $S1 = match
39 if $S0 == $S1 goto analyze
40 check_1:
41 null $P0
42 .return ($P0)
43
44 analyze:
45 .local pmc exp, pad
46 exp = match['expr']
b3ef02f @pmichaud [pge]:
pmichaud authored Jun 28, 2007
47 pad = new 'Hash'
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
48 pad['subpats'] = 0
49 exp = exp.'p5analyze'(pad)
f7e5e32 @coke RT #58974 - .return is deprecated when .tailcall could be used.
coke authored Nov 11, 2008
50 .tailcall exp.'compile'(adverbs :flat :named)
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
51 .end
52
53
54 .sub "p5regex"
55 .param pmc mob
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
56 .param pmc adverbs :slurpy :named
57
58 .local string stop, tighter
59 .local pmc stopstack, optable
60
61 stopstack = get_hll_global ['PGE';'P5Regex'], '@!stopstack'
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
62 optable = get_hll_global ["PGE";"P5Regex"], "$optable"
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
63
64 stop = adverbs['stop']
65 tighter = adverbs['tighter']
66 push stopstack, stop
67 $P0 = optable."parse"(mob, 'stop'=>stop, 'tighter'=>tighter)
68 $S0 = pop stopstack
69
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
70 .return ($P0)
71 .end
72
73
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
74 .include "cclass.pasm"
75
76 .const int PGE_INF = 2147483647
77
78 .sub "__onload" :load
79 .local pmc optable
80
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
81 optable = new ['PGE';'OPTable']
82 set_hll_global ["PGE";"P5Regex"], "$optable", optable
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
83
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
84 $P0 = get_hll_global ["PGE";"P5Regex"], "parse_lit"
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
85 optable.'newtok'('term:', 'precedence'=>'=', 'nows'=>1, 'parsed'=>$P0)
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
86
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
87 optable.'newtok'('term:\b', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::Anchor')
88 optable.'newtok'('term:\B', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::Anchor')
89 optable.'newtok'('term:^', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::Anchor')
90 optable.'newtok'('term:$', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::Anchor')
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
91
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
92 optable.'newtok'('term:\d', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::CCShortcut')
93 optable.'newtok'('term:\D', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::CCShortcut')
94 optable.'newtok'('term:\s', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::CCShortcut')
95 optable.'newtok'('term:\S', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::CCShortcut')
96 optable.'newtok'('term:\w', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::CCShortcut')
97 optable.'newtok'('term:\W', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::CCShortcut')
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
98
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
99 optable.'newtok'('circumfix:( )', 'equiv'=>'term:', 'nows'=>1, 'nullterm'=>1, 'match'=>'PGE::Exp::CGroup')
100 optable.'newtok'('circumfix:(?: )', 'equiv'=>'term:', 'nows'=>1, 'nullterm'=>1, 'match'=>'PGE::Exp::Group')
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
101
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
102 $P0 = get_hll_global ['PGE';'P5Regex'], 'parse_enumclass'
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
103 optable.'newtok'('term:[', 'precedence'=>'=', 'nows'=>1, 'parsed'=>$P0)
104 optable.'newtok'('term:.', 'precedence'=>'=', 'nows'=>1, 'parsed'=>$P0)
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
105
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
106 $P0 = get_hll_global ['PGE';'P5Regex'], 'parse_quant'
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
107 optable.'newtok'('postfix:*', 'looser'=>'term:', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
108 optable.'newtok'('postfix:+', 'equiv'=>'postfix:*', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
109 optable.'newtok'('postfix:?', 'equiv'=>'postfix:*', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
110 optable.'newtok'('postfix:{', 'equiv'=>'postfix:*', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
111
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
112 optable.'newtok'('infix:', 'looser'=>'postfix:*', 'right'=>1, 'nows'=>1, 'match'=>'PGE::Exp::Concat')
113 optable.'newtok'('infix:|', 'looser'=>'infix:', 'left'=>1, 'nows'=>1, 'match'=>'PGE::Exp::Alt')
0700c33 @particle [PGE]: convert deprecated 'addtok' calls to 'newtok'
particle authored Sep 30, 2006
114
1e544ba @coke use of bareword method names is [DEPRECATED]
coke authored Nov 13, 2008
115 optable.'newtok'('close:}', 'looser'=>'infix:|', 'nows'=>1) # XXX: hack
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
116
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
117 # Create a stack for holding stop tokens
118 $P0 = new 'ResizablePMCArray'
119 set_hll_global ['PGE';'P5Regex'], '@!stopstack', $P0
120
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
121 $P0 = get_hll_global ["PGE";"P5Regex"], "compile_p5regex"
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
122 compreg "PGE::P5Regex", $P0
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
123 .end
124
125
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
126 .sub 'parse_error'
127 .param pmc mob
128 .param int pos
129 .param string message
abb2d74 @particle [pge]: p5regex compiler now throws exception upon parse error
particle authored Jan 9, 2007
130 $P0 = getattribute mob, '$.pos'
131 $P0 = pos
b3ef02f @pmichaud [pge]:
pmichaud authored Jun 28, 2007
132 $P0 = new 'Exception'
abb2d74 @particle [pge]: p5regex compiler now throws exception upon parse error
particle authored Jan 9, 2007
133 $S0 = 'p5regex parse error: '
134 $S0 .= message
135 $S0 .= ' at offset '
136 $S1 = pos
137 $S0 .= $S1
138 $S0 .= ", found '"
139 $P1 = getattribute mob, '$.target'
140 $S1 = $P1
141 $S1 = substr $S1, pos, 1
142 $S0 .= $S1
143 $S0 .= "'"
2255840 @allisonrandal [pdd17pmc] Merging the pdd25cx branch into trunk for r26555 to r29949.
allisonrandal authored Aug 2, 2008
144 $P0 = $S0
abb2d74 @particle [pge]: p5regex compiler now throws exception upon parse error
particle authored Jan 9, 2007
145 throw $P0
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
146 .return ()
147 .end
148
149
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
150 .sub "parse_lit"
151 .param pmc mob
152 .local string target
153 .local int pos, lastpos
154 .local int litstart, litlen
155 .local string initchar
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
156 (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::Literal')
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
157 lastpos = length target
158 initchar = substr target, pos, 1
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
159 unless initchar == '*' goto initchar_ok
160 parse_error(mob, pos, "Quantifier follows nothing")
161
162 initchar_ok:
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
163 if initchar == ')' goto end
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
164 inc pos
165 if initchar != "\\" goto term_literal
166 term_backslash:
167 initchar = substr target, pos, 1
168 inc pos
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
169 if pos <= lastpos goto term_backslash_ok
170 parse_error(mob, pos, "Search pattern not terminated")
171 term_backslash_ok:
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
172 $I0 = index "nrteab", initchar
173 if $I0 < 0 goto term_literal
174 initchar = substr "\n\r\t\e\a\b", $I0, 1
175 term_literal:
176 litstart = pos
177 litlen = 0
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
178 .local string stop
179 .local int stoplen
180 $P0 = get_hll_global ['PGE';'P5Regex'], '@!stopstack'
181 stop = $P0[-1]
182 stoplen = length stop
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
183 term_literal_loop:
184 if pos >= lastpos goto term_literal_end
4889075 @pmichaud [pge]: Update P5Regex so that its parser recognizes specific stop tok…
pmichaud authored Mar 27, 2009
185 if stoplen == 0 goto not_stop
186 $S0 = substr target, pos, stoplen
187 if $S0 == stop goto term_literal_end
188 not_stop:
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
189 $S0 = substr target, pos, 1
190 $I0 = index "[](){}*?+\\|^$.", $S0
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
191 # if not in circumfix:( ) throw error on end paren
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
192 if $I0 >= 0 goto term_literal_end
193 inc pos
194 inc litlen
195 goto term_literal_loop
196 term_literal_end:
197 if litlen < 1 goto term_literal_one
198 dec pos
199 term_literal_one:
200 $I0 = pos - litstart
201 $S0 = substr target, litstart, $I0
202 $S0 = concat initchar, $S0
19472de @pmichaud Change 'value' method to 'result_object' method, to address
pmichaud authored Sep 11, 2006
203 mob.'result_object'($S0)
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
204 goto end
205 end:
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
206 mob.'to'(pos)
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
207 .return (mob)
208 .end
209
210 .sub "parse_quant"
211 .param pmc mob
212 .local string target
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
213 .local int min, max, backtrack
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
214 .local int pos, lastpos
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
215 .local string key
216 key = mob['KEY']
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
217 (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::Quant')
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
218 lastpos = length target
219 min = 0
220 max = PGE_INF
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
221 backtrack = 0
222 if key == '{' goto quant_range
223 if key != '+' goto quant_max
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
224 min = 1
225 quant_max:
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
226 if key != "?" goto quant_lazy
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
227 max = 1
228 goto quant_lazy
229 quant_range:
230 $I1 = find_not_cclass .CCLASS_NUMERIC, target, pos, lastpos
231 if $I1 <= pos goto quant_range_max
232 $S0 = substr target, pos
233 min = $S0
234 max = $S0
235 pos = $I1
236 quant_range_max:
237 $S0 = substr target, pos, 1
238 if $S0 != "," goto quant_range_end
239 inc pos
240 max = PGE_INF
241 $I1 = find_not_cclass .CCLASS_NUMERIC, target, pos, lastpos
242 if $I1 <= pos goto quant_range_end
243 $S0 = substr target, pos
244 max = $S0
245 pos = $I1
246 quant_range_end:
247 $S0 = substr target, pos, 1
248 if $S0 != "}" goto err_range
249 inc pos
250 quant_lazy:
251 $S0 = substr target, pos, 1
252 if $S0 != "?" goto end
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
253 backtrack = PGE_BACKTRACK_EAGER
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
254 inc pos
255 end:
256 mob["min"] = min
257 mob["max"] = max
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
258 mob["backtrack"] = backtrack
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
259 mob.'to'(pos)
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
260 .return (mob)
261 err_range:
262 parse_error(mob, pos, "Error in quantified range")
263 .end
264
265
266 .sub parse_group
267 .param pmc mob
268 .local string target
269 .local int pos, lastpos
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
270 (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::CGroup')
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
271 inc pos
272 $S0 = substr target, pos, 2
273 if $S0 == "?:" goto nocapture
274 goto end
275 nocapture:
276 pos += 2
277 end:
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
278 mob.'to'(pos)
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
279 .return (mob)
280 .end
281
282 .sub "parse_enumclass"
283 .param pmc mob
284 .local string target
285 .local int pos, lastpos
286 .local int isrange
287 .local string charlist
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
288 .local string key
289 key = mob['KEY']
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
290 (mob, pos, target) = mob.'new'(mob, 'grammar'=>'PGE::Exp::EnumCharList')
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
291 if key == '.' goto dot
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
292 lastpos = length target
293 charlist = ""
294 mob["isnegated"] = 0
295 isrange = 0
296 $S0 = substr target, pos, 1
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
297 if $S0 != "^" goto scan_first
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
298 mob["isnegated"] = 1
299 inc pos
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
300 scan_first:
301 if pos >= lastpos goto err_close
302 $S0 = substr target, pos, 1
303 inc pos
304 if $S0 == "\\" goto backslash
305 goto addchar
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
306 scan:
307 if pos >= lastpos goto err_close
308 $S0 = substr target, pos, 1
309 inc pos
310 if $S0 == "]" goto endclass
311 if $S0 == "-" goto hyphenrange
312 if $S0 != "\\" goto addchar
313 backslash:
314 $S0 = substr target, pos, 1
315 inc pos
316 $I0 = index "nrtfae0b", $S0
317 if $I0 == -1 goto addchar
318 $S0 = substr "\n\r\t\f\a\e\0\b", $I0, 1
319 addchar:
320 if isrange goto addrange
321 charlist .= $S0
322 goto scan
323 addrange:
324 isrange = 0
325 $I2 = ord charlist, -1
326 $I0 = ord $S0
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
327 if $I0 < $I2 goto err_range
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
328 addrange_1:
329 inc $I2
330 if $I2 > $I0 goto scan
331 $S1 = chr $I2
332 charlist .= $S1
333 goto addrange_1
334 hyphenrange:
335 if isrange goto addrange
336 isrange = 1
337 goto scan
338 endclass:
339 if isrange == 0 goto end
340 charlist .= "-"
341 goto end
342 dot:
343 charlist = "\n"
344 mob["isnegated"] = 1
345 end:
281fd4b @pmichaud [pge]:
pmichaud authored Oct 5, 2007
346 mob.'to'(pos)
19472de @pmichaud Change 'value' method to 'result_object' method, to address
pmichaud authored Sep 11, 2006
347 mob.'result_object'(charlist)
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
348 .return (mob)
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
349
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
350 err_close:
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
351 parse_error(mob, pos, "Unmatched [")
352 err_range:
353 $S0 = 'Invalid [] range "'
354 $S1 = chr $I2
355 $S0 .= $S1
356 $S0 .= '-'
357 $S1 = chr $I0
358 $S0 .= $S1
359 $S0 .= '"'
360 parse_error(mob, pos, $S0)
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
361 .end
1af8ba3 @particle [PGE]: #40106: [PATCH] 15 more tests work for PGE::P5Regex
particle authored Oct 2, 2006
362
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
363
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
364 .namespace [ "PGE";"Exp" ]
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
365
366 .sub "p5analyze" :method
367 .param pmc pad
368 .local pmc exp
369 $I0 = 0
370 loop:
371 $I1 = defined self[$I0]
9cbdcbc @pmichaud Merge pge-pm branch with updated PGE into trunk.
pmichaud authored Apr 27, 2006
372 if $I1 == 0 goto end
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
373 $P0 = self[$I0]
374 $P0 = $P0."p5analyze"(pad)
375 self[$I0] = $P0
376 inc $I0
377 goto loop
378 end:
379 .return (self)
380 .end
381
1ebf2db @tene Merge hllmagic branch into trunk.
tene authored Oct 10, 2008
382 .namespace [ "PGE";"Exp";"CGroup" ]
c346e6b @pmichaud * Added initial version of compreg "PGE::P5Regexp"
pmichaud authored Nov 17, 2005
383
384 .sub "p5analyze" :method
385 .param pmc pad
386 .local pmc exp
387
388 self["iscapture"] = 0
389 if self != "(" goto end
390 self["iscapture"] = 1
391 self["isscope"] = 0
392 self["isarray"] = 0
393 $I0 = pad["subpats"]
394 self["cname"] = $I0
395 inc $I0
396 pad["subpats"] = $I0
397 end:
398 exp = self[0]
399 exp = exp."p5analyze"(pad)
400 self[0] = exp
401 .return (self)
402 .end
403
404
99869c4 @paultcochrane [pge] Added pir coda as per coding standards (part 5)
paultcochrane authored Mar 18, 2007
405
406 # Local Variables:
407 # mode: pir
408 # fill-column: 100
409 # End:
95eed07 @coke [codingstd]
coke authored Feb 18, 2008
410 # vim: expandtab shiftwidth=4 ft=pir:
Something went wrong with that request. Please try again.