Changeset 104
- Timestamp:
- 01/02/08 02:08:14 (11 months ago)
- Files:
-
- branches/1.9/bin/walnut.exe (modified) (previous)
- branches/1.9/bin/walnut.lib (modified) (previous)
- branches/1.9/source/interpreter.d (modified) (3 diffs)
- branches/1.9/test/hello.nut (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.9/source/interpreter.d
r102 r104 51 51 case '"': 52 52 case '\'': 53 // capture string 53 // BUG: *p == *pStart may trigger an always empty string? 54 pStart = p; 55 p++; 56 for(; *p != *pStart; p++) { 57 if(*p == 0x03){ 58 // terminate with an unterminated string error 59 return; 60 } 61 if(*p == '\\'){ 62 printf("ESCAPED"); 63 // handle the escaped character 64 } 65 } 66 // token = pStart[1..(p-pStart)] 67 printf("\n\"%.*s\"",pStart[1..(p-pStart)]); 68 continue; 69 case '=': 70 if(p[1] == '=') { 71 // EMIT: cmp 72 p++; 73 continue; 74 } 75 // EMIT: mov 54 76 continue; 55 77 case '+': … … 94 116 } 95 117 if(p[1] == '/') { 96 // consume to the end of line97 p++;118 for(; *p != '\n' && *p != '\r' && *p != 0x03; p++) { 119 } 98 120 continue; 99 121 } 100 122 if(p[1] == '*') { 101 // conume until '*' '/'102 p++;123 for(; *p != 0x03 && !(*p == '*' && p[1] == '/'); p++) { 124 } 103 125 continue; 104 126 } … … 220 242 // a letter 221 243 pStart = p; 222 while(p < last && ((0x41 <= *p && *p <= 0x5A) || (0x61 <= *p && *p <= 0x7A))) {244 while(p < last && ((0x41 <= *p && *p <= 0x5A) || (0x61 <= *p && *p <= 0x7A))) { 223 245 p++; 224 246 } 225 247 const(char)[] word = pStart[0..(p-pStart)]; 248 p--; 226 249 switch(word) { 227 250 /// ECMA 7.5.2 branches/1.9/test/hello.nut
r85 r104 1 1 2 hello 3 I am here. 2 i am// WHAT I AM //I AM 3 here still. 4 5 what it would be/* LIKE */without comments? 6 7 whats="i eat strings."] 8 9 'stringy!'
