From 074441eda27cb6ab5e307b81cd634a1bd92ec01e Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 12 Sep 2009 13:05:46 +0000 Subject: [PATCH] [[NEW_FEATURE] (Author : Christian Cuvier) Rational number is recognized in User Defined Language System. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@535 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/installer/nativeLang/french.xml | 24 ++++++------- scintilla/src/LexUser.cxx | 37 +++++++++++++++++++++ 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index 1819144f..cde4b075 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -155,10 +155,10 @@ - - - - + + + + @@ -189,17 +189,17 @@ - - - + + + - + - - + + @@ -241,7 +241,7 @@ - + @@ -417,7 +417,7 @@ - + diff --git a/scintilla/src/LexUser.cxx b/scintilla/src/LexUser.cxx index a167341c..4570dbe0 100644 --- a/scintilla/src/LexUser.cxx +++ b/scintilla/src/LexUser.cxx @@ -243,6 +243,9 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W bool escaped = false; char escapeChar = static_cast(styler.GetPropertyInt("userDefine.escapeChar", 0)); + bool hasDot = false; + bool hasExp = false; + for (int i = 0 ; i < 3 ; i++) { delimOpen[i] = keywords.words[0][i] == '0'?'\0':keywords.words[0][i]; @@ -258,9 +261,36 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W { case SCE_USER_NUMBER : { + if (sc.ch == '.') + { + if (!hasDot) + { + hasDot = true; + break; + } + } //if (!isAWordChar(sc.ch)) + if (sc.ch == 'e' || sc.ch == 'E') + { + if (!hasExp && sc.More()) + { + hasExp = true; + sc.Forward(); + if (IsADigit(sc.ch)) break; + if (sc.More()) + if (sc.ch == '+' || sc.ch == '-') + { + sc.Forward(); + if (IsADigit(sc.ch)) break; + } + } + } if (!IsADigit(sc.ch)) + { sc.SetState(SCE_USER_DEFAULT); + hasDot = false; + hasExp = false; + } break; } @@ -431,6 +461,13 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W } else if (isInOpList(symbols, sc.ch)) sc.SetState(SCE_USER_OPERATOR); + else if (sc.ch == '-' && IsADigit(sc.chNext)) + sc.SetState(SCE_USER_NUMBER); + else if (sc.ch == '.' && IsADigit(sc.chNext)) + { + hasDot = true; + sc.SetState(SCE_USER_NUMBER); + } else if (isAWordStart(sc.ch)) sc.SetState(SCE_USER_IDENTIFIER); }