1 22 23 package org.javacc.parser; 24 25 import java.util.Vector ; 26 27 30 31 public class RRepetitionRange extends RegularExpression { 32 33 36 public RegularExpression regexpr; 37 public int min = 0; 38 public int max = -1; 39 public boolean hasMax; 40 41 public Nfa GenerateNfa(boolean ignoreCase) 42 { 43 Vector units = new Vector (); 44 RSequence seq; 45 int i; 46 47 for (i = 0; i < min; i++) 48 { 49 units.addElement(regexpr); 50 } 51 52 if (hasMax && max == -1) { 54 RZeroOrMore zoo = new RZeroOrMore(); 55 zoo.regexpr = regexpr; 56 units.addElement(zoo); 57 } 58 59 while (i++ < max) 60 { 61 RZeroOrOne zoo = new RZeroOrOne(); 62 zoo.regexpr = regexpr; 63 units.addElement(zoo); 64 } 65 seq = new RSequence(units); 66 return seq.GenerateNfa(ignoreCase); 67 } 68 } 69 | Popular Tags |