44//BH fix for String not having .length() or .subSequence()
55//BH fix for not reinitializing correctly
66//BH note that start(groupIndex) is not implemented for groupIndex > 0
7- ( function ( ) { Clazz . newPackage$ ( "java.util.regex" ) ;
7+ ( function ( ) { Clazz . newPackage ( "java.util.regex" ) ;
88
9- var C$ = Clazz . newClass$ ( java . util . regex , "Matcher" , function ( ) {
10- Clazz . newInstance$ ( this , arguments ) ;
9+ var C$ = Clazz . newClass ( java . util . regex , "Matcher" , function ( ) {
10+ Clazz . newInstance ( this , arguments ) ;
1111} , null , "java.util.regex.MatchResult" ) ;
1212
1313
@@ -18,28 +18,28 @@ Clazz.load(C$, 1);
1818
1919( function ( ) {
2020
21- var C$ = Clazz . newClass$ ( java . util . regex , "Matcher$1" , function ( ) {
22- Clazz . newInstance$ ( this , arguments [ 0 ] , true ) ;
21+ var C$ = Clazz . newClass ( java . util . regex , "Matcher$1" , function ( ) {
22+ Clazz . newInstance ( this , arguments [ 0 ] , true ) ;
2323 } ) ;
2424
2525 C$ . $clinit$ = function ( ) { delete C$ . $clinit$ ; Clazz . load ( C$ , 1 ) ; }
2626
27- Clazz . newMethod$ ( C$ , "$init$" , function ( ) {
27+ Clazz . newMeth ( C$ , "$init$" , function ( ) {
2828 this . grN = 0 ;
2929 } , 1 ) ;
30- Clazz . newMethod$ ( C$ , "toString" , function ( ) {
30+ Clazz . newMeth ( C$ , "toString" , function ( ) {
3131 return this . b$ [ "java.util.regex.Matcher" ] . group ( this . grN ) ;
3232 } ) ;
3333} ) ( ) ;
3434
35- Clazz . newMethod$ ( C$ , 'c$$java_util_regex_Pattern$CharSequence' , function ( pat , cs ) {
35+ Clazz . newMeth ( C$ , 'c$$java_util_regex_Pattern$CharSequence' , function ( pat , cs ) {
3636 this . pat = pat ;
3737 this . charSeq = cs ;
3838 this . leftBound = 0 ;
3939 this . rightBound = this . charSeq . length$ ( ) ;
4040} , 1 ) ;
4141
42- Clazz . newMethod$ ( C$ , "reset$CharSequence" , function ( newSequence ) {
42+ Clazz . newMeth ( C$ , "reset$CharSequence" , function ( newSequence ) {
4343 if ( newSequence == null ) {
4444 throw new NullPointerException ( "Empty new sequence!" ) ;
4545 }
@@ -48,7 +48,7 @@ Clazz.newMethod$(C$,"reset$CharSequence",function(newSequence){
4848 return this . reset ( ) ;
4949} ) ;
5050
51- Clazz . newMethod$ ( C$ , "reset" , function ( ) {
51+ Clazz . newMeth ( C$ , "reset" , function ( ) {
5252 this . leftBound = 0 ;
5353 this . rightBound = this . charSeq . length$ ( ) ;
5454 this . appendPos = 0 ;
@@ -62,7 +62,7 @@ Clazz.newMethod$(C$,"reset",function(){
6262 return this ;
6363} ) ;
6464
65- Clazz . newMethod$ ( C$ , "find" , function ( ) {
65+ Clazz . newMeth ( C$ , "find" , function ( ) {
6666 // 'find next'
6767 if ( this . strString == null )
6868 this . strString = this . charSeq . toString ( ) ;
@@ -75,7 +75,7 @@ Clazz.newMethod$(C$,"find",function(){
7575 return ( this . results != null ) ;
7676} ) ;
7777
78- Clazz . newMethod$ ( C$ , "find$I" , function ( startIndex ) {
78+ Clazz . newMeth ( C$ , "find$I" , function ( startIndex ) {
7979 var stringLength = this . charSeq . length$ ( ) ;
8080 if ( startIndex < 0 || startIndex > stringLength )
8181 throw new IndexOutOfBoundsException$S ( "Out of bound " + startIndex ) ;
@@ -84,38 +84,38 @@ Clazz.newMethod$(C$,"find$I",function(startIndex){
8484 return this . find ( ) ;
8585} ) ;
8686
87- Clazz . newMethod$ ( C$ , "start" , function ( ) {
87+ Clazz . newMeth ( C$ , "start" , function ( ) {
8888 return this . start$I ( 0 ) ;
8989} ) ;
9090
91- Clazz . newMethod$ ( C$ , "start$I" , function ( groupIndex ) {
91+ Clazz . newMeth ( C$ , "start$I" , function ( groupIndex ) {
9292 return this . startImpl$I ( groupIndex ) ;
9393} ) ;
9494
95- Clazz . newMethod$ ( C$ , "startImpl$I" , function ( groupIndex ) {
95+ Clazz . newMeth ( C$ , "startImpl$I" , function ( groupIndex ) {
9696 // BH SAEM
9797 // NOTE: TODO groupIndex is not implemented!
9898 return this . pat . regexp . lastIndex - this . results [ 0 ] . length ;
9999} ) ;
100100
101- Clazz . newMethod$ ( C$ , "end" , function ( ) {
101+ Clazz . newMeth ( C$ , "end" , function ( ) {
102102 return this . end$I ( 0 ) ;
103103} ) ;
104104
105- Clazz . newMethod$ ( C$ , "end$I" , function ( groupIndex ) {
105+ Clazz . newMeth ( C$ , "end$I" , function ( groupIndex ) {
106106 return this . pat . regexp . lastIndex ;
107107} ) ;
108108
109109
110- Clazz . newMethod$ ( C$ , "appendReplacement$StringBuffer$S" , function ( sb , replacement ) {
110+ Clazz . newMeth ( C$ , "appendReplacement$StringBuffer$S" , function ( sb , replacement ) {
111111 this . processedRepl = this . processReplacement$S ( replacement ) ;
112112 sb . append$S ( this . charSeq . subSequence$I$I ( this . appendPos , this . start ( ) ) ) ;
113113 sb . append$S ( this . processedRepl ) ;
114114 this . appendPos = this . end ( ) ;
115115 return this ;
116116} ) ;
117117
118- Clazz . newMethod$ ( C$ , "processReplacement$S" , function ( replacement ) {
118+ Clazz . newMeth ( C$ , "processReplacement$S" , function ( replacement ) {
119119 if ( this . replacement != null && this . replacement . equals$O ( replacement ) ) {
120120 if ( this . replacementParts == null ) {
121121 return this . processedRepl ;
@@ -145,15 +145,15 @@ Clazz.newMethod$(C$,"processReplacement$S",function(replacement){
145145 } else {
146146 if ( ( repl [ index ] ) . charCodeAt ( 0 ) == ( '$' ) . charCodeAt ( 0 ) ) {
147147 if ( this . replacementParts == null ) {
148- this . replacementParts = Clazz . newArray$ ( String , 0 ) ;
148+ this . replacementParts = Clazz . array ( String , 0 ) ;
149149 }
150150 try {
151151 var gr = Integer . parseInt$S ( String . instantialize ( repl , ++ index , 1 ) ) ;
152152 if ( replacementPos != res . length$ ( ) ) {
153153 this . replacementParts [ this . replacementParts . length ] = res . subSequence$I$I ( replacementPos , res . length$ ( ) ) ;
154154 replacementPos = res . length$ ( ) ;
155155 }
156- this . replacementParts [ this . replacementParts . length ] = Clazz . new ( Clazz . incl$ ( "java.util.regex.Matcher$1" ) . c$ , [ this ] ) ;
156+ this . replacementParts [ this . replacementParts . length ] = Clazz . new ( Clazz . load ( "java.util.regex.Matcher$1" ) . c$ , [ this ] ) ;
157157 var group = this . group ( gr ) ;
158158 replacementPos += group . length ;
159159 res . append$S ( group ) ;
@@ -186,7 +186,7 @@ Clazz.newMethod$(C$,"processReplacement$S",function(replacement){
186186} ) ;
187187
188188
189- Clazz . newMethod$ ( C$ , "region$I$I" , function ( leftBound , rightBound ) {
189+ Clazz . newMeth ( C$ , "region$I$I" , function ( leftBound , rightBound ) {
190190 if ( leftBound > rightBound || leftBound < 0 || rightBound < 0 || leftBound > this . charSeq . length$ ( ) || rightBound > this . charSeq . length$ ( ) ) {
191191 throw Clazz . new ( IndexOutOfBoundsException . c$ , [ leftBound + " is out of bound of " + rightBound ] ) ;
192192 }
@@ -198,11 +198,11 @@ Clazz.newMethod$(C$,"region$I$I",function(leftBound,rightBound){
198198 return this ;
199199} ) ;
200200
201- Clazz . newMethod$ ( C$ , "appendTail$StringBuffer" , function ( sb ) {
201+ Clazz . newMeth ( C$ , "appendTail$StringBuffer" , function ( sb ) {
202202 return sb . append$S ( this . charSeq . subSequence ( this . appendPos , this . charSeq . length$ ( ) ) ) ;
203203} , "StringBuffer" ) ;
204204
205- Clazz . newMethod$ ( C$ , "replaceFirst$S" , function ( replacement ) {
205+ Clazz . newMeth ( C$ , "replaceFirst$S" , function ( replacement ) {
206206 this . reset ( ) ;
207207 if ( this . find ( ) ) {
208208 var sb = new StringBuffer ( ) ;
@@ -212,7 +212,7 @@ Clazz.newMethod$(C$,"replaceFirst$S",function(replacement){
212212 return this . charSeq . toString ( ) ;
213213} ) ;
214214
215- Clazz . newMethod$ ( C$ , "replaceAll$S" , function ( replacement ) {
215+ Clazz . newMeth ( C$ , "replaceAll$S" , function ( replacement ) {
216216 var sb = new StringBuffer ( ) ;
217217 this . reset ( ) ;
218218 while ( this . find ( ) ) {
@@ -221,22 +221,22 @@ Clazz.newMethod$(C$,"replaceAll$S", function(replacement){
221221 return this . appendTail$StringBuffer ( sb ) . toString ( ) ;
222222} ) ;
223223
224- Clazz . newMethod$ ( C$ , "pattern" , function ( ) {
224+ Clazz . newMeth ( C$ , "pattern" , function ( ) {
225225 return this . pat ;
226226} ) ;
227227
228- Clazz . newMethod$ ( C$ , "group$I" , function ( groupIndex ) {
228+ Clazz . newMeth ( C$ , "group$I" , function ( groupIndex ) {
229229 if ( this . results == null || groupIndex < 0 || groupIndex > this . results . length ) {
230230 return null ;
231231 }
232232 return this . results [ groupIndex ] ;
233233} ) ;
234234
235- Clazz . newMethod$ ( C$ , "group" , function ( ) {
235+ Clazz . newMeth ( C$ , "group" , function ( ) {
236236 return this . group ( 0 ) ;
237237} ) ;
238238
239- Clazz . newMethod$ ( C$ , "matches" , function ( ) {
239+ Clazz . newMeth ( C$ , "matches" , function ( ) {
240240 // UB: the find must match the complete input and not modify the RE object
241241 var old_lastIndex = this . pat . regexp . lastIndex ;
242242 try {
@@ -249,7 +249,7 @@ Clazz.newMethod$(C$,"matches",function(){
249249 }
250250} ) ;
251251
252- Clazz . newMethod$ ( C$ , "quoteReplacement$S" , function ( string ) {
252+ Clazz . newMeth ( C$ , "quoteReplacement$S" , function ( string ) {
253253 if ( string . indexOf ( '\\' ) < 0 && string . indexOf ( '$' ) < 0 ) ; // '))
254254 return string ;
255255 var res = Clazz . new ( StringBuffer , [ string . length * 2 ] ) ;
@@ -272,52 +272,52 @@ Clazz.newMethod$(C$,"quoteReplacement$S",function(string){
272272 return res . toString ( ) ;
273273} , 1 ) ;
274274
275- Clazz . newMethod$ ( C$ , "lookingAt" , function ( ) {
275+ Clazz . newMeth ( C$ , "lookingAt" , function ( ) {
276276 return false ;
277277} ) ;
278278
279- Clazz . newMethod$ ( C$ , "groupCount" , function ( ) {
279+ Clazz . newMeth ( C$ , "groupCount" , function ( ) {
280280 return this . results == null ?0 :this . results . length ;
281281} ) ;
282282
283283
284- Clazz . newMethod$ ( C$ , "toMatchResult" , function ( ) {
284+ Clazz . newMeth ( C$ , "toMatchResult" , function ( ) {
285285 return this ;
286286} ) ;
287287
288- Clazz . newMethod$ ( C$ , "useAnchoringBounds$Z" , function ( value ) {
288+ Clazz . newMeth ( C$ , "useAnchoringBounds$Z" , function ( value ) {
289289 return this ;
290290} ) ;
291291
292- Clazz . newMethod$ ( C$ , "hasAnchoringBounds" , function ( ) {
292+ Clazz . newMeth ( C$ , "hasAnchoringBounds" , function ( ) {
293293 return false ;
294294} ) ;
295295
296- Clazz . newMethod$ ( C$ , "useTransparentBounds$Z" , function ( value ) {
296+ Clazz . newMeth ( C$ , "useTransparentBounds$Z" , function ( value ) {
297297 return this ;
298298} ) ;
299299
300- Clazz . newMethod$ ( C$ , "hasTransparentBounds" , function ( ) {
300+ Clazz . newMeth ( C$ , "hasTransparentBounds" , function ( ) {
301301 return false ;
302302} ) ;
303303
304- Clazz . newMethod$ ( C$ , "regionStart" , function ( ) {
304+ Clazz . newMeth ( C$ , "regionStart" , function ( ) {
305305 return this . leftBound ;
306306} ) ;
307307
308- Clazz . newMethod$ ( C$ , "regionEnd" , function ( ) {
308+ Clazz . newMeth ( C$ , "regionEnd" , function ( ) {
309309 return this . rightBound ;
310310} ) ;
311311
312- Clazz . newMethod$ ( C$ , "requireEnd" , function ( ) {
312+ Clazz . newMeth ( C$ , "requireEnd" , function ( ) {
313313 return false ;
314314} ) ;
315315
316- Clazz . newMethod$ ( C$ , "hitEnd" , function ( ) {
316+ Clazz . newMeth ( C$ , "hitEnd" , function ( ) {
317317 return false ;
318318} ) ;
319319
320- Clazz . newMethod$ ( C$ , "usePattern$java.util_regex_Pattern" , function ( pat ) {
320+ Clazz . newMeth ( C$ , "usePattern$java.util_regex_Pattern" , function ( pat ) {
321321 if ( pat == null ) {
322322 throw new IllegalArgumentException ( "Empty pattern!" ) ;
323323 }
0 commit comments