author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 17 Jun 2015 16:49:28 +0100 | |
changeset 492 | fc3dbe5654c5 |
parent 437 | 54b3bc9e3987 |
permissions | -rw-r--r-- |
435 | 1 |
"{ Encoding: utf8 }" |
2 |
||
3 |
"{ Package: 'stx:goodies/petitparser/parsers/java' }" |
|
4 |
||
5 |
"{ NameSpace: Smalltalk }" |
|
6 |
||
7 |
PPCompositeParserTest subclass:#PPJavaLexiconTest |
|
8 |
instanceVariableNames:'' |
|
9 |
classVariableNames:'' |
|
10 |
poolDictionaries:'' |
|
11 |
category:'PetitJava-Tests' |
|
12 |
! |
|
13 |
||
14 |
!PPJavaLexiconTest methodsFor:'accessing'! |
|
15 |
||
16 |
parserClass |
|
17 |
^ PPJavaLexicon |
|
18 |
! ! |
|
19 |
||
20 |
!PPJavaLexiconTest methodsFor:'testing'! |
|
21 |
||
22 |
testIdentifier6 |
|
23 |
||
24 |
self |
|
25 |
fail: 'super' |
|
26 |
rule: #identifier |
|
27 |
! ! |
|
28 |
||
29 |
!PPJavaLexiconTest methodsFor:'testing-comments'! |
|
30 |
||
31 |
testComment1 |
|
32 |
||
33 |
self |
|
34 |
parse: '//' |
|
35 |
rule: #comment |
|
36 |
! |
|
37 |
||
38 |
testComment2 |
|
39 |
||
40 |
self |
|
41 |
parse: '//comment' |
|
42 |
rule: #comment |
|
43 |
! |
|
44 |
||
45 |
testComment3 |
|
46 |
||
47 |
self |
|
48 |
parse: '// comment' |
|
49 |
rule: #comment |
|
50 |
! |
|
51 |
||
52 |
testComment4 |
|
53 |
||
54 |
self |
|
55 |
parse: '/* comment */' |
|
56 |
rule: #comment |
|
57 |
! |
|
58 |
||
59 |
testComment5 |
|
60 |
||
61 |
self |
|
62 |
fail: '/* comment ' |
|
63 |
rule: #comment |
|
64 |
! |
|
65 |
||
66 |
testComment6 |
|
67 |
||
68 |
self |
|
69 |
parse: '/* this comment /* // /** ends here: */' |
|
70 |
rule: #comment |
|
71 |
! |
|
72 |
||
73 |
testComment7 |
|
74 |
||
75 |
self |
|
76 |
parse: '/** |
|
77 |
* @param args |
|
78 |
* @return void |
|
79 |
*/' |
|
80 |
rule: #comment |
|
81 |
! |
|
82 |
||
437
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
83 |
testComment8cr |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
84 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
85 |
self |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
86 |
parse: '/*',(Character codePoint: 13),'*/' |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
87 |
rule: #comment |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
88 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
89 |
"Created: / 21-04-2015 / 17:07:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
90 |
! |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
91 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
92 |
testComment8crlf |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
93 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
94 |
self |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
95 |
parse: '/*',(Character codePoint: 13),(Character codePoint: 10),'*/' |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
96 |
rule: #comment |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
97 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
98 |
"Created: / 21-04-2015 / 17:07:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
99 |
! |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
100 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
101 |
testComment8lf |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
102 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
103 |
self |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
104 |
parse: '/*',(Character codePoint: 10),'*/' |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
105 |
rule: #comment |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
106 |
|
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
107 |
"Created: / 21-04-2015 / 17:07:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
108 |
! |
54b3bc9e3987
A super ugly hack to fix line endings in Java comments.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
436
diff
changeset
|
109 |
|
435 | 110 |
testTraditionalComment1 |
111 |
||
112 |
self |
|
113 |
parse: '/* this comment */' |
|
114 |
rule: #traditionalComment |
|
115 |
! |
|
116 |
||
117 |
testTraditionalComment2 |
|
118 |
||
119 |
self |
|
120 |
parse: '/* this comment / */' |
|
121 |
rule: #comment |
|
122 |
! ! |
|
123 |
||
124 |
!PPJavaLexiconTest methodsFor:'testing-identifiers'! |
|
125 |
||
126 |
testIdentifier1 |
|
127 |
||
128 |
self |
|
129 |
parse: 'String' |
|
130 |
rule: #identifier |
|
131 |
! |
|
132 |
||
133 |
testIdentifier2 |
|
134 |
||
135 |
self |
|
136 |
parse: 'i3' |
|
137 |
rule: #identifier |
|
138 |
! |
|
139 |
||
140 |
testIdentifier3 |
|
141 |
||
142 |
self |
|
143 |
parse: 'ฮฑฯฮตฯฮท' |
|
144 |
rule: #identifier |
|
145 |
! |
|
146 |
||
147 |
testIdentifier4 |
|
148 |
||
149 |
self |
|
150 |
parse: 'MAX_VALUE' |
|
151 |
rule: #identifier |
|
152 |
! |
|
153 |
||
154 |
testIdentifier5 |
|
155 |
||
156 |
self |
|
157 |
parse: 'isLetterOrDigit' |
|
158 |
rule: #identifier |
|
159 |
! ! |
|
160 |
||
161 |
!PPJavaLexiconTest methodsFor:'testing-input'! |
|
162 |
||
163 |
testInput1 |
|
164 |
||
165 |
self parse: 'package testPackage; |
|
166 |
class Test { |
|
167 |
public static void main(String[] args) { |
|
168 |
String hello = "Hello", lo = "lo"; |
|
169 |
System.out.print((hello == "Hello") + " "); |
|
170 |
System.out.print((Other.hello == hello) + " "); |
|
171 |
System.out.print((other.Other.hello == hello) + " "); |
|
172 |
System.out.print((hello == ("Hel"+"lo")) + " "); |
|
173 |
System.out.print((hello == ("Hel"+lo)) + " "); |
|
174 |
System.out.println(hello == ("Hel"+lo).intern()); |
|
175 |
} |
|
176 |
} |
|
177 |
class Other { static String hello = "Hello"; }' |
|
178 |
rule: #input |
|
179 |
! |
|
180 |
||
181 |
testInput2 |
|
182 |
||
183 |
self parse: 'package other; |
|
184 |
public class Other { static String hello = "Hello"; }' |
|
185 |
rule: #input |
|
186 |
! |
|
187 |
||
188 |
testInput3 |
|
189 |
||
190 |
self parse: 'class Value { int val; } |
|
191 |
class Test { |
|
192 |
public static void main(String[] args) { |
|
193 |
int i1 = 3; |
|
194 |
int i2 = i1; |
|
195 |
i2 = 4; |
|
196 |
System.out.print("i1==" + i1); |
|
197 |
System.out.println(" but i2==" + i2); |
|
198 |
Value v1 = new Value(); |
|
199 |
v1.val = 5; |
|
200 |
Value v2 = v1; |
|
201 |
v2.val = 6; |
|
202 |
System.out.print("v1.val==" + v1.val); |
|
203 |
System.out.println(" and v2.val==" + v2.val); |
|
204 |
} |
|
205 |
}' |
|
206 |
rule: #input |
|
207 |
! ! |
|
208 |
||
209 |
!PPJavaLexiconTest methodsFor:'testing-lineTerminators'! |
|
210 |
||
211 |
testInputCharacter1 |
|
212 |
||
213 |
self |
|
214 |
parse: '\' |
|
215 |
rule: #inputCharacter |
|
216 |
! |
|
217 |
||
218 |
testInputCharacter2 |
|
219 |
||
220 |
self |
|
221 |
fail: (Character cr asString) |
|
222 |
rule: #inputCharacter |
|
223 |
! |
|
224 |
||
225 |
testInputCharacter3 |
|
226 |
||
227 |
self |
|
228 |
fail: (Character lf asString) |
|
229 |
rule: #inputCharacter |
|
230 |
! |
|
231 |
||
232 |
testLineTerminator1 |
|
233 |
||
234 |
self |
|
235 |
parse: (Character lf asString) |
|
236 |
rule: #lineTerminator |
|
237 |
! |
|
238 |
||
239 |
testLineTerminator2 |
|
240 |
||
241 |
self |
|
242 |
parse: (Character cr asString) |
|
243 |
rule: #lineTerminator |
|
244 |
! |
|
245 |
||
246 |
testLineTerminator3 |
|
247 |
||
436 | 248 |
self |
249 |
parse: (Character codePoint: 13) asString , (Character codePoint: 10) asString |
|
250 |
rule: #lineTerminator |
|
251 |
||
252 |
"Modified: / 21-04-2015 / 15:47:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
435 | 253 |
! |
254 |
||
255 |
testLineTerminator4 |
|
256 |
||
257 |
self |
|
258 |
fail: (Character space asString) |
|
259 |
rule: #lineTerminator |
|
260 |
! |
|
261 |
||
262 |
testLineTerminator5 |
|
263 |
||
264 |
self |
|
265 |
fail: ('a' asString) |
|
266 |
rule: #lineTerminator |
|
267 |
! ! |
|
268 |
||
269 |
!PPJavaLexiconTest methodsFor:'testing-literal-float'! |
|
270 |
||
271 |
testFloatLiteral1 |
|
272 |
self |
|
273 |
parse: '1e1f' |
|
274 |
rule: #floatingPointLiteral |
|
275 |
! |
|
276 |
||
277 |
testFloatLiteral10 |
|
278 |
self |
|
279 |
parse: '0.0' |
|
280 |
rule: #floatingPointLiteral |
|
281 |
! |
|
282 |
||
283 |
testFloatLiteral11 |
|
284 |
self |
|
285 |
parse: '3.14' |
|
286 |
rule: #floatingPointLiteral |
|
287 |
! |
|
288 |
||
289 |
testFloatLiteral12 |
|
290 |
self |
|
291 |
parse: '1e-9d' |
|
292 |
rule: #floatingPointLiteral |
|
293 |
! |
|
294 |
||
295 |
testFloatLiteral13 |
|
296 |
self |
|
297 |
parse: '1e137' |
|
298 |
rule: #floatingPointLiteral |
|
299 |
! |
|
300 |
||
301 |
testFloatLiteral2 |
|
302 |
self |
|
303 |
parse: '2.f' |
|
304 |
rule: #floatingPointLiteral |
|
305 |
! |
|
306 |
||
307 |
testFloatLiteral3 |
|
308 |
self |
|
309 |
parse: '.3f' |
|
310 |
rule: #floatingPointLiteral |
|
311 |
! |
|
312 |
||
313 |
testFloatLiteral4 |
|
314 |
self |
|
315 |
parse: '0f' |
|
316 |
rule: #floatingPointLiteral |
|
317 |
! |
|
318 |
||
319 |
testFloatLiteral5 |
|
320 |
self |
|
321 |
parse: '3.14f' |
|
322 |
rule: #floatingPointLiteral |
|
323 |
! |
|
324 |
||
325 |
testFloatLiteral6 |
|
326 |
self |
|
327 |
parse: '6.022137e+23f' |
|
328 |
rule: #floatingPointLiteral |
|
329 |
! |
|
330 |
||
331 |
testFloatLiteral7 |
|
332 |
self |
|
333 |
parse: '1e1' |
|
334 |
rule: #floatingPointLiteral |
|
335 |
! |
|
336 |
||
337 |
testFloatLiteral8 |
|
338 |
self |
|
339 |
parse: '2.' |
|
340 |
rule: #floatingPointLiteral |
|
341 |
! |
|
342 |
||
343 |
testFloatLiteral9 |
|
344 |
self |
|
345 |
parse: '.3' |
|
346 |
rule: #floatingPointLiteral |
|
347 |
! ! |
|
348 |
||
349 |
!PPJavaLexiconTest methodsFor:'testing-literals'! |
|
350 |
||
351 |
testBooleanLiteral1 |
|
352 |
self |
|
353 |
parse: 'true' |
|
354 |
rule: #booleanLiteral |
|
355 |
! |
|
356 |
||
357 |
testBooleanLiteral2 |
|
358 |
self |
|
359 |
parse: 'false' |
|
360 |
rule: #booleanLiteral |
|
361 |
! |
|
362 |
||
363 |
testLiteral1 |
|
364 |
||
365 |
self |
|
366 |
parse: 'null' |
|
367 |
rule: #literal |
|
368 |
! |
|
369 |
||
370 |
testLiteral10 |
|
371 |
||
372 |
self |
|
373 |
fail: '0777 L' |
|
374 |
rule: #literal |
|
375 |
! |
|
376 |
||
377 |
testLiteral11 |
|
378 |
||
379 |
self |
|
380 |
fail: '0777 0' |
|
381 |
rule: #literal |
|
382 |
! |
|
383 |
||
384 |
testLiteral12 |
|
385 |
||
386 |
self |
|
387 |
fail: '0 x' |
|
388 |
rule: #literal |
|
389 |
! |
|
390 |
||
391 |
testLiteral13 |
|
392 |
||
393 |
self |
|
394 |
parse: '"This is a Java string"' |
|
395 |
rule: #literal |
|
396 |
! |
|
397 |
||
398 |
testLiteral2 |
|
399 |
||
400 |
self |
|
401 |
parse: 'false' |
|
402 |
rule: #literal |
|
403 |
! |
|
404 |
||
405 |
testLiteral3 |
|
406 |
||
407 |
self |
|
408 |
parse: '6.022137e+23f' |
|
409 |
rule: #literal |
|
410 |
! |
|
411 |
||
412 |
testLiteral4 |
|
413 |
||
414 |
self |
|
415 |
parse: '1e1' |
|
416 |
rule: #literal |
|
417 |
! |
|
418 |
||
419 |
testLiteral5 |
|
420 |
||
421 |
self |
|
422 |
parse: '0x100000000L' |
|
423 |
rule: #literal |
|
424 |
! |
|
425 |
||
426 |
testLiteral6 |
|
427 |
||
428 |
self |
|
429 |
parse: '0372' |
|
430 |
rule: #literal |
|
431 |
! |
|
432 |
||
433 |
testLiteral7 |
|
434 |
||
435 |
self |
|
436 |
parse: '0xDadaCafe' |
|
437 |
rule: #literal |
|
438 |
! |
|
439 |
||
440 |
testLiteral8 |
|
441 |
||
442 |
self |
|
443 |
parse: '0x00FF00FF' |
|
444 |
rule: #literal |
|
445 |
! |
|
446 |
||
447 |
testLiteral9 |
|
448 |
||
449 |
self |
|
450 |
parse: '0777L' |
|
451 |
rule: #literal |
|
452 |
! |
|
453 |
||
454 |
testNullLiteral1 |
|
455 |
||
456 |
self |
|
457 |
parse: 'null' |
|
458 |
rule: #nullLiteral |
|
459 |
! |
|
460 |
||
461 |
testStringLiteral1 |
|
462 |
||
463 |
self |
|
464 |
parse: '""' |
|
465 |
rule: #stringLiteral |
|
466 |
! |
|
467 |
||
468 |
testStringLiteral10 |
|
469 |
||
470 |
self |
|
471 |
fail: '"This is a \\ |
|
472 |
two lines Java string"' |
|
473 |
rule: #stringLiteral |
|
474 |
! |
|
475 |
||
476 |
testStringLiteral11 |
|
477 |
||
478 |
self |
|
479 |
parse: '"null"' |
|
480 |
rule: #stringLiteral |
|
481 |
! |
|
482 |
||
483 |
testStringLiteral2 |
|
484 |
||
485 |
self |
|
486 |
parse: '"\""' |
|
487 |
rule: #stringLiteral |
|
488 |
! |
|
489 |
||
490 |
testStringLiteral3 |
|
491 |
||
492 |
self |
|
493 |
parse: '"This is a Java string"' |
|
494 |
rule: #stringLiteral |
|
495 |
! |
|
496 |
||
497 |
testStringLiteral4 |
|
498 |
||
499 |
self |
|
500 |
fail: '"This is a |
|
501 |
two lines Java string"' |
|
502 |
rule: #stringLiteral |
|
503 |
! |
|
504 |
||
505 |
testStringLiteral5 |
|
506 |
||
507 |
self |
|
508 |
fail: '"This is a \b |
|
509 |
two lines Java string"' |
|
510 |
rule: #stringLiteral |
|
511 |
! |
|
512 |
||
513 |
testStringLiteral6 |
|
514 |
||
515 |
self |
|
516 |
fail: '"This is a \t |
|
517 |
two lines Java string"' |
|
518 |
rule: #stringLiteral |
|
519 |
! |
|
520 |
||
521 |
testStringLiteral7 |
|
522 |
||
523 |
self |
|
524 |
fail: '"This is a \n |
|
525 |
two lines Java string"' |
|
526 |
rule: #stringLiteral |
|
527 |
! |
|
528 |
||
529 |
testStringLiteral8 |
|
530 |
||
531 |
self |
|
532 |
fail: '"This is a \f |
|
533 |
two lines Java string"' |
|
534 |
rule: #stringLiteral |
|
535 |
! |
|
536 |
||
537 |
testStringLiteral9 |
|
538 |
||
539 |
self |
|
540 |
fail: '"This is a \r |
|
541 |
two lines Java string"' |
|
542 |
rule: #stringLiteral |
|
543 |
! ! |
|
544 |
||
545 |
!PPJavaLexiconTest methodsFor:'testing-literals-characters'! |
|
546 |
||
547 |
testCharacterLiteral1 |
|
548 |
self |
|
549 |
parse: '''a''' |
|
550 |
rule: #characterLiteral |
|
551 |
! |
|
552 |
||
553 |
testCharacterLiteral2 |
|
554 |
self |
|
555 |
parse: '''%''' |
|
556 |
rule: #characterLiteral |
|
557 |
! |
|
558 |
||
559 |
testCharacterLiteral3 |
|
560 |
self |
|
561 |
parse: '''\t''' |
|
562 |
rule: #characterLiteral |
|
563 |
! |
|
564 |
||
565 |
testCharacterLiteral4 |
|
566 |
self |
|
567 |
parse: '''\\''' |
|
568 |
rule: #characterLiteral |
|
569 |
! |
|
570 |
||
571 |
testCharacterLiteral5 |
|
572 |
self |
|
573 |
parse: '''\''''' |
|
574 |
rule: #characterLiteral |
|
575 |
! |
|
576 |
||
577 |
testCharacterLiteral6 |
|
578 |
"not clear how this must be supported |
|
579 |
(see http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6)" |
|
580 |
||
581 |
"self |
|
582 |
parse: '''\u03a9''' |
|
583 |
rule: #characterLiteral" |
|
584 |
! |
|
585 |
||
586 |
testCharacterLiteral7 |
|
587 |
"not clear how this must be supported |
|
588 |
(see http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6)" |
|
589 |
" |
|
590 |
self |
|
591 |
parse: '''\uFFFF''' |
|
592 |
rule: #characterLiteral" |
|
593 |
! |
|
594 |
||
595 |
testCharacterLiteral8 |
|
596 |
self |
|
597 |
parse: '''\177''' |
|
598 |
rule: #characterLiteral |
|
599 |
! |
|
600 |
||
601 |
testSeparator1 |
|
602 |
self |
|
603 |
parse: '{' |
|
604 |
rule: #separator |
|
605 |
! ! |
|
606 |
||
607 |
!PPJavaLexiconTest methodsFor:'testing-literals-integer'! |
|
608 |
||
609 |
testHexIntegerLiteral1 |
|
610 |
self |
|
611 |
parse: '0xC0B0L' |
|
612 |
rule: #hexIntegerLiteral |
|
613 |
! |
|
614 |
||
615 |
testIntegerLiteral1 |
|
616 |
self |
|
617 |
parse: '0' |
|
618 |
rule: #integerLiteral |
|
619 |
! |
|
620 |
||
621 |
testIntegerLiteral10 |
|
622 |
self |
|
623 |
parse: '1996' |
|
624 |
rule: #integerLiteral |
|
625 |
! |
|
626 |
||
627 |
testIntegerLiteral11 |
|
628 |
self |
|
629 |
parse: '0x00FF00FF' |
|
630 |
rule: #integerLiteral |
|
631 |
! |
|
632 |
||
633 |
testIntegerLiteral2 |
|
634 |
self |
|
635 |
parse: '0l' |
|
636 |
rule: #integerLiteral |
|
637 |
! |
|
638 |
||
639 |
testIntegerLiteral3 |
|
640 |
self |
|
641 |
parse: '0777L' |
|
642 |
rule: #integerLiteral |
|
643 |
! |
|
644 |
||
645 |
testIntegerLiteral4 |
|
646 |
self |
|
647 |
parse: '0x100000000L' |
|
648 |
rule: #integerLiteral |
|
649 |
! |
|
650 |
||
651 |
testIntegerLiteral5 |
|
652 |
self |
|
653 |
parse: '2147483648L' |
|
654 |
rule: #integerLiteral |
|
655 |
! |
|
656 |
||
657 |
testIntegerLiteral6 |
|
658 |
self |
|
659 |
parse: '0xC0B0L' |
|
660 |
rule: #integerLiteral |
|
661 |
! |
|
662 |
||
663 |
testIntegerLiteral7 |
|
664 |
self |
|
665 |
parse: '2' |
|
666 |
rule: #integerLiteral |
|
667 |
! |
|
668 |
||
669 |
testIntegerLiteral8 |
|
670 |
self |
|
671 |
parse: '0372' |
|
672 |
rule: #integerLiteral |
|
673 |
! |
|
674 |
||
675 |
testIntegerLiteral9 |
|
676 |
self |
|
677 |
parse: '0xDadaCafe' |
|
678 |
rule: #integerLiteral |
|
679 |
! |
|
680 |
||
681 |
testOctalIntegerLiteral1 |
|
682 |
self |
|
683 |
parse: '0777L' |
|
684 |
rule: #octalIntegerLiteral |
|
685 |
! |
|
686 |
||
687 |
testOperator |
|
688 |
self |
|
689 |
parse: '>' |
|
690 |
rule: #operator |
|
691 |
! ! |
|
692 |
||
693 |
!PPJavaLexiconTest methodsFor:'testing-unicode'! |
|
694 |
||
695 |
testUnicodeEscape1 |
|
696 |
||
697 |
self |
|
698 |
parse: '\u0000' |
|
699 |
rule: #unicodeEscape |
|
700 |
! |
|
701 |
||
702 |
testUnicodeEscape2 |
|
703 |
||
704 |
self |
|
705 |
fail: '\u000' |
|
706 |
rule: #unicodeEscape |
|
707 |
! |
|
708 |
||
709 |
testUnicodeEscape3 |
|
710 |
||
711 |
self |
|
712 |
fail: '\u00000' |
|
713 |
rule: #unicodeEscape |
|
714 |
! |
|
715 |
||
716 |
testUnicodeInputCharacter1 |
|
717 |
||
718 |
self |
|
719 |
parse: '\u0000' |
|
720 |
rule: #unicodeInputCharacter |
|
721 |
! |
|
722 |
||
723 |
testUnicodeInputCharacter2 |
|
724 |
||
725 |
self |
|
726 |
parse: '\' |
|
727 |
rule: #unicodeInputCharacter |
|
728 |
! |
|
729 |
||
730 |
testUnicodeInputCharacter3 |
|
731 |
||
732 |
self |
|
733 |
parse: 'ยต' |
|
734 |
rule: #unicodeInputCharacter |
|
735 |
! |
|
736 |
||
737 |
testUnicodeInputCharacter4 |
|
738 |
||
739 |
self |
|
740 |
fail: '\\' |
|
741 |
rule: #unicodeInputCharacter |
|
742 |
! |
|
743 |
||
744 |
testUnicodeInputCharacter5 |
|
745 |
self |
|
746 |
parse: '\u2297' |
|
747 |
rule: #unicodeInputCharacter |
|
748 |
! |
|
749 |
||
750 |
testUnicodeInputCharacter6 |
|
751 |
self |
|
752 |
fail: '\u2H97' |
|
753 |
rule: #unicodeInputCharacter |
|
754 |
! |
|
755 |
||
756 |
testUnicodeInputCharacter7 |
|
757 |
"unicode value for \" |
|
758 |
self |
|
759 |
parse: '\u005a' |
|
760 |
rule: #unicodeInputCharacter |
|
761 |
! |
|
762 |
||
763 |
testWhiteSpace1 |
|
764 |
"Testing whiteSpace parser" |
|
765 |
self |
|
766 |
parse: (Character value: 12) asString |
|
767 |
rule: #whiteSpace |
|
768 |
! |
|
769 |
||
770 |
testWhiteSpace2 |
|
771 |
"Testing whiteSpace parser" |
|
772 |
self |
|
773 |
fail: 'WhiteSpace testing' |
|
774 |
rule: #whiteSpace |
|
775 |
! ! |
|
776 |