Mercurial > hg > Applications > Grep
comparison regexParser/regexParser.cc @ 287:2f3e7bba038e
fix \
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Jan 2016 22:59:59 +0900 |
parents | 3f3c9902bb6d |
children | 3e78631a6222 |
comparison
equal
deleted
inserted
replaced
286:555ca452f031 | 287:2f3e7bba038e |
---|---|
205 \0xa5 | 205 \0xa5 |
206 \[ | 206 \[ |
207 \\ | 207 \\ |
208 \utf-8 etc... | 208 \utf-8 etc... |
209 */ | 209 */ |
210 ri->ptr++; | |
211 ri->tokenType = 'a'; | |
212 ri->tokenValue = ri->ptr; | |
213 ri->ptr++; | |
214 return; | |
210 } else if (ri->ptr[0] == '[') { | 215 } else if (ri->ptr[0] == '[') { |
211 ri->ptr++; | 216 ri->ptr++; |
212 ri->tokenType = 'c'; | 217 ri->tokenType = 'c'; |
213 ri->tokenValue = ri->ptr; | 218 ri->tokenValue = ri->ptr; |
214 return; | 219 return; |
215 } else { | 220 } else { |
216 ri->tokenType = 'a'; | 221 ri->tokenType = 'a'; |
217 ri->tokenValue = ri->ptr; | 222 ri->tokenValue = ri->ptr; |
218 if (isalnum(ri->ptr[0])) { | 223 // if (isalnum(ri->ptr[0])) { |
219 ri->ptr++; | 224 ri->ptr++; |
220 } | 225 // } |
221 return; | 226 return; |
222 } | 227 } |
223 } | 228 } |
224 ri->tokenType = 0; | 229 ri->tokenType = 0; |
225 ri->tokenValue = NULL; | 230 ri->tokenValue = NULL; |
235 else if (ri->tokenType == 'a') n = literal(ri); | 240 else if (ri->tokenType == 'a') n = literal(ri); |
236 else if (ri->tokenType == '(') { | 241 else if (ri->tokenType == '(') { |
237 n = regex(ri); | 242 n = regex(ri); |
238 if (ri->tokenType != ')') { | 243 if (ri->tokenType != ')') { |
239 // error | 244 // error |
245 fprintf(stderr,"unclosed ')' before %s \n", ri->ptr); | |
246 return createNode(ri,0,0,0,0); | |
240 } | 247 } |
241 token(ri); | 248 token(ri); |
242 } | 249 } |
243 if (ri->tokenType == '*') { | 250 if (ri->tokenType == '*') { |
244 n = createNode(ri,'*',0,n,0); | 251 n = createNode(ri,'*',0,n,0); |