comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java @ 7517:b6743d7eb8d4

disabled auto-formatting of generated code
author Doug Simon <doug.simon@oracle.com>
date Tue, 22 Jan 2013 20:36:00 +0100
parents 213c1297a814
children 5e3d1a68664e
comparison
equal deleted inserted replaced
7516:427e797ab18e 7517:b6743d7eb8d4
30 import java.io.RandomAccessFile; 30 import java.io.RandomAccessFile;
31 import java.util.Map; 31 import java.util.Map;
32 import java.util.HashMap; 32 import java.util.HashMap;
33 33
34 // Checkstyle: stop 34 // Checkstyle: stop
35 // @formatter:off
35 class Token { 36 class Token {
36 37
37 public int kind; // token kind 38 public int kind; // token kind
38 public int pos; // token position in bytes in the source text (starting at 0) 39 public int pos; // token position in bytes in the source text (starting at 0)
39 public int charPos; // token position in characters in the source text (starting at 0) 40 public int charPos; // token position in characters in the source text (starting at 0)
336 start = new StartStates(); 337 start = new StartStates();
337 literals = new HashMap(); 338 literals = new HashMap();
338 for (int i = 65; i <= 90; ++i) start.set(i, 1); 339 for (int i = 65; i <= 90; ++i) start.set(i, 1);
339 for (int i = 97; i <= 122; ++i) start.set(i, 1); 340 for (int i = 97; i <= 122; ++i) start.set(i, 1);
340 for (int i = 49; i <= 57; ++i) start.set(i, 4); 341 for (int i = 49; i <= 57; ++i) start.set(i, 4);
341 start.set(34, 2); 342 start.set(34, 2);
342 start.set(48, 5); 343 start.set(48, 5);
343 start.set(123, 6); 344 start.set(123, 6);
344 start.set(125, 7); 345 start.set(125, 7);
345 start.set(40, 8); 346 start.set(40, 8);
346 start.set(41, 9); 347 start.set(41, 9);
347 start.set(61, 20); 348 start.set(61, 20);
348 start.set(59, 10); 349 start.set(59, 10);
349 start.set(60, 21); 350 start.set(60, 21);
350 start.set(62, 22); 351 start.set(62, 22);
351 start.set(33, 14); 352 start.set(33, 14);
352 start.set(43, 16); 353 start.set(43, 16);
353 start.set(45, 17); 354 start.set(45, 17);
354 start.set(42, 18); 355 start.set(42, 18);
355 start.set(47, 19); 356 start.set(47, 19);
356 start.set(Buffer.EOF, -1); 357 start.set(Buffer.EOF, -1);
357 literals.put("function", new Integer(4)); 358 literals.put("function", new Integer(4));
358 literals.put("while", new Integer(7)); 359 literals.put("while", new Integer(7));
359 literals.put("print", new Integer(12)); 360 literals.put("print", new Integer(12));
360 literals.put("return", new Integer(13)); 361 literals.put("return", new Integer(13));
422 char[] newBuf = new char[2 * tval.length]; 423 char[] newBuf = new char[2 * tval.length];
423 System.arraycopy(tval, 0, newBuf, 0, tval.length); 424 System.arraycopy(tval, 0, newBuf, 0, tval.length);
424 tval = newBuf; 425 tval = newBuf;
425 } 426 }
426 if (ch != Buffer.EOF) { 427 if (ch != Buffer.EOF) {
427 tval[tlen++] = (char)ch; 428 tval[tlen++] = (char)ch;
428 429
429 NextCh(); 430 NextCh();
430 } 431 }
431 } 432 }
432 433
433 434
434 boolean Comment0() { 435 boolean Comment0() {
435 int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos; 436 int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
436 NextCh(); 437 NextCh();
437 if (ch == '/') { 438 if (ch == '/') {
481 t.kind = ((Integer) kind).intValue(); 482 t.kind = ((Integer) kind).intValue();
482 } 483 }
483 } 484 }
484 485
485 Token NextToken() { 486 Token NextToken() {
486 while (ch == ' ' || 487 while (ch == ' ' ||
487 ch >= 9 && ch <= 10 || ch == 13 488 ch >= 9 && ch <= 10 || ch == 13
488 ) NextCh(); 489 ) NextCh();
489 if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken(); 490 if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken();
490 int recKind = noSym; 491 int recKind = noSym;
491 int recEnd = pos; 492 int recEnd = pos;