Changeset 434
- Timestamp:
- 09/27/08 18:02:39 (2 months ago)
- Files:
-
- trunk/scilexer/LexD.cxx (modified) (4 diffs)
- trunk/scilexer/SciLexer.dll (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/scilexer/LexD.cxx
r433 r434 356 356 }; 357 357 358 StatePtr NewMaybeKeyword(std::string beg); 359 358 360 struct MaybeFloat : State 359 361 { 362 MaybeFloat(Colourizer dot) : dot(dot) {} 360 363 virtual int getStyle() const {return SCE_D_OPERATOR;} 361 364 StatePtr onChar(int ch, Colourizer colourizer) 362 365 { 363 if (IsDecimal(ch, false) || ch == '_') 364 return NewDecimalNumber(NumberPart::fractional); 365 // simply a dot 366 colourizer.colourExcl(SCE_D_OPERATOR); 367 return NewDefaultState()->onChar(ch, colourizer); 368 } 366 if (IsDecimal(ch, false)) 367 return NewDecimalNumber(NumberPart::fractional); // phew, it was a number after all. 368 if (ch == '_') 369 { 370 // it still may be an identifier after a dot 371 underscore += ch; 372 return StatePtr(new MaybeFloat(*this)); 373 } 374 // dot was a dot, and the rest is either an ident or a keyword 375 dot.colourIncl(SCE_D_OPERATOR); 376 return NewMaybeKeyword(underscore)->onChar(ch, colourizer); 377 } 378 private: 379 Colourizer dot; 380 std::string underscore; 369 381 }; 370 382 … … 755 767 struct MaybeKeyword : State 756 768 { 769 MaybeKeyword(std::string beg = std::string()) : keyword(beg) {} 757 770 virtual int getStyle() const {return SCE_D_IDENT;} 758 771 virtual StatePtr onChar(int ch, Colourizer colourizer) … … 785 798 }; 786 799 800 StatePtr NewMaybeKeyword(std::string beg) 801 { 802 return StatePtr(new MaybeKeyword(beg)); 803 } 787 804 // 788 805 // Chars … … 1093 1110 return StatePtr(new NumberOpen); 1094 1111 if (ch == '.') 1095 return StatePtr(new MaybeFloat );1112 return StatePtr(new MaybeFloat(colourizer)); 1096 1113 1097 1114 if (ch == '\'')
