KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JFlex > RegExp2


1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * JFlex 1.4.1 *
3  * Copyright (C) 1998-2004 Gerwin Klein <lsf@jflex.de> *
4  * All rights reserved. *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License. See the file *
8  * COPYRIGHT for more information. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License along *
16  * with this program; if not, write to the Free Software Foundation, Inc., *
17  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
18  * *
19  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

20
21 package JFlex;
22
23
24 /**
25  * Regular expression with two children (e.g. a | b)
26  *
27  * @author Gerwin Klein
28  * @version JFlex 1.4.1, $Revision: 2.3 $, $Date: 2004/11/06 23:03:30 $
29  */

30 public class RegExp2 extends RegExp {
31
32   RegExp r1, r2;
33
34   public RegExp2(int type, RegExp r1, RegExp r2) {
35     super(type);
36     this.r1 = r1;
37     this.r2 = r2;
38   }
39   
40   public String JavaDoc print(String JavaDoc tab) {
41     return tab+"type = "+type+Out.NL+tab+"child 1 :"+Out.NL+ //$NON-NLS-1$ //$NON-NLS-2$
42
r1.print(tab+" ")+Out.NL+tab+"child 2 :"+Out.NL+ //$NON-NLS-1$ //$NON-NLS-2$
43
r2.print(tab+" "); //$NON-NLS-1$
44
}
45   
46   public String JavaDoc toString() {
47     return print(""); //$NON-NLS-1$
48
}
49 }
50   
51
Popular Tags