|
Re: [jruby-user] What does nested repeat operator + and ? was replaced with: msg#00209lang.jruby.user
Hi, It's a warning issued when Oniguruma finds nested quantifier within a quantifier (not an enclose) and the quantifies are not quantified by ranges: if (!isByNumber() && !qnt.isByNumber() && env.syntax.warnReduntantNestedRepeat()) { ... for example: /(?:a+)?/ ( which is equivalent to: /(:?a)*/ ) then it does: QuantifierNode qnt = (QuantifierNode)target; int nestQNum = popularNum(); int targetQNum = qnt.popularNum(); where popular number is a number assigned to different types of quantifiers: from Oniguruma comment: ?:0, *:1, +:2, ??:3, *?:4, +?:5 so nested (+) is 2: nesting (?) is 0: then the following reduction table is used: enum ReduceType { ASIS, /* as is */ DEL, /* delete parent */ A, /* to '*' */ AQ, /* to '*?' */ QQ, /* to '??' */ P_QQ, /* to '+)??' */ PQ_Q, /* to '+?)?' */ } final ReduceType[][]REDUCE_TABLE = { {DEL, A, A, QQ, AQ, ASIS}, /* '?' */ {DEL, DEL, DEL, P_QQ, P_QQ, DEL}, /* '*' */ {A, A, DEL, ASIS, P_QQ, DEL}, /* '+' */ {DEL, AQ, AQ, DEL, AQ, AQ}, /* '??' */ {DEL, DEL, DEL, DEL, DEL, DEL}, /* '*?' */ {ASIS, PQ_Q, DEL, AQ, AQ, DEL} /* '+?' */ }; so: ReduceType[2, 0] == A (the asterisk) the implementation for this case is: case A: setTarget(other.target); // steal the nested target's target // and set * characteristics lower = 0; upper = REPEAT_INFINITE; greedy = true; break; The other thing is that 1.9 has this warning turned off by default (which we also should have, will fix that) lopex James Moore wrote: Tried to run the tests for my rails app using trunk jruby (r5081), and --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [jruby-user] What does nested repeat operator + and ? was replaced with '*' mean?: 00209, James Moore |
|---|---|
| Next by Date: | [jruby-user] Classpath in JRuby: 00209, Jason Vinson |
| Previous by Thread: | Re: [jruby-user] What does nested repeat operator + and ? was replaced with '*' mean?i: 00209, Ola Bini |
| Next by Thread: | [jruby-user] Classpath in JRuby: 00209, Jason Vinson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |