1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.directory.api.ldap.model.schema.syntaxes;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 import org.apache.directory.api.ldap.model.schema.parsers.ParserMonitor;
28
29
30 import antlr.TokenBuffer;
31 import antlr.TokenStreamException;
32 import antlr.TokenStreamIOException;
33 import antlr.ANTLRException;
34 import antlr.LLkParser;
35 import antlr.Token;
36 import antlr.TokenStream;
37 import antlr.RecognitionException;
38 import antlr.NoViableAltException;
39 import antlr.MismatchedTokenException;
40 import antlr.SemanticException;
41 import antlr.ParserSharedInputState;
42 import antlr.collections.impl.BitSet;
43
44
45
46
47
48
49
50 public class AntlrSchemaQdstringParser extends antlr.LLkParser implements AntlrSchemaQdstringTokenTypes
51 {
52
53 private ParserMonitor monitor = null;
54 public void setParserMonitor( ParserMonitor monitor )
55 {
56 this.monitor = monitor;
57 }
58 private void matchedProduction( String msg )
59 {
60 if ( null != monitor )
61 {
62 monitor.matchedProduction( msg );
63 }
64 }
65
66 protected AntlrSchemaQdstringParser(TokenBuffer tokenBuf, int k) {
67 super(tokenBuf,k);
68 tokenNames = _tokenNames;
69 }
70
71 public AntlrSchemaQdstringParser(TokenBuffer tokenBuf) {
72 this(tokenBuf,3);
73 }
74
75 protected AntlrSchemaQdstringParser(TokenStream lexer, int k) {
76 super(lexer,k);
77 tokenNames = _tokenNames;
78 }
79
80 public AntlrSchemaQdstringParser(TokenStream lexer) {
81 this(lexer,3);
82 }
83
84 public AntlrSchemaQdstringParser(ParserSharedInputState state) {
85 super(state,3);
86 tokenNames = _tokenNames;
87 }
88
89
90
91
92
93 public final List<String> qdstrings() throws RecognitionException, TokenStreamException {
94 List<String> qdstrings;
95
96 Token q = null;
97
98 matchedProduction( "AntlrSchemaQdstringParser.qdstrings()" );
99 qdstrings = new ArrayList<String>();
100 String qdstring = null;
101
102
103 {
104 switch ( LA(1)) {
105 case QDSTRING:
106 {
107 {
108 q = LT(1);
109 match(QDSTRING);
110
111 qdstring = q.getText();
112 if(qdstring.startsWith("'")) {
113 qdstring = qdstring.substring(1, qdstring.length());
114 }
115 if(qdstring.endsWith("'")) {
116 qdstring = qdstring.substring(0, qdstring.length()-1);
117 }
118 qdstring = qdstring.replaceAll("\\\\5C", "\\\\");
119 qdstring = qdstring.replaceAll("\\\\5c", "\\\\");
120 qdstring = qdstring.replaceAll("\\\\27", "'");
121 qdstrings.add(qdstring);
122
123 }
124 break;
125 }
126 case LPAR:
127 {
128 {
129 match(LPAR);
130 qdstring=qdstring();
131 qdstrings.add(qdstring);
132 {
133 _loop17:
134 do {
135 if ((LA(1)==QDSTRING)) {
136 qdstring=qdstring();
137 qdstrings.add(qdstring);
138 }
139 else {
140 break _loop17;
141 }
142
143 } while (true);
144 }
145 match(RPAR);
146 }
147 break;
148 }
149 default:
150 {
151 throw new NoViableAltException(LT(1), getFilename());
152 }
153 }
154 }
155 return qdstrings;
156 }
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172 public final String qdstring() throws RecognitionException, TokenStreamException {
173 String qdstring=null;
174
175 Token q = null;
176
177 matchedProduction( "AntlrSchemaQdstringParser.qdstring()" );
178
179
180 {
181 q = LT(1);
182 match(QDSTRING);
183
184 qdstring = q.getText();
185 if(qdstring.startsWith("'")) {
186 qdstring = qdstring.substring(1, qdstring.length());
187 }
188 if(qdstring.endsWith("'")) {
189 qdstring = qdstring.substring(0, qdstring.length()-1);
190 }
191 qdstring = qdstring.replaceAll("\\\\5C", "\\\\");
192 qdstring = qdstring.replaceAll("\\\\5c", "\\\\");
193 qdstring = qdstring.replaceAll("\\\\27", "'");
194
195 }
196 return qdstring;
197 }
198
199
200 public static final String[] _tokenNames = {
201 "<0>",
202 "EOF",
203 "<2>",
204 "NULL_TREE_LOOKAHEAD",
205 "WHSP",
206 "LPAR",
207 "RPAR",
208 "QUOTE",
209 "QDSTRING"
210 };
211
212
213 }