Differences From Artifact [50586221a28fd499]:
- File
polemy/lex.d
- 2010-11-08 14:59:30 - part of checkin [b985f3bf91] on branch trunk - refactored parser to change AST to ML-like one. (user: kinaba) [annotate]
To Artifact [cc80329bc2ab2034]:
- File
polemy/lex.d
- 2010-11-08 16:40:55 - part of checkin [aa770610d3] on branch trunk - added layered-let (user: kinaba) [annotate]
153 153 this.current = (current is null ? readNext() : current);
154 154 }
155 155
156 156 public static {
157 157 bool isSpace (dchar c) { return std.ctype.isspace(c)!=0; }
158 158 bool isSymbol (dchar c) { return 0x21<=c && c<=0x7f && !std.ctype.isalnum(c) && c!='_' && c!='\''; }
159 159 bool isSSymbol (dchar c) { return !find("()[]{};", c).empty; }
160 - bool isMSymbol (dchar c) { return isSymbol(c) && !isSSymbol(c); }
160 + bool isMSymbol (dchar c) { return isSymbol(c) && !isSSymbol(c) && c!='"' && c!='#'; }
161 161 bool isLetter (dchar c) { return !isSpace(c) && !isSymbol(c); }
162 162 }
163 163
164 164 string readQuoted(const LexPosition pos){char[] buf; return readQuoted(pos,buf);}
165 165 string readQuoted(const LexPosition pos, ref char[] buf)
166 166 {
167 167 if( reader.empty )
................................................................................
349 349 assert_eq( lex2.front.str, "5" );
350 350 lex2.popFront;
351 351 lex3.popFront;
352 352 assert( lex2.empty );
353 353 assert( !lex3.empty );
354 354 assert_eq( lex3.front.str, "5" );
355 355 }
356 +
357 +unittest
358 +{
359 + auto lex = lexerFromString(`=""`);
360 + assert_eq(lex.front.str, "="); lex.popFront;
361 + assert_eq(lex.front.str, ""); lex.popFront;
362 + assert( lex.empty );
363 +}
356 364
357 365 /// Forward range for reader character by character,
358 366 /// keeping track of position information and caring \r\n -> \n conversion.
359 367
360 368 private
361 369 struct PositionedReader(CharSeq)
362 370 if( isForwardRange!(CharSeq) && is(ElementType!(CharSeq) == dchar) )