diff options
author | XhmikosR <xhmikosr@gmail.com> | 2015-08-04 00:52:40 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2015-08-04 09:29:48 +0300 |
commit | af3a1a1dbfbf017e6a192a89c55f92238010336c (patch) | |
tree | 71083fac10b3561a2877f98e6c4587dc62087cda | |
parent | 26e3e3c2440c5fa2cbbe080bfc228687bec8574a (diff) | |
download | notepad2-mod-af3a1a1dbfbf017e6a192a89c55f92238010336c.zip notepad2-mod-af3a1a1dbfbf017e6a192a89c55f92238010336c.tar.gz notepad2-mod-af3a1a1dbfbf017e6a192a89c55f92238010336c.tar.bz2 |
Update Scintilla to 3.6.0.
170 files changed, 4145 insertions, 3402 deletions
diff --git a/build/makefile.deps.mak b/build/makefile.deps.mak index f30ed17..9433783 100644 --- a/build/makefile.deps.mak +++ b/build/makefile.deps.mak @@ -34,22 +34,26 @@ $(SCI_LEX_OBJDIR)\LexAsm.obj: $(SCI_LEX)\LexAsm.cxx $(LEX_HEADERS) $(SCI_LIB)\Op $(SCI_LEX_OBJDIR)\LexAU3.obj: $(SCI_LEX)\LexAU3.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexAVS.obj: $(SCI_LEX)\LexAVS.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexBash.obj: $(SCI_LEX)\LexBash.cxx $(LEX_HEADERS)
+$(SCI_LEX_OBJDIR)\LexBatch.obj: $(SCI_LEX)\LexBatch.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexCmake.obj: $(SCI_LEX)\LexCmake.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexCoffeeScript.obj: $(SCI_LEX)\LexCoffeeScript.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexConf.obj: $(SCI_LEX)\LexConf.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexCPP.obj: $(SCI_LEX)\LexCPP.cxx $(LEX_HEADERS) $(SCI_LIB)\OptionSet.h \
$(SCI_LIB)\SparseState.h $(SCI_LIB)\SubStyles.h
$(SCI_LEX_OBJDIR)\LexCSS.obj: $(SCI_LEX)\LexCSS.cxx $(LEX_HEADERS)
+$(SCI_LEX_OBJDIR)\LexDiff.obj: $(SCI_LEX)\LexDiff.cxx $(LEX_HEADERS)
+$(SCI_LEX_OBJDIR)\LexErrorList.obj: $(SCI_LEX)\LexErrorList.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexHTML.obj: $(SCI_LEX)\LexHTML.cxx $(LEX_HEADERS) $(SCI_LIB)\StringCopy.h
$(SCI_LEX_OBJDIR)\LexInno.obj: $(SCI_LEX)\LexInno.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexLua.obj: $(SCI_LEX)\LexLaTeX.cxx $(LEX_HEADERS)
-$(SCI_LEX_OBJDIR)\LexLua.obj: $(SCI_LEX)\LexLua.cxx $(LEX_HEADERS)
+$(SCI_LEX_OBJDIR)\LexMake.obj: $(SCI_LEX)\LexMake.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexMarkdown.obj: $(SCI_LEX)\LexMarkdown.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexNsis.obj: $(SCI_LEX)\LexNsis.cxx $(LEX_HEADERS)
-$(SCI_LEX_OBJDIR)\LexOthers.obj: $(SCI_LEX)\LexOthers.cxx $(LEX_HEADERS)
+$(SCI_LEX_OBJDIR)\LexNull.obj: $(SCI_LEX)\LexNull.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexPascal.obj: $(SCI_LEX)\LexPascal.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexPerl.obj: $(SCI_LEX)\LexPerl.cxx $(LEX_HEADERS) $(SCI_LIB)\OptionSet.h
$(SCI_LEX_OBJDIR)\LexPowerShell.obj: $(SCI_LEX)\LexPowerShell.cxx $(LEX_HEADERS)
+$(SCI_LEX_OBJDIR)\LexProps.obj: $(SCI_LEX)\LexProps.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexPython.obj: $(SCI_LEX)\LexPython.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexRuby.obj: $(SCI_LEX)\LexRuby.cxx $(LEX_HEADERS)
$(SCI_LEX_OBJDIR)\LexSQL.obj: $(SCI_LEX)\LexSQL.cxx $(LEX_HEADERS) $(SCI_LIB)\OptionSet.h
diff --git a/build/makefile.mak b/build/makefile.mak index bc5de2a..eea9f03 100644 --- a/build/makefile.mak +++ b/build/makefile.mak @@ -128,21 +128,26 @@ SCI_LEX_OBJ = \ $(SCI_LEX_OBJDIR)\LexAU3.obj \
$(SCI_LEX_OBJDIR)\LexAVS.obj \
$(SCI_LEX_OBJDIR)\LexBash.obj \
+ $(SCI_LEX_OBJDIR)\LexBatch.obj \
$(SCI_LEX_OBJDIR)\LexCmake.obj \
$(SCI_LEX_OBJDIR)\LexCoffeeScript.obj \
$(SCI_LEX_OBJDIR)\LexConf.obj \
$(SCI_LEX_OBJDIR)\LexCPP.obj \
$(SCI_LEX_OBJDIR)\LexCSS.obj \
+ $(SCI_LEX_OBJDIR)\LexDiff.obj \
+ $(SCI_LEX_OBJDIR)\LexErrorList.obj \
$(SCI_LEX_OBJDIR)\LexHTML.obj \
$(SCI_LEX_OBJDIR)\LexInno.obj \
$(SCI_LEX_OBJDIR)\LexLaTeX.obj \
$(SCI_LEX_OBJDIR)\LexLua.obj \
+ $(SCI_LEX_OBJDIR)\LexMake.obj \
$(SCI_LEX_OBJDIR)\LexMarkdown.obj \
$(SCI_LEX_OBJDIR)\LexNsis.obj \
- $(SCI_LEX_OBJDIR)\LexOthers.obj \
+ $(SCI_LEX_OBJDIR)\LexNull.obj \
$(SCI_LEX_OBJDIR)\LexPascal.obj \
$(SCI_LEX_OBJDIR)\LexPerl.obj \
$(SCI_LEX_OBJDIR)\LexPowerShell.obj \
+ $(SCI_LEX_OBJDIR)\LexProps.obj \
$(SCI_LEX_OBJDIR)\LexPython.obj \
$(SCI_LEX_OBJDIR)\LexRuby.obj \
$(SCI_LEX_OBJDIR)\LexSQL.obj \
diff --git a/scintilla/Scintilla.vcxproj b/scintilla/Scintilla.vcxproj index d893767..5f359f4 100644 --- a/scintilla/Scintilla.vcxproj +++ b/scintilla/Scintilla.vcxproj @@ -163,28 +163,33 @@ <ClCompile Include="lexers\LexAU3.cxx" /> <ClCompile Include="lexers\LexAVS.cxx" /> <ClCompile Include="lexers\LexBash.cxx" /> + <ClCompile Include="lexers\LexBatch.cxx" /> <ClCompile Include="lexers\LexCmake.cxx" /> <ClCompile Include="lexers\LexCoffeeScript.cxx" /> <ClCompile Include="lexers\LexConf.cxx" /> <ClCompile Include="lexers\LexCPP.cxx" /> <ClCompile Include="lexers\LexCSS.cxx" /> + <ClCompile Include="lexers\LexDiff.cxx" /> + <ClCompile Include="lexers\LexErrorList.cxx" /> <ClCompile Include="lexers\LexHTML.cxx" /> <ClCompile Include="lexers\LexInno.cxx" /> <ClCompile Include="lexers\LexLaTeX.cxx" /> <ClCompile Include="lexers\LexLua.cxx" /> + <ClCompile Include="lexers\LexMake.cxx" /> <ClCompile Include="lexers\LexMarkdown.cxx" /> <ClCompile Include="lexers\LexNsis.cxx" /> - <ClCompile Include="lexers\LexOthers.cxx" /> + <ClCompile Include="lexers\LexNull.cxx" /> <ClCompile Include="lexers\LexPascal.cxx" /> <ClCompile Include="lexers\LexPerl.cxx" /> <ClCompile Include="lexers\LexPowerShell.cxx" /> + <ClCompile Include="lexers\LexProps.cxx" /> <ClCompile Include="lexers\LexPython.cxx" /> <ClCompile Include="lexers\LexRuby.cxx" /> <ClCompile Include="lexers\LexSQL.cxx" /> <ClCompile Include="lexers\LexTCL.cxx" /> <ClCompile Include="lexers\LexVB.cxx" /> - <ClCompile Include="lexers\LexYAML.cxx" /> <ClCompile Include="lexers\LexVHDL.cxx" /> + <ClCompile Include="lexers\LexYAML.cxx" /> <ClCompile Include="lexlib\Accessor.cxx" /> <ClCompile Include="lexlib\CharacterCategory.cxx" /> <ClCompile Include="lexlib\CharacterSet.cxx" /> @@ -232,6 +237,7 @@ <ClInclude Include="include\Platform.h" /> <ClInclude Include="include\SciLexer.h" /> <ClInclude Include="include\Scintilla.h" /> + <ClInclude Include="include\Sci_Position.h" /> <ClInclude Include="lexlib\Accessor.h" /> <ClInclude Include="lexlib\CharacterCategory.h" /> <ClInclude Include="lexlib\CharacterSet.h" /> @@ -268,6 +274,7 @@ <ClInclude Include="src\MarginView.h" /> <ClInclude Include="src\Partitioning.h" /> <ClInclude Include="src\PerLine.h" /> + <ClInclude Include="src\Position.h" /> <ClInclude Include="src\PositionCache.h" /> <ClInclude Include="src\RESearch.h" /> <ClInclude Include="src\RunStyles.h" /> diff --git a/scintilla/Scintilla.vcxproj.filters b/scintilla/Scintilla.vcxproj.filters index 540e09d..99ead61 100644 --- a/scintilla/Scintilla.vcxproj.filters +++ b/scintilla/Scintilla.vcxproj.filters @@ -33,6 +33,9 @@ <ClCompile Include="lexers\LexBash.cxx"> <Filter>lexers</Filter> </ClCompile> + <ClCompile Include="lexers\LexBatch.cxx"> + <Filter>lexers</Filter> + </ClCompile> <ClCompile Include="lexers\LexCmake.cxx"> <Filter>lexers</Filter> </ClCompile> @@ -48,6 +51,12 @@ <ClCompile Include="lexers\LexCSS.cxx"> <Filter>lexers</Filter> </ClCompile> + <ClCompile Include="lexers\LexDiff.cxx"> + <Filter>lexers</Filter> + </ClCompile> + <ClCompile Include="lexers\LexErrorList.cxx"> + <Filter>lexers</Filter> + </ClCompile> <ClCompile Include="lexers\LexHTML.cxx"> <Filter>lexers</Filter> </ClCompile> @@ -60,13 +69,16 @@ <ClCompile Include="lexers\LexLua.cxx"> <Filter>lexers</Filter> </ClCompile> + <ClCompile Include="lexers\LexMake.cxx"> + <Filter>lexers</Filter> + </ClCompile> <ClCompile Include="lexers\LexMarkdown.cxx"> <Filter>lexers</Filter> </ClCompile> <ClCompile Include="lexers\LexNsis.cxx"> <Filter>lexers</Filter> </ClCompile> - <ClCompile Include="lexers\LexOthers.cxx"> + <ClCompile Include="lexers\LexNull.cxx"> <Filter>lexers</Filter> </ClCompile> <ClCompile Include="lexers\LexPascal.cxx"> @@ -78,6 +90,9 @@ <ClCompile Include="lexers\LexPowerShell.cxx"> <Filter>lexers</Filter> </ClCompile> + <ClCompile Include="lexers\LexProps.cxx"> + <Filter>lexers</Filter> + </ClCompile> <ClCompile Include="lexers\LexPython.cxx"> <Filter>lexers</Filter> </ClCompile> @@ -344,6 +359,9 @@ <ClInclude Include="src\PerLine.h"> <Filter>src</Filter> </ClInclude> + <ClInclude Include="src\Position.h"> + <Filter>src</Filter> + </ClInclude> <ClInclude Include="src\PositionCache.h"> <Filter>src</Filter> </ClInclude> diff --git a/scintilla/cppcheck.suppress b/scintilla/cppcheck.suppress index 813b207..edbff28 100644 --- a/scintilla/cppcheck.suppress +++ b/scintilla/cppcheck.suppress @@ -17,6 +17,7 @@ useInitializationList:scintilla/lexers/LexAsm.cxx useInitializationList:scintilla/lexers/LexBasic.cxx noCopyConstructor:scintilla/lexers/LexBash.cxx variableScope:scintilla/lexers/LexBash.cxx +variableScope:scintilla/lexers/LexBatch.cxx variableScope:scintilla/lexers/LexCmake.cxx variableScope:scintilla/lexers/LexCSS.cxx useInitializationList:scintilla/lexers/LexD.cxx @@ -29,7 +30,6 @@ variableScope:scintilla/lexers/LexModula.cxx variableScope:scintilla/lexers/LexNimrod.cxx variableScope:scintilla/lexers/LexNsis.cxx variableScope:scintilla/lexers/LexOpal.cxx -variableScope:scintilla/lexers/LexOthers.cxx variableScope:scintilla/lexers/LexPB.cxx noCopyConstructor:scintilla/lexers/LexPerl.cxx variableScope:scintilla/lexers/LexRuby.cxx diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index 080cea3..c24f52d 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -82,7 +82,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 11 June 2015 NH</p> + <p>Last edited 31 July 2015 NH</p> <p>There is <a class="jump" href="Design.html">an overview of the internal design of Scintilla</a>.<br /> @@ -575,10 +575,14 @@ These structures are defined to be exactly the same shape as the Win32 <code>TEXTRANGE</code> and <code>CHARRANGE</code>, so that older code that treats Scintilla as a RichEdit will work.</p> + <p>In a future release the type <code>Sci_PositionCR</code> will be redefined to be 64-bits when Scintilla is + built for 64-bits on all platforms.</p> <pre> +typedef long Sci_PositionCR; + struct Sci_CharacterRange { - long cpMin; - long cpMax; + Sci_PositionCR cpMin; + Sci_PositionCR cpMax; }; struct Sci_TextRange { @@ -1646,6 +1650,9 @@ struct Sci_TextToFind { Any selection apart from the main selection is called an additional selection. The calls in the previous section operate on the main selection. There is always at least one selection. + The selection can be simplified down to just the main selection by + <a class="message" href="#SCI_CANCEL"><code>SCI_CANCEL</code></a> + which is normally mapped to the Esc key. </p> <p> @@ -1673,7 +1680,9 @@ struct Sci_TextToFind { <p> <b id="SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</b><br /> <b id="SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</b><br /> - Whether typing, backspace, or delete works with multiple selections simultaneously.</p> + Whether typing, new line, cursor left/right/up/down, backspace, delete, home, and end work + with multiple selections simultaneously. + Also allows selection and word and line deletion commands.</p> <p> <b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br /> @@ -2694,8 +2703,8 @@ struct Sci_TextToFind { <p><b id="SCI_STYLESETCASE">SCI_STYLESETCASE(int styleNumber, int caseMode)</b><br /> <b id="SCI_STYLEGETCASE">SCI_STYLEGETCASE(int styleNumber)</b><br /> The value of caseMode determines how text is displayed. You can set upper case - (<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or display - normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is + (<code>SC_CASE_UPPER</code>, 1) or lower case (<code>SC_CASE_LOWER</code>, 2) or camel case (<code>SC_CASE_CAMEL</code>, 3) + or display normally (<code>SC_CASE_MIXED</code>, 0). This does not change the stored text, only how it is displayed.</p> <p><b id="SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE(int styleNumber, bool visible)</b><br /> @@ -3636,7 +3645,7 @@ struct Sci_TextToFind { colour)</a><br /> <a class="message" href="#SCI_MARKERSETBACKSELECTED">SCI_MARKERSETBACKSELECTED(int markerNumber, int colour)</a><br /> - <a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(int enabled)</a><br /> + <a class="message" href="#SCI_MARKERENABLEHIGHLIGHT">SCI_MARKERENABLEHIGHLIGHT(bool enabled)</a><br /> <a class="message" href="#SCI_MARKERSETALPHA">SCI_MARKERSETALPHA(int markerNumber, int alpha)</a><br /> <a class="message" href="#SCI_MARKERADD">SCI_MARKERADD(int line, int markerNumber)</a><br /> @@ -4320,8 +4329,10 @@ struct Sci_TextToFind { <p>When the user makes a selection from the list the container is sent a <code><a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> <a class="jump" href="#Notifications">notification message</a>. On return from the notification Scintilla will insert - the selected text unless the autocompletion list has been cancelled, for example by the container sending - <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>.</p> + the selected text and the container is sent a <code><a class="message" + href="#SCN_AUTOCCOMPLETED">SCN_AUTOCCOMPLETED</a></code> <a class="jump" + href="#Notifications">notification message</a> unless the autocompletion list has been cancelled, for example by the container sending + <code><a class="message" href="#SCI_AUTOCCANCEL">SCI_AUTOCCANCEL</a></code>. </p> <p>To make use of autocompletion you must monitor each character added to the document. See <code>SciTEBase::CharAdded()</code> in SciTEBase.cxx for an example of autocompletion.</p> @@ -4550,10 +4561,10 @@ struct Sci_TextToFind { <p>o The <code><a class="message" href="#SCI_AUTOCSETCHOOSESINGLE">SCI_AUTOCSETCHOOSESINGLE</a></code> message has no effect.<br /> - o When the user makes a selection you are sent a <code><a class="message" + o When the user makes a selection you are sent a <code><a class="jump" href="#SCN_USERLISTSELECTION">SCN_USERLISTSELECTION</a></code> <a class="jump" - href="#Notifications">notification message</a> rather than <code><a class="message" - href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code>.</p> + href="#Notifications">notification message</a> rather than <code><a class="jump" + href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code>.<br> <p>BEWARE: if you have set fillup characters or stop characters, these will still be active with the user list, and may result in items being selected or the user list cancelled due to @@ -4967,6 +4978,10 @@ struct Sci_TextToFind { by binding the <code>home</code> and <code>end</code> keys to these commands. </p> + <p class="message" id="SCI_CANCEL">The <code>SCI_CANCEL</code> command cancels autocompletion and + calltip display and drops any additional selections. + </p> + <h2 id="KeyBindings">Key bindings</h2> <p>There is a default binding of keys to commands that is defined in the Scintilla source in @@ -6325,62 +6340,34 @@ SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span> <span class="S0"> </span><span class="S5">virtual</span> <span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeProperty<span class="S10">(</span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>name<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>PropertySet<span class="S10">(</span><span class="S5">const</span> -<span class="S0"> </span><span class="S5">char</span> -<span class="S0"> </span><span class="S10">*</span>key<span class="S10">,</span> -<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span> -<span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span> -<span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span> -<span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD +<span class="S0"> </span>PropertySet<span class="S10">(</span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>key<span class="S10">,</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>WordListSet<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>n<span class="S10">,</span> -<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span> -<span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD +<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span> +<span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD +<span class="S0"> </span>WordListSet<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>n<span class="S10">,</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S0"> </span><span class="S5">virtual</span> <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>Lex<span class="S10">(</span><span class="S5">unsigned</span> -<span class="S0"> </span><span class="S5">int</span> -<span class="S0"> </span>startPos<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span> -<span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0"> -</span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span> -<span class="S0"> </span>IDocument<span class="S0"> -</span><span class="S10">*</span>pAccess<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span>Lex<span class="S10">(</span>Sci_PositionU<span class="S0"> </span>startPos<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span><span class="S0"> </span>IDocument<span class="S0"> </span><span class="S10">*</span>pAccess<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S0"> </span><span class="S5">virtual</span> <span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>Fold<span class="S10">(</span><span class="S5">unsigned</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>startPos<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span> -<span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0"> -</span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span> -<span class="S0"> </span>IDocument<span class="S0"> -</span><span class="S10">*</span>pAccess<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span>Fold<span class="S10">(</span>Sci_PositionU<span class="S0"> </span>startPos<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>lengthDoc<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>initStyle<span class="S10">,</span><span class="S0"> </span>IDocument<span class="S0"> </span><span class="S10">*</span>pAccess<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span> -<span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> -</span>PrivateCall<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>operation<span class="S10">,</span><span class="S0"> -</span><span class="S5">void</span><span class="S0"> </span> -<span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span> -<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD +<span class="S0"> </span>PrivateCall<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>operation<span class="S10">,</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span><span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S10">};</span><br /> </div> <p> +The types <code>Sci_Position</code> and <code>Sci_PositionU</code> are used for positions and line numbers in the document. +Before release 3.6.0 the types <code>int</code> and <code>unsigned int</code> were used instead and, for 3.6.0, +<code>Sci_Position</code> is defined as <code>int</code> and <code>Sci_PositionU</code> is defined as <code>unsigned int</code>. +In a future release, 64-bit builds will define these as 64-bit types to allow documents larger than 2 GB. +</p> + +<p> The return values from PropertySet and WordListSet are used to indicate whether the change requires performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1 if the change does not require any extra work on the document. @@ -6433,134 +6420,29 @@ To allow lexers to report which line ends they support, and to support substyles <h4>IDocument</h4> <div class="highlighted"> -<span class="S5">class</span><span class="S0"> </span>IDocument -<span class="S0"> </span><span class="S10">{</span><br /> +<span class="S5">class</span><span class="S0"> </span>IDocument<span class="S0"> </span><span class="S10">{</span><br /> <span class="S5">public</span><span class="S10">:</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span> -<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>status<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span> -<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span> -<span class="S0"> </span><span class="S10">*</span>buffer<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span> -position<span class="S10">,</span><span class="S0"> </span> -<span class="S5">int</span><span class="S0"> </span>lengthRetrieve<span class="S10">)</span> -<span class="S0"> </span><span class="S5">const</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>StyleAt<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span> -<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>LineFromPosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">)</span> -<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span> -<span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>LineStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span> -<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span> -<span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>GetLevel<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span> -<span class="S0"> </span> -<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span> -<span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>SetLevel<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span> -<span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>GetLineState<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>line<span class="S10">)</span> -<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span> -<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span> -<span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>SetLineState<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>line<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>StartStyling<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>position<span class="S10">,</span> -<span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span> -<span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>SetStyleFor<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>length<span class="S10">,</span> -<span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span> -<span class="S10">;</span><br /> - <span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>SetStyles<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span> -<span class="S5">const</span><span class="S0"> </span><span class="S5">char</span> -<span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span> -<span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>indicator<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>DecorationFillRange<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>position<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>value<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>fillLength<span class="S10">)</span> -<span class="S0"> - </span><span class="S10">=</span><span class="S0"> </span> -<span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>ChangeLexerState<span class="S10">(</span><span class="S5">int</span> -<span class="S0"> </span>start<span class="S10">,</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>end<span class="S10">)</span> -<span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span> -<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0"> - </span><span class="S5">const</span><span class="S0"> </span> -<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span> -<span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span> -<span class="S0"> </span>SCI_METHOD -<span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span> -<span class="S0"> </span>ch<span class="S10">)</span> -<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span> -<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>status<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD<span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>buffer<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>lengthRetrieve<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>StyleAt<span class="S10">(</span>Sci_Position<span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineFromPosition<span class="S10">(</span>Sci_Position<span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineStart<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetLevel<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetLevel<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetLineState<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetLineState<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>StartStyling<span class="S10">(</span>Sci_Position<span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetStyleFor<span class="S10">(</span>Sci_Position<span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>SetStyles<span class="S10">(</span>Sci_Position<span class="S0"> </span>length<span class="S10">,</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>indicator<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DecorationFillRange<span class="S10">(</span>Sci_Position<span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>value<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>fillLength<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>ChangeLexerState<span class="S10">(</span>Sci_Position<span class="S0"> </span>start<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>end<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span><span class="S0"> </span>ch<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span><span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>BufferPointer<span class="S10">()</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetLineIndentation<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S10">};</span><br /> </div> @@ -6598,9 +6480,9 @@ bytes in the character. <div class="highlighted"> <span class="S5">class</span><span class="S0"> </span>IDocumentWithLineEnd<span class="S0"> </span><span class="S10">:</span><span class="S0"> </span><span class="S5">public</span><span class="S0"> </span>IDocument<span class="S0"> </span><span class="S10">{</span><br /> <span class="S5">public</span><span class="S10">:</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineEnd<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetRelativePosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>positionStart<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>characterOffset<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> -<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetCharacterAndWidth<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span><span class="S10">*</span>pWidth<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD<span class="S0"> </span>LineEnd<span class="S10">(</span>Sci_Position<span class="S0"> </span>line<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetRelativePosition<span class="S10">(</span>Sci_Position<span class="S0"> </span>positionStart<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span>characterOffset<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> +<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>GetCharacterAndWidth<span class="S10">(</span>Sci_Position<span class="S0"> </span>position<span class="S10">,</span><span class="S0"> </span>Sci_Position<span class="S0"> </span><span class="S10">*</span>pWidth<span class="S10">)</span><span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br /> <span class="S10">};</span><br /> </div> @@ -6625,7 +6507,7 @@ implemented and thus which methods may be called.</p> <p>The container is passed a <code>SCNotification</code> structure containing information about the event.</p> <pre id="SCNotification"> -struct NotifyHeader { // This matches the Win32 NMHDR structure +struct Sci_NotifyHeader { // This matches the Win32 NMHDR structure void *hwndFrom; // environment specific window handle/pointer uptr_t idFrom; // CtrlID of the window issuing the notification unsigned int code; // The SCN_* notification code @@ -6633,14 +6515,16 @@ struct NotifyHeader { // This matches the Win32 NMHDR structure struct SCNotification { struct Sci_NotifyHeader nmhdr; - int position; + Sci_Position position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ - int ch; /* SCN_CHARADDED, SCN_KEY */ + int ch; + /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETE, SCN_AUTOCSELECTION, */ + /* SCN_USERLISTSELECTION */ int modifiers; /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ @@ -6649,12 +6533,12 @@ struct SCNotification { const char *text; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ - int length; /* SCN_MODIFIED */ - int linesAdded; /* SCN_MODIFIED */ + Sci_Position length; /* SCN_MODIFIED */ + Sci_Position linesAdded; /* SCN_MODIFIED */ int message; /* SCN_MACRORECORD */ uptr_t wParam; /* SCN_MACRORECORD */ sptr_t lParam; /* SCN_MACRORECORD */ - int line; /* SCN_MODIFIED */ + Sci_Position line; /* SCN_MODIFIED */ int foldLevelNow; /* SCN_MODIFIED */ int foldLevelPrev; /* SCN_MODIFIED */ int margin; /* SCN_MARGINCLICK */ @@ -6664,6 +6548,9 @@ struct SCNotification { int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ int updated; /* SCN_UPDATEUI */ + int listCompletionMethod; + /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION */ + }; </pre> @@ -6698,6 +6585,7 @@ struct SCNotification { <a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br /> <a class="message" href="#SCN_FOCUSIN">SCN_FOCUSIN</a><br /> <a class="message" href="#SCN_FOCUSOUT">SCN_FOCUSOUT</a><br /> + <a class="message" href="#SCN_AUTOCCOMPLETED">SCN_AUTOCCOMPLETED</a><br /> </code> <p>The following <code>SCI_*</code> messages are associated with these notifications:</p> @@ -6874,7 +6762,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber); <tr> <td align="left"><code>length</code></td> - <td align="left">Length of the change in cells or characters when the text or styling + <td align="left">Length of the change in bytes when the text or styling changes. Set to 0 if not used.</td> </tr> @@ -7042,7 +6930,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber); <td>Text is about to be inserted into the document.</td> - <td><code>position, if performed by user then text in cells, length in cells</code></td> + <td><code>position, if performed by user then text in bytes, length in bytes</code></td> </tr> <tr> @@ -7350,11 +7238,24 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next <td align="left">The position the list was displayed at.</td> </tr> + <tr> + <td align="left"><code>ch</code></td> + + <td align="left">If a fillup character was the method of selection, the used + character, otherwise 0.</td> + </tr> + <tr> + <td align="left"><code>listCompletionMethod</code></td> + + <td align="left">A value indicating the way in which the completion + occurred. See the table below.</td> + </tr> </tbody> </table> <br /> - - + + See the <code><a class="jump" href="#SCN_AUTOCCOMPLETED">SCN_AUTOCCOMPLETED</a></code> notification + for the possible values for <code>listCompletionMethod.</code> <p><b id="SCN_URIDROPPED">SCN_URIDROPPED</b><br /> Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web address onto Scintilla. The container could interpret this as a request to open the file. The @@ -7465,6 +7366,82 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next <td align="left">The text of the selection.</td> </tr> + <tr> + <td align="left"><code>ch</code></td> + + <td align="left">If a fillup character was the method of selection, the used + character, otherwise 0.</td> + </tr> + <tr> + <td align="left"><code>listCompletionMethod</code></td> + + <td align="left">A value indicating the way in which the completion + occurred. See the table below.</td> + </tr> + </tbody> + </table> + <br /> + <table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags"> + <tbody> + <tr> + <th align="left">Symbol</th> + + <th>Value</th> + + <th align="left">Meaning</th> + + </tr> + </tbody> + + <tbody valign="top"> + <tr> + <td align="left"><code>SC_AC_FILLUP</code></td> + + <td align="center">0x01</td> + + <td>A fillup character triggered the completion. The character used is + in ch. </td> + + </tr> + + <tr> + <td align="left"><code>SC_AC_DOUBLECLICK</code></td> + + <td align="center">0x02</td> + + <td>A double-click triggered the completion. ch is 0.</td> + + </tr> + + <tr> + <td align="left"><code>SC_AC_TAB</code></td> + + <td align="center">0x04</td> + + <td>The tab key or SCI_TAB triggered the completion. ch is 0.</td> + + </tr> + + <tr> + <td align="left"><code>SC_AC_NEWLINE</code></td> + + <td align="center">0x08</td> + + <td>A new line or SCI_NEWLINE triggered the completion. ch is 0.</td> + + </tr> + + <tr> + <td align="left"><code>SC_AC_COMMAND</code></td> + + <td align="center">0x10</td> + + <td>The + <code> + <a class="message" href="#SCI_AUTOCSELECT">SCI_AUTOCSELECT</a></code> message + triggered the completion. ch is 0.</td> + + </tr> </tbody> </table> @@ -7481,6 +7458,13 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next <code>SCN_FOCUSIN</code> (2028) is fired when Scintilla receives focus and <code>SCN_FOCUSOUT</code> (2029) when it loses focus.</p> + <p><b id="SCN_AUTOCCOMPLETED">SCN_AUTOCCOMPLETED<br /> + </b>This notification is generated after an autocompletion has inserted its + text. The fields are identical to the + <code> + <a class="jump" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> + notification.</p> + <h2 id="Images">Images</h2> <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p> diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html index f362f88..5fb96d9 100644 --- a/scintilla/doc/ScintillaDownload.html +++ b/scintilla/doc/ScintillaDownload.html @@ -25,9 +25,9 @@ <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
- <font size="4"> <a href="http://www.scintilla.org/scintilla357.zip">
+ <font size="4"> <a href="http://www.scintilla.org/scintilla360.zip">
Windows</a>
- <a href="http://www.scintilla.org/scintilla357.tgz">
+ <a href="http://www.scintilla.org/scintilla360.tgz">
GTK+/Linux</a>
</font>
</td>
@@ -41,7 +41,7 @@ containing very few restrictions.
</p>
<h3>
- Release 3.5.7
+ Release 3.6.0
</h3>
<h4>
Source Code
@@ -49,8 +49,8 @@ The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
- <li><a href="http://www.scintilla.org/scintilla357.zip">zip format</a> (1500K) commonly used on Windows</li>
- <li><a href="http://www.scintilla.org/scintilla357.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
+ <li><a href="http://www.scintilla.org/scintilla360.zip">zip format</a> (1500K) commonly used on Windows</li>
+ <li><a href="http://www.scintilla.org/scintilla360.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>
diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 82a8ed7..e74ffe3 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -472,6 +472,7 @@ <td>Stefan Küng</td>
</tr><tr>
<td>Jiřà Techet</td>
+ <td>Jonathan Hunt</td>
</tr>
</table>
<p>
@@ -484,7 +485,89 @@ </li>
</ul>
<h3>
- <a href="http://prdownloads.sourceforge.net/scintilla/scite356.zip?download">Release 3.5.7</a>
+ <a href="http://prdownloads.sourceforge.net/scintilla/scite360.zip?download">Release 3.6.0</a>
+ </h3>
+ <ul>
+ <li>
+ Released 3 August 2015.
+ </li>
+ <li>
+ External interfaces use the Sci_Position and Sci_PositionU typedefs instead of int and unsigned int
+ to allow for changes to a 64-bit interface on 64-bit plactforms in the future.
+ Applications and external lexers should start using the new type names so that
+ they will be compatible when the 64-bit change occurs.
+ There is also Sci_PositionCR (long) for use in the Sci_CharacterRange struct which will
+ also eventually become 64-bit.
+ </li>
+ <li>
+ Multiple selection now works over more key commands.
+ The new multiple-selection handling commands include horizontal movement and selection commands,
+ line up and down movement and selection commands, word and line deletion commands, and
+ line end insertion.
+ This change in behaviours is conditional on setting the SCI_SETADDITIONALSELECTIONTYPING property.
+ </li>
+ <li>
+ Autocompletion lists send an SCN_AUTOCCOMPLETED notification after the text has been inserted.
+ <a href="http://sourceforge.net/p/scintilla/feature-requests/1109/">Feature #1109.</a>
+ </li>
+ <li>
+ The case mode style attribute can now be SC_CASE_CAMEL.
+ </li>
+ <li>
+ The Python lexer supports substyles for identifiers.
+ </li>
+ <li>
+ SciTE adds support for substyles.
+ </li>
+ <li>
+ SciTE's Export as RTF and Copy as RTF commands support UTF-8.
+ </li>
+ <li>
+ SciTE can display autocompletion on all IME input with ime.autocomplete property.
+ </li>
+ <li>
+ SciTE properties files now discard trailing white space on variable names.
+ </li>
+ <li>
+ Calling SCI_SETIDENTIFIERS resets styling to ensure any added identifier are highlighted.
+ </li>
+ <li>
+ Avoid candidate box randomly popping up away from edit pane with (especially
+ Japanese) IME input.
+ </li>
+ <li>
+ On Cocoa fix problems with positioning of autocompletion lists near screen edge
+ or under dock. Cancel autocompletion when window moved.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1740/">Bug #1740</a>.
+ </li>
+ <li>
+ Fix drawing problem when control characters are in a hidden style as they then
+ have a zero width rectangle to draw but modify that rectangle in a way that
+ clears some pixels.
+ </li>
+ <li>
+ Report error when attempt to resize buffer to more than 2GB with SC_STATUS_FAILURE.
+ </li>
+ <li>
+ Fix bug on GTK+ with scroll bars leaking.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1742/">Bug #1742</a>.
+ </li>
+ <li>
+ LexOthers.cxx file split into one file per lexer: LexBatch, LexDiff,
+ LexErrorList, LexMake, LexNull, and LexProps.
+ </li>
+ <li>
+ SciTE exporters handle styles > 127 correctly now.
+ </li>
+ <li>
+ SciTE on Windows can scale window element sizes based on the system DPI setting.
+ </li>
+ <li>
+ SciTE implements find.in.files.close.on.find on all platforms, not just Windows.
+ </li>
+ </ul>
+ <h3>
+ <a href="http://prdownloads.sourceforge.net/scintilla/scite357.zip?download">Release 3.5.7</a>
</h3>
<ul>
<li>
diff --git a/scintilla/doc/ScintillaRelated.html b/scintilla/doc/ScintillaRelated.html index 956f805..3a20b08 100644 --- a/scintilla/doc/ScintillaRelated.html +++ b/scintilla/doc/ScintillaRelated.html @@ -455,6 +455,10 @@ Editing Components
</h3>
<p>
+ <a href="https://codemirror.net/">CodeMirror</a>
+ is a versatile text editor implemented in JavaScript for the browser.
+ </p>
+ <p>
<a href="http://www.soft-gems.net/index.php/controls/unicodeeditor-formerly-unicode-syntax-editor">UniCodeEditor</a>
is a Unicode aware syntax editor control for Delphi and C++ Builder.
</p>
diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html index 873d028..90eb1c6 100644 --- a/scintilla/doc/index.html +++ b/scintilla/doc/index.html @@ -9,7 +9,7 @@ <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
- <meta name="Date.Modified" content="20150620" />
+ <meta name="Date.Modified" content="20150803" />
<style type="text/css">
#versionlist {
margin: 0;
@@ -55,8 +55,8 @@ GTK+, and OS X</font>
</td>
<td width="40%" align="right">
- <font color="#FFCC99" size="3"> Release version 3.5.7<br />
- Site last modified June 20 2015</font>
+ <font color="#FFCC99" size="3"> Release version 3.6.0<br />
+ Site last modified August 3 2015</font>
</td>
<td width="20%">
@@ -71,16 +71,14 @@ </tr>
</table>
<ul id="versionlist">
+ <li>Version 3.6.0 implements more multiple selection operations.
+ Type definitions Sci_Position, Sci_PositionU, and Sci_PositionCR allow client
+ code to prepare for a future change allowing larger than 2 GB documents.</li>
<li>Version 3.5.7 fixes a crash on Cocoa with drag and drop and adds commands to add the next or each occurrence of the
main selection to the set of selections.</li>
<li>Version 3.5.6 fixes a bug with undo on Cocoa that could lose data.</li>
<li>Version 3.5.5 improves IME on Qt and fixes minor bugs.</li>
<li>Version 3.5.4 improves indicators to be able to change appearance on mouse-over and to use a wide variety of colours together.</li>
- <li>Version 3.5.3 removes support for Windows 95, 98, and ME.</li>
- <li>Version 3.5.2 only supports 64-bit builds for OS X 10.7+ Cocoa. Provisional support of C++11 <regex>.</li>
- <li>Version 3.5.1 fixes minor bugs and includes a lexer for BibTeX.</li>
- <li>Version 3.5.0 can share space vertically so that extreme ascenders and descenders are not cut off.
- Separate timers are used to minimize wake ups and thus power use.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
diff --git a/scintilla/include/ILexer.h b/scintilla/include/ILexer.h index b859cfd..4d131cd 100644 --- a/scintilla/include/ILexer.h +++ b/scintilla/include/ILexer.h @@ -8,6 +8,8 @@ #ifndef ILEXER_H
#define ILEXER_H
+#include "Sci_Position.h"
+
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
@@ -24,32 +26,32 @@ class IDocument { public:
virtual int SCI_METHOD Version() const = 0;
virtual void SCI_METHOD SetErrorStatus(int status) = 0;
- virtual int SCI_METHOD Length() const = 0;
- virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0;
- virtual char SCI_METHOD StyleAt(int position) const = 0;
- virtual int SCI_METHOD LineFromPosition(int position) const = 0;
- virtual int SCI_METHOD LineStart(int line) const = 0;
- virtual int SCI_METHOD GetLevel(int line) const = 0;
- virtual int SCI_METHOD SetLevel(int line, int level) = 0;
- virtual int SCI_METHOD GetLineState(int line) const = 0;
- virtual int SCI_METHOD SetLineState(int line, int state) = 0;
- virtual void SCI_METHOD StartStyling(int position, char mask) = 0;
- virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0;
- virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0;
+ virtual Sci_Position SCI_METHOD Length() const = 0;
+ virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0;
+ virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0;
+ virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0;
+ virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0;
+ virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0;
+ virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0;
+ virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0;
+ virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0;
+ virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0;
+ virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0;
+ virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0;
virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
- virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0;
- virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0;
+ virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0;
+ virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0;
virtual int SCI_METHOD CodePage() const = 0;
virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
virtual const char * SCI_METHOD BufferPointer() = 0;
- virtual int SCI_METHOD GetLineIndentation(int line) = 0;
+ virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0;
};
class IDocumentWithLineEnd : public IDocument {
public:
- virtual int SCI_METHOD LineEnd(int line) const = 0;
- virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0;
- virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0;
+ virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0;
+ virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0;
+ virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0;
};
enum { lvOriginal=0, lvSubStyles=1 };
@@ -61,11 +63,11 @@ public: virtual const char * SCI_METHOD PropertyNames() = 0;
virtual int SCI_METHOD PropertyType(const char *name) = 0;
virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
- virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0;
+ virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0;
virtual const char * SCI_METHOD DescribeWordListSets() = 0;
- virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0;
- virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
- virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0;
+ virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
};
@@ -87,7 +89,7 @@ class ILoader { public:
virtual int SCI_METHOD Release() = 0;
// Returns a status code from SC_STATUS_*
- virtual int SCI_METHOD AddData(char *data, int length) = 0;
+ virtual int SCI_METHOD AddData(char *data, Sci_Position length) = 0;
virtual void * SCI_METHOD ConvertToDocument() = 0;
};
diff --git a/scintilla/include/Sci_Position.h b/scintilla/include/Sci_Position.h new file mode 100644 index 0000000..a83e286 --- /dev/null +++ b/scintilla/include/Sci_Position.h @@ -0,0 +1,21 @@ +// Scintilla source code edit control +/** @file Sci_Position.h + ** Define the Sci_Position type used in Scintilla's external interfaces. + ** These need to be available to clients written in C so are not in a C++ namespace. + **/ +// Copyright 2015 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCI_POSITION_H +#define SCI_POSITION_H + +// Basic signed type used throughout interface +typedef int Sci_Position; + +// Unsigned variant used for ILexer::Lex and ILexer::Fold +typedef unsigned int Sci_PositionU; + +// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE +typedef long Sci_PositionCR; + +#endif diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 8434f5f..cc8dfa2 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -11,6 +11,8 @@ #ifndef SCINTILLA_H
#define SCINTILLA_H
+#include "Sci_Position.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -217,6 +219,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_CASE_MIXED 0
#define SC_CASE_UPPER 1
#define SC_CASE_LOWER 2
+#define SC_CASE_CAMEL 3
#define SCI_STYLEGETFORE 2481
#define SCI_STYLEGETBACK 2482
#define SCI_STYLEGETBOLD 2483
@@ -1023,6 +1026,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCMOD_ALT 4
#define SCMOD_SUPER 8
#define SCMOD_META 16
+#define SC_AC_FILLUP 1
+#define SC_AC_DOUBLECLICK 2
+#define SC_AC_TAB 3
+#define SC_AC_NEWLINE 4
+#define SC_AC_COMMAND 5
#define SCN_STYLENEEDED 2000
#define SCN_CHARADDED 2001
#define SCN_SAVEPOINTREACHED 2002
@@ -1052,6 +1060,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_HOTSPOTRELEASECLICK 2027
#define SCN_FOCUSIN 2028
#define SCN_FOCUSOUT 2029
+#define SCN_AUTOCCOMPLETED 2030
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
/* These structures are defined to be exactly the same shape as the Win32
@@ -1063,8 +1072,8 @@ namespace Scintilla { #endif
struct Sci_CharacterRange {
- long cpMin;
- long cpMax;
+ Sci_PositionCR cpMin;
+ Sci_PositionCR cpMax;
};
struct Sci_TextRange {
@@ -1117,14 +1126,16 @@ struct Sci_NotifyHeader { struct SCNotification {
struct Sci_NotifyHeader nmhdr;
- int position;
+ Sci_Position position;
/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
/* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
/* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
/* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
/* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
- int ch; /* SCN_CHARADDED, SCN_KEY */
+ int ch;
+ /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */
+ /* SCN_USERLISTSELECTION */
int modifiers;
/* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
/* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
@@ -1133,12 +1144,12 @@ struct SCNotification { const char *text;
/* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
- int length; /* SCN_MODIFIED */
- int linesAdded; /* SCN_MODIFIED */
+ Sci_Position length; /* SCN_MODIFIED */
+ Sci_Position linesAdded; /* SCN_MODIFIED */
int message; /* SCN_MACRORECORD */
uptr_t wParam; /* SCN_MACRORECORD */
sptr_t lParam; /* SCN_MACRORECORD */
- int line; /* SCN_MODIFIED */
+ Sci_Position line; /* SCN_MODIFIED */
int foldLevelNow; /* SCN_MODIFIED */
int foldLevelPrev; /* SCN_MODIFIED */
int margin; /* SCN_MARGINCLICK */
@@ -1146,8 +1157,10 @@ struct SCNotification { int x; /* SCN_DWELLSTART, SCN_DWELLEND */
int y; /* SCN_DWELLSTART, SCN_DWELLEND */
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
- int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
+ Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
int updated; /* SCN_UPDATEUI */
+ int listCompletionMethod;
+ /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */
};
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index d2a3639..9b004e6 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -462,6 +462,7 @@ enu CaseVisible=SC_CASE_ val SC_CASE_MIXED=0
val SC_CASE_UPPER=1
val SC_CASE_LOWER=2
+val SC_CASE_CAMEL=3
# Get the foreground colour of a style.
get colour StyleGetFore=2481(int style,)
@@ -2656,6 +2657,13 @@ val SCMOD_ALT=4 val SCMOD_SUPER=8
val SCMOD_META=16
+enu CompletionMethods=SC_AC_
+val SC_AC_FILLUP=1
+val SC_AC_DOUBLECLICK=2
+val SC_AC_TAB=3
+val SC_AC_NEWLINE=4
+val SC_AC_COMMAND=5
+
################################################
# For SciLexer.h
enu Lexer=SCLEX_
@@ -4675,7 +4683,7 @@ evt void MacroRecord=2009(int message, int wParam, int lParam) evt void MarginClick=2010(int modifiers, int position, int margin)
evt void NeedShown=2011(int position, int length)
evt void Painted=2013(void)
-evt void UserListSelection=2014(int listType, string text, int position)
+evt void UserListSelection=2014(int listType, string text, int positionint, int ch, CompletionMethods listCompletionMethod)
evt void URIDropped=2015(string text)
evt void DwellStart=2016(int position, int x, int y)
evt void DwellEnd=2017(int position, int x, int y)
@@ -4683,7 +4691,7 @@ evt void Zoom=2018(void) evt void HotSpotClick=2019(int modifiers, int position)
evt void HotSpotDoubleClick=2020(int modifiers, int position)
evt void CallTipClick=2021(int position)
-evt void AutoCSelection=2022(string text, int position)
+evt void AutoCSelection=2022(string text, int position, int ch, CompletionMethods listCompletionMethod)
evt void IndicatorClick=2023(int modifiers, int position)
evt void IndicatorRelease=2024(int modifiers, int position)
evt void AutoCCancelled=2025(void)
@@ -4691,6 +4699,7 @@ evt void AutoCCharDeleted=2026(void) evt void HotSpotReleaseClick=2027(int modifiers, int position)
evt void FocusIn=2028(void)
evt void FocusOut=2029(void)
+evt void AutoCCompleted=2030(string text, int position, int ch, CompletionMethods listCompletionMethod)
# There are no provisional features currently
diff --git a/scintilla/lexers/LexA68k.cxx b/scintilla/lexers/LexA68k.cxx index 81f26ce..59c0cd5 100644 --- a/scintilla/lexers/LexA68k.cxx +++ b/scintilla/lexers/LexA68k.cxx @@ -115,7 +115,7 @@ static inline bool IsDoxygenChar (const int ch) * Main function, which colourises a 68k source
*/
-static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler)
+static void ColouriseA68kDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler)
{
// Used to buffer a string, to be able to compare it using built-in functions
char Buffer[100];
diff --git a/scintilla/lexers/LexAHK.cxx b/scintilla/lexers/LexAHK.cxx index 9136711..144a830 100644 --- a/scintilla/lexers/LexAHK.cxx +++ b/scintilla/lexers/LexAHK.cxx @@ -84,8 +84,8 @@ static void HighlightKeyword( }
static void ColouriseAHKDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -398,11 +398,11 @@ static void ColouriseAHKDoc( sc.Complete();
}
-static void FoldAHKDoc(unsigned int startPos, int length, int initStyle,
+static void FoldAHKDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
bool bOnlySpaces = true;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
@@ -413,7 +413,7 @@ static void FoldAHKDoc(unsigned int startPos, int length, int initStyle, char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexAPDL.cxx b/scintilla/lexers/LexAPDL.cxx index 5df1d65..a37dcff 100644 --- a/scintilla/lexers/LexAPDL.cxx +++ b/scintilla/lexers/LexAPDL.cxx @@ -43,7 +43,7 @@ static inline bool IsAnOperator(char ch) { return false;
}
-static void ColouriseAPDLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseAPDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
int stringStart = ' ';
@@ -184,16 +184,16 @@ static int CheckAPDLFoldPoint(char const *token, int &level) { return 0;
}
-static void FoldAPDLDoc(unsigned int startPos, int length, int,
+static void FoldAPDLDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
- int line = styler.GetLine(startPos);
+ Sci_Position line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int go = 0, done = 0;
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
char word[256];
int wordlen = 0;
- int i;
+ Sci_Position i;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// Scan for tokens at the start of the line (they may include
// whitespace, for tokens like "End Function"
diff --git a/scintilla/lexers/LexASY.cxx b/scintilla/lexers/LexASY.cxx index d58fb4b..fbbccf4 100644 --- a/scintilla/lexers/LexASY.cxx +++ b/scintilla/lexers/LexASY.cxx @@ -23,7 +23,7 @@ using namespace Scintilla;
#endif
-static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -152,7 +152,7 @@ static inline bool isASYidentifier(int ch) { ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ;
}
-static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)
+static int ParseASYWord(Sci_PositionU pos, Accessor &styler, char *word)
{
int length=0;
char ch=styler.SafeGetCharAt(pos);
@@ -167,11 +167,11 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) return length;
}
-static bool IsASYDrawingLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
+static bool IsASYDrawingLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
- int startpos = pos;
+ Sci_Position startpos = pos;
char buffer[100]="";
while (startpos<eol_pos){
@@ -186,14 +186,14 @@ static bool IsASYDrawingLine(int line, Accessor &styler) { return false;
}
-static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
+static void FoldAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -202,7 +202,7 @@ static void FoldAsyDoc(unsigned int startPos, int length, int initStyle, char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexAU3.cxx b/scintilla/lexers/LexAU3.cxx index 456eab2..529946d 100644 --- a/scintilla/lexers/LexAU3.cxx +++ b/scintilla/lexers/LexAU3.cxx @@ -170,10 +170,10 @@ static int GetSendKey(const char *szLine, char *szKey) //
// Routine to check the last "none comment" character on a line to see if its a continuation
//
-static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
+static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler)
{
- int nsPos = styler.LineStart(szLine);
- int nePos = styler.LineStart(szLine+1) - 2;
+ Sci_Position nsPos = styler.LineStart(szLine);
+ Sci_Position nePos = styler.LineStart(szLine+1) - 2;
//int stylech = styler.StyleAt(nsPos);
while (nsPos < nePos)
{
@@ -195,8 +195,8 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler) //
// syntax highlighting logic
-static void ColouriseAU3Doc(unsigned int startPos,
- int length, int initStyle,
+static void ColouriseAU3Doc(Sci_PositionU startPos,
+ Sci_Position length, int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -209,8 +209,8 @@ static void ColouriseAU3Doc(unsigned int startPos, WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
// find the first previous line without continuation character at the end
- int lineCurrent = styler.GetLine(startPos);
- int s_startPos = startPos;
+ Sci_Position lineCurrent = styler.GetLine(startPos);
+ Sci_Position s_startPos = startPos;
// When not inside a Block comment: find First line without _
if (!(initStyle==SCE_AU3_COMMENTBLOCK)) {
while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
@@ -447,7 +447,7 @@ static void ColouriseAU3Doc(unsigned int startPos, {
si=0;
// at line end and not found a continuation char then reset to default
- int lineCurrent = styler.GetLine(sc.currentPos);
+ Sci_Position lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
{
sc.SetState(SCE_AU3_DEFAULT);
@@ -492,7 +492,7 @@ static void ColouriseAU3Doc(unsigned int startPos, else
{
// check if the start is a valid SendKey start
- int nPos = 0;
+ Sci_Position nPos = 0;
int nState = 1;
char cTemp;
while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
@@ -659,10 +659,10 @@ static bool IsStreamCommentStyle(int style) { //
// Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
-static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
+static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler)
{
- int nsPos = styler.LineStart(szLine);
- int nePos = styler.LineStart(szLine+1) - 1;
+ Sci_Position nsPos = styler.LineStart(szLine);
+ Sci_Position nePos = styler.LineStart(szLine+1) - 1;
while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos)
{
nsPos++; // skip to next char
@@ -674,16 +674,16 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) //
-static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
// get settings from the config files for folding comments and preprocessor lines
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
// Backtrack to previous line in case need to fix its fold status
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
@@ -720,7 +720,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc char chNext = styler.SafeGetCharAt(startPos);
char chPrev = ' ';
//
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (IsAWordChar(ch)) {
diff --git a/scintilla/lexers/LexAVE.cxx b/scintilla/lexers/LexAVE.cxx index 774c19a..9cd3018 100644 --- a/scintilla/lexers/LexAVE.cxx +++ b/scintilla/lexers/LexAVE.cxx @@ -59,8 +59,8 @@ inline bool isAveOperator(char ch) { }
static void ColouriseAveDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -82,7 +82,7 @@ static void ColouriseAveDoc( for (; sc.More(); sc.Forward()) {
if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line
- int currentLine = styler.GetLine(sc.currentPos);
+ Sci_Position currentLine = styler.GetLine(sc.currentPos);
styler.SetLineState(currentLine, 0);
}
if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) {
@@ -157,11 +157,11 @@ static void ColouriseAveDoc( sc.Complete();
}
-static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = static_cast<char>(tolower(styler[startPos]));
@@ -169,7 +169,7 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W int styleNext = styler.StyleAt(startPos);
char s[10] = "";
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = static_cast<char>(tolower(chNext));
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
int style = styleNext;
diff --git a/scintilla/lexers/LexAVS.cxx b/scintilla/lexers/LexAVS.cxx index f9f21dc..551f1f4 100644 --- a/scintilla/lexers/LexAVS.cxx +++ b/scintilla/lexers/LexAVS.cxx @@ -44,8 +44,8 @@ static inline bool IsANumberChar(int ch) { }
static void ColouriseAvsDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -57,7 +57,7 @@ static void ColouriseAvsDoc( WordList &clipProperties = *keywordlists[4];
WordList &userDefined = *keywordlists[5];
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
// Initialize the block comment nesting level, if we are inside such a comment.
int blockCommentLevel = 0;
if (initStyle == SCE_AVS_COMMENTBLOCK || initStyle == SCE_AVS_COMMENTBLOCKN) {
@@ -208,24 +208,24 @@ static void ColouriseAvsDoc( }
static void FoldAvsDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexAbaqus.cxx b/scintilla/lexers/LexAbaqus.cxx index e1584a3..2691dfe 100644 --- a/scintilla/lexers/LexAbaqus.cxx +++ b/scintilla/lexers/LexAbaqus.cxx @@ -38,7 +38,7 @@ static inline bool IsASetChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
}
-static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
+static void ColouriseABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList*[] /* *keywordlists[] */,
Accessor &styler) {
enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \
DAT_LINE_VAL, DAT_LINE_COMMA,\
@@ -301,10 +301,10 @@ static int LowerCase(int c) return c;
}
-static int LineEnd(int line, Accessor &styler)
+static Sci_Position LineEnd(Sci_Position line, Accessor &styler)
{
- const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
- int eol_pos ;
+ const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
+ Sci_Position eol_pos ;
// if the line is the last line, the eol_pos is styler.Length()
// eol will contain a new line, or a virtual new line
if ( docLines == line )
@@ -314,7 +314,7 @@ static int LineEnd(int line, Accessor &styler) return eol_pos ;
}
-static int LineStart(int line, Accessor &styler)
+static Sci_Position LineStart(Sci_Position line, Accessor &styler)
{
return styler.LineStart(line) ;
}
@@ -330,14 +330,14 @@ static int LineStart(int line, Accessor &styler) // 6 : block close keyword line
// 7 : keyword line in error
// 8 : comment line
-static int LineType(int line, Accessor &styler) {
- int pos = LineStart(line, styler) ;
- int eol_pos = LineEnd(line, styler) ;
+static int LineType(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = LineStart(line, styler) ;
+ Sci_Position eol_pos = LineEnd(line, styler) ;
int c ;
char ch = ' ';
- int i = pos ;
+ Sci_Position i = pos ;
while ( i < eol_pos ) {
c = styler.SafeGetCharAt(i);
ch = static_cast<char>(LowerCase(c));
@@ -418,7 +418,7 @@ static int LineType(int line, Accessor &styler) { return 4 ;
}
-static void SafeSetLevel(int line, int level, Accessor &styler)
+static void SafeSetLevel(Sci_Position line, int level, Accessor &styler)
{
if ( line < 0 )
return ;
@@ -432,20 +432,20 @@ static void SafeSetLevel(int line, int level, Accessor &styler) styler.SetLevel(line, level) ;
}
-static void FoldABAQUSDoc(unsigned int startPos, int length, int,
+static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
- int startLine = styler.GetLine(startPos) ;
- int endLine = styler.GetLine(startPos+length-1) ;
+ Sci_Position startLine = styler.GetLine(startPos) ;
+ Sci_Position endLine = styler.GetLine(startPos+length-1) ;
// bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// We want to deal with all the cases
// To know the correct indentlevel, we need to look back to the
// previous command line indentation level
// order of formatting keyline datalines commentlines
- int beginData = -1 ;
- int beginComment = -1 ;
- int prvKeyLine = startLine ;
- int prvKeyLineTp = 0 ;
+ Sci_Position beginData = -1 ;
+ Sci_Position beginComment = -1 ;
+ Sci_Position prvKeyLine = startLine ;
+ Sci_Position prvKeyLineTp = 0 ;
// Scan until we find the previous keyword line
// this will give us the level reference that we need
@@ -467,7 +467,7 @@ WordList *[], Accessor &styler) { prvKeyLine = -1 ;
// Now start scanning over the lines.
- for ( int line = startLine; line <= endLine; line++ ) {
+ for ( Sci_Position line = startLine; line <= endLine; line++ ) {
int lineType = LineType(line, styler) ;
// Check for comment line
@@ -516,7 +516,7 @@ WordList *[], Accessor &styler) { datLevel = level ;
}
- for ( int ll = beginData; ll < beginComment; ll++ )
+ for ( Sci_Position ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
// The keyword we just found is going to be written at another level
@@ -532,7 +532,7 @@ WordList *[], Accessor &styler) { }
}
- for ( int lll = beginComment; lll < line; lll++ )
+ for ( Sci_Position lll = beginComment; lll < line; lll++ )
SafeSetLevel(lll, level, styler) ;
// wrap and reset
@@ -549,10 +549,10 @@ WordList *[], Accessor &styler) { } else {
// We need to find out whether this comment block is followed by
// a data line or a keyword line
- const int docLines = styler.GetLine(styler.Length() - 1);
+ const Sci_Position docLines = styler.GetLine(styler.Length() - 1);
- for ( int line = endLine + 1; line <= docLines; line++ ) {
- int lineType = LineType(line, styler) ;
+ for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) {
+ Sci_Position lineType = LineType(line, styler) ;
if ( lineType != 8 ) {
if ( !(lineType & 4) ) {
@@ -578,7 +578,7 @@ WordList *[], Accessor &styler) { datLevel = level ;
}
- for ( int ll = beginData; ll < beginComment; ll++ )
+ for ( Sci_Position ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
if ( prvKeyLineTp == 5 ) {
@@ -588,7 +588,7 @@ WordList *[], Accessor &styler) { if ( prvKeyLineTp == 6 ) {
level -= 1 ;
}
- for ( int m = beginComment; m <= endLine; m++ )
+ for ( Sci_Position m = beginComment; m <= endLine; m++ )
SafeSetLevel(m, level, styler) ;
}
diff --git a/scintilla/lexers/LexAda.cxx b/scintilla/lexers/LexAda.cxx index 13aba46..853e785 100644 --- a/scintilla/lexers/LexAda.cxx +++ b/scintilla/lexers/LexAda.cxx @@ -34,8 +34,8 @@ using namespace Scintilla; */
static void ColouriseDocument(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
@@ -222,8 +222,8 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe //
static void ColouriseDocument(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -231,7 +231,7 @@ static void ColouriseDocument( StyleContext sc(startPos, length, initStyle, styler);
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
while (sc.More()) {
diff --git a/scintilla/lexers/LexAsm.cxx b/scintilla/lexers/LexAsm.cxx index b4fdf6c..6b61fc3 100644 --- a/scintilla/lexers/LexAsm.cxx +++ b/scintilla/lexers/LexAsm.cxx @@ -172,13 +172,13 @@ public: const char * SCI_METHOD DescribeProperty(const char *name) {
return osAsm.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
return osAsm.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -193,14 +193,14 @@ public: }
};
-int SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) {
if (osAsm.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
-int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -228,7 +228,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { wordListN = &directives4foldend;
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -240,7 +240,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { return firstModification;
}
-void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
// Do not leak onto next line
@@ -371,16 +371,16 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, // level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "else".
-void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -391,7 +391,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, char word[100];
int wordlen = 0;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -453,7 +453,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, }
lineCurrent++;
levelCurrent = levelNext;
- if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
+ if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length() - 1))) {
// There is an empty line at end of file so give it same level and empty
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
}
diff --git a/scintilla/lexers/LexAsn1.cxx b/scintilla/lexers/LexAsn1.cxx index 90b8917..8695cd3 100644 --- a/scintilla/lexers/LexAsn1.cxx +++ b/scintilla/lexers/LexAsn1.cxx @@ -47,7 +47,7 @@ static bool isAsn1Char(int ch) // Function determining the color of a given code portion
// Based on a "state"
//
-static void ColouriseAsn1Doc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[], Accessor &styler)
+static void ColouriseAsn1Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[], Accessor &styler)
{
// The keywords
WordList &Keywords = *keywordLists[0];
@@ -168,7 +168,7 @@ asn1_default: sc.Complete();
}
-static void FoldAsn1Doc(unsigned int, int, int, WordList *[], Accessor &styler)
+static void FoldAsn1Doc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &styler)
{
// No folding enabled, no reason to continue...
if( styler.GetPropertyInt("fold") == 0 )
diff --git a/scintilla/lexers/LexBaan.cxx b/scintilla/lexers/LexBaan.cxx index 1542150..8b9905f 100644 --- a/scintilla/lexers/LexBaan.cxx +++ b/scintilla/lexers/LexBaan.cxx @@ -36,7 +36,7 @@ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-static void ColouriseBaanDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseBaanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -137,19 +137,19 @@ static void ColouriseBaanDoc(unsigned int startPos, int length, int initStyle, W sc.Complete();
}
-static void FoldBaanDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void FoldBaanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexBash.cxx b/scintilla/lexers/LexBash.cxx index b495575..14a4ec5 100644 --- a/scintilla/lexers/LexBash.cxx +++ b/scintilla/lexers/LexBash.cxx @@ -96,7 +96,7 @@ static int opposite(int ch) { return ch;
}
-static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -223,14 +223,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, int numBase = 0;
int digit;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int cmdState = BASH_CMD_START;
int testExprType = 0;
// Always backtracks to the start of a line that is not a continuation
// of the previous line (i.e. start of a bash command segment)
- int ln = styler.GetLine(startPos);
- if (ln > 0 && startPos == static_cast<unsigned int>(styler.LineStart(ln)))
+ Sci_Position ln = styler.GetLine(startPos);
+ if (ln > 0 && startPos == static_cast<Sci_PositionU>(styler.LineStart(ln)))
ln--;
for (;;) {
startPos = styler.LineStart(ln);
@@ -752,10 +752,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
@@ -765,19 +765,19 @@ static bool IsCommentLine(int line, Accessor &styler) { return false;
}
-static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
+static void FoldBashDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int skipHereCh = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexBasic.cxx b/scintilla/lexers/LexBasic.cxx index 21ace52..c07513e 100644 --- a/scintilla/lexers/LexBasic.cxx +++ b/scintilla/lexers/LexBasic.cxx @@ -255,13 +255,13 @@ public: const char * SCI_METHOD DescribeProperty(const char *name) {
return osBasic.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
return osBasic.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -277,14 +277,14 @@ public: }
};
-int SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) {
if (osBasic.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
-int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -300,7 +300,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { wordListN = &keywordlists[3];
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -312,7 +312,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { return firstModification;
}
-void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerBasic::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
bool wasfirst = true, isfirst = true; // true if first token in a line
@@ -471,17 +471,17 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle }
-void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) {
+void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
- int line = styler.GetLine(startPos);
+ Sci_Position line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int go = 0, done = 0;
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
char word[256];
int wordlen = 0;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
@@ -489,7 +489,7 @@ void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initS // Scan for tokens at the start of the line (they may include
// whitespace, for tokens like "End Function"
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
int c = cNext;
cNext = styler.SafeGetCharAt(i + 1);
bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n');
diff --git a/scintilla/lexers/LexBatch.cxx b/scintilla/lexers/LexBatch.cxx new file mode 100644 index 0000000..377b2cb --- /dev/null +++ b/scintilla/lexers/LexBatch.cxx @@ -0,0 +1,500 @@ +// Scintilla source code edit control +/** @file LexBatch.cxx + ** Lexer for batch files. + **/ +// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool Is0To9(char ch) { + return (ch >= '0') && (ch <= '9'); +} + +static bool IsAlphabetic(int ch) { + return IsASCII(ch) && isalpha(ch); +} + +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { + return (styler[i] == '\n') || + ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); +} + +// Tests for BATCH Operators +static bool IsBOperator(char ch) { + return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || + (ch == '|') || (ch == '?') || (ch == '*'); +} + +// Tests for BATCH Separators +static bool IsBSeparator(char ch) { + return (ch == '\\') || (ch == '.') || (ch == ';') || + (ch == '\"') || (ch == '\'') || (ch == '/'); +} + +static void ColouriseBatchLine( + char *lineBuffer, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, + WordList *keywordlists[], + Accessor &styler) { + + Sci_PositionU offset = 0; // Line Buffer Offset + Sci_PositionU cmdLoc; // External Command / Program Location + char wordBuffer[81]; // Word Buffer - large to catch long paths + Sci_PositionU wbl; // Word Buffer Length + Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length + WordList &keywords = *keywordlists[0]; // Internal Commands + WordList &keywords2 = *keywordlists[1]; // External Commands (optional) + + // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords + // Toggling Regular Keyword Checking off improves readability + // Other Regular Keywords and External Commands / Programs might also benefit from toggling + // Need a more robust algorithm to properly toggle Regular Keyword Checking + bool continueProcessing = true; // Used to toggle Regular Keyword Checking + // Special Keywords are those that allow certain characters without whitespace after the command + // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path= + // Special Keyword Buffer used to determine if the first n characters is a Keyword + char sKeywordBuffer[10]; // Special Keyword Buffer + bool sKeywordFound; // Exit Special Keyword for-loop if found + + // Skip initial spaces + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { + offset++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + // Set External Command / Program Location + cmdLoc = offset; + + // Check for Fake Label (Comment) or Real Label - return if found + if (lineBuffer[offset] == ':') { + if (lineBuffer[offset + 1] == ':') { + // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm + styler.ColourTo(endPos, SCE_BAT_COMMENT); + } else { + // Colorize Real Label + styler.ColourTo(endPos, SCE_BAT_LABEL); + } + return; + // Check for Drive Change (Drive Change is internal command) - return if found + } else if ((IsAlphabetic(lineBuffer[offset])) && + (lineBuffer[offset + 1] == ':') && + ((isspacechar(lineBuffer[offset + 2])) || + (((lineBuffer[offset + 2] == '\\')) && + (isspacechar(lineBuffer[offset + 3]))))) { + // Colorize Regular Keyword + styler.ColourTo(endPos, SCE_BAT_WORD); + return; + } + + // Check for Hide Command (@ECHO OFF/ON) + if (lineBuffer[offset] == '@') { + styler.ColourTo(startLine + offset, SCE_BAT_HIDE); + offset++; + } + // Skip next spaces + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { + offset++; + } + + // Read remainder of line word-at-a-time or remainder-of-word-at-a-time + while (offset < lengthLine) { + if (offset > startLine) { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // Copy word from Line Buffer into Word Buffer + wbl = 0; + for (; offset < lengthLine && wbl < 80 && + !isspacechar(lineBuffer[offset]); wbl++, offset++) { + wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset])); + } + wordBuffer[wbl] = '\0'; + wbo = 0; + + // Check for Comment - return if found + if (CompareCaseInsensitive(wordBuffer, "rem") == 0) { + styler.ColourTo(endPos, SCE_BAT_COMMENT); + return; + } + // Check for Separator + if (IsBSeparator(wordBuffer[0])) { + // Check for External Command / Program + if ((cmdLoc == offset - wbl) && + ((wordBuffer[0] == ':') || + (wordBuffer[0] == '\\') || + (wordBuffer[0] == '.'))) { + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Colorize External Command / Program + if (!keywords2) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else if (keywords2.InList(wordBuffer)) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else { + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // Reset External Command / Program Location + cmdLoc = offset; + } else { + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Colorize Default Text + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // Check for Regular Keyword in list + } else if ((keywords.InList(wordBuffer)) && + (continueProcessing)) { + // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking + if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) || + (CompareCaseInsensitive(wordBuffer, "goto") == 0) || + (CompareCaseInsensitive(wordBuffer, "prompt") == 0) || + (CompareCaseInsensitive(wordBuffer, "set") == 0)) { + continueProcessing = false; + } + // Identify External Command / Program Location for ERRORLEVEL, and EXIST + if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) || + (CompareCaseInsensitive(wordBuffer, "exist") == 0)) { + // Reset External Command / Program Location + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Skip comparison + while ((cmdLoc < lengthLine) && + (!isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Identify External Command / Program Location for CALL, DO, LOADHIGH and LH + } else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) || + (CompareCaseInsensitive(wordBuffer, "do") == 0) || + (CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) || + (CompareCaseInsensitive(wordBuffer, "lh") == 0)) { + // Reset External Command / Program Location + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + } + // Colorize Regular keyword + styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); + // No need to Reset Offset + // Check for Special Keyword in list, External Command / Program, or Default Text + } else if ((wordBuffer[0] != '%') && + (wordBuffer[0] != '!') && + (!IsBOperator(wordBuffer[0])) && + (continueProcessing)) { + // Check for Special Keyword + // Affected Commands are in Length range 2-6 + // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected + sKeywordFound = false; + for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { + wbo = 0; + // Copy Keyword Length from Word Buffer into Special Keyword Buffer + for (; wbo < keywordLength; wbo++) { + sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]); + } + sKeywordBuffer[wbo] = '\0'; + // Check for Special Keyword in list + if ((keywords.InList(sKeywordBuffer)) && + ((IsBOperator(wordBuffer[wbo])) || + (IsBSeparator(wordBuffer[wbo])))) { + sKeywordFound = true; + // ECHO requires no further Regular Keyword Checking + if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) { + continueProcessing = false; + } + // Colorize Special Keyword as Regular Keyword + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + } + // Check for External Command / Program or Default Text + if (!sKeywordFound) { + wbo = 0; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Reset External Command / Program Location + cmdLoc = offset - (wbl - wbo); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // CHOICE requires no further Regular Keyword Checking + if (CompareCaseInsensitive(wordBuffer, "choice") == 0) { + continueProcessing = false; + } + // Check for START (and its switches) - What follows is External Command \ Program + if (CompareCaseInsensitive(wordBuffer, "start") == 0) { + // Reset External Command / Program Location + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Reset External Command / Program Location if command switch detected + if (lineBuffer[cmdLoc] == '/') { + // Skip command switch + while ((cmdLoc < lengthLine) && + (!isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + } + } + // Colorize External Command / Program + if (!keywords2) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else if (keywords2.InList(wordBuffer)) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else { + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // No need to Reset Offset + // Check for Default Text + } else { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + } + // Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a) + } else if (wordBuffer[0] == '%') { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + wbo++; + // Search to end of word for second % (can be a long path) + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Check for Argument (%n) or (%*) + if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) && + (wordBuffer[wbo] != '%')) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - 2); + } + // Colorize Argument + styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - 2); + // Check for Expanded Argument (%~...) / Variable (%%~...) + } else if (((wbl > 1) && (wordBuffer[1] == '~')) || + ((wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] == '~'))) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Expanded Argument / Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // Check for Environment Variable (%x...%) + } else if ((wordBuffer[1] != '%') && + (wordBuffer[wbo] == '%')) { + wbo++; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Environment Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // Check for Local Variable (%%a) + } else if ( + (wbl > 2) && + (wordBuffer[1] == '%') && + (wordBuffer[2] != '%') && + (!IsBOperator(wordBuffer[2])) && + (!IsBSeparator(wordBuffer[2]))) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - 3); + } + // Colorize Local Variable + styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - 3); + } + // Check for Environment Variable (!x...!) + } else if (wordBuffer[0] == '!') { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + wbo++; + // Search to end of word for second ! (can be a long path) + while ((wbo < wbl) && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + if (wordBuffer[wbo] == '!') { + wbo++; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Environment Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + // Check for Operator + } else if (IsBOperator(wordBuffer[0])) { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + // Check for Comparison Operator + if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) { + // Identify External Command / Program Location for IF + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Colorize Comparison Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 2); + // Check for Pipe Operator + } else if (wordBuffer[0] == '|') { + // Reset External Command / Program Location + cmdLoc = offset - wbl + 1; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Colorize Pipe Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Check for Other Operator + } else { + // Check for > Operator + if (wordBuffer[0] == '>') { + // Turn Keyword and External Command / Program checking back on + continueProcessing = true; + } + // Colorize Other Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + } + // Check for Default Text + } else { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + // Skip next spaces - nothing happens if Offset was Reset + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { + offset++; + } + } + // Colorize Default Text for remainder of line - currently not lexed + styler.ColourTo(endPos, SCE_BAT_DEFAULT); +} + +static void ColouriseBatchDoc( + Sci_PositionU startPos, + Sci_Position length, + int /*initStyle*/, + WordList *keywordlists[], + Accessor &styler) { + + char lineBuffer[1024]; + + styler.StartAt(startPos); + styler.StartSegment(startPos); + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { + // End of line (or of line buffer) met, colourise it + lineBuffer[linePos] = '\0'; + ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler); + linePos = 0; + startLine = i + 1; + } + } + if (linePos > 0) { // Last line does not have ending characters + lineBuffer[linePos] = '\0'; + ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1, + keywordlists, styler); + } +} + +static const char *const batchWordListDesc[] = { + "Internal Commands", + "External Commands", + 0 +}; + +LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); diff --git a/scintilla/lexers/LexBibTeX.cxx b/scintilla/lexers/LexBibTeX.cxx index cdbce8d..fef58a9 100644 --- a/scintilla/lexers/LexBibTeX.cxx +++ b/scintilla/lexers/LexBibTeX.cxx @@ -76,7 +76,7 @@ namespace { return IsEntryStart(sc.chPrev, sc.ch); } - void ColorizeBibTeX(unsigned start_pos, int length, int /*init_style*/, WordList* keywordlists[], Accessor& styler) + void ColorizeBibTeX(Sci_PositionU start_pos, Sci_Position length, int /*init_style*/, WordList* keywordlists[], Accessor& styler) { WordList &EntryNames = *keywordlists[0]; bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0; @@ -94,7 +94,7 @@ namespace { styler.StartAt(start_pos); styler.StartSegment(start_pos); - int current_line = styler.GetLine(start_pos); + Sci_Position current_line = styler.GetLine(start_pos); int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK; int current_level = prev_level; int visible_chars = 0; @@ -153,7 +153,7 @@ namespace { sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the = sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization - int start = sc.currentPos; + Sci_Position start = sc.currentPos; // We need to handle multiple situations: // 1. name"one two {three}" @@ -227,12 +227,12 @@ namespace { state = SCE_BIBTEX_DEFAULT; } - int end = sc.currentPos; + Sci_Position end = sc.currentPos; current_line = styler.GetLine(end); // We have possibly skipped some lines, so the folding levels // have to be adjusted separately - for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i) + for (Sci_Position i = styler.GetLine(start); i <= styler.GetLine(end); ++i) styler.SetLevel(i, prev_level); sc.ForwardSetState(state); diff --git a/scintilla/lexers/LexBullant.cxx b/scintilla/lexers/LexBullant.cxx index 47894b8..2577b89 100644 --- a/scintilla/lexers/LexBullant.cxx +++ b/scintilla/lexers/LexBullant.cxx @@ -23,10 +23,10 @@ using namespace Scintilla;
#endif
-static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+static int classifyWordBullant(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
char s[100];
s[0] = '\0';
- for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+ for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0';
}
@@ -58,14 +58,14 @@ static int classifyWordBullant(unsigned int start, unsigned int end, WordList &k return lev;
}
-static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold") != 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@@ -74,11 +74,11 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
styler.StartSegment(startPos);
int endFoundThisLine = 0;
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexCLW.cxx b/scintilla/lexers/LexCLW.cxx index dbe067f..c12e6c0 100644 --- a/scintilla/lexers/LexCLW.cxx +++ b/scintilla/lexers/LexCLW.cxx @@ -142,12 +142,12 @@ inline bool SetNumericConstantState(StyleContext &scDoc) { }
// Get the next word in uppercase from the current position (keyword lookahead)
-inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) {
+inline bool GetNextWordUpper(Accessor &styler, Sci_PositionU uiStartPos, Sci_Position iLength, char *cWord) {
- unsigned int iIndex = 0; // Buffer Index
+ Sci_PositionU iIndex = 0; // Buffer Index
// Loop through the remaining string from the current position
- for (int iOffset = uiStartPos; iOffset < iLength; iOffset++) {
+ for (Sci_Position iOffset = uiStartPos; iOffset < iLength; iOffset++) {
// Get the character from the buffer using the offset
char cCharacter = styler[iOffset];
if (IsEOL(cCharacter)) {
@@ -174,7 +174,7 @@ inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLen }
// Clarion Language Colouring Procedure
-static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
+static void ColouriseClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
int iParenthesesLevel = 0; // Parenthese Level
int iColumn1Label = false; // Label starts in Column 1
@@ -521,22 +521,22 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS }
// Clarion Language Case Sensitive Colouring Procedure
-static void ColouriseClarionDocSensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
+static void ColouriseClarionDocSensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true);
}
// Clarion Language Case Insensitive Colouring Procedure
-static void ColouriseClarionDocInsensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
+static void ColouriseClarionDocInsensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false);
}
// Fill Buffer
-static void FillBuffer(unsigned int uiStart, unsigned int uiEnd, Accessor &accStyler, char *szBuffer, unsigned int uiLength) {
+static void FillBuffer(Sci_PositionU uiStart, Sci_PositionU uiEnd, Accessor &accStyler, char *szBuffer, Sci_PositionU uiLength) {
- unsigned int uiPos = 0;
+ Sci_PositionU uiPos = 0;
while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) {
szBuffer[uiPos] = static_cast<char>(toupper(accStyler[uiStart + uiPos]));
@@ -599,19 +599,19 @@ static int ClassifyClarionFoldPoint(int iLevel, const char* szString) { }
// Clarion Language Folding Procedure
-static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
+static void FoldClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
- unsigned int uiEndPos = uiStartPos + iLength;
- int iLineCurrent = accStyler.GetLine(uiStartPos);
+ Sci_PositionU uiEndPos = uiStartPos + iLength;
+ Sci_Position iLineCurrent = accStyler.GetLine(uiStartPos);
int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK;
int iLevelCurrent = iLevelPrev;
char chNext = accStyler[uiStartPos];
int iStyle = iInitStyle;
int iStyleNext = accStyler.StyleAt(uiStartPos);
int iVisibleChars = 0;
- int iLastStart = 0;
+ Sci_Position iLastStart = 0;
- for (unsigned int uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
+ for (Sci_PositionU uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
char chChar = chNext;
chNext = accStyler.SafeGetCharAt(uiPos + 1);
diff --git a/scintilla/lexers/LexCOBOL.cxx b/scintilla/lexers/LexCOBOL.cxx index 61a5dae..9284992 100644 --- a/scintilla/lexers/LexCOBOL.cxx +++ b/scintilla/lexers/LexCOBOL.cxx @@ -64,12 +64,12 @@ static int CountBits(int nBits) return count;
}
-static void getRange(unsigned int start,
- unsigned int end,
+static void getRange(Sci_PositionU start,
+ Sci_PositionU end,
Accessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -77,12 +77,12 @@ static void getRange(unsigned int start, s[i] = '\0';
}
-static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) {
+static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) {
styler.ColourTo(end, attr);
}
-static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
+static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
int ret = 0;
WordList& a_keywords = *keywordlists[0];
@@ -142,7 +142,7 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k return ret;
}
-static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
@@ -152,11 +152,11 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int nContainment;
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
nContainment = styler.GetLineState(currentLine);
@@ -170,7 +170,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, bool bNewLine = true;
bool bAarea = !isspacechar(chNext);
int column = 0;
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -277,7 +277,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, if (ch == '\r' || ch == '\n') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
- (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
+ (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
@@ -309,12 +309,12 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, ColourTo(styler, lengthDoc - 1, state);
}
-static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[],
+static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF;
char chNext = styler[startPos];
@@ -322,7 +322,7 @@ static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[], bool bAarea = !isspacechar(chNext);
int column = 0;
bool bComment = false;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
++column;
diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx index 1d9e40d..628672b 100644 --- a/scintilla/lexers/LexCPP.cxx +++ b/scintilla/lexers/LexCPP.cxx @@ -54,7 +54,7 @@ bool IsSpaceEquiv(int state) { // Putting a space between the '++' post-inc operator and the '+' binary op // fixes this, and is highly recommended for readability anyway. bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { - int pos = (int) sc.currentPos; + Sci_Position pos = (Sci_Position) sc.currentPos; while (--pos > 0) { char ch = styler[pos]; if (ch == '+' || ch == '-') { @@ -66,9 +66,9 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { // Don't look at styles, so no need to flush. - int pos = (int) sc.currentPos; - int currentLine = styler.GetLine(pos); - int lineStartPos = styler.LineStart(currentLine); + Sci_Position pos = (Sci_Position) sc.currentPos; + Sci_Position currentLine = styler.GetLine(pos); + Sci_Position lineStartPos = styler.LineStart(currentLine); while (--pos > lineStartPos) { char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { @@ -145,7 +145,7 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { const int lengthMarker = 50; char marker[lengthMarker+1]; - int currPos = (int) sc.currentPos; + Sci_Position currPos = (Sci_Position) sc.currentPos; int i = 0; while (i < lengthMarker) { char ch = styler.SafeGetCharAt(currPos + i); @@ -199,11 +199,11 @@ struct EscapeSequence { } }; -std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { +std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { std::string restOfLine; - int i =0; + Sci_Position i =0; char ch = styler.SafeGetCharAt(start, '\n'); - int endLine = styler.LineEnd(styler.GetLine(start)); + Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); while (((start+i) < endLine) && (ch != '\r')) { char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); if (ch == '/' && (chNext == '/' || chNext == '*')) @@ -224,12 +224,12 @@ bool IsStreamCommentStyle(int style) { } struct PPDefinition { - int line; + Sci_Position line; std::string key; std::string value; bool isUndef; std::string arguments; - PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : + PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { } }; @@ -285,14 +285,14 @@ public: class PPStates { std::vector<LinePPState> vlls; public: - LinePPState ForLine(int line) const { + LinePPState ForLine(Sci_Position line) const { if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) { return vlls[line]; } else { return LinePPState(); } } - void Add(int line, LinePPState lls) { + void Add(Sci_Position line, LinePPState lls) { vlls.resize(line+1); vlls[line] = lls; } @@ -495,13 +495,13 @@ public: const char * SCI_METHOD DescribeProperty(const char *name) { return osCPP.DescribeProperty(name); } - int SCI_METHOD PropertySet(const char *key, const char *val); + Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); const char * SCI_METHOD DescribeWordListSets() { return osCPP.DescribeWordListSets(); } - int SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + Sci_Position SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); void * SCI_METHOD PrivateCall(int, void *) { return 0; @@ -555,7 +555,7 @@ public: bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions); }; -int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { +Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { if (osCPP.PropertySet(&options, key, val)) { if (strcmp(key, "lexer.cpp.allow.dollars") == 0) { setWord = CharacterSet(CharacterSet::setAlphaNum, "._", 0x80, true); @@ -568,7 +568,7 @@ int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { return -1; } -int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { +Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: @@ -590,7 +590,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { wordListN = &markerList; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -630,14 +630,14 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { // Functor used to truncate history struct After { - int line; - explicit After(int line_) : line(line_) {} + Sci_Position line; + explicit After(Sci_Position line_) : line(line_) {} bool operator()(PPDefinition &p) const { return p.line > line; } }; -void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); @@ -664,13 +664,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, bool inRERange = false; bool seenDocKeyBrace = false; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || (MaskActive(initStyle) == SCE_C_COMMENTLINE) || (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) { // Set continuationLine if last character of previous line is '\' if (lineCurrent > 0) { - int endLinePrevious = styler.LineEnd(lineCurrent - 1); + Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1); if (endLinePrevious > 0) { continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; } @@ -679,7 +679,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { - int back = startPos; + Sci_Position back = startPos; while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back)))) ; if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) { @@ -719,7 +719,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD); - int lineEndNext = styler.LineEnd(lineCurrent); + Sci_Position lineEndNext = styler.LineEnd(lineCurrent); for (; sc.More();) { @@ -757,7 +757,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, // Handle line continuation generically. if (sc.ch == '\\') { - if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) { + if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) { lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); @@ -1026,7 +1026,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\\' && (static_cast<int>(sc.currentPos+1) < lineEndNext)) { + } else if (sc.ch == '\\' && (static_cast<Sci_Position>(sc.currentPos+1) < lineEndNext)) { // Gobble up the escaped character sc.Forward(); } else if (sc.ch == '[') { @@ -1132,7 +1132,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) { sc.SetState(SCE_C_STRINGRAW|activitySet); rawStringTerminator = ")"; - for (int termPos = sc.currentPos + 1;; termPos++) { + for (Sci_Position termPos = sc.currentPos + 1;; termPos++) { char chTerminator = styler.SafeGetCharAt(termPos, '('); if (chTerminator == '(') break; @@ -1279,28 +1279,28 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". -void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; bool inLineComment = false; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - unsigned int lineStartNext = styler.LineStart(lineCurrent+1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = MaskActive(styler.StyleAt(startPos)); int style = MaskActive(initStyle); const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -1337,7 +1337,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, } if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -1379,7 +1379,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) { + if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } diff --git a/scintilla/lexers/LexCSS.cxx b/scintilla/lexers/LexCSS.cxx index 896bfcd..4142fcb 100644 --- a/scintilla/lexers/LexCSS.cxx +++ b/scintilla/lexers/LexCSS.cxx @@ -58,11 +58,11 @@ inline bool IsCssOperator(const int ch) { }
// look behind (from start of document to our start position) to determine current nesting level
-inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) {
+inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) {
int ch;
int nestingLevel = 0;
- for (unsigned int i = 0; i < startPos; i++) {
+ for (Sci_PositionU i = 0; i < startPos; i++) {
ch = styler.SafeGetCharAt(i);
if (ch == '{')
nestingLevel++;
@@ -73,7 +73,7 @@ inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) { return nestingLevel;
}
-static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
+static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &css1Props = *keywordlists[0];
WordList &pseudoClasses = *keywordlists[1];
WordList &css2Props = *keywordlists[2];
@@ -131,7 +131,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo if (lastStateC == -1) {
// backtrack to get last state:
// comments are like whitespace, so we must return to the previous state
- unsigned int i = startPos;
+ Sci_PositionU i = startPos;
for (; i > 0; i--) {
if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) {
if (lastStateC == SCE_CSS_OPERATOR) {
@@ -165,7 +165,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) {
if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\''))
continue;
- unsigned int i = sc.currentPos;
+ Sci_PositionU i = sc.currentPos;
while (i && styler[i-1] == '\\')
i--;
if ((sc.currentPos - i) % 2 == 1)
@@ -175,7 +175,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo if (sc.state == SCE_CSS_OPERATOR) {
if (op == ' ') {
- unsigned int i = startPos;
+ Sci_PositionU i = startPos;
op = styler.SafeGetCharAt(i-1);
opPrev = styler.SafeGetCharAt(i-2);
while (--i) {
@@ -380,10 +380,10 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo // check for nested rule selector
if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) {
// look ahead to see whether { comes before next ; and }
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int ch;
- for (unsigned int i = sc.currentPos; i < endPos; i++) {
+ for (Sci_PositionU i = sc.currentPos; i < endPos; i++) {
ch = styler.SafeGetCharAt(i);
if (ch == ';' || ch == '}')
break;
@@ -502,17 +502,17 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo sc.Complete();
}
-static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
+static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
diff --git a/scintilla/lexers/LexCaml.cxx b/scintilla/lexers/LexCaml.cxx index 982384f..af04524 100644 --- a/scintilla/lexers/LexCaml.cxx +++ b/scintilla/lexers/LexCaml.cxx @@ -66,18 +66,18 @@ using namespace Scintilla; #endif
static void ColouriseCamlDoc(
- unsigned int startPos, int length,
+ Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static void FoldCamlDoc(
- unsigned int startPos, int length,
+ Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
-static void InternalLexOrFold(int lexOrFold, unsigned int startPos, int length,
+static void InternalLexOrFold(int lexOrFold, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props);
static const char* LexerName = "caml";
@@ -109,7 +109,7 @@ long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long reinterpret_cast<LPARAM>(lParam));
}
-void EXT_LEXER_DECL Fold(unsigned int lexer, unsigned int startPos, int length,
+void EXT_LEXER_DECL Fold(unsigned int lexer, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props)
{
// below useless evaluation(s) to supress "not used" warnings
@@ -138,7 +138,7 @@ void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength) }
}
-void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length,
+void EXT_LEXER_DECL Lex(unsigned int lexer, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props)
{
// below useless evaluation(s) to supress "not used" warnings
@@ -147,7 +147,7 @@ void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, InternalLexOrFold(0, startPos, length, initStyle, words, window, props);
}
-static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length,
+static void InternalLexOrFold(int foldOrLex, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props)
{
// create and initialize a WindowAccessor (including contained PropSet)
@@ -180,7 +180,7 @@ static #endif /* BUILD_AS_EXTERNAL_LEXER */
void ColouriseCamlDoc(
- unsigned int startPos, int length,
+ Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
@@ -188,7 +188,8 @@ void ColouriseCamlDoc( // initialize styler
StyleContext sc(startPos, length, initStyle, styler);
- int chBase = 0, chToken = 0, chLit = 0;
+ Sci_PositionU chToken = 0;
+ int chBase = 0, chLit = 0;
WordList& keywords = *keywordlists[0];
WordList& keywords2 = *keywordlists[1];
WordList& keywords3 = *keywordlists[2];
@@ -206,7 +207,7 @@ void ColouriseCamlDoc( while (sc.More()) {
// set up [per-char] state info
int state2 = -1; // (ASSUME no state change)
- int chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
+ Sci_Position chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
bool advance = true; // (ASSUME scanner "eats" 1 char)
// step state machine
@@ -254,11 +255,11 @@ void ColouriseCamlDoc( case SCE_CAML_IDENTIFIER:
// [try to] interpret as [additional] identifier char
if (!(iscaml(sc.ch) || sc.Match('\''))) {
- const int n = sc.currentPos - chToken;
+ const Sci_Position n = sc.currentPos - chToken;
if (n < 24) {
// length is believable as keyword, [re-]construct token
char t[24];
- for (int i = -n; i < 0; i++)
+ for (Sci_Position i = -n; i < 0; i++)
t[n + i] = static_cast<char>(sc.GetRelative(i));
t[n] = '\0';
// special-case "_" token as KEYWORD
@@ -390,7 +391,7 @@ void ColouriseCamlDoc( state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++,
styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush();
// ... then backtrack to determine original SML literal type
- int p = chColor - 2;
+ Sci_Position p = chColor - 2;
for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ;
if (p >= 0)
state2 = static_cast<int>(styler.StyleAt(p));
@@ -437,7 +438,7 @@ void ColouriseCamlDoc( static
#endif /* BUILD_AS_EXTERNAL_LEXER */
void FoldCamlDoc(
- unsigned int, int,
+ Sci_PositionU, Sci_Position,
int,
WordList *[],
Accessor &)
diff --git a/scintilla/lexers/LexCmake.cxx b/scintilla/lexers/LexCmake.cxx index fb79abf..1cbca36 100644 --- a/scintilla/lexers/LexCmake.cxx +++ b/scintilla/lexers/LexCmake.cxx @@ -43,10 +43,10 @@ static bool isCmakeLetter(char ch) return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } -static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) +static bool CmakeNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { - int nNextLine = -1; - for ( unsigned int i = start; i < end; i++ ) { + Sci_Position nNextLine = -1; + for ( Sci_PositionU i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if ( cNext == '\n' ) { nNextLine = i+1; @@ -57,7 +57,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor if ( nNextLine == -1 ) // We never foudn the next line... return false; - for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { + for ( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if ( cNext == ' ' ) continue; @@ -71,7 +71,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor return false; } -static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) +static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse) { // If the word is too long, it is not what we are looking for if ( end - start > 20 ) @@ -100,7 +100,7 @@ static int calculateFoldCmake(unsigned int start, unsigned int end, int foldleve return newFoldlevel; } -static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) +static int classifyWordCmake(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler ) { char word[100] = {0}; char lowercaseWord[100] = {0}; @@ -109,7 +109,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key WordList &Parameters = *keywordLists[1]; WordList &UserDefined = *keywordLists[2]; - for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { + for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) { word[i] = static_cast<char>( styler[ start + i ] ); lowercaseWord[i] = static_cast<char>(tolower(word[i])); } @@ -162,7 +162,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key return SCE_CMAKE_DEFAULT; } -static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) +static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_CMAKE_DEFAULT; if ( startPos > 0 ) @@ -171,14 +171,14 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList * styler.StartAt( startPos ); styler.GetLine( startPos ); - unsigned int nLengthDoc = startPos + length; + Sci_PositionU nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; - unsigned int i; + Sci_PositionU i; for ( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); char cNextChar = styler.SafeGetCharAt(i+1); @@ -263,8 +263,8 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList * } if ( cNextChar == '\r' || cNextChar == '\n' ) { - int nCurLine = styler.GetLine(i+1); - int nBack = i; + Sci_Position nCurLine = styler.GetLine(i+1); + Sci_Position nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; @@ -377,7 +377,7 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList * styler.ColourTo(nLengthDoc-1,state); } -static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) +static void FoldCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { // No folding enabled, no reason to continue... if ( styler.GetPropertyInt("fold") == 0 ) @@ -385,18 +385,18 @@ static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], A bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; - int lineCurrent = styler.GetLine(startPos); - unsigned int safeStartPos = styler.LineStart( lineCurrent ); + Sci_Position lineCurrent = styler.GetLine(startPos); + Sci_PositionU safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; - int nWordStart = -1; + Sci_Position nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; - for (unsigned int i = safeStartPos; i < startPos + length; i++) { + for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); if ( bArg1 ) { diff --git a/scintilla/lexers/LexCoffeeScript.cxx b/scintilla/lexers/LexCoffeeScript.cxx index 08c6a01..0c80250 100644 --- a/scintilla/lexers/LexCoffeeScript.cxx +++ b/scintilla/lexers/LexCoffeeScript.cxx @@ -48,7 +48,7 @@ static bool IsSpaceEquiv(int state) { // Putting a space between the '++' post-inc operator and the '+' binary op
// fixes this, and is highly recommended for readability anyway.
static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
- int pos = (int) sc.currentPos;
+ Sci_Position pos = (Sci_Position) sc.currentPos;
while (--pos > 0) {
char ch = styler[pos];
if (ch == '+' || ch == '-') {
@@ -60,9 +60,9 @@ static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) {
// Don't look at styles, so no need to flush.
- int pos = (int) sc.currentPos;
- int currentLine = styler.GetLine(pos);
- int lineStartPos = styler.LineStart(currentLine);
+ Sci_Position pos = (Sci_Position) sc.currentPos;
+ Sci_Position currentLine = styler.GetLine(pos);
+ Sci_Position lineStartPos = styler.LineStart(currentLine);
while (--pos > lineStartPos) {
char ch = styler.SafeGetCharAt(pos);
if (ch != ' ' && ch != '\t') {
@@ -80,7 +80,7 @@ static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) { return !*s;
}
-static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -97,9 +97,9 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init int visibleChars = 0;
// look back to set chPrevNonWhite properly for better regex colouring
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
if (startPos > 0 && IsSpaceEquiv(initStyle)) {
- unsigned int back = startPos;
+ Sci_PositionU back = startPos;
styler.Flush();
while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back)))
;
@@ -268,10 +268,10 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init sc.Complete();
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
@@ -281,12 +281,12 @@ static bool IsCommentLine(int line, Accessor &styler) { return false;
}
-static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
+static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
// A simplified version of FoldPyDoc
- const int maxPos = startPos + length;
- const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
- const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
+ const Sci_Position maxPos = startPos + length;
+ const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
+ const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
// property fold.coffeescript.comment
const bool foldComment = styler.GetPropertyInt("fold.coffeescript.comment") != 0;
@@ -298,7 +298,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int, // and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
@@ -321,7 +321,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int, // Gather info
int lev = indentCurrent;
- int lineNext = lineCurrent + 1;
+ Sci_Position lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
@@ -365,7 +365,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int, // which is indented more than the line after the end of
// the comment-block, use the level of the block before
- int skipLine = lineNext;
+ Sci_Position skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
diff --git a/scintilla/lexers/LexConf.cxx b/scintilla/lexers/LexConf.cxx index 769557b..2dfe113 100644 --- a/scintilla/lexers/LexConf.cxx +++ b/scintilla/lexers/LexConf.cxx @@ -31,14 +31,14 @@ using namespace Scintilla;
#endif
-static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
+static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_CONF_DEFAULT;
char chNext = styler[startPos];
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length+1];
- int bufferCount = 0;
+ Sci_Position bufferCount = 0;
// this assumes that we have 2 keyword list in conf.properties
WordList &directives = *keywordLists[0];
@@ -48,7 +48,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k // using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
- for (int i = startPos; i < lengthDoc; i++) {
+ for (Sci_Position i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexCrontab.cxx b/scintilla/lexers/LexCrontab.cxx index 3c3db6c..2ad83d3 100644 --- a/scintilla/lexers/LexCrontab.cxx +++ b/scintilla/lexers/LexCrontab.cxx @@ -29,15 +29,15 @@ using namespace Scintilla;
#endif
-static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
+static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, int, WordList
*keywordLists[], Accessor &styler)
{
int state = SCE_NNCRONTAB_DEFAULT;
char chNext = styler[startPos];
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length+1];
- int bufferCount = 0;
+ Sci_Position bufferCount = 0;
// used when highliting environment variables inside quoted string:
bool insideString = false;
@@ -50,7 +50,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi // using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
- for (int i = startPos; i < lengthDoc; i++) {
+ for (Sci_Position i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexCsound.cxx b/scintilla/lexers/LexCsound.cxx index a3fdf42..77da3cd 100644 --- a/scintilla/lexers/LexCsound.cxx +++ b/scintilla/lexers/LexCsound.cxx @@ -51,7 +51,7 @@ static inline bool IsCsoundOperator(char ch) { return false;
}
-static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseCsoundDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &opcode = *keywordlists[0];
@@ -150,17 +150,17 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldCsoundInstruments(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int stylePrev = 0;
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexD.cxx b/scintilla/lexers/LexD.cxx index 8113447..b23bf46 100644 --- a/scintilla/lexers/LexD.cxx +++ b/scintilla/lexers/LexD.cxx @@ -177,13 +177,13 @@ public: const char * SCI_METHOD DescribeProperty(const char *name) {
return osD.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
return osD.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -197,14 +197,14 @@ public: }
};
-int SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {
if (osD.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
-int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -229,7 +229,7 @@ int SCI_METHOD LexerD::WordListSet(int n, const char *wl) { wordListN = &keywords7;
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -241,14 +241,14 @@ int SCI_METHOD LexerD::WordListSet(int n, const char *wl) { return firstModification;
}
-void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerD::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
int styleBeforeDCKeyword = SCE_D_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
- int curLine = styler.GetLine(startPos);
+ Sci_Position curLine = styler.GetLine(startPos);
int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0;
bool numFloat = false; // Float literals have '+' and '-' signs
bool numHex = false;
@@ -471,16 +471,16 @@ void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, ID // level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -491,7 +491,7 @@ void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, I int style = initStyle;
bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexDMAP.cxx b/scintilla/lexers/LexDMAP.cxx index 431000a..eb43cde 100644 --- a/scintilla/lexers/LexDMAP.cxx +++ b/scintilla/lexers/LexDMAP.cxx @@ -38,14 +38,14 @@ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch)); } /***************************************/ -static void ColouriseDMAPDoc(unsigned int startPos, int length, int initStyle, +static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ - int posLineStart = 0, numNonBlank = 0; - int endPos = startPos + length; + Sci_Position posLineStart = 0, numNonBlank = 0; + Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) { @@ -65,7 +65,7 @@ static void ColouriseDMAPDoc(unsigned int startPos, int length, int initStyle, if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle data appearing after column 72; it is ignored - int toLineStart = sc.currentPos - posLineStart; + Sci_Position toLineStart = sc.currentPos - posLineStart; if (toLineStart >= 72 || sc.ch == '$') { sc.SetState(SCE_DMAP_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end @@ -151,26 +151,26 @@ static int classifyFoldPointDMAP(const char* s, const char* prevWord) { return lev; } // Folding the code -static void FoldDMAPDoc(unsigned int startPos, int length, int initStyle, +static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { // // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; /***************************************/ - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -186,7 +186,7 @@ static void FoldDMAPDoc(unsigned int startPos, int length, int initStyle, if (style == SCE_DMAP_WORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; - unsigned int k; + Sci_PositionU k; for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { s[k] = static_cast<char>(tolower(styler[lastStart+k])); } diff --git a/scintilla/lexers/LexDMIS.cxx b/scintilla/lexers/LexDMIS.cxx index a903e9d..7eeecca 100644 --- a/scintilla/lexers/LexDMIS.cxx +++ b/scintilla/lexers/LexDMIS.cxx @@ -76,11 +76,11 @@ class LexerDMIS : public ILexer return NULL; } - int SCI_METHOD PropertySet(const char *, const char *) { + Sci_Position SCI_METHOD PropertySet(const char *, const char *) { return -1; } - int SCI_METHOD WordListSet(int n, const char *wl); + Sci_Position SCI_METHOD WordListSet(int n, const char *wl); void * SCI_METHOD PrivateCall(int, void *) { return NULL; @@ -91,8 +91,8 @@ class LexerDMIS : public ILexer } const char * SCI_METHOD DescribeWordListSets(); - void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); + void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); }; @@ -145,7 +145,7 @@ LexerDMIS::~LexerDMIS(void) { delete[] this->m_wordListSets; } -int SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl) +Sci_Position SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl) { switch (n) { case 0: @@ -185,9 +185,9 @@ const char * SCI_METHOD LexerDMIS::DescribeWordListSets() return this->m_wordListSets; } -void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) +void SCI_METHOD LexerDMIS::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - const unsigned int MAX_STR_LEN = 100; + const Sci_PositionU MAX_STR_LEN = 100; LexAccessor styler(pAccess); StyleContext scCTX(startPos, lengthDoc, initStyle, styler); @@ -281,14 +281,14 @@ void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initSty scCTX.Complete(); } -void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocument *pAccess) +void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int, IDocument *pAccess) { const int MAX_STR_LEN = 100; LexAccessor styler(pAccess); - unsigned int endPos = startPos + lengthDoc; + Sci_PositionU endPos = startPos + lengthDoc; char chNext = styler[startPos]; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int strPos = 0; @@ -300,7 +300,7 @@ void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocu tmpStr = new char[MAX_STR_LEN]; memset(tmpStr, 0, MAX_STR_LEN*sizeof(char)); - for (unsigned int i=startPos; i<endPos; i++) { + for (Sci_PositionU i=startPos; i<endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i+1); diff --git a/scintilla/lexers/LexDiff.cxx b/scintilla/lexers/LexDiff.cxx new file mode 100644 index 0000000..baa8368 --- /dev/null +++ b/scintilla/lexers/LexDiff.cxx @@ -0,0 +1,153 @@ +// Scintilla source code edit control +/** @file LexDiff.cxx + ** Lexer for diff results. + **/ +// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { + return (styler[i] == '\n') || + ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); +} + +#define DIFF_BUFFER_START_SIZE 16 +// Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE +// characters of each line to classify the line. + +static void ColouriseDiffLine(char *lineBuffer, Sci_Position endLine, Accessor &styler) { + // It is needed to remember the current state to recognize starting + // comment lines before the first "diff " or "--- ". If a real + // difference starts then each line starting with ' ' is a whitespace + // otherwise it is considered a comment (Only in..., Binary file...) + if (0 == strncmp(lineBuffer, "diff ", 5)) { + styler.ColourTo(endLine, SCE_DIFF_COMMAND); + } else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff + styler.ColourTo(endLine, SCE_DIFF_COMMAND); + } else if (0 == strncmp(lineBuffer, "---", 3) && lineBuffer[3] != '-') { + // In a context diff, --- appears in both the header and the position markers + if (lineBuffer[3] == ' ' && atoi(lineBuffer + 4) && !strchr(lineBuffer, '/')) + styler.ColourTo(endLine, SCE_DIFF_POSITION); + else if (lineBuffer[3] == '\r' || lineBuffer[3] == '\n') + styler.ColourTo(endLine, SCE_DIFF_POSITION); + else + styler.ColourTo(endLine, SCE_DIFF_HEADER); + } else if (0 == strncmp(lineBuffer, "+++ ", 4)) { + // I don't know of any diff where "+++ " is a position marker, but for + // consistency, do the same as with "--- " and "*** ". + if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) + styler.ColourTo(endLine, SCE_DIFF_POSITION); + else + styler.ColourTo(endLine, SCE_DIFF_HEADER); + } else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff + styler.ColourTo(endLine, SCE_DIFF_HEADER); + } else if (0 == strncmp(lineBuffer, "***", 3)) { + // In a context diff, *** appears in both the header and the position markers. + // Also ******** is a chunk header, but here it's treated as part of the + // position marker since there is no separate style for a chunk header. + if (lineBuffer[3] == ' ' && atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) + styler.ColourTo(endLine, SCE_DIFF_POSITION); + else if (lineBuffer[3] == '*') + styler.ColourTo(endLine, SCE_DIFF_POSITION); + else + styler.ColourTo(endLine, SCE_DIFF_HEADER); + } else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib + styler.ColourTo(endLine, SCE_DIFF_HEADER); + } else if (lineBuffer[0] == '@') { + styler.ColourTo(endLine, SCE_DIFF_POSITION); + } else if (lineBuffer[0] >= '0' && lineBuffer[0] <= '9') { + styler.ColourTo(endLine, SCE_DIFF_POSITION); + } else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') { + styler.ColourTo(endLine, SCE_DIFF_DELETED); + } else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') { + styler.ColourTo(endLine, SCE_DIFF_ADDED); + } else if (lineBuffer[0] == '!') { + styler.ColourTo(endLine, SCE_DIFF_CHANGED); + } else if (lineBuffer[0] != ' ') { + styler.ColourTo(endLine, SCE_DIFF_COMMENT); + } else { + styler.ColourTo(endLine, SCE_DIFF_DEFAULT); + } +} + +static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { + char lineBuffer[DIFF_BUFFER_START_SIZE] = ""; + styler.StartAt(startPos); + styler.StartSegment(startPos); + Sci_PositionU linePos = 0; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { + if (AtEOL(styler, i)) { + if (linePos < DIFF_BUFFER_START_SIZE) { + lineBuffer[linePos] = 0; + } + ColouriseDiffLine(lineBuffer, i, styler); + linePos = 0; + } else if (linePos < DIFF_BUFFER_START_SIZE - 1) { + lineBuffer[linePos++] = styler[i]; + } else if (linePos == DIFF_BUFFER_START_SIZE - 1) { + lineBuffer[linePos++] = 0; + } + } + if (linePos > 0) { // Last line does not have ending characters + if (linePos < DIFF_BUFFER_START_SIZE) { + lineBuffer[linePos] = 0; + } + ColouriseDiffLine(lineBuffer, startPos + length - 1, styler); + } +} + +static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { + Sci_Position curLine = styler.GetLine(startPos); + Sci_Position curLineStart = styler.LineStart(curLine); + int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE; + int nextLevel; + + do { + int lineType = styler.StyleAt(curLineStart); + if (lineType == SCE_DIFF_COMMAND) + nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; + else if (lineType == SCE_DIFF_HEADER) + nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG; + else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-') + nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG; + else if (prevLevel & SC_FOLDLEVELHEADERFLAG) + nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1; + else + nextLevel = prevLevel; + + if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) + styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); + + styler.SetLevel(curLine, nextLevel); + prevLevel = nextLevel; + + curLineStart = styler.LineStart(++curLine); + } while (static_cast<Sci_Position>(startPos)+length > curLineStart); +} + +static const char *const emptyWordListDesc[] = { + 0 +}; + +LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); diff --git a/scintilla/lexers/LexECL.cxx b/scintilla/lexers/LexECL.cxx index 76a93b4..95a4780 100644 --- a/scintilla/lexers/LexECL.cxx +++ b/scintilla/lexers/LexECL.cxx @@ -62,7 +62,7 @@ static bool IsSpaceEquiv(int state) { }
}
-static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords0 = *keywordlists[0];
WordList &keywords1 = *keywordlists[1];
@@ -90,7 +90,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo if (initStyle == SCE_ECL_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\'
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
int chBack = styler.SafeGetCharAt(startPos-1, 0);
int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
@@ -106,7 +106,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo // look back to set chPrevNonWhite properly for better regex colouring
if (startPos > 0) {
- int back = startPos;
+ Sci_Position back = startPos;
while (--back && IsSpaceEquiv(styler.StyleAt(back)))
;
if (styler.StyleAt(back) == SCE_ECL_OPERATOR) {
@@ -311,7 +311,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo }
// Determine if a new state should be entered.
- int lineCurrent = styler.GetLine(sc.currentPos);
+ Sci_Position lineCurrent = styler.GetLine(sc.currentPos);
int lineState = styler.GetLineState(lineCurrent);
if (sc.state == SCE_ECL_DEFAULT) {
if (lineState) {
@@ -388,8 +388,8 @@ static bool IsStreamCommentStyle(int style) { style == SCE_ECL_COMMENTDOCKEYWORDERROR;
}
-bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) {
- int i=0;
+bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) {
+ Sci_Position i=0;
for (; *s; i++) {
char compare_char = tolower(*s);
char styler_char = tolower(styler.SafeGetCharAt(pos+i));
@@ -405,15 +405,15 @@ bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) { // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-static void FoldEclDoc(unsigned int startPos, int length, int initStyle,
+static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = true;
bool foldPreprocessor = true;
bool foldCompact = true;
bool foldAtElse = true;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -422,7 +422,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle, char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -449,7 +449,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle, }
if (foldPreprocessor && (style == SCE_ECL_PREPROCESSOR)) {
if (ch == '#') {
- unsigned int j = i + 1;
+ Sci_PositionU j = i + 1;
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
@@ -497,7 +497,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle, lineCurrent++;
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
- if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
+ if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) {
// There is an empty line at end of file so give it same level and empty
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
}
diff --git a/scintilla/lexers/LexEScript.cxx b/scintilla/lexers/LexEScript.cxx index 9dd38ac..d0a6d73 100644 --- a/scintilla/lexers/LexEScript.cxx +++ b/scintilla/lexers/LexEScript.cxx @@ -37,7 +37,7 @@ static inline bool IsAWordStart(const int ch) { -static void ColouriseESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -176,24 +176,24 @@ static bool IsStreamCommentStyle(int style) { style == SCE_ESCRIPT_COMMENTLINE;
}
-static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
+static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) {
//~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// Do not know how to fold the comment at the moment.
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldComment = true;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- int lastStart = 0;
+ Sci_Position lastStart = 0;
char prevWord[32] = "";
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -231,7 +231,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor if (style == SCE_ESCRIPT_WORD3) {
if(iswordchar(ch) && !iswordchar(chNext)) {
char s[32];
- unsigned int j;
+ Sci_PositionU j;
for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) {
s[j] = static_cast<char>(tolower(styler[lastStart + j]));
}
diff --git a/scintilla/lexers/LexEiffel.cxx b/scintilla/lexers/LexEiffel.cxx index 204d458..527933e 100644 --- a/scintilla/lexers/LexEiffel.cxx +++ b/scintilla/lexers/LexEiffel.cxx @@ -46,8 +46,8 @@ static inline bool IsAWordStart(unsigned int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-static void ColouriseEiffelDoc(unsigned int startPos,
- int length,
+static void ColouriseEiffelDoc(Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -118,16 +118,16 @@ static void ColouriseEiffelDoc(unsigned int startPos, sc.Complete();
}
-static bool IsEiffelComment(Accessor &styler, int pos, int len) {
+static bool IsEiffelComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
return len>1 && styler[pos]=='-' && styler[pos+1]=='-';
}
-static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
+static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its fold status
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
@@ -137,7 +137,7 @@ static void FoldEiffelDocIndent(unsigned int startPos, int length, int, int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment);
char chNext = styler[startPos];
- for (int i = startPos; i < lengthDoc; i++) {
+ for (Sci_Position i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -164,11 +164,11 @@ static void FoldEiffelDocIndent(unsigned int startPos, int length, int, }
}
-static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
@@ -177,7 +177,7 @@ static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* init // lastDeferred should be determined by looking back to last keyword in case
// the "deferred" is on a line before "class"
bool lastDeferred = false;
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
@@ -185,7 +185,7 @@ static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* init bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) {
char s[20];
- unsigned int j = 0;
+ Sci_PositionU j = 0;
while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) {
s[j] = styler[i + j];
j++;
diff --git a/scintilla/lexers/LexErlang.cxx b/scintilla/lexers/LexErlang.cxx index d8e15cc..b6c8007 100644 --- a/scintilla/lexers/LexErlang.cxx +++ b/scintilla/lexers/LexErlang.cxx @@ -75,7 +75,7 @@ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (ch != ' ') && (isalnum(ch) || ch == '_');
}
-static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseErlangDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
StyleContext sc(startPos, length, initStyle, styler);
@@ -500,7 +500,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, static int ClassifyErlangFoldPoint(
Accessor &styler,
int styleNext,
- int keyword_start
+ Sci_Position keyword_start
) {
int lev = 0;
if (styler.Match(keyword_start,"case")
@@ -521,23 +521,23 @@ static int ClassifyErlangFoldPoint( }
static void FoldErlangDoc(
- unsigned int startPos, int length, int initStyle,
+ Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList** /*keywordlists*/, Accessor &styler
) {
- unsigned int endPos = startPos + length;
- int currentLine = styler.GetLine(startPos);
+ Sci_PositionU endPos = startPos + length;
+ Sci_Position currentLine = styler.GetLine(startPos);
int lev;
int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK;
int currentLevel = previousLevel;
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
int stylePrev;
- int keyword_start = 0;
+ Sci_Position keyword_start = 0;
char ch;
char chNext = styler.SafeGetCharAt(startPos);
bool atEOL;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexErrorList.cxx b/scintilla/lexers/LexErrorList.cxx new file mode 100644 index 0000000..be85cdc --- /dev/null +++ b/scintilla/lexers/LexErrorList.cxx @@ -0,0 +1,308 @@ +// Scintilla source code edit control +/** @file LexErrorList.cxx + ** Lexer for error lists. Used for the output pane in SciTE. + **/ +// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool strstart(const char *haystack, const char *needle) { + return strncmp(haystack, needle, strlen(needle)) == 0; +} + +static bool Is0To9(char ch) { + return (ch >= '0') && (ch <= '9'); +} + +static bool Is1To9(char ch) { + return (ch >= '1') && (ch <= '9'); +} + +static bool IsAlphabetic(int ch) { + return IsASCII(ch) && isalpha(ch); +} + +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { + return (styler[i] == '\n') || + ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); +} + +static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) { + if (lineBuffer[0] == '>') { + // Command or return status + return SCE_ERR_CMD; + } else if (lineBuffer[0] == '<') { + // Diff removal. + return SCE_ERR_DIFF_DELETION; + } else if (lineBuffer[0] == '!') { + return SCE_ERR_DIFF_CHANGED; + } else if (lineBuffer[0] == '+') { + if (strstart(lineBuffer, "+++ ")) { + return SCE_ERR_DIFF_MESSAGE; + } else { + return SCE_ERR_DIFF_ADDITION; + } + } else if (lineBuffer[0] == '-') { + if (strstart(lineBuffer, "--- ")) { + return SCE_ERR_DIFF_MESSAGE; + } else { + return SCE_ERR_DIFF_DELETION; + } + } else if (strstart(lineBuffer, "cf90-")) { + // Absoft Pro Fortran 90/95 v8.2 error and/or warning message + return SCE_ERR_ABSF; + } else if (strstart(lineBuffer, "fortcom:")) { + // Intel Fortran Compiler v8.0 error/warning message + return SCE_ERR_IFORT; + } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { + return SCE_ERR_PYTHON; + } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) { + return SCE_ERR_PHP; + } else if ((strstart(lineBuffer, "Error ") || + strstart(lineBuffer, "Warning ")) && + strstr(lineBuffer, " at (") && + strstr(lineBuffer, ") : ") && + (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) { + // Intel Fortran Compiler error/warning message + return SCE_ERR_IFC; + } else if (strstart(lineBuffer, "Error ")) { + // Borland error message + return SCE_ERR_BORLAND; + } else if (strstart(lineBuffer, "Warning ")) { + // Borland warning message + return SCE_ERR_BORLAND; + } else if (strstr(lineBuffer, "at line ") && + (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) && + strstr(lineBuffer, "file ") && + (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { + // Lua 4 error message + return SCE_ERR_LUA; + } else if (strstr(lineBuffer, " at ") && + (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) && + strstr(lineBuffer, " line ") && + (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && + (strstr(lineBuffer, " at ") + 4 < (strstr(lineBuffer, " line ")))) { + // perl error message: + // <message> at <file> line <line> + return SCE_ERR_PERL; + } else if ((memcmp(lineBuffer, " at ", 6) == 0) && + strstr(lineBuffer, ":line ")) { + // A .NET traceback + return SCE_ERR_NET; + } else if (strstart(lineBuffer, "Line ") && + strstr(lineBuffer, ", file ")) { + // Essential Lahey Fortran error message + return SCE_ERR_ELF; + } else if (strstart(lineBuffer, "line ") && + strstr(lineBuffer, " column ")) { + // HTML tidy style: line 42 column 1 + return SCE_ERR_TIDY; + } else if (strstart(lineBuffer, "\tat ") && + strstr(lineBuffer, "(") && + strstr(lineBuffer, ".java:")) { + // Java stack back trace + return SCE_ERR_JAVA_STACK; + } else if (strstart(lineBuffer, "In file included from ") || + strstart(lineBuffer, " from ")) { + // GCC showing include path to following error + return SCE_ERR_GCC_INCLUDED_FROM; + } else { + // Look for one of the following formats: + // GCC: <filename>:<line>:<message> + // Microsoft: <filename>(<line>) :<message> + // Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal + // Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal + // Microsoft: <filename>(<line>,<column>)<message> + // CTags: <identifier>\t<filename>\t<message> + // Lua 5 traceback: \t<filename>:<line>:<message> + // Lua 5.1: <exe>: <filename>:<line>:<message> + bool initialTab = (lineBuffer[0] == '\t'); + bool initialColonPart = false; + bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab + enum { stInitial, + stGccStart, stGccDigit, stGccColumn, stGcc, + stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet, + stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags, + stUnrecognized + } state = stInitial; + for (Sci_PositionU i = 0; i < lengthLine; i++) { + char ch = lineBuffer[i]; + char chNext = ' '; + if ((i + 1) < lengthLine) + chNext = lineBuffer[i + 1]; + if (state == stInitial) { + if (ch == ':') { + // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix) + if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) { + // This check is not completely accurate as may be on + // GTK+ with a file name that includes ':'. + state = stGccStart; + } else if (chNext == ' ') { // indicates a Lua 5.1 error message + initialColonPart = true; + } + } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) { + // May be Microsoft + // Check against '0' often removes phone numbers + state = stMsStart; + } else if ((ch == '\t') && canBeCtags) { + // May be CTags + state = stCtagsStart; + } else if (ch == ' ') { + canBeCtags = false; + } + } else if (state == stGccStart) { // <filename>: + state = Is1To9(ch) ? stGccDigit : stUnrecognized; + } else if (state == stGccDigit) { // <filename>:<line> + if (ch == ':') { + state = stGccColumn; // :9.*: is GCC + startValue = i + 1; + } else if (!Is0To9(ch)) { + state = stUnrecognized; + } + } else if (state == stGccColumn) { // <filename>:<line>:<column> + if (!Is0To9(ch)) { + state = stGcc; + if (ch == ':') + startValue = i + 1; + break; + } + } else if (state == stMsStart) { // <filename>( + state = Is0To9(ch) ? stMsDigit : stUnrecognized; + } else if (state == stMsDigit) { // <filename>(<line> + if (ch == ',') { + state = stMsDigitComma; + } else if (ch == ')') { + state = stMsBracket; + } else if ((ch != ' ') && !Is0To9(ch)) { + state = stUnrecognized; + } + } else if (state == stMsBracket) { // <filename>(<line>) + if ((ch == ' ') && (chNext == ':')) { + state = stMsVc; + } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) { + // Possibly Delphi.. don't test against chNext as it's one of the strings below. + char word[512]; + Sci_PositionU j, chPos; + unsigned numstep; + chPos = 0; + if (ch == ' ') + numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. + else + numstep = 2; // otherwise add 2. + for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) + word[chPos++] = lineBuffer[j]; + word[chPos] = 0; + if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || + !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") || + !CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) { + state = stMsVc; + } else { + state = stUnrecognized; + } + } else { + state = stUnrecognized; + } + } else if (state == stMsDigitComma) { // <filename>(<line>, + if (ch == ')') { + state = stMsDotNet; + break; + } else if ((ch != ' ') && !Is0To9(ch)) { + state = stUnrecognized; + } + } else if (state == stCtagsStart) { + if (ch == '\t') { + state = stCtagsFile; + } + } else if (state == stCtagsFile) { + if ((lineBuffer[i - 1] == '\t') && + ((ch == '/' && chNext == '^') || Is0To9(ch))) { + state = stCtags; + break; + } else if ((ch == '/') && (chNext == '^')) { + state = stCtagsStartString; + } + } else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) { + state = stCtagsStringDollar; + break; + } + } + if (state == stGcc) { + return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC; + } else if ((state == stMsVc) || (state == stMsDotNet)) { + return SCE_ERR_MS; + } else if ((state == stCtagsStringDollar) || (state == stCtags)) { + return SCE_ERR_CTAG; + } else { + return SCE_ERR_DEFAULT; + } + } +} + +static void ColouriseErrorListLine( + char *lineBuffer, + Sci_PositionU lengthLine, + Sci_PositionU endPos, + Accessor &styler, + bool valueSeparate) { + Sci_Position startValue = -1; + int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue); + if (valueSeparate && (startValue >= 0)) { + styler.ColourTo(endPos - (lengthLine - startValue), style); + styler.ColourTo(endPos, SCE_ERR_VALUE); + } else { + styler.ColourTo(endPos, style); + } +} + +static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { + char lineBuffer[10000]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + Sci_PositionU linePos = 0; + + // property lexer.errorlist.value.separate + // For lines in the output pane that are matches from Find in Files or GCC-style + // diagnostics, style the path and line number separately from the rest of the + // line with style 21 used for the rest of the line. + // This allows matched text to be more easily distinguished from its location. + bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { + // End of line (or of line buffer) met, colourise it + lineBuffer[linePos] = '\0'; + ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate); + linePos = 0; + } + } + if (linePos > 0) { // Last line does not have ending characters + ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate); + } +} + +static const char *const emptyWordListDesc[] = { + 0 +}; + +LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc); diff --git a/scintilla/lexers/LexFlagship.cxx b/scintilla/lexers/LexFlagship.cxx index 013521b..a5c8d7a 100644 --- a/scintilla/lexers/LexFlagship.cxx +++ b/scintilla/lexers/LexFlagship.cxx @@ -37,7 +37,7 @@ static inline bool IsAWordChar(int ch) (isalnum(ch) || ch == '_');
}
-static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler)
{
@@ -271,9 +271,9 @@ static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyl }
}
} else if (bEnableCode && sc.ch == '{') {
- int p = 0;
+ Sci_Position p = 0;
int chSeek;
- unsigned int endPos(startPos + length);
+ Sci_PositionU endPos(startPos + length);
do { // Skip whitespace
chSeek = sc.GetRelative(++p);
} while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos));
@@ -302,14 +302,14 @@ static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyl sc.Complete();
}
-static void FoldFlagShipDoc(unsigned int startPos, int length, int,
+static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler)
{
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
// Backtrack to previous line in case need to fix its fold status
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0 && lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
@@ -317,7 +317,7 @@ static void FoldFlagShipDoc(unsigned int startPos, int length, int, int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
char chNext = styler[startPos];
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexForth.cxx b/scintilla/lexers/LexForth.cxx index 0a7b9df..741431c 100644 --- a/scintilla/lexers/LexForth.cxx +++ b/scintilla/lexers/LexForth.cxx @@ -39,7 +39,7 @@ static inline bool IsASpaceChar(int ch) { return (ch < 0x80) && isspace(ch);
}
-static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[],
+static void ColouriseForthDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[],
Accessor &styler) {
WordList &control = *keywordLists[0];
@@ -151,7 +151,7 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static void FoldForthDoc(unsigned int, int, int, WordList *[],
+static void FoldForthDoc(Sci_PositionU, Sci_Position, int, WordList *[],
Accessor &) {
}
diff --git a/scintilla/lexers/LexFortran.cxx b/scintilla/lexers/LexFortran.cxx index 3b76f77..7675c20 100644 --- a/scintilla/lexers/LexFortran.cxx +++ b/scintilla/lexers/LexFortran.cxx @@ -46,7 +46,7 @@ static inline bool IsALineEnd(char ch) { return ((ch == '\n') || (ch == '\r')) ;
}
/***************************************/
-static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
+static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) {
while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue;
if (styler.SafeGetCharAt(pos) == '\n') pos++;
while (IsABlank(styler.SafeGetCharAt(pos++))) continue;
@@ -59,14 +59,15 @@ static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { }
}
/***************************************/
-static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
/***************************************/
- int posLineStart = 0, numNonBlank = 0, prevState = 0;
- int endPos = startPos + length;
+ Sci_Position posLineStart = 0;
+ int numNonBlank = 0, prevState = 0;
+ Sci_Position endPos = startPos + length;
/***************************************/
// backtrack to the nearest keyword
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) {
@@ -86,7 +87,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle if (!IsASpaceOrTab(sc.ch)) numNonBlank ++;
/***********************************************/
// Handle the fix format generically
- int toLineStart = sc.currentPos - posLineStart;
+ Sci_Position toLineStart = sc.currentPos - posLineStart;
if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) {
if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
@@ -130,7 +131,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle // Handle line continuation generically.
if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) {
char chTemp = ' ';
- int j = 1;
+ Sci_Position j = 1;
while (IsABlank(chTemp) && j<132) {
chTemp = static_cast<char>(sc.GetRelative(j));
j++;
@@ -295,16 +296,16 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c }
/***************************************/
// Folding the code
-static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
+static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
Accessor &styler, bool isFixFormat) {
//
// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// Do not know how to fold the comment at the moment.
//
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent;
bool isPrevLine;
if (lineCurrent > 0) {
@@ -321,10 +322,10 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, int style = initStyle;
int levelDeltaNext = 0;
/***************************************/
- int lastStart = 0;
+ Sci_Position lastStart = 0;
char prevWord[32] = "";
/***************************************/
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
char chNextNonBlank = chNext;
@@ -332,7 +333,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, if (IsALineEnd(chNextNonBlank)) {
nextEOL = true;
}
- unsigned int j=i+1;
+ Sci_PositionU j=i+1;
while(IsABlank(chNextNonBlank) && j<endPos) {
j ++ ;
chNextNonBlank = styler.SafeGetCharAt(j);
@@ -357,7 +358,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, if (style == SCE_F_WORD) {
if(iswordchar(ch) && !iswordchar(chNext)) {
char s[32];
- unsigned int k;
+ Sci_PositionU k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
}
@@ -386,7 +387,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, if (depth == 0) break;
}
}
- int tmpLineCurrent = lineCurrent;
+ Sci_Position tmpLineCurrent = lineCurrent;
while (j<endPos) {
j++;
chAtPos = styler.SafeGetCharAt(j);
@@ -490,22 +491,22 @@ static const char * const FortranWordLists[] = { 0,
};
/***************************************/
-static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
}
/***************************************/
-static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
}
/***************************************/
-static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle,
+static void FoldFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
FoldFortranDoc(startPos, length, initStyle,styler, false);
}
/***************************************/
-static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle,
+static void FoldFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
FoldFortranDoc(startPos, length, initStyle,styler, true);
}
diff --git a/scintilla/lexers/LexGAP.cxx b/scintilla/lexers/LexGAP.cxx index e63006e..598c3a4 100644 --- a/scintilla/lexers/LexGAP.cxx +++ b/scintilla/lexers/LexGAP.cxx @@ -39,8 +39,8 @@ static inline bool IsGAPOperator(char ch) { return false;
}
-static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) {
- unsigned int i = 0;
+static void GetRange(Sci_PositionU start, Sci_PositionU end, Accessor &styler, char *s, Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(styler[start + i]);
i++;
@@ -48,7 +48,7 @@ static void GetRange(unsigned int start, unsigned int end, Accessor &styler, cha s[i] = '\0';
}
-static void ColouriseGAPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
+static void ColouriseGAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords1 = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
@@ -197,19 +197,19 @@ static int ClassifyFoldPointGAP(const char* s) { return level;
}
-static void FoldGAPDoc( unsigned int startPos, int length, int initStyle, WordList** , Accessor &styler) {
- unsigned int endPos = startPos + length;
+static void FoldGAPDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** , Accessor &styler) {
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- int lastStart = 0;
+ Sci_Position lastStart = 0;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexGui4Cli.cxx b/scintilla/lexers/LexGui4Cli.cxx index 5b000b2..8abee01 100644 --- a/scintilla/lexers/LexGui4Cli.cxx +++ b/scintilla/lexers/LexGui4Cli.cxx @@ -68,9 +68,9 @@ inline bool isGCOperator(int ch) #define isFoldPoint(x) ((styler.LevelAt(x) & SC_FOLDLEVELNUMBERMASK) == 1024)
static void colorFirstWord(WordList *keywordlists[], Accessor &styler,
- StyleContext *sc, char *buff, int length, int)
+ StyleContext *sc, char *buff, Sci_Position length, int)
{
- int c = 0;
+ Sci_Position c = 0;
while (sc->More() && isSpaceOrNL(sc->ch))
{ sc->Forward();
}
@@ -119,12 +119,13 @@ static void colorFirstWord(WordList *keywordlists[], Accessor &styler, // Main colorizing function called by Scintilla
static void
-ColouriseGui4CliDoc(unsigned int startPos, int length, int initStyle,
+ColouriseGui4CliDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler)
{
styler.StartAt(startPos);
- int quotestart = 0, oldstate, currentline = styler.GetLine(startPos);
+ Sci_Position currentline = styler.GetLine(startPos);
+ int quotestart = 0, oldstate;
styler.StartSegment(startPos);
bool noforward;
char buff[BUFFSIZE+1]; // buffer for command name
@@ -243,20 +244,20 @@ ColouriseGui4CliDoc(unsigned int startPos, int length, int initStyle, }
// Main folding function called by Scintilla - (based on props (.ini) files function)
-static void FoldGui4Cli(unsigned int startPos, int length, int,
+static void FoldGui4Cli(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler)
{
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
bool headerPoint = false;
- for (unsigned int i = startPos; i < endPos; i++)
+ for (Sci_PositionU i = startPos; i < endPos; i++)
{
char ch = chNext;
chNext = styler[i+1];
diff --git a/scintilla/lexers/LexHTML.cxx b/scintilla/lexers/LexHTML.cxx index ff25c92..dcca93f 100644 --- a/scintilla/lexers/LexHTML.cxx +++ b/scintilla/lexers/LexHTML.cxx @@ -57,17 +57,17 @@ inline bool IsOperator(int ch) { return false;
}
-static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
- unsigned int i = 0;
+static void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) {
+ Sci_PositionU i = 0;
for (; (i < end - start + 1) && (i < len-1); i++) {
s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
}
s[i] = '\0';
}
-static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) {
+static const char *GetNextWord(Accessor &styler, Sci_PositionU start, char *s, size_t sLen) {
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (; i < sLen-1; i++) {
char ch = static_cast<char>(styler.SafeGetCharAt(start + i));
if ((i == 0) && !IsAWordStart(ch))
@@ -81,7 +81,7 @@ static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, si return s;
}
-static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
+static script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
@@ -110,7 +110,7 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, return prevValue;
}
-static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
+static int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) {
int iResult = 0;
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
@@ -171,7 +171,7 @@ static int stateForPrintState(int StateToPrint) { return state;
}
-static inline bool IsNumber(unsigned int start, Accessor &styler) {
+static inline bool IsNumber(Sci_PositionU start, Accessor &styler) {
return IsADigit(styler[start]) || (styler[start] == '.') ||
(styler[start] == '-') || (styler[start] == '#');
}
@@ -242,7 +242,7 @@ static inline bool isCommentASPState(int state) { return bResult;
}
-static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+static void classifyAttribHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
bool wordIsNumber = IsNumber(start, styler);
char chAttr = SCE_H_ATTRIBUTEUNKNOWN;
if (wordIsNumber) {
@@ -259,14 +259,14 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k styler.ColourTo(end, chAttr);
}
-static int classifyTagHTML(unsigned int start, unsigned int end,
+static int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
WordList &keywords, Accessor &styler, bool &tagDontFold,
bool caseSensitive, bool isXml, bool allowScripts) {
char withSpace[30 + 2] = " ";
const char *s = withSpace + 1;
// Copy after the '<'
- unsigned int i = 1;
- for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
+ Sci_PositionU i = 1;
+ for (Sci_PositionU cPos = start; cPos <= end && i < 30; cPos++) {
char ch = styler[cPos];
if ((ch != '<') && (ch != '/')) {
withSpace[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
@@ -298,7 +298,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, if (allowScripts && 0 == strcmp(s, "script")) {
// check to see if this is a self-closing tag by sniffing ahead
bool isSelfClose = false;
- for (unsigned int cPos = end; cPos <= end + 200; cPos++) {
+ for (Sci_PositionU cPos = end; cPos <= end + 200; cPos++) {
char ch = styler.SafeGetCharAt(cPos, '\0');
if (ch == '\0' || ch == '>')
break;
@@ -318,10 +318,10 @@ static int classifyTagHTML(unsigned int start, unsigned int end, return chAttr;
}
-static void classifyWordHTJS(unsigned int start, unsigned int end,
+static void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end,
WordList &keywords, Accessor &styler, script_mode inScriptType) {
char s[30 + 1];
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
}
@@ -337,7 +337,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
}
-static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
+static int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
char chAttr = SCE_HB_IDENTIFIER;
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
if (wordIsNumber) {
@@ -358,10 +358,10 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw return SCE_HB_DEFAULT;
}
-static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) {
+static void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) {
bool wordIsNumber = IsADigit(styler[start]);
char s[30 + 1];
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
}
@@ -383,7 +383,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key // Update the word colour to default or keyword
// Called when in a PHP word
-static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+static void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
char chAttr = SCE_HPHP_DEFAULT;
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1]));
if (wordIsNumber) {
@@ -397,9 +397,9 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke styler.ColourTo(end, chAttr);
}
-static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+static bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
char s[30 + 1];
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
}
@@ -407,9 +407,9 @@ static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords return keywords.InList(s);
}
-static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) {
+static bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) {
char s[30 + 1];
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
}
@@ -520,9 +520,9 @@ static bool isPHPStringState(int state) { (state == SCE_HPHP_COMPLEX_VARIABLE);
}
-static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler, bool &isSimpleString) {
- int j;
- const int beginning = i - 1;
+static Sci_Position FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) {
+ Sci_Position j;
+ const Sci_Position beginning = i - 1;
bool isValidSimpleString = false;
while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t'))
@@ -567,7 +567,7 @@ static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringD return j - 1;
}
-static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler, bool isXml) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
@@ -592,7 +592,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty // If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen
if (InTagState(state)) {
while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
- int backLineStart = styler.LineStart(styler.GetLine(startPos-1));
+ Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1));
length += startPos - backLineStart;
startPos = backLineStart;
}
@@ -610,7 +610,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty }
styler.StartAt(startPos);
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int lineState;
if (lineCurrent > 0) {
lineState = styler.GetLineState(lineCurrent-1);
@@ -695,7 +695,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty int chPrevNonWhite = ' ';
// look back to set chPrevNonWhite properly for better regex colouring
if (scriptLanguage == eScriptJS && startPos > 0) {
- int back = startPos;
+ Sci_Position back = startPos;
int style = 0;
while (--back) {
style = styler.StyleAt(back);
@@ -709,8 +709,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty }
styler.StartSegment(startPos);
- const int lengthDoc = startPos + length;
- for (int i = startPos; i < lengthDoc; i++) {
+ const Sci_Position lengthDoc = startPos + length;
+ for (Sci_Position i = startPos; i < lengthDoc; i++) {
const int chPrev2 = chPrev;
chPrev = ch;
if (!IsASpace(ch) && state != SCE_HJ_COMMENT &&
@@ -746,7 +746,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle);
//if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) {
if (ch == '#') {
- int j = i + 1;
+ Sci_Position j = i + 1;
while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
@@ -769,7 +769,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
// check if the number of tabs is lower than the level
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
- for (int j = 0; Findlevel > 0; j++) {
+ for (Sci_Position j = 0; Findlevel > 0; j++) {
char chTmp = styler.SafeGetCharAt(i + j + 1);
if (chTmp == '\t') {
Findlevel -= 8;
@@ -875,7 +875,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (const char *tag =
state == SCE_HJ_COMMENTLINE || isXml ? "script" :
state == SCE_H_COMMENT ? "comment" : 0) {
- int j = i + 2;
+ Sci_Position j = i + 2;
int chr;
do {
chr = static_cast<int>(*tag++);
@@ -1237,7 +1237,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i - 1, StateToPrint);
state = SCE_H_SGML_SIMPLESTRING;
} else if ((ch == '-') && (chPrev == '-')) {
- if (static_cast<int>(styler.GetStartSegment()) <= (i - 2)) {
+ if (static_cast<Sci_Position>(styler.GetStartSegment()) <= (i - 2)) {
styler.ColourTo(i - 2, StateToPrint);
}
state = SCE_H_SGML_COMMENT;
@@ -2080,7 +2080,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty // Some of the above terminated their lexeme but since the same character starts
// the same class again, only reenter if non empty segment.
- bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
+ bool nonEmptySegment = i >= static_cast<Sci_Position>(styler.GetStartSegment());
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
if ((ch == '\"') && (nonEmptySegment)) {
state = SCE_HB_STRING;
@@ -2136,7 +2136,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty break;
default:
StateToPrint = statePrintForState(state, inScriptType);
- if (static_cast<int>(styler.GetStartSegment()) < lengthDoc)
+ if (static_cast<Sci_Position>(styler.GetStartSegment()) < lengthDoc)
styler.ColourTo(lengthDoc - 1, StateToPrint);
break;
}
@@ -2148,19 +2148,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty }
}
-static void ColouriseXMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseXMLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
// Passing in true because we're lexing XML
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, true);
}
-static void ColouriseHTMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseHTMLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
// Passing in false because we're notlexing XML
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, false);
}
-static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColourisePHPScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
if (startPos == 0)
initStyle = SCE_HPHP_DEFAULT;
diff --git a/scintilla/lexers/LexHaskell.cxx b/scintilla/lexers/LexHaskell.cxx index 275bc66..61d216c 100644 --- a/scintilla/lexers/LexHaskell.cxx +++ b/scintilla/lexers/LexHaskell.cxx @@ -143,13 +143,13 @@ static inline int CommentBlockStyleFromNestLevel(const unsigned int nestLevel) { // Mangled version of lexlib/Accessor.cxx IndentAmount.
// Modified to treat comment blocks as whitespace
// plus special case for commentline/preprocessor.
-static int HaskellIndentAmount(Accessor &styler, const int line) {
+static int HaskellIndentAmount(Accessor &styler, const Sci_Position line) {
// Determines the indentation level of the current line
// Comment blocks are treated as whitespace
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
char ch = styler[pos];
int style = styler.StyleAt(pos);
@@ -157,7 +157,7 @@ static int HaskellIndentAmount(Accessor &styler, const int line) { int indent = 0;
bool inPrevPrefix = line > 0;
- int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0;
+ Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0;
while (( ch == ' ' || ch == '\t'
|| IsCommentBlockStyle(style)
@@ -271,7 +271,7 @@ struct OptionSetHaskell : public OptionSet<OptionsHaskell> { class LexerHaskell : public ILexer {
bool literate;
- int firstImportLine;
+ Sci_Position firstImportLine;
int firstImportIndent;
WordList keywords;
WordList ffi;
@@ -347,12 +347,12 @@ class LexerHaskell : public ILexer { }
}
- bool LineContainsImport(const int line, Accessor &styler) const {
+ bool LineContainsImport(const Sci_Position line, Accessor &styler) const {
if (options.foldImports) {
- int currentPos = styler.LineStart(line);
+ Sci_Position currentPos = styler.LineStart(line);
int style = styler.StyleAt(currentPos);
- int eol_pos = styler.LineStart(line + 1) - 1;
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
while (currentPos < eol_pos) {
int ch = styler[currentPos];
@@ -374,7 +374,7 @@ class LexerHaskell : public ILexer { }
}
- inline int IndentAmountWithOffset(Accessor &styler, const int line) const {
+ inline int IndentAmountWithOffset(Accessor &styler, const Sci_Position line) const {
const int indent = HaskellIndentAmount(styler, line);
const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK;
return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE)
@@ -416,17 +416,17 @@ public: return osHaskell.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
return osHaskell.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -441,14 +441,14 @@ public: }
};
-int SCI_METHOD LexerHaskell::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerHaskell::PropertySet(const char *key, const char *val) {
if (osHaskell.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
-int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -461,7 +461,7 @@ int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) { wordListN = &reserved_operators;
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -473,11 +473,11 @@ int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) { return firstModification;
}
-void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initStyle
+void SCI_METHOD LexerHaskell::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle
,IDocument *pAccess) {
LexAccessor styler(pAccess);
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
HaskellLineInfo hs = HaskellLineInfo(lineCurrent ? styler.GetLineState(lineCurrent-1) : 0);
@@ -961,26 +961,26 @@ void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initSty sc.Complete();
}
-void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // initStyle
+void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, int // initStyle
,IDocument *pAccess) {
if (!options.fold)
return;
Accessor styler(pAccess, NULL);
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (lineCurrent <= firstImportLine) {
firstImportLine = -1; // readjust first import position
firstImportIndent = 0;
}
- const int maxPos = startPos + length;
- const int maxLines =
+ const Sci_Position maxPos = startPos + length;
+ const Sci_Position maxLines =
maxPos == styler.Length()
? styler.GetLine(maxPos)
: styler.GetLine(maxPos - 1); // Requested last line
- const int docLines = styler.GetLine(styler.Length()); // Available last line
+ const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line
// Backtrack to previous non-blank line so we can determine indent level
// for any white space lines
@@ -1018,7 +1018,7 @@ void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // ini while (lineCurrent <= docLines && lineCurrent <= maxLines) {
// Gather info
- int lineNext = lineCurrent + 1;
+ Sci_Position lineNext = lineCurrent + 1;
importHere = false;
int indentNext = indentCurrent;
@@ -1063,7 +1063,7 @@ void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // ini // which is indented more than the line after the end of
// the comment-block, use the level of the block before
- int skipLine = lineNext;
+ Sci_Position skipLine = lineNext;
int skipLevel = indentNextLevel;
while (--skipLine > lineCurrent) {
diff --git a/scintilla/lexers/LexHex.cxx b/scintilla/lexers/LexHex.cxx index fe972ff..d549881 100644 --- a/scintilla/lexers/LexHex.cxx +++ b/scintilla/lexers/LexHex.cxx @@ -126,37 +126,37 @@ using namespace Scintilla; static inline bool IsNewline(const int ch); static int GetHexaNibble(char hd); static int GetHexaChar(char hd1, char hd2); -static int GetHexaChar(unsigned int pos, Accessor &styler); -static bool ForwardWithinLine(StyleContext &sc, int nb = 1); -static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler); -static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler); -static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler); +static int GetHexaChar(Sci_PositionU pos, Accessor &styler); +static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb = 1); +static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler); +static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler); +static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler); // prototypes for file format specific helper functions -static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler); -static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler); -static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler); -static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler); -static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler); - -static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler); -static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler); -static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler); -static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler); -static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler); - -static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler); -static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler); -static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler); +static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler); +static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); + +static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler); +static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); + +static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static inline bool IsNewline(const int ch) { @@ -207,7 +207,7 @@ static int GetHexaChar(char hd1, char hd2) return hexValue; } -static int GetHexaChar(unsigned int pos, Accessor &styler) +static int GetHexaChar(Sci_PositionU pos, Accessor &styler) { char highNibble, lowNibble; @@ -221,9 +221,9 @@ static int GetHexaChar(unsigned int pos, Accessor &styler) // end. Return true if forwarding within the line was possible. // Avoids influence on highlighting of the subsequent line if the current line // is malformed (too short). -static bool ForwardWithinLine(StyleContext &sc, int nb) +static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb) { - for (int i = 0; i < nb; i++) { + for (Sci_Position i = 0; i < nb; i++) { if (sc.atLineEnd) { // line is too short sc.SetState(SCE_HEX_DEFAULT); @@ -238,7 +238,7 @@ static bool ForwardWithinLine(StyleContext &sc, int nb) } // Checks whether the given positions are in the same record. -static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler) +static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler) { return styler.GetLine(pos1) == styler.GetLine(pos2); } @@ -246,10 +246,10 @@ static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styl // Count the number of digit pairs from <startPos> till end of record, ignoring // <uncountedDigits> digits. // If the record is too short, a negative count may be returned. -static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler) +static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler) { - int cnt; - unsigned int pos; + Sci_Position cnt; + Sci_PositionU pos; pos = startPos; @@ -258,7 +258,7 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor & } // number of digits in this line minus number of digits of uncounted fields - cnt = static_cast<int>(pos - startPos) - uncountedDigits; + cnt = static_cast<Sci_Position>(pos - startPos) - uncountedDigits; // Prepare round up if odd (digit pair incomplete), this way the byte // count is considered to be valid if the checksum is incomplete. @@ -275,11 +275,11 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor & // Calculate the checksum of the record. // <startPos> is the position of the first character of the starting digit // pair, <cnt> is the number of digit pairs. -static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler) +static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler) { int cs = 0; - for (unsigned int pos = startPos; pos < startPos + cnt; pos += 2) { + for (Sci_PositionU pos = startPos; pos < startPos + cnt; pos += 2) { int val = GetHexaChar(pos, styler); if (val < 0) { @@ -301,7 +301,7 @@ static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor // Get the position of the record "start" field (first character in line) in // the record around position <pos>. -static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler) +static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != 'S') { pos--; @@ -312,7 +312,7 @@ static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler) // Get the value of the "byte count" field, it counts the number of bytes in // the subsequent fields ("address", "data" and "checksum" fields). -static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler) +static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; @@ -327,13 +327,13 @@ static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler) // Count the number of digit pairs for the "address", "data" and "checksum" // fields in this record. Has to be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. -static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 4, styler); } // Get the size of the "address" field. -static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler) +static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -357,7 +357,7 @@ static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler) } // Get the type of the "address" field content. -static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -383,7 +383,7 @@ static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the type of the "data" field content. -static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler) +static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -407,7 +407,7 @@ static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler) // Get the required size of the "data" field. Useless for block header and // ordinary data records (type S0, S1, S2, S3), return the value calculated // from the "byte count" and "address field" size in this case. -static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler) +static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '5': @@ -425,7 +425,7 @@ static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl } // Get the value of the "checksum" field. -static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler) +static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -435,9 +435,9 @@ static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler) } // Calculate the checksum of the record. -static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { - int byteCount; + Sci_Position byteCount; byteCount = GetSrecByteCount(recStartPos, styler); @@ -447,7 +447,7 @@ static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler) // Get the position of the record "start" field (first character in line) in // the record around position <pos>. -static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler) +static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != ':') { pos--; @@ -458,7 +458,7 @@ static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler) // Get the value of the "byte count" field, it counts the number of bytes in // the "data" field. -static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler) +static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; @@ -473,13 +473,13 @@ static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler) // Count the number of digit pairs for the "data" field in this record. Has to // be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. -static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 11, styler); } // Get the type of the "address" field content. -static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { if (!PosInSameRecord(recStartPos, recStartPos + 7, styler)) { // malformed (record too short) @@ -504,7 +504,7 @@ static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the type of the "data" field content. -static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler) +static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x00: @@ -528,7 +528,7 @@ static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler) // Get the required size of the "data" field. Useless for an ordinary data // record (type 00), return the "byte count" in this case. -static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler) +static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x01: @@ -548,7 +548,7 @@ static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl } // Get the value of the "checksum" field. -static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler) +static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -558,7 +558,7 @@ static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler) } // Calculate the checksum of the record. -static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -571,7 +571,7 @@ static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler) // Get the value of the "record length" field, it counts the number of digits in // the record excluding the percent. -static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler) +static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { int val = GetHexaChar(recStartPos + 1, styler); if (val < 0) @@ -582,9 +582,9 @@ static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler) // Count the number of digits in this record. Has to // be equal to the "record length" field value. -static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { - unsigned int pos; + Sci_PositionU pos; pos = recStartPos+1; @@ -592,11 +592,11 @@ static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler) pos++; } - return static_cast<int>(pos - (recStartPos+1)); + return static_cast<Sci_Position>(pos - (recStartPos+1)); } // Get the type of the "address" field content. -static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 3)) { case '6': @@ -611,16 +611,16 @@ static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the value of the "checksum" field. -static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler) +static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { return GetHexaChar(recStartPos+4, styler); } // Calculate the checksum of the record (excluding the checksum field). -static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { - unsigned int pos = recStartPos +1; - unsigned int length = GetTEHexDigitCount(recStartPos, styler); + Sci_PositionU pos = recStartPos +1; + Sci_PositionU length = GetTEHexDigitCount(recStartPos, styler); int cs = GetHexaNibble(styler.SafeGetCharAt(pos++));//length cs += GetHexaNibble(styler.SafeGetCharAt(pos++));//length @@ -645,12 +645,12 @@ static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler) } -static void ColouriseSrecDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) +static void ColouriseSrecDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int byteCount, reqByteCount, addrFieldSize, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; @@ -769,12 +769,12 @@ static void ColouriseSrecDoc(unsigned int startPos, int length, int initStyle, W sc.Complete(); } -static void ColouriseIHexDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) +static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int byteCount, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; @@ -890,19 +890,19 @@ static void ColouriseIHexDoc(unsigned int startPos, int length, int initStyle, W sc.Complete(); } -static void FoldIHexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) +static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1); - unsigned int lineStartNext = styler.LineStart(lineCurrent + 1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent + 1); int levelNext = SC_FOLDLEVELBASE; // default if no specific line found - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { bool atEOL = i == (lineStartNext - 1); int style = styler.StyleAt(i); @@ -912,7 +912,7 @@ static void FoldIHexDoc(unsigned int startPos, int length, int, WordList *[], Ac levelNext = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; } else if (style == SCE_HEX_DATAADDRESS || (style == SCE_HEX_DEFAULT - && i == (unsigned int)styler.LineStart(lineCurrent))) { + && i == (Sci_PositionU)styler.LineStart(lineCurrent))) { // data record or no record start code at all if (levelCurrent & SC_FOLDLEVELHEADERFLAG) { levelNext = SC_FOLDLEVELBASE + 1; @@ -933,12 +933,12 @@ static void FoldIHexDoc(unsigned int startPos, int length, int, WordList *[], Ac } } -static void ColouriseTEHexDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) +static void ColouriseTEHexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int digitCount, addrFieldType; int cs1, cs2; diff --git a/scintilla/lexers/LexInno.cxx b/scintilla/lexers/LexInno.cxx index 5a81f2a..8db8349 100644 --- a/scintilla/lexers/LexInno.cxx +++ b/scintilla/lexers/LexInno.cxx @@ -27,14 +27,14 @@ using namespace Scintilla;
#endif
-static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
+static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) {
int state = SCE_INNO_DEFAULT;
char chPrev;
char ch = 0;
char chNext = styler[startPos];
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
char *buffer = new char[length];
- int bufferCount = 0;
+ Sci_Position bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0;
bool isCStyleComment = false;
@@ -45,7 +45,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k WordList &pascalKeywords = *keywordLists[4];
WordList &userKeywords = *keywordLists[5];
- int curLine = styler.GetLine(startPos);
+ Sci_Position curLine = styler.GetLine(startPos);
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
bool isCode = (curLineState == 1);
@@ -53,7 +53,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k // using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
- for (int i = startPos; i < lengthDoc; i++) {
+ for (Sci_Position i = startPos; i < lengthDoc; i++) {
chPrev = ch;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -248,17 +248,17 @@ static const char * const innoWordListDesc[] = { 0
};
-static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- unsigned int endPos = startPos + length;
+static void FoldInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
+ Sci_PositionU endPos = startPos + length;
char chNext = styler[startPos];
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
bool sectionFlag = false;
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE;
int level;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler[i+1];
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
diff --git a/scintilla/lexers/LexKVIrc.cxx b/scintilla/lexers/LexKVIrc.cxx index 958a2cf..76259db 100644 --- a/scintilla/lexers/LexKVIrc.cxx +++ b/scintilla/lexers/LexKVIrc.cxx @@ -49,7 +49,7 @@ static inline bool IsAWordStart(int ch) { /* Interface function called by Scintilla to request some text to be syntax highlighted */ -static void ColouriseKVIrcDoc(unsigned int startPos, int length, +static void ColouriseKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { @@ -313,10 +313,10 @@ static void ColouriseKVIrcDoc(unsigned int startPos, int length, * fetching the current word, NULL-terminated like * the keyword list */ char s[100]; - int wordLen = sc.currentPos - styler.GetStartSegment(); + Sci_Position wordLen = sc.currentPos - styler.GetStartSegment(); if (wordLen > 99) wordLen = 99; /* Include '\0' in buffer */ - int i; + Sci_Position i; for( i = 0; i < wordLen; ++i ) { s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i ); @@ -355,7 +355,7 @@ static void ColouriseKVIrcDoc(unsigned int startPos, int length, sc.Complete(); } -static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - unused*/, +static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, WordList *[], Accessor &styler) { /* Based on CMake's folder */ @@ -365,11 +365,11 @@ static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - un return; /* Obtaining current line number*/ - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); /* Obtaining starting character - indentation is done on a line basis, * not character */ - unsigned int safeStartPos = styler.LineStart( currentLine ); + Sci_PositionU safeStartPos = styler.LineStart( currentLine ); /* Initialising current level - this is defined as indentation level * in the low 12 bits, with flag bits in the upper four bits. @@ -386,7 +386,7 @@ static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - un int nextLevel = currentLevel; // Looping for characters in range - for (unsigned int i = safeStartPos; i < startPos + length; ++i) + for (Sci_PositionU i = safeStartPos; i < startPos + length; ++i) { /* Folding occurs after syntax highlighting, meaning Scintilla * already knows where the comments are diff --git a/scintilla/lexers/LexKix.cxx b/scintilla/lexers/LexKix.cxx index 4f2ff11..fc88080 100644 --- a/scintilla/lexers/LexKix.cxx +++ b/scintilla/lexers/LexKix.cxx @@ -37,7 +37,7 @@ static inline bool IsOperator(const int ch) { return (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '&' || ch == '|' || ch == '<' || ch == '>' || ch == '=');
}
-static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseKixDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
diff --git a/scintilla/lexers/LexLaTeX.cxx b/scintilla/lexers/LexLaTeX.cxx index f8af1e7..7e03a9c 100644 --- a/scintilla/lexers/LexLaTeX.cxx +++ b/scintilla/lexers/LexLaTeX.cxx @@ -48,41 +48,41 @@ struct latexFoldSave { class LexerLaTeX : public LexerBase { private: vector<int> modes; - void setMode(int line, int mode) { - if (line >= static_cast<int>(modes.size())) modes.resize(line + 1, 0); + void setMode(Sci_Position line, int mode) { + if (line >= static_cast<Sci_Position>(modes.size())) modes.resize(line + 1, 0); modes[line] = mode; } - int getMode(int line) { - if (line >= 0 && line < static_cast<int>(modes.size())) return modes[line]; + int getMode(Sci_Position line) { + if (line >= 0 && line < static_cast<Sci_Position>(modes.size())) return modes[line]; return 0; } - void truncModes(int numLines) { - if (static_cast<int>(modes.size()) > numLines * 2 + 256) + void truncModes(Sci_Position numLines) { + if (static_cast<Sci_Position>(modes.size()) > numLines * 2 + 256) modes.resize(numLines + 128); } vector<latexFoldSave> saves; - void setSave(int line, const latexFoldSave &save) { - if (line >= static_cast<int>(saves.size())) saves.resize(line + 1); + void setSave(Sci_Position line, const latexFoldSave &save) { + if (line >= static_cast<Sci_Position>(saves.size())) saves.resize(line + 1); saves[line] = save; } - void getSave(int line, latexFoldSave &save) { - if (line >= 0 && line < static_cast<int>(saves.size())) save = saves[line]; + void getSave(Sci_Position line, latexFoldSave &save) { + if (line >= 0 && line < static_cast<Sci_Position>(saves.size())) save = saves[line]; else { save.structLev = 0; for (int i = 0; i < 8; ++i) save.openBegins[i] = 0; } } - void truncSaves(int numLines) { - if (static_cast<int>(saves.size()) > numLines * 2 + 256) + void truncSaves(Sci_Position numLines) { + if (static_cast<Sci_Position>(saves.size()) > numLines * 2 + 256) saves.resize(numLines + 128); } public: static ILexer *LexerFactoryLaTeX() { return new LexerLaTeX(); } - void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); }; static bool latexIsSpecial(int ch) { @@ -102,7 +102,7 @@ static bool latexIsLetter(int ch) { return IsASCII(ch) && isalpha(ch); } -static bool latexIsTagValid(int &i, int l, Accessor &styler) { +static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) { while (i < l) { if (styler.SafeGetCharAt(i) == '{') { while (i < l) { @@ -122,7 +122,7 @@ static bool latexIsTagValid(int &i, int l, Accessor &styler) { return false; } -static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { +static bool latexNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) { char ch; while (i < styler.Length()) { ch = styler.SafeGetCharAt(i); @@ -137,10 +137,10 @@ static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { return false; } -static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { - unsigned int i = 0; - unsigned int l = static_cast<unsigned int>(strlen(needle)); - int ini = start-l+1; +static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *needle) { + Sci_PositionU i = 0; + Sci_PositionU l = static_cast<Sci_PositionU>(strlen(needle)); + Sci_Position ini = start-l+1; char s[32]; while (i < l && i < 31) { @@ -152,8 +152,8 @@ static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { return (strcmp(s, needle) == 0); } -static bool latexLastWordIsMathEnv(int pos, Accessor &styler) { - int i, j; +static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) { + Sci_Position i, j; char s[32]; const char *mathEnvs[] = { "align", "alignat", "flalign", "gather", "multiline", "displaymath", "eqnarray", "equation" }; @@ -184,7 +184,7 @@ static inline void latexStateReset(int &mode, int &state) { // There are cases not handled correctly, like $abcd\textrm{what is $x+y$}z+w$. // But I think it's already good enough. -void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { // startPos is assumed to be the first character of a line Accessor styler(pAccess, &props); styler.StartAt(startPos); @@ -196,9 +196,9 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle char chNext = styler.SafeGetCharAt(startPos); char chVerbatimDelim = '\0'; styler.StartSegment(startPos); - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -325,7 +325,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -367,7 +367,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -418,7 +418,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle break; case SCE_L_COMMENT2 : if (ch == '\\') { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -432,7 +432,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle break; case SCE_L_VERBATIM : if (ch == '\\') { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -470,23 +470,24 @@ static int latexFoldSaveToInt(const latexFoldSave &save) { // Change folding state while processing a line // Return the level before the first relevant command -void SCI_METHOD LexerLaTeX::Fold(unsigned int startPos, int length, int, IDocument *pAccess) { +void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) { const char *structWords[7] = {"part", "chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"}; Accessor styler(pAccess, &props); - unsigned int endPos = startPos + length; - int curLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position curLine = styler.GetLine(startPos); latexFoldSave save; getSave(curLine - 1, save); do { char ch, buf[16]; - int i, j, lev = -1; + Sci_Position i, j; + int lev = -1; bool needFold = false; - for (i = static_cast<int>(startPos); i < static_cast<int>(endPos); ++i) { + for (i = static_cast<Sci_Position>(startPos); i < static_cast<Sci_Position>(endPos); ++i) { ch = styler.SafeGetCharAt(i); if (ch == '\r' || ch == '\n') break; if (ch != '\\' || styler.StyleAt(i) != SCE_L_COMMAND) continue; - for (j = 0; j < 15 && i + 1 < static_cast<int>(endPos); ++j, ++i) { + for (j = 0; j < 15 && i + 1 < static_cast<Sci_Position>(endPos); ++j, ++i) { buf[j] = styler.SafeGetCharAt(i + 1); if (!latexIsLetter(buf[j])) break; } @@ -522,7 +523,7 @@ void SCI_METHOD LexerLaTeX::Fold(unsigned int startPos, int length, int, IDocume setSave(curLine, save); ++curLine; startPos = styler.LineStart(curLine); - if (static_cast<int>(startPos) == styler.Length()) { + if (static_cast<Sci_Position>(startPos) == styler.Length()) { lev = latexFoldSaveToInt(save); styler.SetLevel(curLine, lev); setSave(curLine, save); diff --git a/scintilla/lexers/LexLisp.cxx b/scintilla/lexers/LexLisp.cxx index 8177d83..83ea591 100644 --- a/scintilla/lexers/LexLisp.cxx +++ b/scintilla/lexers/LexLisp.cxx @@ -46,10 +46,10 @@ static inline bool isLispwordstart(char ch) { }
-static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
+static void classifyWordLisp(Sci_PositionU start, Sci_PositionU end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
assert(end >= start);
char s[100];
- unsigned int i;
+ Sci_PositionU i;
bool digit_flag = true;
for (i = 0; (i < end - start + 1) && (i < 99); i++) {
s[i] = styler[start + i];
@@ -74,7 +74,7 @@ static void classifyWordLisp(unsigned int start, unsigned int end, WordList &key }
-static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -84,9 +84,9 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W int state = initStyle, radix = -1;
char chNext = styler[startPos];
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
styler.StartSegment(startPos);
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -233,16 +233,16 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W styler.ColourTo(lengthDoc - 1, state);
}
-static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldLispDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexLout.cxx b/scintilla/lexers/LexLout.cxx index cdbceb0..58e7230 100644 --- a/scintilla/lexers/LexLout.cxx +++ b/scintilla/lexers/LexLout.cxx @@ -40,7 +40,7 @@ static inline bool IsAnOther(const int ch) { ch == ']' || ch == '^' || ch == '`' || ch == '|' || ch == '~');
}
-static void ColouriseLoutDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseLoutDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -140,12 +140,12 @@ static void ColouriseLoutDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[],
+static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
@@ -153,7 +153,7 @@ static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[], int styleNext = styler.StyleAt(startPos);
char s[10] = "";
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
@@ -162,7 +162,7 @@ static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[], if (style == SCE_LOUT_WORD) {
if (ch == '@') {
- for (unsigned int j = 0; j < 8; j++) {
+ for (Sci_PositionU j = 0; j < 8; j++) {
if (!IsAWordChar(styler[i + j])) {
break;
}
diff --git a/scintilla/lexers/LexLua.cxx b/scintilla/lexers/LexLua.cxx index d8a3e18..09bab27 100644 --- a/scintilla/lexers/LexLua.cxx +++ b/scintilla/lexers/LexLua.cxx @@ -42,8 +42,8 @@ static int LongDelimCheck(StyleContext &sc) { }
static void ColouriseLuaDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -67,7 +67,7 @@ static void ColouriseLuaDoc( CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#");
CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\");
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
// Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level,
// if we are inside such a string. Block comment was introduced in Lua 5.0,
// blocks with separators [=[ ... ]=] in Lua 5.1.
@@ -132,10 +132,10 @@ static void ColouriseLuaDoc( if (sc.state == SCE_LUA_OPERATOR) {
if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan
sc.Forward();
- int ln = 0;
+ Sci_Position ln = 0;
while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs
ln++;
- int ws1 = ln;
+ Sci_Position ws1 = ln;
if (setWordStart.Contains(sc.GetRelative(ln))) {
int c, i = 0;
char s[100];
@@ -144,11 +144,11 @@ static void ColouriseLuaDoc( s[i++] = static_cast<char>(c);
ln++;
}
- s[i] = '\0'; int lbl = ln;
+ s[i] = '\0'; Sci_Position lbl = ln;
if (!keywords.InList(s)) {
while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs
ln++;
- int ws2 = ln - lbl;
+ Sci_Position ws2 = ln - lbl;
if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') {
// final :: found, complete valid label construct
sc.ChangeState(SCE_LUA_LABEL);
@@ -347,18 +347,18 @@ static void ColouriseLuaDoc( sc.Complete();
}
-static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
@@ -367,7 +367,7 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W if (style == SCE_LUA_WORD) {
if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') {
char s[10] = "";
- for (unsigned int j = 0; j < 8; j++) {
+ for (Sci_PositionU j = 0; j < 8; j++) {
if (!iswordchar(styler[i + j])) {
break;
}
diff --git a/scintilla/lexers/LexMMIXAL.cxx b/scintilla/lexers/LexMMIXAL.cxx index ee94f98..7e9bb0b 100644 --- a/scintilla/lexers/LexMMIXAL.cxx +++ b/scintilla/lexers/LexMMIXAL.cxx @@ -47,7 +47,7 @@ inline bool isMMIXALOperator(char ch) { return false;
}
-static void ColouriseMMIXALDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseMMIXALDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &opcodes = *keywordlists[0];
diff --git a/scintilla/lexers/LexMPT.cxx b/scintilla/lexers/LexMPT.cxx index 18e8200..f1c7f4e 100644 --- a/scintilla/lexers/LexMPT.cxx +++ b/scintilla/lexers/LexMPT.cxx @@ -80,7 +80,7 @@ static int GetLotLineState(std::string &line) { }
}
-static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
+static void ColourizeLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
styler.StartAt(startPos);
styler.StartSegment(startPos);
bool atLineStart = true;// Arms the 'at line start' flag
@@ -89,7 +89,7 @@ static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[] line.reserve(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations
// Styles LOT document
- unsigned int i; // Declared here because it's used after the for loop
+ Sci_PositionU i; // Declared here because it's used after the for loop
for (i = startPos; i < startPos + length; ++i) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -118,11 +118,11 @@ static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[] // sections (headed by a set line)
// passes (contiguous pass results within a section)
// fails (contiguous fail results within a section)
-static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
+static void FoldLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
char chNext = styler.SafeGetCharAt(startPos);
int style = SCE_LOT_DEFAULT;
@@ -133,7 +133,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc if (startPos > 1)
style = styler.StyleAt(startPos - 2);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexMSSQL.cxx b/scintilla/lexers/LexMSSQL.cxx index 2d551c8..996c4ab 100644 --- a/scintilla/lexers/LexMSSQL.cxx +++ b/scintilla/lexers/LexMSSQL.cxx @@ -35,8 +35,8 @@ using namespace Scintilla; #define KW_MSSQL_STORED_PROCEDURES 5
#define KW_MSSQL_OPERATORS 6
-static char classifyWordSQL(unsigned int start,
- unsigned int end,
+static char classifyWordSQL(Sci_PositionU start,
+ Sci_PositionU end,
WordList *keywordlists[],
Accessor &styler,
unsigned int actualState,
@@ -52,7 +52,7 @@ static char classifyWordSQL(unsigned int start, WordList &kwStoredProcedures = *keywordlists[KW_MSSQL_STORED_PROCEDURES];
WordList &kwOperators = *keywordlists[KW_MSSQL_OPERATORS];
- for (unsigned int i = 0; i < end - start + 1 && i < 128; i++) {
+ for (Sci_PositionU i = 0; i < end - start + 1 && i < 128; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0';
}
@@ -101,14 +101,14 @@ static char classifyWordSQL(unsigned int start, return chAttr;
}
-static void ColouriseMSSQLDoc(unsigned int startPos, int length,
+static void ColouriseMSSQLDoc(Sci_PositionU startPos, Sci_Position length,
int initStyle, WordList *keywordlists[], Accessor &styler) {
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold") != 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
int state = initStyle;
@@ -116,8 +116,8 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length, char chPrev = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
- unsigned int lengthDoc = startPos + length;
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ Sci_PositionU lengthDoc = startPos + length;
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -277,18 +277,18 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length, styler.ColourTo(lengthDoc - 1, state);
}
-static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
+static void FoldMSSQLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
bool inComment = (styler.StyleAt(startPos-1) == SCE_MSSQL_COMMENT);
char s[10] = "";
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
@@ -304,7 +304,7 @@ static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], A if (style == SCE_MSSQL_STATEMENT) {
// Folding between begin or case and end
if (ch == 'b' || ch == 'B' || ch == 'c' || ch == 'C' || ch == 'e' || ch == 'E') {
- for (unsigned int j = 0; j < 5; j++) {
+ for (Sci_PositionU j = 0; j < 5; j++) {
if (!iswordchar(styler[i + j])) {
break;
}
diff --git a/scintilla/lexers/LexMagik.cxx b/scintilla/lexers/LexMagik.cxx index ae7fb2b..4790244 100644 --- a/scintilla/lexers/LexMagik.cxx +++ b/scintilla/lexers/LexMagik.cxx @@ -87,7 +87,7 @@ static inline bool IsAlNumSym(int ch) { * \param keywordslists The keywordslists, currently, number 5 is used
* \param styler The styler
*/
-static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseMagikDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
styler.StartAt(startPos);
@@ -141,7 +141,7 @@ static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle, char keywordChar = static_cast<char>(
tolower(styler.SafeGetCharAt(
scanPosition +
- static_cast<int>(sc.currentPos+1), ' ')));
+ static_cast<Sci_Position>(sc.currentPos+1), ' ')));
if(IsAlpha(keywordChar)) {
keyword[scanPosition] = keywordChar;
} else {
@@ -359,24 +359,24 @@ static inline int IsFoldingContainer(WordList &keywordslist, char * keyword) { * \param keywordslists The keywordslists, currently, number 5 is used
* \param styler The styler
*/
-static void FoldMagikDoc(unsigned int startPos, int length, int,
+static void FoldMagikDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *keywordslists[], Accessor &styler) {
bool compact = styler.GetPropertyInt("fold.compact") != 0;
WordList &foldingElements = *keywordslists[5];
- int endPos = startPos + length;
- int line = styler.GetLine(startPos);
+ Sci_Position endPos = startPos + length;
+ Sci_Position line = styler.GetLine(startPos);
int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK;
int flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK;
for(
- int currentPos = startPos;
+ Sci_Position currentPos = startPos;
currentPos < endPos;
currentPos++) {
char currentState = styler.StyleAt(currentPos);
char c = styler.SafeGetCharAt(currentPos, ' ');
- int prevLine = styler.GetLine(currentPos - 1);
+ Sci_Position prevLine = styler.GetLine(currentPos - 1);
line = styler.GetLine(currentPos);
// Default situation
diff --git a/scintilla/lexers/LexMake.cxx b/scintilla/lexers/LexMake.cxx new file mode 100644 index 0000000..9e8dadf --- /dev/null +++ b/scintilla/lexers/LexMake.cxx @@ -0,0 +1,144 @@ +// Scintilla source code edit control +/** @file LexMake.cxx + ** Lexer for make files. + **/ +// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { + return (styler[i] == '\n') || + ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); +} + +static void ColouriseMakeLine( + char *lineBuffer, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, + Accessor &styler) { + + Sci_PositionU i = 0; + Sci_Position lastNonSpace = -1; + unsigned int state = SCE_MAKE_DEFAULT; + bool bSpecial = false; + + // check for a tab character in column 0 indicating a command + bool bCommand = false; + if ((lengthLine > 0) && (lineBuffer[0] == '\t')) + bCommand = true; + + // Skip initial spaces + while ((i < lengthLine) && isspacechar(lineBuffer[i])) { + i++; + } + if (i < lengthLine) { + if (lineBuffer[i] == '#') { // Comment + styler.ColourTo(endPos, SCE_MAKE_COMMENT); + return; + } + if (lineBuffer[i] == '!') { // Special directive + styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR); + return; + } + } + int varCount = 0; + while (i < lengthLine) { + if (((i + 1) < lengthLine) && (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(')) { + styler.ColourTo(startLine + i - 1, state); + state = SCE_MAKE_IDENTIFIER; + varCount++; + } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') { + if (--varCount == 0) { + styler.ColourTo(startLine + i, state); + state = SCE_MAKE_DEFAULT; + } + } + + // skip identifier and target styling if this is a command line + if (!bSpecial && !bCommand) { + if (lineBuffer[i] == ':') { + if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) { + // it's a ':=', so style as an identifier + if (lastNonSpace >= 0) + styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); + styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); + styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR); + } else { + // We should check that no colouring was made since the beginning of the line, + // to avoid colouring stuff like /OUT:file + if (lastNonSpace >= 0) + styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET); + styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); + styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); + } + bSpecial = true; // Only react to the first ':' of the line + state = SCE_MAKE_DEFAULT; + } else if (lineBuffer[i] == '=') { + if (lastNonSpace >= 0) + styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); + styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); + styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); + bSpecial = true; // Only react to the first '=' of the line + state = SCE_MAKE_DEFAULT; + } + } + if (!isspacechar(lineBuffer[i])) { + lastNonSpace = i; + } + i++; + } + if (state == SCE_MAKE_IDENTIFIER) { + styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended + } else { + styler.ColourTo(endPos, SCE_MAKE_DEFAULT); + } +} + +static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { + // End of line (or of line buffer) met, colourise it + lineBuffer[linePos] = '\0'; + ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler); + linePos = 0; + startLine = i + 1; + } + } + if (linePos > 0) { // Last line does not have ending characters + ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); + } +} + +static const char *const emptyWordListDesc[] = { + 0 +}; + +LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); diff --git a/scintilla/lexers/LexMarkdown.cxx b/scintilla/lexers/LexMarkdown.cxx index 23a2e60..6729ca5 100644 --- a/scintilla/lexers/LexMarkdown.cxx +++ b/scintilla/lexers/LexMarkdown.cxx @@ -60,8 +60,8 @@ static inline bool IsNewline(const int ch) { }
// True if can follow ch down to the end with possibly trailing whitespace
-static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) {
- unsigned int i = 0;
+static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) {
+ Sci_PositionU i = 0;
while (sc.GetRelative(++i) == ch)
;
// Skip over whitespace
@@ -78,7 +78,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en // Set the state on text section from current to length characters,
// then set the rest until the newline to default, except for any characters matching token
-static void SetStateAndZoom(const int state, const int length, const int token, StyleContext &sc) {
+static void SetStateAndZoom(const int state, const Sci_Position length, const int token, StyleContext &sc) {
sc.SetState(state);
sc.Forward(length);
sc.SetState(SCE_MARKDOWN_DEFAULT);
@@ -100,11 +100,11 @@ static void SetStateAndZoom(const int state, const int length, const int token, // Does the previous line have more than spaces and tabs?
static bool HasPrevLineContent(StyleContext &sc) {
- int i = 0;
+ Sci_Position i = 0;
// Go back to the previous newline
- while ((--i + (int)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i)))
+ while ((--i + (Sci_Position)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i)))
;
- while ((--i + (int)sc.currentPos) >= 0) {
+ while ((--i + (Sci_Position)sc.currentPos) >= 0) {
if (IsNewline(sc.GetRelative(i)))
break;
if (!IsASpaceOrTab(sc.GetRelative(i)))
@@ -117,9 +117,9 @@ static bool AtTermStart(StyleContext &sc) { return sc.currentPos == 0 || isspacechar(sc.chPrev);
}
-static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
+static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) {
int count = 1;
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (;;) {
++i;
int c = sc.GetRelative(i);
@@ -143,9 +143,9 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { }
}
-static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle,
+static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList **, Accessor &styler) {
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int precharCount = 0;
// Don't advance on a new loop iteration and retry at the same position.
// Useful in the corner case of having to start at the beginning file position
@@ -225,7 +225,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle }
else if (sc.state == SCE_MARKDOWN_CODEBK) {
if (sc.atLineStart && sc.Match("~~~")) {
- int i = 1;
+ Sci_Position i = 1;
while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos)
i++;
sc.Forward(i);
@@ -347,8 +347,8 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle }
// Links and Images
if (sc.Match("![") || sc.ch == '[') {
- int i = 0, j = 0, k = 0;
- int len = endPos - sc.currentPos;
+ Sci_Position i = 0, j = 0, k = 0;
+ Sci_Position len = endPos - sc.currentPos;
while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
;
if (sc.GetRelative(i) == ']') {
diff --git a/scintilla/lexers/LexMatlab.cxx b/scintilla/lexers/LexMatlab.cxx index 0290816..7780370 100644 --- a/scintilla/lexers/LexMatlab.cxx +++ b/scintilla/lexers/LexMatlab.cxx @@ -49,16 +49,16 @@ static bool IsOctaveCommentChar(int c) { return (c == '%' || c == '#') ;
}
-static bool IsMatlabComment(Accessor &styler, int pos, int len) {
+static bool IsMatlabComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
return len > 0 && IsMatlabCommentChar(styler[pos]) ;
}
-static bool IsOctaveComment(Accessor &styler, int pos, int len) {
+static bool IsOctaveComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
return len > 0 && IsOctaveCommentChar(styler[pos]) ;
}
static void ColouriseMatlabOctaveDoc(
- unsigned int startPos, int length, int initStyle,
+ Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler,
bool (*IsCommentChar)(int),
bool ismatlab) {
@@ -77,7 +77,7 @@ static void ColouriseMatlabOctaveDoc( int column = 0;
// use the line state of each line to store the block comment depth
- int curLine = styler.GetLine(startPos);
+ Sci_Position curLine = styler.GetLine(startPos);
int commentDepth = curLine > 0 ? styler.GetLineState(curLine-1) : 0;
@@ -235,24 +235,24 @@ static void ColouriseMatlabOctaveDoc( sc.Complete();
}
-static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true);
}
-static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false);
}
-static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
+static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler,
- bool (*IsComment)(Accessor&, int, int)) {
+ bool (*IsComment)(Accessor&, Sci_Position, Sci_Position)) {
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
// Backtrack to previous line in case need to fix its fold status
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
@@ -262,7 +262,7 @@ static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int, int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsComment);
char chNext = styler[startPos];
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -289,12 +289,12 @@ static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int, }
}
-static void FoldMatlabDoc(unsigned int startPos, int length, int initStyle,
+static void FoldMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabComment);
}
-static void FoldOctaveDoc(unsigned int startPos, int length, int initStyle,
+static void FoldOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveComment);
}
diff --git a/scintilla/lexers/LexMetapost.cxx b/scintilla/lexers/LexMetapost.cxx index b6f4222..beda92a 100644 --- a/scintilla/lexers/LexMetapost.cxx +++ b/scintilla/lexers/LexMetapost.cxx @@ -62,7 +62,7 @@ using namespace Scintilla; // Auxiliary functions:
-static inline bool endOfLine(Accessor &styler, unsigned int i) {
+static inline bool endOfLine(Accessor &styler, Sci_PositionU i) {
return
(styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ;
}
@@ -119,18 +119,18 @@ static inline bool isMETAPOSTequal(int ch) { }
static int CheckMETAPOSTInterface(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
Accessor &styler,
int defaultInterface) {
char lineBuffer[1024] ;
- unsigned int linePos = 0 ;
+ Sci_PositionU linePos = 0 ;
// some day we can make something lexer.metapost.mapping=(none,0)(metapost,1)(mp,1)(metafun,2)...
if (styler.SafeGetCharAt(0) == '%') {
- for (unsigned int i = 0; i < startPos + length; i++) {
+ for (Sci_PositionU i = 0; i < startPos + length; i++) {
lineBuffer[linePos++] = styler.SafeGetCharAt(i) ;
if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
lineBuffer[linePos] = '\0';
@@ -154,8 +154,8 @@ static int CheckMETAPOSTInterface( }
static void ColouriseMETAPOSTDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int,
WordList *keywordlists[],
Accessor &styler) {
@@ -336,7 +336,7 @@ static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) { }
-static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)
+static int ParseMetapostWord(Sci_PositionU pos, Accessor &styler, char *word)
{
int length=0;
char ch=styler.SafeGetCharAt(pos);
@@ -351,19 +351,19 @@ static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word) return length;
}
-static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)
+static void FoldMetapostDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordlists[], Accessor &styler)
{
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos+length;
+ Sci_PositionU endPos = startPos+length;
int visibleChars=0;
- int lineCurrent=styler.GetLine(startPos);
+ Sci_Position lineCurrent=styler.GetLine(startPos);
int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent=levelPrev;
char chNext=styler[startPos];
char buffer[100]="";
- for (unsigned int i=startPos; i < endPos; i++) {
+ for (Sci_PositionU i=startPos; i < endPos; i++) {
char ch=chNext;
chNext=styler.SafeGetCharAt(i+1);
char chPrev=styler.SafeGetCharAt(i-1);
diff --git a/scintilla/lexers/LexModula.cxx b/scintilla/lexers/LexModula.cxx index 3fa1bd9..40117b5 100644 --- a/scintilla/lexers/LexModula.cxx +++ b/scintilla/lexers/LexModula.cxx @@ -79,7 +79,7 @@ static inline unsigned IsOperator( StyleContext & sc, WordList & op ) { return 0;
}
-static inline bool IsEOL( Accessor &styler, unsigned curPos ) {
+static inline bool IsEOL( Accessor &styler, Sci_PositionU curPos ) {
unsigned ch = styler.SafeGetCharAt( curPos );
if( ( ch == '\r' && styler.SafeGetCharAt( curPos + 1 ) == '\n' ) ||
( ch == '\n' ) ) {
@@ -90,7 +90,7 @@ static inline bool IsEOL( Accessor &styler, unsigned curPos ) { static inline bool checkStatement(
Accessor &styler,
- int &curPos,
+ Sci_Position &curPos,
const char *stt, bool spaceAfter = true ) {
int len = static_cast<int>(strlen( stt ));
int i;
@@ -110,7 +110,7 @@ static inline bool checkStatement( static inline bool checkEndSemicolon(
Accessor &styler,
- int &curPos, int endPos )
+ Sci_Position &curPos, Sci_Position endPos )
{
const char *stt = "END";
int len = static_cast<int>(strlen( stt ));
@@ -134,9 +134,9 @@ static inline bool checkEndSemicolon( static inline bool checkKeyIdentOper(
Accessor &styler,
- int &curPos, int endPos,
+ Sci_Position &curPos, Sci_Position endPos,
const char *stt, const char etk ) {
- int newPos = curPos;
+ Sci_Position newPos = curPos;
if( ! checkStatement( styler, newPos, stt ) )
return false;
newPos++;
@@ -174,17 +174,17 @@ static inline bool checkKeyIdentOper( return true;
}
-static void FoldModulaDoc( unsigned int startPos,
- int length,
+static void FoldModulaDoc( Sci_PositionU startPos,
+ Sci_Position length,
int , WordList *[],
Accessor &styler)
{
- int curLine = styler.GetLine(startPos);
+ Sci_Position curLine = styler.GetLine(startPos);
int curLevel = SC_FOLDLEVELBASE;
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
if( curLine > 0 )
curLevel = styler.LevelAt( curLine - 1 ) >> 16;
- int curPos = startPos;
+ Sci_Position curPos = startPos;
int style = styler.StyleAt( curPos );
int visChars = 0;
int nextLevel = curLevel;
@@ -250,9 +250,9 @@ static void FoldModulaDoc( unsigned int startPos, nextLevel++;
else
if( checkKeyIdentOper( styler, curPos, endPos, "END", ';' ) ) {
- int cln = curLine;
+ Sci_Position cln = curLine;
int clv_old = curLevel;
- int pos;
+ Sci_Position pos;
char ch;
int clv_new;
while( cln > 0 ) {
@@ -325,8 +325,8 @@ static inline bool skipWhiteSpaces( StyleContext & sc ) { return true;
}
-static void ColouriseModulaDoc( unsigned int startPos,
- int length,
+static void ColouriseModulaDoc( Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *wl[],
Accessor &styler ) {
@@ -342,7 +342,7 @@ static void ColouriseModulaDoc( unsigned int startPos, char buf[BUFLEN];
int i, kl;
- int charPos = 0;
+ Sci_Position charPos = 0;
StyleContext sc( startPos, length, initStyle, styler );
diff --git a/scintilla/lexers/LexMySQL.cxx b/scintilla/lexers/LexMySQL.cxx index 9c31e10..c289ed5 100644 --- a/scintilla/lexers/LexMySQL.cxx +++ b/scintilla/lexers/LexMySQL.cxx @@ -105,7 +105,7 @@ static void ForwardDefaultState(StyleContext& sc, int activeState) sc.ForwardSetState(SCE_MYSQL_HIDDENCOMMAND);
}
-static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler)
{
StyleContext sc(startPos, length, initStyle, styler, 127);
@@ -150,7 +150,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, case SCE_MYSQL_SYSTEMVARIABLE:
if (!IsAWordChar(sc.ch))
{
- int length = sc.LengthCurrent() + 1;
+ Sci_Position length = sc.LengthCurrent() + 1;
char* s = new char[length];
sc.GetCurrentLowered(s, length);
@@ -328,9 +328,9 @@ static bool IsStreamCommentStyle(int style) * Code copied from StyleContext and modified to work here. Should go into Accessor as a
* companion to Match()...
*/
-bool MatchIgnoreCase(Accessor &styler, int currentPos, const char *s)
+bool MatchIgnoreCase(Accessor &styler, Sci_Position currentPos, const char *s)
{
- for (int n = 0; *s; n++)
+ for (Sci_Position n = 0; *s; n++)
{
if (*s != tolower(styler.SafeGetCharAt(currentPos + n)))
return false;
@@ -343,14 +343,14 @@ bool MatchIgnoreCase(Accessor &styler, int currentPos, const char *s) // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment.
-static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler)
+static void FoldMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler)
{
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
@@ -365,7 +365,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL bool elseIfPending = false;
char nextChar = styler.SafeGetCharAt(startPos);
- for (unsigned int i = startPos; length > 0; i++, length--)
+ for (Sci_PositionU i = startPos; length > 0; i++, length--)
{
int stylePrev = style;
int lastActiveState = activeState;
diff --git a/scintilla/lexers/LexNimrod.cxx b/scintilla/lexers/LexNimrod.cxx index 7946501..b6cc208 100644 --- a/scintilla/lexers/LexNimrod.cxx +++ b/scintilla/lexers/LexNimrod.cxx @@ -33,7 +33,7 @@ static inline bool IsAWordChar(int ch) { return (ch >= 0x80) || isalnum(ch) || ch == '_';
}
-static int tillEndOfTripleQuote(Accessor &styler, int pos, int max) {
+static Sci_Position tillEndOfTripleQuote(Accessor &styler, Sci_Position pos, Sci_Position max) {
/* search for """ */
for (;;) {
if (styler.SafeGetCharAt(pos, '\0') == '\0') return pos;
@@ -52,7 +52,7 @@ static bool inline isNewLine(int ch) { return ch == CR || ch == LF;
}
-static int scanString(Accessor &styler, int pos, int max, bool rawMode) {
+static Sci_Position scanString(Accessor &styler, Sci_Position pos, Sci_Position max, bool rawMode) {
for (;;) {
if (pos >= max) return pos;
char ch = styler.SafeGetCharAt(pos, '\0');
@@ -66,7 +66,7 @@ static int scanString(Accessor &styler, int pos, int max, bool rawMode) { }
}
-static int scanChar(Accessor &styler, int pos, int max) {
+static Sci_Position scanChar(Accessor &styler, Sci_Position pos, Sci_Position max) {
for (;;) {
if (pos >= max) return pos;
char ch = styler.SafeGetCharAt(pos, '\0');
@@ -81,9 +81,9 @@ static int scanChar(Accessor &styler, int pos, int max) { }
}
-static int scanIdent(Accessor &styler, int pos, WordList &keywords) {
+static Sci_Position scanIdent(Accessor &styler, Sci_Position pos, WordList &keywords) {
char buf[100]; /* copy to lowercase and ignore underscores */
- int i = 0;
+ Sci_Position i = 0;
for (;;) {
char ch = styler.SafeGetCharAt(pos, '\0');
@@ -104,7 +104,7 @@ static int scanIdent(Accessor &styler, int pos, WordList &keywords) { return pos;
}
-static int scanNumber(Accessor &styler, int pos) {
+static Sci_Position scanNumber(Accessor &styler, Sci_Position pos) {
char ch, ch2;
ch = styler.SafeGetCharAt(pos, '\0');
ch2 = styler.SafeGetCharAt(pos+1, '\0');
@@ -179,10 +179,10 @@ static int scanNumber(Accessor &styler, int pos) { /* rewritten from scratch, because I couldn't get rid of the bugs...
(A character based approach sucks!)
*/
-static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseNimrodDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
- int pos = startPos;
- int max = startPos + length;
+ Sci_Position pos = startPos;
+ Sci_Position max = startPos + length;
char ch;
WordList &keywords = *keywordlists[0];
@@ -264,10 +264,10 @@ static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle, }
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
@@ -277,18 +277,18 @@ static bool IsCommentLine(int line, Accessor &styler) { return false;
}
-static bool IsQuoteLine(int line, Accessor &styler) {
+static bool IsQuoteLine(Sci_Position line, Accessor &styler) {
int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
-static void FoldNimrodDoc(unsigned int startPos, int length,
+static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length,
int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
- const int maxPos = startPos + length;
- const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
- const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
+ const Sci_Position maxPos = startPos + length;
+ const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
+ const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
const bool foldComment = styler.GetPropertyInt("fold.comment.nimrod") != 0;
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.nimrod") != 0;
@@ -297,7 +297,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, // and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
@@ -328,7 +328,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, // Gather info
int lev = indentCurrent;
- int lineNext = lineCurrent + 1;
+ Sci_Position lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
int quote = false;
if (lineNext <= docLines) {
@@ -388,7 +388,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length, // which is indented more than the line after the end of
// the comment-block, use the level of the block before
- int skipLine = lineNext;
+ Sci_Position skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
diff --git a/scintilla/lexers/LexNsis.cxx b/scintilla/lexers/LexNsis.cxx index 3e99395..4fe4654 100644 --- a/scintilla/lexers/LexNsis.cxx +++ b/scintilla/lexers/LexNsis.cxx @@ -69,10 +69,10 @@ static bool isNsisLetter(char ch) return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
-static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
+static bool NsisNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler)
{
- int nNextLine = -1;
- for( unsigned int i = start; i < end; i++ )
+ Sci_Position nNextLine = -1;
+ for( Sci_PositionU i = start; i < end; i++ )
{
char cNext = styler.SafeGetCharAt( i );
if( cNext == '\n' )
@@ -85,7 +85,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor & if( nNextLine == -1 ) // We never found the next line...
return false;
- for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ )
+ for( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ )
{
char cNext = styler.SafeGetCharAt( firstChar );
if( cNext == ' ' )
@@ -111,7 +111,7 @@ static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase ) return strcmp( s1, s2 );
}
-static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd )
+static int calculateFoldNsis(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd )
{
int style = styler.StyleAt(end);
@@ -143,7 +143,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel char s[20]; // The key word we are looking for has atmost 13 characters
s[0] = '\0';
- for (unsigned int i = 0; i < end - start + 1 && i < 19; i++)
+ for (Sci_PositionU i = 0; i < end - start + 1 && i < 19; i++)
{
s[i] = static_cast<char>( styler[ start + i ] );
s[i + 1] = '\0';
@@ -169,7 +169,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel return newFoldlevel;
}
-static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler )
+static int classifyWordNsis(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler )
{
bool bIgnoreCase = false;
if( styler.GetPropertyInt("nsis.ignorecase") == 1 )
@@ -188,7 +188,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw WordList &Lables = *keywordLists[2];
WordList &UserDefined = *keywordLists[3];
- for (unsigned int i = 0; i < end - start + 1 && i < 99; i++)
+ for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++)
{
if( bIgnoreCase )
s[i] = static_cast<char>( tolower(styler[ start + i ] ) );
@@ -247,7 +247,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw if( s[0] == '$' && bUserVars )
{
bool bHasSimpleNsisChars = true;
- for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
+ for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++)
{
if( !isNsisChar( s[j] ) )
{
@@ -264,7 +264,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw if( isNsisNumber( s[0] ) )
{
bool bHasSimpleNsisNumber = true;
- for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
+ for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++)
{
if( !isNsisNumber( s[j] ) )
{
@@ -280,7 +280,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw return SCE_NSIS_DEFAULT;
}
-static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
+static void ColouriseNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_NSIS_DEFAULT;
if( startPos > 0 )
@@ -289,14 +289,14 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k styler.StartAt( startPos );
styler.GetLine( startPos );
- unsigned int nLengthDoc = startPos + length;
+ Sci_PositionU nLengthDoc = startPos + length;
styler.StartSegment( startPos );
char cCurrChar;
bool bVarInString = false;
bool bClassicVarInString = false;
- unsigned int i;
+ Sci_PositionU i;
for( i = startPos; i < nLengthDoc; i++ )
{
cCurrChar = styler.SafeGetCharAt( i );
@@ -403,8 +403,8 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k if( cNextChar == '\r' || cNextChar == '\n' )
{
- int nCurLine = styler.GetLine(i+1);
- int nBack = i;
+ Sci_Position nCurLine = styler.GetLine(i+1);
+ Sci_Position nBack = i;
// We need to check if the previous line has a \ in it...
bool bNextLine = false;
@@ -552,7 +552,7 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k styler.ColourTo(nLengthDoc-1,state);
}
-static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
// No folding enabled, no reason to continue...
if( styler.GetPropertyInt("fold") == 0 )
@@ -562,11 +562,11 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac bool foldUtilityCmd = styler.GetPropertyInt("nsis.foldutilcmd", 1) == 1;
bool blockComment = false;
- int lineCurrent = styler.GetLine(startPos);
- unsigned int safeStartPos = styler.LineStart( lineCurrent );
+ Sci_Position lineCurrent = styler.GetLine(startPos);
+ Sci_PositionU safeStartPos = styler.LineStart( lineCurrent );
bool bArg1 = true;
- int nWordStart = -1;
+ Sci_Position nWordStart = -1;
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
@@ -580,7 +580,7 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac blockComment = true;
}
- for (unsigned int i = safeStartPos; i < startPos + length; i++)
+ for (Sci_PositionU i = safeStartPos; i < startPos + length; i++)
{
char chCurr = styler.SafeGetCharAt(i);
style = styler.StyleAt(i);
diff --git a/scintilla/lexers/LexNull.cxx b/scintilla/lexers/LexNull.cxx new file mode 100644 index 0000000..3487677 --- /dev/null +++ b/scintilla/lexers/LexNull.cxx @@ -0,0 +1,40 @@ +// Scintilla source code edit control +/** @file LexNull.cxx + ** Lexer for no language. Used for plain text and unrecognized files. + **/ +// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static void ColouriseNullDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], + Accessor &styler) { + // Null language means all style bytes are 0 so just mark the end - no need to fill in. + if (length > 0) { + styler.StartAt(startPos + length - 1); + styler.StartSegment(startPos + length - 1); + styler.ColourTo(startPos + length - 1, 0); + } +} + +LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); diff --git a/scintilla/lexers/LexOScript.cxx b/scintilla/lexers/LexOScript.cxx index 5593db7..55e57bd 100644 --- a/scintilla/lexers/LexOScript.cxx +++ b/scintilla/lexers/LexOScript.cxx @@ -183,7 +183,7 @@ public: // ------------------------------------------------
// Function colourising an excerpt of OScript code.
-static void ColouriseOScriptDoc(unsigned int startPos, int length,
+static void ColouriseOScriptDoc(Sci_PositionU startPos, Sci_Position length,
int initStyle, WordList *keywordlists[],
Accessor &styler) {
// I wonder how whole-line styles ended by EOLN can escape the resetting
@@ -374,10 +374,10 @@ static inline bool IsBlockComment(int style) { return style == SCE_OSCRIPT_BLOCK_COMMENT;
}
-static bool IsLineComment(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eolPos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eolPos; i++) {
+static bool IsLineComment(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eolPos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eolPos; i++) {
char ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
@@ -395,9 +395,9 @@ static inline bool IsPreprocessor(int style) { style == SCE_OSCRIPT_DOC_COMMENT;
}
-static void GetRangeLowered(unsigned int start, unsigned int end,
- Accessor &styler, char *s, unsigned int len) {
- unsigned int i = 0;
+static void GetRangeLowered(Sci_PositionU start, Sci_PositionU end,
+ Accessor &styler, char *s, Sci_PositionU len) {
+ Sci_PositionU i = 0;
while (i < end - start + 1 && i < len - 1) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -405,9 +405,9 @@ static void GetRangeLowered(unsigned int start, unsigned int end, s[i] = '\0';
}
-static void GetForwardWordLowered(unsigned int start, Accessor &styler,
- char *s, unsigned int len) {
- unsigned int i = 0;
+static void GetForwardWordLowered(Sci_PositionU start, Accessor &styler,
+ char *s, Sci_PositionU len) {
+ Sci_PositionU i = 0;
while (i < len - 1 && IsAlpha(styler.SafeGetCharAt(start + i))) {
s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i)));
i++;
@@ -416,7 +416,7 @@ static void GetForwardWordLowered(unsigned int start, Accessor &styler, }
static void UpdatePreprocessorFoldLevel(int &levelCurrent,
- unsigned int startPos, Accessor &styler) {
+ Sci_PositionU startPos, Accessor &styler) {
char s[7]; // Size of the longest possible keyword + null.
GetForwardWordLowered(startPos, styler, s, sizeof(s));
@@ -431,8 +431,8 @@ static void UpdatePreprocessorFoldLevel(int &levelCurrent, }
}
-static void UpdateKeywordFoldLevel(int &levelCurrent, unsigned int lastStart,
- unsigned int currentPos, Accessor &styler) {
+static void UpdateKeywordFoldLevel(int &levelCurrent, Sci_PositionU lastStart,
+ Sci_PositionU currentPos, Accessor &styler) {
char s[9];
GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s));
@@ -451,14 +451,14 @@ static void UpdateKeywordFoldLevel(int &levelCurrent, unsigned int lastStart, // ------------------------------
// Function folding OScript code.
-static void FoldOScriptDoc(unsigned int startPos, int length, int initStyle,
+static void FoldOScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
@@ -466,7 +466,7 @@ static void FoldOScriptDoc(unsigned int startPos, int length, int initStyle, int style = initStyle;
int lastStart = 0;
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexOpal.cxx b/scintilla/lexers/LexOpal.cxx index 259417f..a2aeacc 100644 --- a/scintilla/lexers/LexOpal.cxx +++ b/scintilla/lexers/LexOpal.cxx @@ -26,9 +26,9 @@ using namespace Scintilla;
#endif
-inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
+inline static void getRange( Sci_PositionU start, Sci_PositionU end, Accessor & styler, char * s, Sci_PositionU len )
{
- unsigned int i = 0;
+ Sci_PositionU i = 0;
while( ( i < end - start + 1 ) && ( i < len - 1 ) )
{
s[i] = static_cast<char>( styler[ start + i ] );
@@ -37,7 +37,7 @@ inline static void getRange( unsigned int start, unsigned int end, Accessor & st s[ i ] = '\0';
}
-inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+inline bool HandleString( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
{
char ch;
@@ -92,7 +92,7 @@ inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accesso }
}
-inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
+inline bool HandleCommentBlock( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail )
{
char ch;
@@ -155,7 +155,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A }
}
-inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
+inline bool HandleCommentLine( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail )
{
char ch;
@@ -240,7 +240,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac }
}
-inline bool HandlePar( unsigned int & cur, Accessor & styler )
+inline bool HandlePar( Sci_PositionU & cur, Accessor & styler )
{
styler.ColourTo( cur, SCE_OPAL_PAR );
@@ -250,7 +250,7 @@ inline bool HandlePar( unsigned int & cur, Accessor & styler ) return true;
}
-inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+inline bool HandleSpace( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
{
char ch;
@@ -281,7 +281,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor }
}
-inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+inline bool HandleInteger( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
{
char ch;
@@ -304,10 +304,10 @@ inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Access }
}
-inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] )
+inline bool HandleWord( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, WordList * keywordlists[] )
{
char ch;
- const unsigned int beg = cur;
+ const Sci_PositionU beg = cur;
cur++;
for( ; ; )
@@ -323,7 +323,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor }
}
- const int ide_len = cur - beg + 1;
+ const Sci_Position ide_len = cur - beg + 1;
char * ide = new char[ ide_len ];
getRange( beg, cur, styler, ide, ide_len );
@@ -393,7 +393,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor }
-inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+inline bool HandleSkip( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
{
cur++;
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
@@ -408,13 +408,13 @@ inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor }
}
-static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor & styler )
+static void ColouriseOpalDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor & styler )
{
styler.StartAt( startPos );
styler.StartSegment( startPos );
- unsigned int & cur = startPos;
- const unsigned int one_too_much = startPos + length;
+ Sci_PositionU & cur = startPos;
+ const Sci_PositionU one_too_much = startPos + length;
int state = initStyle;
diff --git a/scintilla/lexers/LexOthers.cxx b/scintilla/lexers/LexOthers.cxx deleted file mode 100644 index 8f0dc8c..0000000 --- a/scintilla/lexers/LexOthers.cxx +++ /dev/null @@ -1,1149 +0,0 @@ -// Scintilla source code edit control
-/** @file LexOthers.cxx
- ** Lexers for batch files, diff results, properties files, make files and error lists.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <ctype.h>
-
-#include "ILexer.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
-
-#include "WordList.h"
-#include "LexAccessor.h"
-#include "Accessor.h"
-#include "StyleContext.h"
-#include "CharacterSet.h"
-#include "LexerModule.h"
-
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
-static bool strstart(const char *haystack, const char *needle) {
- return strncmp(haystack, needle, strlen(needle)) == 0;
-}
-
-static bool Is0To9(char ch) {
- return (ch >= '0') && (ch <= '9');
-}
-
-static bool Is1To9(char ch) {
- return (ch >= '1') && (ch <= '9');
-}
-
-static bool IsAlphabetic(int ch) {
- return IsASCII(ch) && isalpha(ch);
-}
-
-static inline bool AtEOL(Accessor &styler, unsigned int i) {
- return (styler[i] == '\n') ||
- ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
-}
-
-// Tests for BATCH Operators
-static bool IsBOperator(char ch) {
- return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') ||
- (ch == '|') || (ch == '?') || (ch == '*');
-}
-
-// Tests for BATCH Separators
-static bool IsBSeparator(char ch) {
- return (ch == '\\') || (ch == '.') || (ch == ';') ||
- (ch == '\"') || (ch == '\'') || (ch == '/');
-}
-
-static void ColouriseBatchLine(
- char *lineBuffer,
- unsigned int lengthLine,
- unsigned int startLine,
- unsigned int endPos,
- WordList *keywordlists[],
- Accessor &styler) {
-
- unsigned int offset = 0; // Line Buffer Offset
- unsigned int cmdLoc; // External Command / Program Location
- char wordBuffer[81]; // Word Buffer - large to catch long paths
- unsigned int wbl; // Word Buffer Length
- unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length
- WordList &keywords = *keywordlists[0]; // Internal Commands
- WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
-
- // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
- // Toggling Regular Keyword Checking off improves readability
- // Other Regular Keywords and External Commands / Programs might also benefit from toggling
- // Need a more robust algorithm to properly toggle Regular Keyword Checking
- bool continueProcessing = true; // Used to toggle Regular Keyword Checking
- // Special Keywords are those that allow certain characters without whitespace after the command
- // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path=
- // Special Keyword Buffer used to determine if the first n characters is a Keyword
- char sKeywordBuffer[10]; // Special Keyword Buffer
- bool sKeywordFound; // Exit Special Keyword for-loop if found
-
- // Skip initial spaces
- while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
- offset++;
- }
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
- // Set External Command / Program Location
- cmdLoc = offset;
-
- // Check for Fake Label (Comment) or Real Label - return if found
- if (lineBuffer[offset] == ':') {
- if (lineBuffer[offset + 1] == ':') {
- // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
- styler.ColourTo(endPos, SCE_BAT_COMMENT);
- } else {
- // Colorize Real Label
- styler.ColourTo(endPos, SCE_BAT_LABEL);
- }
- return;
- // Check for Drive Change (Drive Change is internal command) - return if found
- } else if ((IsAlphabetic(lineBuffer[offset])) &&
- (lineBuffer[offset + 1] == ':') &&
- ((isspacechar(lineBuffer[offset + 2])) ||
- (((lineBuffer[offset + 2] == '\\')) &&
- (isspacechar(lineBuffer[offset + 3]))))) {
- // Colorize Regular Keyword
- styler.ColourTo(endPos, SCE_BAT_WORD);
- return;
- }
-
- // Check for Hide Command (@ECHO OFF/ON)
- if (lineBuffer[offset] == '@') {
- styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
- offset++;
- }
- // Skip next spaces
- while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
- offset++;
- }
-
- // Read remainder of line word-at-a-time or remainder-of-word-at-a-time
- while (offset < lengthLine) {
- if (offset > startLine) {
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
- }
- // Copy word from Line Buffer into Word Buffer
- wbl = 0;
- for (; offset < lengthLine && wbl < 80 &&
- !isspacechar(lineBuffer[offset]); wbl++, offset++) {
- wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
- }
- wordBuffer[wbl] = '\0';
- wbo = 0;
-
- // Check for Comment - return if found
- if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
- styler.ColourTo(endPos, SCE_BAT_COMMENT);
- return;
- }
- // Check for Separator
- if (IsBSeparator(wordBuffer[0])) {
- // Check for External Command / Program
- if ((cmdLoc == offset - wbl) &&
- ((wordBuffer[0] == ':') ||
- (wordBuffer[0] == '\\') ||
- (wordBuffer[0] == '.'))) {
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 1);
- // Colorize External Command / Program
- if (!keywords2) {
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
- } else if (keywords2.InList(wordBuffer)) {
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
- } else {
- styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
- }
- // Reset External Command / Program Location
- cmdLoc = offset;
- } else {
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 1);
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
- }
- // Check for Regular Keyword in list
- } else if ((keywords.InList(wordBuffer)) &&
- (continueProcessing)) {
- // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
- if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "prompt") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "set") == 0)) {
- continueProcessing = false;
- }
- // Identify External Command / Program Location for ERRORLEVEL, and EXIST
- if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "exist") == 0)) {
- // Reset External Command / Program Location
- cmdLoc = offset;
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Skip comparison
- while ((cmdLoc < lengthLine) &&
- (!isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Identify External Command / Program Location for CALL, DO, LOADHIGH and LH
- } else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "do") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) ||
- (CompareCaseInsensitive(wordBuffer, "lh") == 0)) {
- // Reset External Command / Program Location
- cmdLoc = offset;
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- }
- // Colorize Regular keyword
- styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);
- // No need to Reset Offset
- // Check for Special Keyword in list, External Command / Program, or Default Text
- } else if ((wordBuffer[0] != '%') &&
- (wordBuffer[0] != '!') &&
- (!IsBOperator(wordBuffer[0])) &&
- (continueProcessing)) {
- // Check for Special Keyword
- // Affected Commands are in Length range 2-6
- // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected
- sKeywordFound = false;
- for (unsigned int keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) {
- wbo = 0;
- // Copy Keyword Length from Word Buffer into Special Keyword Buffer
- for (; wbo < keywordLength; wbo++) {
- sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]);
- }
- sKeywordBuffer[wbo] = '\0';
- // Check for Special Keyword in list
- if ((keywords.InList(sKeywordBuffer)) &&
- ((IsBOperator(wordBuffer[wbo])) ||
- (IsBSeparator(wordBuffer[wbo])))) {
- sKeywordFound = true;
- // ECHO requires no further Regular Keyword Checking
- if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) {
- continueProcessing = false;
- }
- // Colorize Special Keyword as Regular Keyword
- styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- }
- }
- // Check for External Command / Program or Default Text
- if (!sKeywordFound) {
- wbo = 0;
- // Check for External Command / Program
- if (cmdLoc == offset - wbl) {
- // Read up to %, Operator or Separator
- while ((wbo < wbl) &&
- (wordBuffer[wbo] != '%') &&
- (wordBuffer[wbo] != '!') &&
- (!IsBOperator(wordBuffer[wbo])) &&
- (!IsBSeparator(wordBuffer[wbo]))) {
- wbo++;
- }
- // Reset External Command / Program Location
- cmdLoc = offset - (wbl - wbo);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- // CHOICE requires no further Regular Keyword Checking
- if (CompareCaseInsensitive(wordBuffer, "choice") == 0) {
- continueProcessing = false;
- }
- // Check for START (and its switches) - What follows is External Command \ Program
- if (CompareCaseInsensitive(wordBuffer, "start") == 0) {
- // Reset External Command / Program Location
- cmdLoc = offset;
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Reset External Command / Program Location if command switch detected
- if (lineBuffer[cmdLoc] == '/') {
- // Skip command switch
- while ((cmdLoc < lengthLine) &&
- (!isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- }
- }
- // Colorize External Command / Program
- if (!keywords2) {
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
- } else if (keywords2.InList(wordBuffer)) {
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
- } else {
- styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
- }
- // No need to Reset Offset
- // Check for Default Text
- } else {
- // Read up to %, Operator or Separator
- while ((wbo < wbl) &&
- (wordBuffer[wbo] != '%') &&
- (wordBuffer[wbo] != '!') &&
- (!IsBOperator(wordBuffer[wbo])) &&
- (!IsBSeparator(wordBuffer[wbo]))) {
- wbo++;
- }
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- }
- }
- // Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a)
- } else if (wordBuffer[0] == '%') {
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
- wbo++;
- // Search to end of word for second % (can be a long path)
- while ((wbo < wbl) &&
- (wordBuffer[wbo] != '%') &&
- (!IsBOperator(wordBuffer[wbo])) &&
- (!IsBSeparator(wordBuffer[wbo]))) {
- wbo++;
- }
- // Check for Argument (%n) or (%*)
- if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) &&
- (wordBuffer[wbo] != '%')) {
- // Check for External Command / Program
- if (cmdLoc == offset - wbl) {
- cmdLoc = offset - (wbl - 2);
- }
- // Colorize Argument
- styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 2);
- // Check for Expanded Argument (%~...) / Variable (%%~...)
- } else if (((wbl > 1) && (wordBuffer[1] == '~')) ||
- ((wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] == '~'))) {
- // Check for External Command / Program
- if (cmdLoc == offset - wbl) {
- cmdLoc = offset - (wbl - wbo);
- }
- // Colorize Expanded Argument / Variable
- styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- // Check for Environment Variable (%x...%)
- } else if ((wordBuffer[1] != '%') &&
- (wordBuffer[wbo] == '%')) {
- wbo++;
- // Check for External Command / Program
- if (cmdLoc == offset - wbl) {
- cmdLoc = offset - (wbl - wbo);
- }
- // Colorize Environment Variable
- styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- // Check for Local Variable (%%a)
- } else if (
- (wbl > 2) &&
- (wordBuffer[1] == '%') &&
- (wordBuffer[2] != '%') &&
- (!IsBOperator(wordBuffer[2])) &&
- (!IsBSeparator(wordBuffer[2]))) {
- // Check for External Command / Program
- if (cmdLoc == offset - wbl) {
- cmdLoc = offset - (wbl - 3);
- }
- // Colorize Local Variable
- styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 3);
- }
- // Check for Environment Variable (!x...!)
- } else if (wordBuffer[0] == '!') {
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
- wbo++;
- // Search to end of word for second ! (can be a long path)
- while ((wbo < wbl) &&
- (wordBuffer[wbo] != '!') &&
- (!IsBOperator(wordBuffer[wbo])) &&
- (!IsBSeparator(wordBuffer[wbo]))) {
- wbo++;
- }
- if (wordBuffer[wbo] == '!') {
- wbo++;
- // Check for External Command / Program
- if (cmdLoc == offset - wbl) {
- cmdLoc = offset - (wbl - wbo);
- }
- // Colorize Environment Variable
- styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- }
- // Check for Operator
- } else if (IsBOperator(wordBuffer[0])) {
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
- // Check for Comparison Operator
- if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) {
- // Identify External Command / Program Location for IF
- cmdLoc = offset;
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Colorize Comparison Operator
- styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 2);
- // Check for Pipe Operator
- } else if (wordBuffer[0] == '|') {
- // Reset External Command / Program Location
- cmdLoc = offset - wbl + 1;
- // Skip next spaces
- while ((cmdLoc < lengthLine) &&
- (isspacechar(lineBuffer[cmdLoc]))) {
- cmdLoc++;
- }
- // Colorize Pipe Operator
- styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 1);
- // Check for Other Operator
- } else {
- // Check for > Operator
- if (wordBuffer[0] == '>') {
- // Turn Keyword and External Command / Program checking back on
- continueProcessing = true;
- }
- // Colorize Other Operator
- styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - 1);
- }
- // Check for Default Text
- } else {
- // Read up to %, Operator or Separator
- while ((wbo < wbl) &&
- (wordBuffer[wbo] != '%') &&
- (wordBuffer[wbo] != '!') &&
- (!IsBOperator(wordBuffer[wbo])) &&
- (!IsBSeparator(wordBuffer[wbo]))) {
- wbo++;
- }
- // Colorize Default Text
- styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
- // Reset Offset to re-process remainder of word
- offset -= (wbl - wbo);
- }
- // Skip next spaces - nothing happens if Offset was Reset
- while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
- offset++;
- }
- }
- // Colorize Default Text for remainder of line - currently not lexed
- styler.ColourTo(endPos, SCE_BAT_DEFAULT);
-}
-
-static void ColouriseBatchDoc(
- unsigned int startPos,
- int length,
- int /*initStyle*/,
- WordList *keywordlists[],
- Accessor &styler) {
-
- char lineBuffer[1024];
-
- styler.StartAt(startPos);
- styler.StartSegment(startPos);
- unsigned int linePos = 0;
- unsigned int startLine = startPos;
- for (unsigned int i = startPos; i < startPos + length; i++) {
- lineBuffer[linePos++] = styler[i];
- if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
- // End of line (or of line buffer) met, colourise it
- lineBuffer[linePos] = '\0';
- ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
- linePos = 0;
- startLine = i + 1;
- }
- }
- if (linePos > 0) { // Last line does not have ending characters
- lineBuffer[linePos] = '\0';
- ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
- keywordlists, styler);
- }
-}
-
-#define DIFF_BUFFER_START_SIZE 16
-// Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE
-// characters of each line to classify the line.
-
-static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
- // It is needed to remember the current state to recognize starting
- // comment lines before the first "diff " or "--- ". If a real
- // difference starts then each line starting with ' ' is a whitespace
- // otherwise it is considered a comment (Only in..., Binary file...)
- if (0 == strncmp(lineBuffer, "diff ", 5)) {
- styler.ColourTo(endLine, SCE_DIFF_COMMAND);
- } else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff
- styler.ColourTo(endLine, SCE_DIFF_COMMAND);
- } else if (0 == strncmp(lineBuffer, "---", 3) && lineBuffer[3] != '-') {
- // In a context diff, --- appears in both the header and the position markers
- if (lineBuffer[3] == ' ' && atoi(lineBuffer + 4) && !strchr(lineBuffer, '/'))
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- else if (lineBuffer[3] == '\r' || lineBuffer[3] == '\n')
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- else
- styler.ColourTo(endLine, SCE_DIFF_HEADER);
- } else if (0 == strncmp(lineBuffer, "+++ ", 4)) {
- // I don't know of any diff where "+++ " is a position marker, but for
- // consistency, do the same as with "--- " and "*** ".
- if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/'))
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- else
- styler.ColourTo(endLine, SCE_DIFF_HEADER);
- } else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff
- styler.ColourTo(endLine, SCE_DIFF_HEADER);
- } else if (0 == strncmp(lineBuffer, "***", 3)) {
- // In a context diff, *** appears in both the header and the position markers.
- // Also ******** is a chunk header, but here it's treated as part of the
- // position marker since there is no separate style for a chunk header.
- if (lineBuffer[3] == ' ' && atoi(lineBuffer+4) && !strchr(lineBuffer, '/'))
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- else if (lineBuffer[3] == '*')
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- else
- styler.ColourTo(endLine, SCE_DIFF_HEADER);
- } else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib
- styler.ColourTo(endLine, SCE_DIFF_HEADER);
- } else if (lineBuffer[0] == '@') {
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- } else if (lineBuffer[0] >= '0' && lineBuffer[0] <= '9') {
- styler.ColourTo(endLine, SCE_DIFF_POSITION);
- } else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') {
- styler.ColourTo(endLine, SCE_DIFF_DELETED);
- } else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') {
- styler.ColourTo(endLine, SCE_DIFF_ADDED);
- } else if (lineBuffer[0] == '!') {
- styler.ColourTo(endLine, SCE_DIFF_CHANGED);
- } else if (lineBuffer[0] != ' ') {
- styler.ColourTo(endLine, SCE_DIFF_COMMENT);
- } else {
- styler.ColourTo(endLine, SCE_DIFF_DEFAULT);
- }
-}
-
-static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- char lineBuffer[DIFF_BUFFER_START_SIZE] = "";
- styler.StartAt(startPos);
- styler.StartSegment(startPos);
- unsigned int linePos = 0;
- for (unsigned int i = startPos; i < startPos + length; i++) {
- if (AtEOL(styler, i)) {
- if (linePos < DIFF_BUFFER_START_SIZE) {
- lineBuffer[linePos] = 0;
- }
- ColouriseDiffLine(lineBuffer, i, styler);
- linePos = 0;
- } else if (linePos < DIFF_BUFFER_START_SIZE - 1) {
- lineBuffer[linePos++] = styler[i];
- } else if (linePos == DIFF_BUFFER_START_SIZE - 1) {
- lineBuffer[linePos++] = 0;
- }
- }
- if (linePos > 0) { // Last line does not have ending characters
- if (linePos < DIFF_BUFFER_START_SIZE) {
- lineBuffer[linePos] = 0;
- }
- ColouriseDiffLine(lineBuffer, startPos + length - 1, styler);
- }
-}
-
-static void FoldDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- int curLine = styler.GetLine(startPos);
- int curLineStart = styler.LineStart(curLine);
- int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE;
- int nextLevel;
-
- do {
- int lineType = styler.StyleAt(curLineStart);
- if (lineType == SCE_DIFF_COMMAND)
- nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
- else if (lineType == SCE_DIFF_HEADER)
- nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG;
- else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-')
- nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG;
- else if (prevLevel & SC_FOLDLEVELHEADERFLAG)
- nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
- else
- nextLevel = prevLevel;
-
- if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel))
- styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG);
-
- styler.SetLevel(curLine, nextLevel);
- prevLevel = nextLevel;
-
- curLineStart = styler.LineStart(++curLine);
- } while (static_cast<int>(startPos) + length > curLineStart);
-}
-
-static inline bool isassignchar(unsigned char ch) {
- return (ch == '=') || (ch == ':');
-}
-
-static void ColourisePropsLine(
- char *lineBuffer,
- unsigned int lengthLine,
- unsigned int startLine,
- unsigned int endPos,
- Accessor &styler,
- bool allowInitialSpaces) {
-
- unsigned int i = 0;
- if (allowInitialSpaces) {
- while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces
- i++;
- } else {
- if (isspacechar(lineBuffer[i])) // don't allow initial spaces
- i = lengthLine;
- }
-
- if (i < lengthLine) {
- if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
- styler.ColourTo(endPos, SCE_PROPS_COMMENT);
- } else if (lineBuffer[i] == '[') {
- styler.ColourTo(endPos, SCE_PROPS_SECTION);
- } else if (lineBuffer[i] == '@') {
- styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
- if (isassignchar(lineBuffer[i++]))
- styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
- styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
- } else {
- // Search for the '=' character
- while ((i < lengthLine) && !isassignchar(lineBuffer[i]))
- i++;
- if ((i < lengthLine) && isassignchar(lineBuffer[i])) {
- styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
- styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
- styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
- } else {
- styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
- }
- }
- } else {
- styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
- }
-}
-
-static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- char lineBuffer[1024];
- styler.StartAt(startPos);
- styler.StartSegment(startPos);
- unsigned int linePos = 0;
- unsigned int startLine = startPos;
-
- // property lexer.props.allow.initial.spaces
- // For properties files, set to 0 to style all lines that start with whitespace in the default style.
- // This is not suitable for SciTE .properties files which use indentation for flow control but
- // can be used for RFC2822 text where indentation is used for continuation lines.
- bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0;
-
- for (unsigned int i = startPos; i < startPos + length; i++) {
- lineBuffer[linePos++] = styler[i];
- if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
- // End of line (or of line buffer) met, colourise it
- lineBuffer[linePos] = '\0';
- ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces);
- linePos = 0;
- startLine = i + 1;
- }
- }
- if (linePos > 0) { // Last line does not have ending characters
- ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces);
- }
-}
-
-// adaption by ksc, using the "} else {" trick of 1.53
-// 030721
-static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
-
- unsigned int endPos = startPos + length;
- int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
-
- char chNext = styler[startPos];
- int styleNext = styler.StyleAt(startPos);
- bool headerPoint = false;
- int lev;
-
- for (unsigned int i = startPos; i < endPos; i++) {
- char ch = chNext;
- chNext = styler[i+1];
-
- int style = styleNext;
- styleNext = styler.StyleAt(i + 1);
- bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
-
- if (style == SCE_PROPS_SECTION) {
- headerPoint = true;
- }
-
- if (atEOL) {
- lev = SC_FOLDLEVELBASE;
-
- if (lineCurrent > 0) {
- int levelPrevious = styler.LevelAt(lineCurrent - 1);
-
- if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
- lev = SC_FOLDLEVELBASE + 1;
- } else {
- lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
- }
- }
-
- if (headerPoint) {
- lev = SC_FOLDLEVELBASE;
- }
- if (visibleChars == 0 && foldCompact)
- lev |= SC_FOLDLEVELWHITEFLAG;
-
- if (headerPoint) {
- lev |= SC_FOLDLEVELHEADERFLAG;
- }
- if (lev != styler.LevelAt(lineCurrent)) {
- styler.SetLevel(lineCurrent, lev);
- }
-
- lineCurrent++;
- visibleChars = 0;
- headerPoint = false;
- }
- if (!isspacechar(ch))
- visibleChars++;
- }
-
- if (lineCurrent > 0) {
- int levelPrevious = styler.LevelAt(lineCurrent - 1);
- if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
- lev = SC_FOLDLEVELBASE + 1;
- } else {
- lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
- }
- } else {
- lev = SC_FOLDLEVELBASE;
- }
- int flagsNext = styler.LevelAt(lineCurrent);
- styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
-}
-
-static void ColouriseMakeLine(
- char *lineBuffer,
- unsigned int lengthLine,
- unsigned int startLine,
- unsigned int endPos,
- Accessor &styler) {
-
- unsigned int i = 0;
- int lastNonSpace = -1;
- unsigned int state = SCE_MAKE_DEFAULT;
- bool bSpecial = false;
-
- // check for a tab character in column 0 indicating a command
- bool bCommand = false;
- if ((lengthLine > 0) && (lineBuffer[0] == '\t'))
- bCommand = true;
-
- // Skip initial spaces
- while ((i < lengthLine) && isspacechar(lineBuffer[i])) {
- i++;
- }
- if (i < lengthLine) {
- if (lineBuffer[i] == '#') { // Comment
- styler.ColourTo(endPos, SCE_MAKE_COMMENT);
- return;
- }
- if (lineBuffer[i] == '!') { // Special directive
- styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR);
- return;
- }
- }
- int varCount = 0;
- while (i < lengthLine) {
- if (((i + 1) < lengthLine) && (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(')) {
- styler.ColourTo(startLine + i - 1, state);
- state = SCE_MAKE_IDENTIFIER;
- varCount++;
- } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') {
- if (--varCount == 0) {
- styler.ColourTo(startLine + i, state);
- state = SCE_MAKE_DEFAULT;
- }
- }
-
- // skip identifier and target styling if this is a command line
- if (!bSpecial && !bCommand) {
- if (lineBuffer[i] == ':') {
- if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) {
- // it's a ':=', so style as an identifier
- if (lastNonSpace >= 0)
- styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
- styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
- styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR);
- } else {
- // We should check that no colouring was made since the beginning of the line,
- // to avoid colouring stuff like /OUT:file
- if (lastNonSpace >= 0)
- styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
- styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
- styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
- }
- bSpecial = true; // Only react to the first ':' of the line
- state = SCE_MAKE_DEFAULT;
- } else if (lineBuffer[i] == '=') {
- if (lastNonSpace >= 0)
- styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
- styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
- styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
- bSpecial = true; // Only react to the first '=' of the line
- state = SCE_MAKE_DEFAULT;
- }
- }
- if (!isspacechar(lineBuffer[i])) {
- lastNonSpace = i;
- }
- i++;
- }
- if (state == SCE_MAKE_IDENTIFIER) {
- styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended
- } else {
- styler.ColourTo(endPos, SCE_MAKE_DEFAULT);
- }
-}
-
-static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- char lineBuffer[1024];
- styler.StartAt(startPos);
- styler.StartSegment(startPos);
- unsigned int linePos = 0;
- unsigned int startLine = startPos;
- for (unsigned int i = startPos; i < startPos + length; i++) {
- lineBuffer[linePos++] = styler[i];
- if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
- // End of line (or of line buffer) met, colourise it
- lineBuffer[linePos] = '\0';
- ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler);
- linePos = 0;
- startLine = i + 1;
- }
- }
- if (linePos > 0) { // Last line does not have ending characters
- ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler);
- }
-}
-
-static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) {
- if (lineBuffer[0] == '>') {
- // Command or return status
- return SCE_ERR_CMD;
- } else if (lineBuffer[0] == '<') {
- // Diff removal.
- return SCE_ERR_DIFF_DELETION;
- } else if (lineBuffer[0] == '!') {
- return SCE_ERR_DIFF_CHANGED;
- } else if (lineBuffer[0] == '+') {
- if (strstart(lineBuffer, "+++ ")) {
- return SCE_ERR_DIFF_MESSAGE;
- } else {
- return SCE_ERR_DIFF_ADDITION;
- }
- } else if (lineBuffer[0] == '-') {
- if (strstart(lineBuffer, "--- ")) {
- return SCE_ERR_DIFF_MESSAGE;
- } else {
- return SCE_ERR_DIFF_DELETION;
- }
- } else if (strstart(lineBuffer, "cf90-")) {
- // Absoft Pro Fortran 90/95 v8.2 error and/or warning message
- return SCE_ERR_ABSF;
- } else if (strstart(lineBuffer, "fortcom:")) {
- // Intel Fortran Compiler v8.0 error/warning message
- return SCE_ERR_IFORT;
- } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
- return SCE_ERR_PYTHON;
- } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {
- return SCE_ERR_PHP;
- } else if ((strstart(lineBuffer, "Error ") ||
- strstart(lineBuffer, "Warning ")) &&
- strstr(lineBuffer, " at (") &&
- strstr(lineBuffer, ") : ") &&
- (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {
- // Intel Fortran Compiler error/warning message
- return SCE_ERR_IFC;
- } else if (strstart(lineBuffer, "Error ")) {
- // Borland error message
- return SCE_ERR_BORLAND;
- } else if (strstart(lineBuffer, "Warning ")) {
- // Borland warning message
- return SCE_ERR_BORLAND;
- } else if (strstr(lineBuffer, "at line ") &&
- (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) &&
- strstr(lineBuffer, "file ") &&
- (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) {
- // Lua 4 error message
- return SCE_ERR_LUA;
- } else if (strstr(lineBuffer, " at ") &&
- (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) &&
- strstr(lineBuffer, " line ") &&
- (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&
- (strstr(lineBuffer, " at ") + 4 < (strstr(lineBuffer, " line ")))) {
- // perl error message:
- // <message> at <file> line <line>
- return SCE_ERR_PERL;
- } else if ((memcmp(lineBuffer, " at ", 6) == 0) &&
- strstr(lineBuffer, ":line ")) {
- // A .NET traceback
- return SCE_ERR_NET;
- } else if (strstart(lineBuffer, "Line ") &&
- strstr(lineBuffer, ", file ")) {
- // Essential Lahey Fortran error message
- return SCE_ERR_ELF;
- } else if (strstart(lineBuffer, "line ") &&
- strstr(lineBuffer, " column ")) {
- // HTML tidy style: line 42 column 1
- return SCE_ERR_TIDY;
- } else if (strstart(lineBuffer, "\tat ") &&
- strstr(lineBuffer, "(") &&
- strstr(lineBuffer, ".java:")) {
- // Java stack back trace
- return SCE_ERR_JAVA_STACK;
- } else if (strstart(lineBuffer, "In file included from ") ||
- strstart(lineBuffer, " from ")) {
- // GCC showing include path to following error
- return SCE_ERR_GCC_INCLUDED_FROM;
- } else {
- // Look for one of the following formats:
- // GCC: <filename>:<line>:<message>
- // Microsoft: <filename>(<line>) :<message>
- // Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal
- // Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal
- // Microsoft: <filename>(<line>,<column>)<message>
- // CTags: <identifier>\t<filename>\t<message>
- // Lua 5 traceback: \t<filename>:<line>:<message>
- // Lua 5.1: <exe>: <filename>:<line>:<message>
- bool initialTab = (lineBuffer[0] == '\t');
- bool initialColonPart = false;
- bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab
- enum { stInitial,
- stGccStart, stGccDigit, stGccColumn, stGcc,
- stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
- stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags,
- stUnrecognized
- } state = stInitial;
- for (unsigned int i = 0; i < lengthLine; i++) {
- char ch = lineBuffer[i];
- char chNext = ' ';
- if ((i + 1) < lengthLine)
- chNext = lineBuffer[i + 1];
- if (state == stInitial) {
- if (ch == ':') {
- // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
- if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) {
- // This check is not completely accurate as may be on
- // GTK+ with a file name that includes ':'.
- state = stGccStart;
- } else if (chNext == ' ') { // indicates a Lua 5.1 error message
- initialColonPart = true;
- }
- } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
- // May be Microsoft
- // Check against '0' often removes phone numbers
- state = stMsStart;
- } else if ((ch == '\t') && canBeCtags) {
- // May be CTags
- state = stCtagsStart;
- } else if (ch == ' ') {
- canBeCtags = false;
- }
- } else if (state == stGccStart) { // <filename>:
- state = Is1To9(ch) ? stGccDigit : stUnrecognized;
- } else if (state == stGccDigit) { // <filename>:<line>
- if (ch == ':') {
- state = stGccColumn; // :9.*: is GCC
- startValue = i + 1;
- } else if (!Is0To9(ch)) {
- state = stUnrecognized;
- }
- } else if (state == stGccColumn) { // <filename>:<line>:<column>
- if (!Is0To9(ch)) {
- state = stGcc;
- if (ch == ':')
- startValue = i + 1;
- break;
- }
- } else if (state == stMsStart) { // <filename>(
- state = Is0To9(ch) ? stMsDigit : stUnrecognized;
- } else if (state == stMsDigit) { // <filename>(<line>
- if (ch == ',') {
- state = stMsDigitComma;
- } else if (ch == ')') {
- state = stMsBracket;
- } else if ((ch != ' ') && !Is0To9(ch)) {
- state = stUnrecognized;
- }
- } else if (state == stMsBracket) { // <filename>(<line>)
- if ((ch == ' ') && (chNext == ':')) {
- state = stMsVc;
- } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {
- // Possibly Delphi.. don't test against chNext as it's one of the strings below.
- char word[512];
- unsigned int j, chPos;
- unsigned numstep;
- chPos = 0;
- if (ch == ' ')
- numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
- else
- numstep = 2; // otherwise add 2.
- for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
- word[chPos++] = lineBuffer[j];
- word[chPos] = 0;
- if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
- !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
- !CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
- state = stMsVc;
- } else {
- state = stUnrecognized;
- }
- } else {
- state = stUnrecognized;
- }
- } else if (state == stMsDigitComma) { // <filename>(<line>,
- if (ch == ')') {
- state = stMsDotNet;
- break;
- } else if ((ch != ' ') && !Is0To9(ch)) {
- state = stUnrecognized;
- }
- } else if (state == stCtagsStart) {
- if (ch == '\t') {
- state = stCtagsFile;
- }
- } else if (state == stCtagsFile) {
- if ((lineBuffer[i - 1] == '\t') &&
- ((ch == '/' && chNext == '^') || Is0To9(ch))) {
- state = stCtags;
- break;
- } else if ((ch == '/') && (chNext == '^')) {
- state = stCtagsStartString;
- }
- } else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) {
- state = stCtagsStringDollar;
- break;
- }
- }
- if (state == stGcc) {
- return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC;
- } else if ((state == stMsVc) || (state == stMsDotNet)) {
- return SCE_ERR_MS;
- } else if ((state == stCtagsStringDollar) || (state == stCtags)) {
- return SCE_ERR_CTAG;
- } else {
- return SCE_ERR_DEFAULT;
- }
- }
-}
-
-static void ColouriseErrorListLine(
- char *lineBuffer,
- unsigned int lengthLine,
- unsigned int endPos,
- Accessor &styler,
- bool valueSeparate) {
- int startValue = -1;
- int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
- if (valueSeparate && (startValue >= 0)) {
- styler.ColourTo(endPos - (lengthLine - startValue), style);
- styler.ColourTo(endPos, SCE_ERR_VALUE);
- } else {
- styler.ColourTo(endPos, style);
- }
-}
-
-static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
- char lineBuffer[10000];
- styler.StartAt(startPos);
- styler.StartSegment(startPos);
- unsigned int linePos = 0;
-
- // property lexer.errorlist.value.separate
- // For lines in the output pane that are matches from Find in Files or GCC-style
- // diagnostics, style the path and line number separately from the rest of the
- // line with style 21 used for the rest of the line.
- // This allows matched text to be more easily distinguished from its location.
- bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
- for (unsigned int i = startPos; i < startPos + length; i++) {
- lineBuffer[linePos++] = styler[i];
- if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
- // End of line (or of line buffer) met, colourise it
- lineBuffer[linePos] = '\0';
- ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate);
- linePos = 0;
- }
- }
- if (linePos > 0) { // Last line does not have ending characters
- ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate);
- }
-}
-
-static const char *const batchWordListDesc[] = {
- "Internal Commands",
- "External Commands",
- 0
-};
-
-static const char *const emptyWordListDesc[] = {
- 0
-};
-
-static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[],
- Accessor &styler) {
- // Null language means all style bytes are 0 so just mark the end - no need to fill in.
- if (length > 0) {
- styler.StartAt(startPos + length - 1);
- styler.StartSegment(startPos + length - 1);
- styler.ColourTo(startPos + length - 1, 0);
- }
-}
-
-LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
-LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);
-LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);
-LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);
-LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);
-LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
diff --git a/scintilla/lexers/LexPB.cxx b/scintilla/lexers/LexPB.cxx index c32d7ef..73ad621 100644 --- a/scintilla/lexers/LexPB.cxx +++ b/scintilla/lexers/LexPB.cxx @@ -70,10 +70,10 @@ static inline bool IsAWordStart(const int ch) return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
+bool MatchUpperCase(Accessor &styler, Sci_Position pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
{
char ch;
- for (int i=0; *s; i++)
+ for (Sci_Position i=0; *s; i++)
{
ch=styler.SafeGetCharAt(pos+i);
if (ch > 0x60) ch -= '\x20';
@@ -83,7 +83,7 @@ bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler return true;
}
-static void ColourisePBDoc(unsigned int startPos, int length, int initStyle,WordList *keywordlists[],Accessor &styler) {
+static void ColourisePBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,WordList *keywordlists[],Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -185,14 +185,14 @@ static void ColourisePBDoc(unsigned int startPos, int length, int initStyle,Word //GFA Basic which is dead now. After testing the feature of toggling FOR-NEXT loops, WHILE-WEND loops
//and so on too I found this is more disturbing then helping (for me). So if You think in another way
//you can (or must) write Your own toggling routine ;-)
-static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldPBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
// No folding enabled, no reason to continue...
if( styler.GetPropertyInt("fold") == 0 )
return;
- unsigned int endPos = startPos + length;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_PositionU endPos = startPos + length;
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -202,7 +202,7 @@ static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Acce bool fNewLine=true;
bool fMightBeMultiLineMacro=false;
bool fBeginOfCommentFound=false;
- for (unsigned int i = startPos; i < endPos; i++)
+ for (Sci_PositionU i = startPos; i < endPos; i++)
{
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -354,7 +354,7 @@ static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Acce break;
}
} //switch (ch)
- } //for (unsigned int i = startPos; i < endPos; i++)
+ } //for (Sci_PositionU i = startPos; i < endPos; i++)
}
static const char * const pbWordListDesc[] = {
diff --git a/scintilla/lexers/LexPLM.cxx b/scintilla/lexers/LexPLM.cxx index 8574ebf..f2afeb5 100644 --- a/scintilla/lexers/LexPLM.cxx +++ b/scintilla/lexers/LexPLM.cxx @@ -24,12 +24,12 @@ using namespace Scintilla;
#endif
-static void GetRange(unsigned int start,
- unsigned int end,
+static void GetRange(Sci_PositionU start,
+ Sci_PositionU end,
Accessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -37,19 +37,19 @@ static void GetRange(unsigned int start, s[i] = '\0';
}
-static void ColourisePlmDoc(unsigned int startPos,
- int length,
+static void ColourisePlmDoc(Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int state = initStyle;
styler.StartAt(startPos);
styler.StartSegment(startPos);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
@@ -99,7 +99,7 @@ static void ColourisePlmDoc(unsigned int startPos, if (!isdigit(ch) && !isalpha(ch) && ch != '$') {
// Get the entire identifier.
char word[1024];
- int segmentStart = styler.GetStartSegment();
+ Sci_Position segmentStart = styler.GetStartSegment();
GetRange(segmentStart, i - 1, styler, word, sizeof(word));
i--;
@@ -125,25 +125,25 @@ static void ColourisePlmDoc(unsigned int startPos, styler.ColourTo(endPos - 1, state);
}
-static void FoldPlmDoc(unsigned int startPos,
- int length,
+static void FoldPlmDoc(Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *[],
Accessor &styler)
{
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- int startKeyword = 0;
+ Sci_Position startKeyword = 0;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexPO.cxx b/scintilla/lexers/LexPO.cxx index 7b44107..61e6011 100644 --- a/scintilla/lexers/LexPO.cxx +++ b/scintilla/lexers/LexPO.cxx @@ -35,10 +35,10 @@ using namespace Scintilla; #endif -static void ColourisePODoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { +static void ColourisePODoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); bool escaped = false; - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); // the line state holds the last state on or before the line that isn't the default style int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT; @@ -148,9 +148,9 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor sc.Complete(); } -static int FindNextNonEmptyLineState(unsigned int startPos, Accessor &styler) { - unsigned int length = styler.Length(); - for (unsigned int i = startPos; i < length; i++) { +static int FindNextNonEmptyLineState(Sci_PositionU startPos, Accessor &styler) { + Sci_PositionU length = styler.Length(); + for (Sci_PositionU i = startPos; i < length; i++) { if (! isspacechar(styler[i])) { return styler.GetLineState(styler.GetLine(i)); } @@ -158,14 +158,14 @@ static int FindNextNonEmptyLineState(unsigned int startPos, Accessor &styler) { return 0; } -static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { +static void FoldPODoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { if (! styler.GetPropertyInt("fold")) return; bool foldCompact = styler.GetPropertyInt("fold.compact") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - unsigned int endPos = startPos + length; - int curLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position curLine = styler.GetLine(startPos); int lineState = styler.GetLineState(curLine); int nextLineState; int level = styler.LevelAt(curLine) & SC_FOLDLEVELNUMBERMASK; @@ -173,7 +173,7 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce int visible = 0; int chNext = styler[startPos]; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { int ch = chNext; chNext = styler.SafeGetCharAt(i+1); @@ -181,7 +181,7 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce visible++; } else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) { int lvl = level; - int nextLine = curLine + 1; + Sci_Position nextLine = curLine + 1; nextLineState = styler.GetLineState(nextLine); if ((lineState != SCE_PO_COMMENT || foldComment) && diff --git a/scintilla/lexers/LexPOV.cxx b/scintilla/lexers/LexPOV.cxx index 66b497b..d0872f2 100644 --- a/scintilla/lexers/LexPOV.cxx +++ b/scintilla/lexers/LexPOV.cxx @@ -53,8 +53,8 @@ static inline bool IsANumberChar(int ch) { }
static void ColourisePovDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -68,7 +68,7 @@ static void ColourisePovDoc( WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
// Initialize the block comment /* */ nesting level, if we are inside such a comment.
int blockCommentLevel = 0;
if (initStyle == SCE_POV_COMMENT) {
@@ -226,8 +226,8 @@ static void ColourisePovDoc( }
static void FoldPovDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *[],
Accessor &styler) {
@@ -235,15 +235,15 @@ static void FoldPovDoc( bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldDirective = styler.GetPropertyInt("fold.directive") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -270,7 +270,7 @@ static void FoldPovDoc( }
if (foldDirective && (style == SCE_POV_DIRECTIVE)) {
if (ch == '#') {
- unsigned int j=i+1;
+ Sci_PositionU j=i+1;
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
diff --git a/scintilla/lexers/LexPS.cxx b/scintilla/lexers/LexPS.cxx index 82349e9..3208079 100644 --- a/scintilla/lexers/LexPS.cxx +++ b/scintilla/lexers/LexPS.cxx @@ -64,8 +64,8 @@ static inline bool IsABase85Char(const int ch) { }
static void ColourisePSDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -79,7 +79,7 @@ static void ColourisePSDoc( StyleContext sc(startPos, length, initStyle, styler);
int pslevel = styler.GetPropertyInt("ps.level", 3);
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int nestTextCurrent = 0;
if (lineCurrent > 0 && initStyle == SCE_PS_TEXT)
nestTextCurrent = styler.GetLineState(lineCurrent - 1);
@@ -266,13 +266,13 @@ static void ColourisePSDoc( sc.Complete();
}
-static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
+static void FoldPSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -280,7 +280,7 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[], int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexPascal.cxx b/scintilla/lexers/LexPascal.cxx index adebb77..780224d 100644 --- a/scintilla/lexers/LexPascal.cxx +++ b/scintilla/lexers/LexPascal.cxx @@ -132,12 +132,12 @@ contains requires using namespace Scintilla;
#endif
-static void GetRangeLowered(unsigned int start,
- unsigned int end,
+static void GetRangeLowered(Sci_PositionU start,
+ Sci_PositionU end,
Accessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -145,12 +145,12 @@ static void GetRangeLowered(unsigned int start, s[i] = '\0';
}
-static void GetForwardRangeLowered(unsigned int start,
+static void GetForwardRangeLowered(Sci_PositionU start,
CharacterSet &charSet,
Accessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < len-1) && charSet.Contains(styler.SafeGetCharAt(start + i))) {
s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i)));
i++;
@@ -214,7 +214,7 @@ static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int & sc.SetState(SCE_PAS_DEFAULT);
}
-static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
bool bSmartHighlighting = styler.GetPropertyInt("lexer.pascal.smart.highlighting", 1) != 0;
@@ -224,7 +224,7 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, CharacterSet setHexNumber(CharacterSet::setDigits, "abcdefABCDEF");
CharacterSet setOperator(CharacterSet::setNone, "#$&'()*+,-./:;<=>@[]^{}");
- int curLine = styler.GetLine(startPos);
+ Sci_Position curLine = styler.GetLine(startPos);
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
StyleContext sc(startPos, length, initStyle, styler);
@@ -347,10 +347,10 @@ static bool IsStreamCommentStyle(int style) { return style == SCE_PAS_COMMENT || style == SCE_PAS_COMMENT2;
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eolPos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eolPos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eolPos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eolPos; i++) {
char ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
@@ -373,7 +373,7 @@ static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned i }
static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
- unsigned int startPos, Accessor &styler) {
+ Sci_PositionU startPos, Accessor &styler) {
CharacterSet setWord(CharacterSet::setAlpha);
char s[11]; // Size of the longest possible keyword + one additional character + null
@@ -405,10 +405,10 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold }
}
-static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
+static Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endPos,
Accessor &styler, bool includeChars = false) {
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
- unsigned int j = currentPos + 1;
+ Sci_PositionU j = currentPos + 1;
char ch = styler.SafeGetCharAt(j);
while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) {
@@ -419,8 +419,8 @@ static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos, }
static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
- int startPos, unsigned int endPos,
- unsigned int lastStart, unsigned int currentPos, Accessor &styler) {
+ Sci_Position startPos, Sci_PositionU endPos,
+ Sci_PositionU lastStart, Sci_PositionU currentPos, Accessor &styler) {
char s[100];
GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s));
@@ -435,7 +435,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur } else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) {
// "class" & "object" keywords require special handling...
bool ignoreKeyword = false;
- unsigned int j = SkipWhiteSpace(currentPos, endPos, styler);
+ Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler);
if (j < endPos) {
CharacterSet setWordStart(CharacterSet::setAlpha, "_");
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
@@ -476,7 +476,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur } else if (strcmp(s, "interface") == 0) {
// "interface" keyword requires special handling...
bool ignoreKeyword = true;
- int j = lastStart - 1;
+ Sci_Position j = lastStart - 1;
char ch = styler.SafeGetCharAt(j);
while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
IsStreamCommentStyle(styler.StyleAt(j)))) {
@@ -487,7 +487,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur ignoreKeyword = false;
}
if (!ignoreKeyword) {
- unsigned int k = SkipWhiteSpace(currentPos, endPos, styler);
+ Sci_PositionU k = SkipWhiteSpace(currentPos, endPos, styler);
if (k < endPos && styler.SafeGetCharAt(k) == ';') {
// Handle forward interface declarations ("type IMyInterface = interface;")
ignoreKeyword = true;
@@ -499,7 +499,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur } else if (strcmp(s, "dispinterface") == 0) {
// "dispinterface" keyword requires special handling...
bool ignoreKeyword = false;
- unsigned int j = SkipWhiteSpace(currentPos, endPos, styler);
+ Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler);
if (j < endPos && styler.SafeGetCharAt(j) == ';') {
// Handle forward dispinterface declarations ("type IMyInterface = dispinterface;")
ignoreKeyword = true;
@@ -516,14 +516,14 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur }
}
-static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int lineFoldStateCurrent = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) & stateFoldMaskAll : 0;
@@ -531,10 +531,10 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- int lastStart = 0;
+ Sci_Position lastStart = 0;
CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexPerl.cxx b/scintilla/lexers/LexPerl.cxx index 94cd120..84088d3 100644 --- a/scintilla/lexers/LexPerl.cxx +++ b/scintilla/lexers/LexPerl.cxx @@ -69,19 +69,19 @@ using namespace Scintilla; // we also assume SCE_PL_STRING_VAR is the interpolated style with the smallest value
#define INTERPOLATE_SHIFT (SCE_PL_STRING_VAR - SCE_PL_STRING)
-static bool isPerlKeyword(unsigned int start, unsigned int end, WordList &keywords, LexAccessor &styler) {
+static bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keywords, LexAccessor &styler) {
// old-style keyword matcher; needed because GetCurrent() needs
// current segment to be committed, but we may abandon early...
char s[100];
- unsigned int i, len = end - start;
+ Sci_PositionU i, len = end - start;
if (len > 30) { len = 30; }
for (i = 0; i < len; i++, start++) s[i] = styler[start];
s[i] = '\0';
return keywords.InList(s);
}
-static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned int fw,
- int backFlag, unsigned int backPos, unsigned int endPos) {
+static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_PositionU fw,
+ int backFlag, Sci_PositionU backPos, Sci_PositionU endPos) {
// identifiers are recognized by Perl as barewords under some
// conditions, the following attempts to do the disambiguation
// by looking backward and forward; result in 2 LSB
@@ -93,7 +93,7 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i return result;
// first look backwards past whitespace/comments to set EOL flag
// (some disambiguation patterns must be on a single line)
- if (backPos <= static_cast<unsigned int>(styler.LineStart(styler.GetLine(bk))))
+ if (backPos <= static_cast<Sci_PositionU>(styler.LineStart(styler.GetLine(bk))))
moreback = true;
// look backwards at last significant lexed item for disambiguation
bk = backPos - 1;
@@ -128,7 +128,7 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i return result;
}
-static void skipWhitespaceComment(LexAccessor &styler, unsigned int &p) {
+static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) {
// when backtracking, we need to skip whitespace and comments
int style;
while ((p > 0) && (style = styler.StyleAt(p),
@@ -136,7 +136,7 @@ static void skipWhitespaceComment(LexAccessor &styler, unsigned int &p) { p--;
}
-static int styleBeforeBracePair(LexAccessor &styler, unsigned int bk) {
+static int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) {
// backtrack to find open '{' corresponding to a '}', balanced
// return significant style to be tested for '/' disambiguation
int braceCount = 1;
@@ -163,7 +163,7 @@ static int styleBeforeBracePair(LexAccessor &styler, unsigned int bk) { return SCE_PL_DEFAULT;
}
-static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) {
+static int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) {
// backtrack to classify sub-styles of identifier under test
// return sub-style to be tested for '/' disambiguation
if (styler.SafeGetCharAt(bk) == '>') // inputsymbol, like <foo>
@@ -188,7 +188,7 @@ static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) { return 0;
}
-static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endPos) {
+static int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU endPos) {
// forward scan the current line to classify line for POD style
int state = -1;
while (pos < endPos) {
@@ -212,7 +212,7 @@ static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endP return state;
}
-static bool styleCheckSubPrototype(LexAccessor &styler, unsigned int bk) {
+static bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) {
// backtrack to identify if we're starting a subroutine prototype
// we also need to ignore whitespace/comments:
// 'sub' [whitespace|comment] <identifier> [whitespace|comment]
@@ -247,10 +247,10 @@ static int opposite(int ch) { return ch;
}
-static bool IsCommentLine(int line, LexAccessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
int style = styler.StyleAt(i);
if (ch == '#' && style == SCE_PL_COMMENTLINE)
@@ -261,8 +261,8 @@ static bool IsCommentLine(int line, LexAccessor &styler) { return false;
}
-static bool IsPackageLine(int line, LexAccessor &styler) {
- int pos = styler.LineStart(line);
+static bool IsPackageLine(Sci_Position line, LexAccessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
int style = styler.StyleAt(pos);
if (style == SCE_PL_WORD && styler.Match(pos, "package")) {
return true;
@@ -270,7 +270,7 @@ static bool IsPackageLine(int line, LexAccessor &styler) { return false;
}
-static int PodHeadingLevel(int pos, LexAccessor &styler) {
+static int PodHeadingLevel(Sci_Position pos, LexAccessor &styler) {
int lvl = static_cast<unsigned char>(styler.SafeGetCharAt(pos + 5));
if (lvl >= '1' && lvl <= '4') {
return lvl - '0';
@@ -367,13 +367,13 @@ public: const char *SCI_METHOD DescribeProperty(const char *name) {
return osPerl.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char *SCI_METHOD DescribeWordListSets() {
return osPerl.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void *SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -386,21 +386,21 @@ public: void InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern=false);
};
-int SCI_METHOD LexerPerl::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerPerl::PropertySet(const char *key, const char *val) {
if (osPerl.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
-int SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
wordListN = &keywords;
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -515,7 +515,7 @@ void LexerPerl::InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern) sc.SetState(sc.state - INTERPOLATE_SHIFT);
}
-void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
// keywords that forces /PATTERN/ at all times; should track vim's behaviour
@@ -600,7 +600,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, int numState = PERLNUM_DECIMAL;
int dotCount = 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
// Backtrack to beginning of style if required...
// If in a long distance lexical state, backtrack to find quote characters.
@@ -663,7 +663,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, || initStyle == SCE_PL_POD_VERB
) {
// POD backtracking finds preceding blank lines and goes back past them
- int ln = styler.GetLine(startPos);
+ Sci_Position ln = styler.GetLine(startPos);
if (ln > 0) {
initStyle = styler.StyleAt(styler.LineStart(--ln));
if (initStyle == SCE_PL_POD || initStyle == SCE_PL_POD_VERB) {
@@ -682,7 +682,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, // Look backwards past whitespace and comments in order to detect either
// operator or keyword. Later updated as we go along.
int backFlag = BACK_NONE;
- unsigned int backPos = startPos;
+ Sci_PositionU backPos = startPos;
if (backPos > 0) {
backPos--;
skipWhitespaceComment(styler, backPos);
@@ -814,7 +814,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, case SCE_PL_HERE_DELIM:
if (HereDoc.State == 0) { // '<<' encountered
int delim_ch = sc.chNext;
- int ws_skip = 0;
+ Sci_Position ws_skip = 0;
HereDoc.State = 1; // pre-init HERE doc class
HereDoc.Quote = sc.chNext;
HereDoc.Quoted = false;
@@ -822,7 +822,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (IsASpaceOrTab(delim_ch)) {
// skip whitespace; legal only for quoted delimiters
- unsigned int i = sc.currentPos + 1;
+ Sci_PositionU i = sc.currentPos + 1;
while ((i < endPos) && IsASpaceOrTab(delim_ch)) {
i++;
delim_ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
@@ -929,8 +929,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, break;
case SCE_PL_POD:
case SCE_PL_POD_VERB: {
- unsigned int fw = sc.currentPos;
- int ln = styler.GetLine(fw);
+ Sci_PositionU fw = sc.currentPos;
+ Sci_Position ln = styler.GetLine(fw);
if (sc.atLineStart && sc.Match("=cut")) { // end of POD
sc.SetState(SCE_PL_POD);
sc.Forward(4);
@@ -942,7 +942,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, styler.SetLineState(ln, pod);
if (pod == SCE_PL_DEFAULT) {
if (sc.state == SCE_PL_POD_VERB) {
- unsigned int fw2 = fw;
+ Sci_PositionU fw2 = fw;
while (fw2 < (endPos - 1) && pod == SCE_PL_DEFAULT) {
fw = fw2++; // penultimate line (last blank line)
pod = podLineScan(styler, fw2, endPos);
@@ -1234,8 +1234,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, if (sc.chPrev == ':' && sc.GetRelative(-2) == ':') {
sc.ChangeState(SCE_PL_IDENTIFIER);
}
- unsigned int bk = sc.currentPos;
- unsigned int fw = sc.currentPos + 1;
+ Sci_PositionU bk = sc.currentPos;
+ Sci_PositionU fw = sc.currentPos + 1;
// first check for possible quote-like delimiter
if (sc.ch == 's' && !setWord.Contains(sc.chNext)) {
sc.ChangeState(SCE_PL_REGSUBST);
@@ -1341,7 +1341,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, bool preferRE = false;
bool isHereDoc = sc.Match('<', '<');
bool hereDocSpace = false; // for: SCALAR [whitespace] '<<'
- unsigned int bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0;
+ Sci_PositionU bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0;
sc.Complete();
styler.Flush();
if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
@@ -1410,7 +1410,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, // keywords always forced as /PATTERN/: split, if, elsif, while
// everything else /PATTERN/ unless digit/space immediately after '/'
// for '//', defined-or favoured unless special keywords
- unsigned int bkend = bk + 1;
+ Sci_PositionU bkend = bk + 1;
while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) {
bk--;
}
@@ -1506,8 +1506,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_PL_POD);
backFlag = BACK_NONE;
} else if (sc.ch == '-' && setWordStart.Contains(sc.chNext)) { // extended '-' cases
- unsigned int bk = sc.currentPos;
- unsigned int fw = 2;
+ Sci_PositionU bk = sc.currentPos;
+ Sci_PositionU fw = 2;
if (setSingleCharOp.Contains(sc.chNext) && // file test operators
!setWord.Contains(sc.GetRelative(2))) {
sc.SetState(SCE_PL_WORD);
@@ -1557,16 +1557,16 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, #define PERL_HEADFOLD_SHIFT 4
#define PERL_HEADFOLD_MASK 0xF0
-void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) {
+void SCI_METHOD LexerPerl::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
// Backtrack to previous line in case need to fix its fold status
if (startPos > 0) {
@@ -1586,7 +1586,7 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt // Used at end of line to determine if the line was a package definition
bool isPackageLine = false;
int podHeading = 0;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexPowerPro.cxx b/scintilla/lexers/LexPowerPro.cxx index 516b678..93caa4a 100644 --- a/scintilla/lexers/LexPowerPro.cxx +++ b/scintilla/lexers/LexPowerPro.cxx @@ -57,10 +57,10 @@ static inline bool IsLineEndChar(unsigned char ch) { || ch == 0x0d; //CR
}
-static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
+static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler)
{
- int startPos = styler.LineStart(szLine);
- int endPos = styler.LineStart(szLine + 1) - 2;
+ Sci_Position startPos = styler.LineStart(szLine);
+ Sci_Position endPos = styler.LineStart(szLine + 1) - 2;
while (startPos < endPos)
{
char stylech = styler.StyleAt(startPos);
@@ -78,10 +78,10 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler) // Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
-static int GetStyleFirstWord(int szLine, Accessor &styler)
+static int GetStyleFirstWord(Sci_Position szLine, Accessor &styler)
{
- int startPos = styler.LineStart(szLine);
- int endPos = styler.LineStart(szLine + 1) - 1;
+ Sci_Position startPos = styler.LineStart(szLine);
+ Sci_Position endPos = styler.LineStart(szLine + 1) - 1;
char ch = styler.SafeGetCharAt(startPos);
while (ch > 0 && isspacechar(ch) && startPos < endPos)
@@ -97,15 +97,15 @@ static int GetStyleFirstWord(int szLine, Accessor &styler) //note:
// sample line (without quotes): "\tfunction asdf()
// currentPos will be the position of 'a'
-static bool IsFunction(Accessor &styler, unsigned int currentPos) {
+static bool IsFunction(Accessor &styler, Sci_PositionU currentPos) {
const char function[10] = "function "; //10 includes \0
unsigned int numberOfCharacters = sizeof(function) - 1;
- unsigned int position = currentPos - numberOfCharacters;
+ Sci_PositionU position = currentPos - numberOfCharacters;
//compare each character with the letters in the function array
//return false if ALL don't match
- for (unsigned int i = 0; i < numberOfCharacters; i++) {
+ for (Sci_PositionU i = 0; i < numberOfCharacters; i++) {
char c = styler.SafeGetCharAt(position++);
if (c != function[i])
return false;
@@ -114,7 +114,7 @@ static bool IsFunction(Accessor &styler, unsigned int currentPos) { //make sure that there are only spaces (or tabs) between the beginning
//of the line and the function declaration
position = currentPos - numberOfCharacters - 1; //-1 to move to char before 'function'
- for (unsigned int j = 0; j < 16; j++) { //check up to 16 preceeding characters
+ for (Sci_PositionU j = 0; j < 16; j++) { //check up to 16 preceeding characters
char c = styler.SafeGetCharAt(position--, '\0'); //if can't read char, return NUL (past beginning of document)
if (c <= 0) //reached beginning of document
return true;
@@ -128,7 +128,7 @@ static bool IsFunction(Accessor &styler, unsigned int currentPos) { return false;
}
-static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColourisePowerProDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler, bool caseSensitive) {
WordList &keywords = *keywordlists[0];
@@ -360,7 +360,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl sc.Complete();
}
-static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldPowerProDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
//define the character sets
CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
@@ -369,8 +369,8 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function)
bool isFoldingAll = true;
- int endPos = startPos + length;
- int lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly
+ Sci_Position endPos = startPos + length;
+ Sci_Position lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly
// get settings from the config files for folding comments and preprocessor lines
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
@@ -378,7 +378,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] bool foldCompact = true;
// Backtrack to previous line in case need to fix its fold status
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
isFoldingAll = false;
if (lineCurrent > 0) {
@@ -427,7 +427,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[] char chPrevPrev = '\0';
char chPrevPrevPrev = '\0';
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -620,7 +620,7 @@ static const char * const powerProWordLists[] = { 0,
};
-static void ColourisePowerProDocWrapper(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColourisePowerProDocWrapper(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false);
}
diff --git a/scintilla/lexers/LexPowerShell.cxx b/scintilla/lexers/LexPowerShell.cxx index 5d6711d..0f386c8 100644 --- a/scintilla/lexers/LexPowerShell.cxx +++ b/scintilla/lexers/LexPowerShell.cxx @@ -32,7 +32,7 @@ static inline bool IsAWordChar(int ch) { return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_';
}
-static void ColourisePowerShellDoc(unsigned int startPos, int length, int initStyle,
+static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -158,14 +158,14 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle,
+static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -174,7 +174,7 @@ static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle, char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -200,7 +200,7 @@ static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle, }
} else if (foldComment && style == SCE_POWERSHELL_COMMENT) {
if (ch == '#') {
- unsigned int j = i + 1;
+ Sci_PositionU j = i + 1;
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
diff --git a/scintilla/lexers/LexProgress.cxx b/scintilla/lexers/LexProgress.cxx index 452aa7e..198d98c 100644 --- a/scintilla/lexers/LexProgress.cxx +++ b/scintilla/lexers/LexProgress.cxx @@ -43,7 +43,7 @@ static inline bool IsAWordStart(int ch) { enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
-static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords1 = *keywordlists[0]; // regular keywords
@@ -205,14 +205,14 @@ static bool IsStreamCommentStyle(int style) { // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle,
+static void FoldNoBox4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -221,7 +221,7 @@ static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle, char chNext = static_cast<char>(tolower(styler[startPos]));
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
int stylePrev = style;
@@ -265,7 +265,7 @@ static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle, }
}
-static void Fold4glDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void Fold4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
FoldNoBox4glDoc(startPos, length, initStyle, styler);
}
diff --git a/scintilla/lexers/LexProps.cxx b/scintilla/lexers/LexProps.cxx new file mode 100644 index 0000000..45af729 --- /dev/null +++ b/scintilla/lexers/LexProps.cxx @@ -0,0 +1,189 @@ +// Scintilla source code edit control +/** @file LexProps.cxx + ** Lexer for properties files. + **/ +// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { + return (styler[i] == '\n') || + ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); +} + +static inline bool isassignchar(unsigned char ch) { + return (ch == '=') || (ch == ':'); +} + +static void ColourisePropsLine( + char *lineBuffer, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, + Accessor &styler, + bool allowInitialSpaces) { + + Sci_PositionU i = 0; + if (allowInitialSpaces) { + while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces + i++; + } else { + if (isspacechar(lineBuffer[i])) // don't allow initial spaces + i = lengthLine; + } + + if (i < lengthLine) { + if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { + styler.ColourTo(endPos, SCE_PROPS_COMMENT); + } else if (lineBuffer[i] == '[') { + styler.ColourTo(endPos, SCE_PROPS_SECTION); + } else if (lineBuffer[i] == '@') { + styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL); + if (isassignchar(lineBuffer[i++])) + styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); + styler.ColourTo(endPos, SCE_PROPS_DEFAULT); + } else { + // Search for the '=' character + while ((i < lengthLine) && !isassignchar(lineBuffer[i])) + i++; + if ((i < lengthLine) && isassignchar(lineBuffer[i])) { + styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY); + styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); + styler.ColourTo(endPos, SCE_PROPS_DEFAULT); + } else { + styler.ColourTo(endPos, SCE_PROPS_DEFAULT); + } + } + } else { + styler.ColourTo(endPos, SCE_PROPS_DEFAULT); + } +} + +static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + + // property lexer.props.allow.initial.spaces + // For properties files, set to 0 to style all lines that start with whitespace in the default style. + // This is not suitable for SciTE .properties files which use indentation for flow control but + // can be used for RFC2822 text where indentation is used for continuation lines. + bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; + + for (Sci_PositionU i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { + // End of line (or of line buffer) met, colourise it + lineBuffer[linePos] = '\0'; + ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces); + linePos = 0; + startLine = i + 1; + } + } + if (linePos > 0) { // Last line does not have ending characters + ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces); + } +} + +// adaption by ksc, using the "} else {" trick of 1.53 +// 030721 +static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + + Sci_PositionU endPos = startPos + length; + int visibleChars = 0; + Sci_Position lineCurrent = styler.GetLine(startPos); + + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + bool headerPoint = false; + int lev; + + for (Sci_PositionU i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler[i+1]; + + int style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + if (style == SCE_PROPS_SECTION) { + headerPoint = true; + } + + if (atEOL) { + lev = SC_FOLDLEVELBASE; + + if (lineCurrent > 0) { + int levelPrevious = styler.LevelAt(lineCurrent - 1); + + if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { + lev = SC_FOLDLEVELBASE + 1; + } else { + lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; + } + } + + if (headerPoint) { + lev = SC_FOLDLEVELBASE; + } + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + + if (headerPoint) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + + lineCurrent++; + visibleChars = 0; + headerPoint = false; + } + if (!isspacechar(ch)) + visibleChars++; + } + + if (lineCurrent > 0) { + int levelPrevious = styler.LevelAt(lineCurrent - 1); + if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { + lev = SC_FOLDLEVELBASE + 1; + } else { + lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; + } + } else { + lev = SC_FOLDLEVELBASE; + } + int flagsNext = styler.LevelAt(lineCurrent); + styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK)); +} + +static const char *const emptyWordListDesc[] = { + 0 +}; + +LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc); diff --git a/scintilla/lexers/LexPython.cxx b/scintilla/lexers/LexPython.cxx index 2e304f1..b7317ae 100644 --- a/scintilla/lexers/LexPython.cxx +++ b/scintilla/lexers/LexPython.cxx @@ -12,6 +12,10 @@ #include <assert.h>
#include <ctype.h>
+#include <string>
+#include <vector>
+#include <map>
+
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
@@ -22,29 +26,34 @@ #include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
+#include "OptionSet.h"
+#include "SubStyles.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
+namespace {
+ // Use an unnamed namespace to protect the functions and classes from name conflicts
+
/* kwCDef, kwCTypeName only used for Cython */
enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName, kwCPDef };
-static const int indicatorWhitespace = 1;
+enum literalsAllowed { litNone = 0, litU = 1, litB = 2 };
+
+const int indicatorWhitespace = 1;
-static bool IsPyComment(Accessor &styler, int pos, int len) {
+bool IsPyComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
return len > 0 && styler[pos] == '#';
}
-enum literalsAllowed { litNone=0, litU=1, litB=2};
-
-static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
+bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
return
((allowed & litB) && (ch == 'b' || ch == 'B')) ||
((allowed & litU) && (ch == 'u' || ch == 'U'));
}
-static bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) {
+bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) {
if (ch == '\'' || ch == '"')
return true;
if (IsPyStringTypeChar(ch, allowed)) {
@@ -60,7 +69,7 @@ static bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed all }
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
-static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, literalsAllowed allowed) {
+int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex, literalsAllowed allowed) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
@@ -100,27 +109,214 @@ static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, li }
}
-static inline bool IsAWordChar(int ch) {
+inline bool IsAWordChar(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
}
-static inline bool IsAWordStart(int ch) {
+inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
-static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
- WordList *keywordlists[], Accessor &styler) {
+// Options used for LexerPython
+struct OptionsPython {
+ int whingeLevel;
+ bool base2or8Literals;
+ bool stringsU;
+ bool stringsB;
+ bool stringsOverNewline;
+ bool keywords2NoSubIdentifiers;
+ bool fold;
+ bool foldQuotes;
+ bool foldCompact;
+
+ OptionsPython() {
+ whingeLevel = 0;
+ base2or8Literals = true;
+ stringsU = true;
+ stringsB = true;
+ stringsOverNewline = false;
+ keywords2NoSubIdentifiers = false;
+ fold = false;
+ foldQuotes = false;
+ foldCompact = false;
+ }
+
+ literalsAllowed AllowedLiterals() const {
+ literalsAllowed allowedLiterals = stringsU ? litU : litNone;
+ if (stringsB)
+ allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
+ return allowedLiterals;
+ }
+};
+
+static const char *const pythonWordListDesc[] = {
+ "Keywords",
+ "Highlighted identifiers",
+ 0
+};
+
+struct OptionSetPython : public OptionSet<OptionsPython> {
+ OptionSetPython() {
+ DefineProperty("tab.timmy.whinge.level", &OptionsPython::whingeLevel,
+ "For Python code, checks whether indenting is consistent. "
+ "The default, 0 turns off indentation checking, "
+ "1 checks whether each line is potentially inconsistent with the previous line, "
+ "2 checks whether any space characters occur before a tab character in the indentation, "
+ "3 checks whether any spaces are in the indentation, and "
+ "4 checks for any tab characters in the indentation. "
+ "1 is a good level to use.");
+
+ DefineProperty("lexer.python.literals.binary", &OptionsPython::base2or8Literals,
+ "Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712.");
+
+ DefineProperty("lexer.python.strings.u", &OptionsPython::stringsU,
+ "Set to 0 to not recognise Python Unicode literals u\"x\" as used before Python 3.");
+
+ DefineProperty("lexer.python.strings.b", &OptionsPython::stringsB,
+ "Set to 0 to not recognise Python 3 bytes literals b\"x\".");
+
+ DefineProperty("lexer.python.strings.over.newline", &OptionsPython::stringsOverNewline,
+ "Set to 1 to allow strings to span newline characters.");
+
+ DefineProperty("lexer.python.keywords2.no.sub.identifiers", &OptionsPython::keywords2NoSubIdentifiers,
+ "When enabled, it will not style keywords2 items that are used as a sub-identifier. "
+ "Example: when set, will not highlight \"foo.open\" when \"open\" is a keywords2 item.");
+
+ DefineProperty("fold", &OptionsPython::fold);
+
+ DefineProperty("fold.quotes.python", &OptionsPython::foldQuotes,
+ "This option enables folding multi-line quoted strings when using the Python lexer.");
+
+ DefineProperty("fold.compact", &OptionsPython::foldCompact);
+
+ DefineWordListSets(pythonWordListDesc);
+ }
+};
+
+const char styleSubable[] = { SCE_P_IDENTIFIER, 0 };
+
+}
+
+class LexerPython : public ILexerWithSubStyles {
+ WordList keywords;
+ WordList keywords2;
+ OptionsPython options;
+ OptionSetPython osPython;
+ enum { ssIdentifier };
+ SubStyles subStyles;
+public:
+ explicit LexerPython() :
+ subStyles(styleSubable, 0x80, 0x40, 0) {
+ }
+ virtual ~LexerPython() {
+ }
+ void SCI_METHOD Release() {
+ delete this;
+ }
+ int SCI_METHOD Version() const {
+ return lvSubStyles;
+ }
+ const char * SCI_METHOD PropertyNames() {
+ return osPython.PropertyNames();
+ }
+ int SCI_METHOD PropertyType(const char *name) {
+ return osPython.PropertyType(name);
+ }
+ const char * SCI_METHOD DescribeProperty(const char *name) {
+ return osPython.DescribeProperty(name);
+ }
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
+ const char * SCI_METHOD DescribeWordListSets() {
+ return osPython.DescribeWordListSets();
+ }
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+
+ void * SCI_METHOD PrivateCall(int, void *) {
+ return 0;
+ }
+
+ int SCI_METHOD LineEndTypesSupported() {
+ return SC_LINE_END_TYPE_UNICODE;
+ }
+
+ int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
+ return subStyles.Allocate(styleBase, numberStyles);
+ }
+ int SCI_METHOD SubStylesStart(int styleBase) {
+ return subStyles.Start(styleBase);
+ }
+ int SCI_METHOD SubStylesLength(int styleBase) {
+ return subStyles.Length(styleBase);
+ }
+ int SCI_METHOD StyleFromSubStyle(int subStyle) {
+ int styleBase = subStyles.BaseStyle(subStyle);
+ return styleBase;
+ }
+ int SCI_METHOD PrimaryStyleFromStyle(int style) {
+ return style;
+ }
+ void SCI_METHOD FreeSubStyles() {
+ subStyles.Free();
+ }
+ void SCI_METHOD SetIdentifiers(int style, const char *identifiers) {
+ subStyles.SetIdentifiers(style, identifiers);
+ }
+ int SCI_METHOD DistanceToSecondaryStyles() {
+ return 0;
+ }
+ const char * SCI_METHOD GetSubStyleBases() {
+ return styleSubable;
+ }
+
+ static ILexer *LexerFactoryPython() {
+ return new LexerPython();
+ }
+};
+
+Sci_Position SCI_METHOD LexerPython::PropertySet(const char *key, const char *val) {
+ if (osPython.PropertySet(&options, key, val)) {
+ return 0;
+ }
+ return -1;
+}
+
+Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) {
+ WordList *wordListN = 0;
+ switch (n) {
+ case 0:
+ wordListN = &keywords;
+ break;
+ case 1:
+ wordListN = &keywords2;
+ break;
+ }
+ Sci_Position firstModification = -1;
+ if (wordListN) {
+ WordList wlNew;
+ wlNew.Set(wl);
+ if (*wordListN != wlNew) {
+ wordListN->Set(wl);
+ firstModification = 0;
+ }
+ }
+ return firstModification;
+}
+
+void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
+ Accessor styler(pAccess, NULL);
- int endPos = startPos + length;
+ const Sci_Position endPos = startPos + length;
// Backtrack to previous line in case need to fix its tab whinging
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
// Look for backslash-continued lines
while (lineCurrent > 0) {
- int eolPos = styler.LineStart(lineCurrent) - 1;
+ Sci_Position eolPos = styler.LineStart(lineCurrent) - 1;
int eolStyle = styler.StyleAt(eolPos);
if (eolStyle == SCE_P_STRING
|| eolStyle == SCE_P_CHARACTER
@@ -135,40 +331,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, initStyle = startPos == 0 ? SCE_P_DEFAULT : styler.StyleAt(startPos - 1);
}
- WordList &keywords = *keywordlists[0];
- WordList &keywords2 = *keywordlists[1];
-
- // property tab.timmy.whinge.level
- // For Python code, checks whether indenting is consistent.
- // The default, 0 turns off indentation checking,
- // 1 checks whether each line is potentially inconsistent with the previous line,
- // 2 checks whether any space characters occur before a tab character in the indentation,
- // 3 checks whether any spaces are in the indentation, and
- // 4 checks for any tab characters in the indentation.
- // 1 is a good level to use.
- const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
-
- // property lexer.python.literals.binary
- // Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712.
- bool base2or8Literals = styler.GetPropertyInt("lexer.python.literals.binary", 1) != 0;
-
- // property lexer.python.strings.u
- // Set to 0 to not recognise Python Unicode literals u"x" as used before Python 3.
- literalsAllowed allowedLiterals = (styler.GetPropertyInt("lexer.python.strings.u", 1)) ? litU : litNone;
-
- // property lexer.python.strings.b
- // Set to 0 to not recognise Python 3 bytes literals b"x".
- if (styler.GetPropertyInt("lexer.python.strings.b", 1))
- allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
-
- // property lexer.python.strings.over.newline
- // Set to 1 to allow strings to span newline characters.
- bool stringsOverNewline = styler.GetPropertyInt("lexer.python.strings.over.newline") != 0;
-
- // property lexer.python.keywords2.no.sub.identifiers
- // When enabled, it will not style keywords2 items that are used as a sub-identifier.
- // Example: when set, will not highlight "foo.open" when "open" is a keywords2 item.
- const bool keywords2NoSubIdentifiers = styler.GetPropertyInt("lexer.python.keywords2.no.sub.identifiers") != 0;
+ const literalsAllowed allowedLiterals = options.AllowedLiterals();
initStyle = initStyle & 31;
if (initStyle == SCE_P_STRINGEOL) {
@@ -180,10 +343,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
bool base_n_number = false;
+ const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_P_IDENTIFIER);
+
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
bool indentGood = true;
- int startIndicator = sc.currentPos;
+ Sci_Position startIndicator = sc.currentPos;
bool inContinuedString = false;
for (; sc.More(); sc.Forward()) {
@@ -191,13 +356,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, if (sc.atLineStart) {
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
indentGood = true;
- if (whingeLevel == 1) {
+ if (options.whingeLevel == 1) {
indentGood = (spaceFlags & wsInconsistent) == 0;
- } else if (whingeLevel == 2) {
+ } else if (options.whingeLevel == 2) {
indentGood = (spaceFlags & wsSpaceTab) == 0;
- } else if (whingeLevel == 3) {
+ } else if (options.whingeLevel == 3) {
indentGood = (spaceFlags & wsSpace) == 0;
- } else if (whingeLevel == 4) {
+ } else if (options.whingeLevel == 4) {
indentGood = (spaceFlags & wsTab) == 0;
}
if (!indentGood) {
@@ -216,7 +381,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, }
lineCurrent++;
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
- if (inContinuedString || stringsOverNewline) {
+ if (inContinuedString || options.stringsOverNewline) {
inContinuedString = false;
} else {
sc.ChangeState(SCE_P_STRINGEOL);
@@ -252,7 +417,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, } else if (kwLast == kwDef) {
style = SCE_P_DEFNAME;
} else if (kwLast == kwCDef || kwLast == kwCPDef) {
- int pos = sc.currentPos;
+ Sci_Position pos = sc.currentPos;
unsigned char ch = styler.SafeGetCharAt(pos, '\0');
while (ch != '\0') {
if (ch == '(') {
@@ -269,16 +434,21 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, }
}
} else if (keywords2.InList(s)) {
- if (keywords2NoSubIdentifiers) {
+ if (options.keywords2NoSubIdentifiers) {
// We don't want to highlight keywords2
// that are used as a sub-identifier,
// i.e. not open in "foo.open".
- int pos = styler.GetStartSegment() - 1;
+ Sci_Position pos = styler.GetStartSegment() - 1;
if (pos < 0 || (styler.SafeGetCharAt(pos, '\0') != '.'))
style = SCE_P_WORD2;
} else {
style = SCE_P_WORD2;
}
+ } else {
+ int subStyle = classifierIdentifiers.ValueFor(s);
+ if (subStyle >= 0) {
+ style = subStyle;
+ }
}
sc.ChangeState(style);
sc.SetState(SCE_P_DEFAULT);
@@ -374,7 +544,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, sc.SetState(SCE_P_NUMBER);
} else if (sc.ch == '0' &&
(sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) {
- if (base2or8Literals) {
+ if (options.base2or8Literals) {
base_n_number = true;
sc.SetState(SCE_P_NUMBER);
} else {
@@ -392,7 +562,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, } else if (sc.ch == '@') {
sc.SetState(SCE_P_DECORATOR);
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) {
- unsigned int nextIndex = 0;
+ Sci_PositionU nextIndex = 0;
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals));
while (nextIndex > (sc.currentPos + 1) && sc.More()) {
sc.Forward();
@@ -406,10 +576,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
@@ -419,30 +589,28 @@ static bool IsCommentLine(int line, Accessor &styler) { return false;
}
-static bool IsQuoteLine(int line, Accessor &styler) {
+static bool IsQuoteLine(Sci_Position line, Accessor &styler) {
int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
-static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
- WordList *[], Accessor &styler) {
- const int maxPos = startPos + length;
- const int maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line
- const int docLines = styler.GetLine(styler.Length()); // Available last line
+void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, IDocument *pAccess) {
+ if (!options.fold)
+ return;
- // property fold.quotes.python
- // This option enables folding multi-line quoted strings when using the Python lexer.
- const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python") != 0;
+ Accessor styler(pAccess, NULL);
- const bool foldCompact = styler.GetPropertyInt("fold.compact") != 0;
+ const Sci_Position maxPos = startPos + length;
+ const Sci_Position maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line
+ const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line
// Backtrack to previous non-blank line so we can determine indent level
// for any white space lines (needed esp. within triple quoted strings)
// and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
@@ -459,7 +627,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse int prev_state = SCE_P_DEFAULT & 31;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
- int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
+ int prevQuote = options.foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
// Process all characters to end of requested range or end of any triple quote
//that hangs over the end of the range. Cap processing in all cases
@@ -468,15 +636,15 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse // Gather info
int lev = indentCurrent;
- int lineNext = lineCurrent + 1;
+ Sci_Position lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
int quote = false;
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
- int lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
+ Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
int style = styler.StyleAt(lookAtPos) & 31;
- quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
+ quote = options.foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
const int quote_start = (quote && !prevQuote);
const int quote_continue = (quote && prevQuote);
@@ -517,13 +685,13 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse // which is indented more than the line after the end of
// the comment-block, use the level of the block before
- int skipLine = lineNext;
+ Sci_Position skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
- if (foldCompact) {
+ if (options.foldCompact) {
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
skipLevel = levelBeforeComments;
@@ -550,7 +718,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse prevQuote = quote;
// Set fold level for this line and move to next line
- styler.SetLevel(lineCurrent, foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG);
+ styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG);
indentCurrent = indentNext;
lineCurrent = lineNext;
}
@@ -560,12 +728,5 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse //styler.SetLevel(lineCurrent, indentCurrent);
}
-static const char *const pythonWordListDesc[] = {
- "Keywords",
- "Highlighted identifiers",
- 0
-};
-
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,
+LexerModule lmPython(SCLEX_PYTHON, LexerPython::LexerFactoryPython, "python",
pythonWordListDesc);
-
diff --git a/scintilla/lexers/LexR.cxx b/scintilla/lexers/LexR.cxx index 409bb4c..630e3cd 100644 --- a/scintilla/lexers/LexR.cxx +++ b/scintilla/lexers/LexR.cxx @@ -50,7 +50,7 @@ static inline bool IsAnOperator(const int ch) { return false;
}
-static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
@@ -146,13 +146,13 @@ static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, Word // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-static void FoldRDoc(unsigned int startPos, int length, int, WordList *[],
+static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -160,7 +160,7 @@ static void FoldRDoc(unsigned int startPos, int length, int, WordList *[], int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexRebol.cxx b/scintilla/lexers/LexRebol.cxx index 5c5b241..8edecc2 100644 --- a/scintilla/lexers/LexRebol.cxx +++ b/scintilla/lexers/LexRebol.cxx @@ -68,7 +68,7 @@ static inline bool IsBinaryStart(const int ch, const int ch2, const int ch3, con }
-static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
+static void ColouriseRebolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
@@ -79,7 +79,7 @@ static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle, WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
// Initialize the braced string {.. { ... } ..} nesting level, if we are inside such a string.
int stringLevel = 0;
if (initStyle == SCE_REBOL_BRACEDSTRING || initStyle == SCE_REBOL_COMMENTBLOCK) {
@@ -273,16 +273,16 @@ static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle, }
-static void FoldRebolDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+static void FoldRebolDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexRegistry.cxx b/scintilla/lexers/LexRegistry.cxx index 0f401fa..8fa9943 100644 --- a/scintilla/lexers/LexRegistry.cxx +++ b/scintilla/lexers/LexRegistry.cxx @@ -65,8 +65,8 @@ class LexerRegistry : public ILexer { return (state == SCE_REG_ADDEDKEY || state == SCE_REG_DELETEDKEY); } - static bool AtValueType(LexAccessor &styler, int start) { - int i = 0; + static bool AtValueType(LexAccessor &styler, Sci_Position start) { + Sci_Position i = 0; while (i < 10) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); @@ -79,8 +79,8 @@ class LexerRegistry : public ILexer { return false; } - static bool IsNextNonWhitespace(LexAccessor &styler, int start, char ch) { - int i = 0; + static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) { + Sci_Position i = 0; while (i < 100) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); @@ -96,9 +96,9 @@ class LexerRegistry : public ILexer { } // Looks for the equal sign at the end of the string - static bool AtValueName(LexAccessor &styler, int start) { + static bool AtValueName(LexAccessor &styler, Sci_Position start) { bool atEOL = false; - int i = 0; + Sci_Position i = 0; bool escaped = false; while (!atEOL) { i++; @@ -119,9 +119,9 @@ class LexerRegistry : public ILexer { return false; } - static bool AtKeyPathEnd(LexAccessor &styler, int start) { + static bool AtKeyPathEnd(LexAccessor &styler, Sci_Position start) { bool atEOL = false; - int i = 0; + Sci_Position i = 0; while (!atEOL) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); @@ -135,7 +135,7 @@ class LexerRegistry : public ILexer { return true; } - static bool AtGUID(LexAccessor &styler, int start) { + static bool AtGUID(LexAccessor &styler, Sci_Position start) { int count = 8; int portion = 0; int offset = 1; @@ -179,13 +179,13 @@ public: virtual const char *SCI_METHOD DescribeProperty(const char *name) { return optSetRegistry.DescribeProperty(name); } - virtual int SCI_METHOD PropertySet(const char *key, const char *val) { + virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) { if (optSetRegistry.PropertySet(&options, key, val)) { return 0; } return -1; } - virtual int SCI_METHOD WordListSet(int, const char *) { + virtual Sci_Position SCI_METHOD WordListSet(int, const char *) { return -1; } virtual void *SCI_METHOD PrivateCall(int, void *) { @@ -197,18 +197,18 @@ public: virtual const char *SCI_METHOD DescribeWordListSets() { return optSetRegistry.DescribeWordListSets(); } - virtual void SCI_METHOD Lex(unsigned startPos, - int length, + virtual void SCI_METHOD Lex(Sci_PositionU startPos, + Sci_Position length, int initStyle, IDocument *pAccess); - virtual void SCI_METHOD Fold(unsigned startPos, - int length, + virtual void SCI_METHOD Fold(Sci_PositionU startPos, + Sci_Position length, int initStyle, IDocument *pAccess); }; -void SCI_METHOD LexerRegistry::Lex(unsigned startPos, - int length, +void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos, + Sci_Position length, int initStyle, IDocument *pAccess) { int beforeGUID = SCE_REG_DEFAULT; @@ -220,7 +220,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos, bool afterEqualSign = false; while (context.More()) { if (context.atLineStart) { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); bool continued = styler[currPos-3] == '\\'; highlight = continued ? true : false; } @@ -232,7 +232,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos, break; case SCE_REG_VALUENAME: case SCE_REG_STRING: { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == '"') { context.ForwardSetState(SCE_REG_DEFAULT); } else if (context.ch == '\\') { @@ -270,7 +270,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos, break; case SCE_REG_DELETEDKEY: case SCE_REG_ADDEDKEY: { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == ']' && AtKeyPathEnd(styler, currPos)) { context.ForwardSetState(SCE_REG_DEFAULT); } else if (context.ch == '{') { @@ -298,7 +298,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos, context.ForwardSetState(beforeGUID); beforeGUID = SCE_REG_DEFAULT; } - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == '"' && IsStringState(context.state)) { context.ForwardSetState(SCE_REG_DEFAULT); } else if (context.ch == ']' && @@ -315,7 +315,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos, } // Determine if a new state should be entered. if (context.state == SCE_REG_DEFAULT) { - int currPos = static_cast<int>(context.currentPos); + Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); if (context.ch == ';') { context.SetState(SCE_REG_COMMENT); } else if (context.ch == '"') { @@ -352,19 +352,19 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos, } // Folding similar to that of FoldPropsDoc in LexOthers -void SCI_METHOD LexerRegistry::Fold(unsigned startPos, - int length, +void SCI_METHOD LexerRegistry::Fold(Sci_PositionU startPos, + Sci_Position length, int, IDocument *pAccess) { if (!options.fold) { return; } LexAccessor styler(pAccess); - int currLine = styler.GetLine(startPos); + Sci_Position currLine = styler.GetLine(startPos); int visibleChars = 0; - unsigned endPos = startPos + length; + Sci_PositionU endPos = startPos + length; bool atKeyPath = false; - for (unsigned i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { atKeyPath = IsKeyPathState(styler.StyleAt(i)) ? true : atKeyPath; char curr = styler.SafeGetCharAt(i); char next = styler.SafeGetCharAt(i+1); diff --git a/scintilla/lexers/LexRuby.cxx b/scintilla/lexers/LexRuby.cxx index 7918d4b..520746c 100644 --- a/scintilla/lexers/LexRuby.cxx +++ b/scintilla/lexers/LexRuby.cxx @@ -68,7 +68,7 @@ static bool inline iswhitespace(char ch) { #define STYLE_MASK 63
#define actual_style(style) (style & STYLE_MASK)
-static bool followsDot(unsigned int pos, Accessor &styler) {
+static bool followsDot(Sci_PositionU pos, Accessor &styler) {
styler.Flush();
for (; pos >= 1; --pos) {
int style = actual_style(styler.StyleAt(pos));
@@ -95,16 +95,16 @@ static bool followsDot(unsigned int pos, Accessor &styler) { // Forward declarations
static bool keywordIsAmbiguous(const char *prevWord);
-static bool keywordDoStartsLoop(int pos,
+static bool keywordDoStartsLoop(Sci_Position pos,
Accessor &styler);
static bool keywordIsModifier(const char *word,
- int pos,
+ Sci_Position pos,
Accessor &styler);
-static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
+static int ClassifyWordRb(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord) {
char s[MAX_KEYWORD_LENGTH];
- unsigned int i, j;
- unsigned int lim = end - start + 1; // num chars to copy
+ Sci_PositionU i, j;
+ Sci_PositionU lim = end - start + 1; // num chars to copy
if (lim >= MAX_KEYWORD_LENGTH) {
lim = MAX_KEYWORD_LENGTH - 1;
}
@@ -149,7 +149,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor //XXX Identical to Perl, put in common area
-static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
+static bool isMatch(Accessor &styler, Sci_Position lengthDoc, Sci_Position pos, const char *val) {
if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) {
return false;
}
@@ -167,8 +167,8 @@ static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { // Precondition: the here-doc target can be indented
static bool lookingAtHereDocDelim(Accessor &styler,
- int pos,
- int lengthDoc,
+ Sci_Position pos,
+ Sci_Position lengthDoc,
const char *HereDocDelim)
{
if (!isMatch(styler, lengthDoc, pos, HereDocDelim)) {
@@ -201,7 +201,7 @@ static char opposite(char ch) { // Null transitions when we see we've reached the end
// and need to relex the curr char.
-static void redo_char(int &i, char &ch, char &chNext, char &chNext2,
+static void redo_char(Sci_Position &i, char &ch, char &chNext, char &chNext2,
int &state) {
i--;
chNext2 = chNext;
@@ -209,19 +209,19 @@ static void redo_char(int &i, char &ch, char &chNext, char &chNext2, state = SCE_RB_DEFAULT;
}
-static void advance_char(int &i, char &ch, char &chNext, char &chNext2) {
+static void advance_char(Sci_Position &i, char &ch, char &chNext, char &chNext2) {
i++;
ch = chNext;
chNext = chNext2;
}
// precondition: startPos points to one after the EOL char
-static bool currLineContainsHereDelims(int &startPos,
+static bool currLineContainsHereDelims(Sci_Position &startPos,
Accessor &styler) {
if (startPos <= 1)
return false;
- int pos;
+ Sci_Position pos;
for (pos = startPos - 1; pos > 0; pos--) {
char ch = styler.SafeGetCharAt(pos);
if (isEOLChar(ch)) {
@@ -314,10 +314,10 @@ static void exitInnerExpression(int *p_inner_string_types, curr_quote = p_inner_quotes[inner_string_count];
}
-static bool isEmptyLine(int pos,
+static bool isEmptyLine(Sci_Position pos,
Accessor &styler) {
int spaceFlags = 0;
- int lineCurrent = styler.GetLine(pos);
+ Sci_Position lineCurrent = styler.GetLine(pos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
return (indentCurrent & SC_FOLDLEVELWHITEFLAG) != 0;
}
@@ -346,10 +346,10 @@ static bool RE_CanFollowKeyword(const char *keyword) { // Look at chars up to but not including endPos
// Don't look at styles in case we're looking forward
-static int skipWhitespace(int startPos,
- int endPos,
+static int skipWhitespace(Sci_Position startPos,
+ Sci_Position endPos,
Accessor &styler) {
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
if (!iswhitespace(styler[i])) {
return i;
}
@@ -363,19 +363,19 @@ static int skipWhitespace(int startPos, //
// iPrev points to the start of <<
-static bool sureThisIsHeredoc(int iPrev,
+static bool sureThisIsHeredoc(Sci_Position iPrev,
Accessor &styler,
char *prevWord) {
// Not so fast, since Ruby's so dynamic. Check the context
// to make sure we're OK.
int prevStyle;
- int lineStart = styler.GetLine(iPrev);
- int lineStartPosn = styler.LineStart(lineStart);
+ Sci_Position lineStart = styler.GetLine(iPrev);
+ Sci_Position lineStartPosn = styler.LineStart(lineStart);
styler.Flush();
// Find the first word after some whitespace
- int firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler);
+ Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler);
if (firstWordPosn >= iPrev) {
// Have something like {^ <<}
//XXX Look at the first previous non-comment non-white line
@@ -391,7 +391,7 @@ static bool sureThisIsHeredoc(int iPrev, return true;
}
}
- int firstWordEndPosn = firstWordPosn;
+ Sci_Position firstWordEndPosn = firstWordPosn;
char *dst = prevWord;
for (;;) {
if (firstWordEndPosn >= iPrev ||
@@ -414,15 +414,15 @@ static bool sureThisIsHeredoc(int iPrev, // Routine that saves us from allocating a buffer for the here-doc target
// targetEndPos points one past the end of the current target
-static bool haveTargetMatch(int currPos,
- int lengthDoc,
- int targetStartPos,
- int targetEndPos,
+static bool haveTargetMatch(Sci_Position currPos,
+ Sci_Position lengthDoc,
+ Sci_Position targetStartPos,
+ Sci_Position targetEndPos,
Accessor &styler) {
if (lengthDoc - currPos < targetEndPos - targetStartPos) {
return false;
}
- int i, j;
+ Sci_Position i, j;
for (i = targetStartPos, j = currPos;
i < targetEndPos && j < lengthDoc;
i++, j++) {
@@ -447,19 +447,19 @@ static bool haveTargetMatch(int currPos, // return true == yes, we have no heredocs
-static bool sureThisIsNotHeredoc(int lt2StartPos,
+static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos,
Accessor &styler) {
int prevStyle;
// Use full document, not just part we're styling
- int lengthDoc = styler.Length();
- int lineStart = styler.GetLine(lt2StartPos);
- int lineStartPosn = styler.LineStart(lineStart);
+ Sci_Position lengthDoc = styler.Length();
+ Sci_Position lineStart = styler.GetLine(lt2StartPos);
+ Sci_Position lineStartPosn = styler.LineStart(lineStart);
styler.Flush();
const bool definitely_not_a_here_doc = true;
const bool looks_like_a_here_doc = false;
// Find the first word after some whitespace
- int firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);
+ Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);
if (firstWordPosn >= lt2StartPos) {
return definitely_not_a_here_doc;
}
@@ -508,12 +508,12 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, return definitely_not_a_here_doc;
}
// OK, now 'j' will point to the current spot moving ahead
- int j = firstWordPosn + 1;
+ Sci_Position j = firstWordPosn + 1;
if (styler.StyleAt(j) != SCE_RB_OPERATOR || styler[j] != '<') {
// This shouldn't happen
return definitely_not_a_here_doc;
}
- int nextLineStartPosn = styler.LineStart(lineStart + 1);
+ Sci_Position nextLineStartPosn = styler.LineStart(lineStart + 1);
if (nextLineStartPosn >= lengthDoc) {
return definitely_not_a_here_doc;
}
@@ -522,7 +522,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, return definitely_not_a_here_doc;
}
bool allow_indent;
- int target_start, target_end;
+ Sci_Position target_start, target_end;
// From this point on no more styling, since we're looking ahead
if (styler[j] == '-') {
allow_indent = true;
@@ -580,12 +580,12 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, }
// Just look at the start of each line
- int last_line = styler.GetLine(lengthDoc - 1);
+ Sci_Position last_line = styler.GetLine(lengthDoc - 1);
// But don't go too far
if (last_line > lineStart + 50) {
last_line = lineStart + 50;
}
- for (int line_num = lineStart + 1; line_num <= last_line; line_num++) {
+ for (Sci_Position line_num = lineStart + 1; line_num <= last_line; line_num++) {
if (allow_indent) {
j = skipWhitespace(styler.LineStart(line_num), lengthDoc, styler);
} else {
@@ -604,8 +604,8 @@ static bool sureThisIsNotHeredoc(int lt2StartPos, // move to the start of the first line that is not in a
// multi-line construct
-static void synchronizeDocStart(unsigned int &startPos,
- int &length,
+static void synchronizeDocStart(Sci_PositionU &startPos,
+ Sci_Position &length,
int &initStyle,
Accessor &styler,
bool skipWhiteSpace=false) {
@@ -620,9 +620,9 @@ static void synchronizeDocStart(unsigned int &startPos, return;
}
- int pos = startPos;
+ Sci_Position pos = startPos;
// Quick way to characterize each line
- int lineStart;
+ Sci_Position lineStart;
for (lineStart = styler.GetLine(pos); lineStart > 0; lineStart--) {
// Now look at the style before the previous line's EOL
pos = styler.LineStart(lineStart) - 1;
@@ -654,7 +654,7 @@ static void synchronizeDocStart(unsigned int &startPos, initStyle = SCE_RB_DEFAULT;
}
-static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
// Lexer for Ruby often has to backtrack to start of current style to determine
@@ -695,7 +695,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, bool preferRE = true;
int state = initStyle;
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero
prevWord[0] = '\0';
@@ -743,7 +743,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, int inner_string_count = 0;
int brace_counts = 0; // Number of #{ ... } things within an expression
- int i;
+ Sci_Position i;
for (i = 0; i < INNER_STRINGS_MAX_COUNT; i++) {
inner_string_types[i] = 0;
inner_expn_brace_counts[i] = 0;
@@ -1103,7 +1103,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // No need to handle this state -- we'll just move to the end
preferRE = false;
} else {
- int wordStartPos = styler.GetStartSegment();
+ Sci_Position wordStartPos = styler.GetStartSegment();
int word_style = ClassifyWordRb(wordStartPos, i - 1, keywords, styler, prevWord);
switch (word_style) {
case SCE_RB_WORD:
@@ -1445,12 +1445,12 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, // Helper functions for folding, disambiguation keywords
// Assert that there are no high-bit chars
-static void getPrevWord(int pos,
+static void getPrevWord(Sci_Position pos,
char *prevWord,
Accessor &styler,
int word_state)
{
- int i;
+ Sci_Position i;
styler.Flush();
for (i = pos - 1; i > 0; i--) {
if (actual_style(styler.StyleAt(i)) != word_state) {
@@ -1488,7 +1488,7 @@ static bool keywordIsAmbiguous(const char *prevWord) // do after a while or until, as a noise word (like then after if)
static bool keywordIsModifier(const char *word,
- int pos,
+ Sci_Position pos,
Accessor &styler)
{
if (word[0] == 'd' && word[1] == 'o' && !word[2]) {
@@ -1496,8 +1496,8 @@ static bool keywordIsModifier(const char *word, }
char ch, chPrev, chPrev2;
int style = SCE_RB_DEFAULT;
- int lineStart = styler.GetLine(pos);
- int lineStartPosn = styler.LineStart(lineStart);
+ Sci_Position lineStart = styler.GetLine(pos);
+ Sci_Position lineStartPosn = styler.LineStart(lineStart);
// We want to step backwards until we don't care about the current
// position. But first move lineStartPosn back behind any
// continuations immediately above word.
@@ -1599,13 +1599,13 @@ static bool keywordIsModifier(const char *word, // Nothing fancy -- look to see if we follow a while/until somewhere
// on the current line
-static bool keywordDoStartsLoop(int pos,
+static bool keywordDoStartsLoop(Sci_Position pos,
Accessor &styler)
{
char ch;
int style;
- int lineStart = styler.GetLine(pos);
- int lineStartPosn = styler.LineStart(lineStart);
+ Sci_Position lineStart = styler.GetLine(pos);
+ Sci_Position lineStartPosn = styler.LineStart(lineStart);
styler.Flush();
while (--pos >= lineStartPosn) {
style = actual_style(styler.StyleAt(pos));
@@ -1621,7 +1621,7 @@ static bool keywordDoStartsLoop(int pos, char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero
char *dst = prevWord;
int wordLen = 0;
- int start_word;
+ Sci_Position start_word;
for (start_word = pos;
start_word >= lineStartPosn && actual_style(styler.StyleAt(start_word)) == SCE_RB_WORD;
start_word--) {
@@ -1651,10 +1651,10 @@ static bool keywordDoStartsLoop(int pos, return false;
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
@@ -1718,16 +1718,16 @@ static bool IsCommentLine(int line, Accessor &styler) { * Later offer to fold POD, here-docs, strings, and blocks of comments
*/
-static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
+static void FoldRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
synchronizeDocStart(startPos, length, initStyle, styler, // ref args
false);
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = startPos == 0 ? 0 : (styler.LevelAt(lineCurrent)
& SC_FOLDLEVELNUMBERMASK
& ~SC_FOLDLEVELBASE);
@@ -1736,7 +1736,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle, int styleNext = styler.StyleAt(startPos);
int stylePrev = startPos <= 1 ? SCE_RB_DEFAULT : styler.StyleAt(startPos - 1);
bool buffer_ends_with_eol = false;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
diff --git a/scintilla/lexers/LexRust.cxx b/scintilla/lexers/LexRust.cxx index 80ec014..f98296b 100644 --- a/scintilla/lexers/LexRust.cxx +++ b/scintilla/lexers/LexRust.cxx @@ -138,13 +138,13 @@ public: const char * SCI_METHOD DescribeProperty(const char *name) { return osRust.DescribeProperty(name); } - int SCI_METHOD PropertySet(const char *key, const char *val); + Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); const char * SCI_METHOD DescribeWordListSets() { return osRust.DescribeWordListSets(); } - int SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + Sci_Position SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); void * SCI_METHOD PrivateCall(int, void *) { return 0; } @@ -153,15 +153,15 @@ public: } }; -int SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) { +Sci_Position SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) { if (osRust.PropertySet(&options, key, val)) { return 0; } return -1; } -int SCI_METHOD LexerRust::WordListSet(int n, const char *wl) { - int firstModification = -1; +Sci_Position SCI_METHOD LexerRust::WordListSet(int n, const char *wl) { + Sci_Position firstModification = -1; if (n < NUM_RUST_KEYWORD_LISTS) { WordList *wordListN = &keywords[n]; WordList wlNew; @@ -188,7 +188,7 @@ static bool IsIdentifierContinue(int ch) { return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch); } -static void ScanWhitespace(Accessor& styler, int& pos, int max) { +static void ScanWhitespace(Accessor& styler, Sci_Position& pos, Sci_Position max) { while (IsWhitespace(styler.SafeGetCharAt(pos, '\0')) && pos < max) { if (pos == styler.LineEnd(styler.GetLine(pos))) styler.SetLineState(styler.GetLine(pos), 0); @@ -197,14 +197,14 @@ static void ScanWhitespace(Accessor& styler, int& pos, int max) { styler.ColourTo(pos-1, SCE_RUST_DEFAULT); } -static void GrabString(char* s, Accessor& styler, int start, int len) { - for (int ii = 0; ii < len; ii++) +static void GrabString(char* s, Accessor& styler, Sci_Position start, Sci_Position len) { + for (Sci_Position ii = 0; ii < len; ii++) s[ii] = styler[ii + start]; s[len] = '\0'; } -static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) { - int start = pos; +static void ScanIdentifier(Accessor& styler, Sci_Position& pos, WordList *keywords) { + Sci_Position start = pos; while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0'))) pos++; @@ -231,8 +231,8 @@ static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) { } /* Scans a sequence of digits, returning true if it found any. */ -static bool ScanDigits(Accessor& styler, int& pos, int base) { - int old_pos = pos; +static bool ScanDigits(Accessor& styler, Sci_Position& pos, int base) { + Sci_Position old_pos = pos; for (;;) { int c = styler.SafeGetCharAt(pos, '\0'); if (IsADigit(c, base) || c == '_') @@ -244,7 +244,7 @@ static bool ScanDigits(Accessor& styler, int& pos, int base) { } /* Scans an integer and floating point literals. */ -static void ScanNumber(Accessor& styler, int& pos) { +static void ScanNumber(Accessor& styler, Sci_Position& pos) { int base = 10; int c = styler.SafeGetCharAt(pos, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0'); @@ -369,7 +369,7 @@ static bool IsValidStringEscape(int c) { return IsValidCharacterEscape(c) || c == '\n' || c == '\r'; } -static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool stop_asap) { +static bool ScanNumericEscape(Accessor &styler, Sci_Position& pos, Sci_Position num_digits, bool stop_asap) { for (;;) { int c = styler.SafeGetCharAt(pos, '\0'); if (!IsADigit(c, 16)) @@ -388,7 +388,7 @@ static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool s /* This is overly permissive for character literals in order to accept UTF-8 encoded * character literals. */ -static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos, bool ascii_only) { +static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos, bool ascii_only) { pos++; int c = styler.SafeGetCharAt(pos, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0'); @@ -467,7 +467,7 @@ enum CommentState { * The rule for block-doc comments is as follows: /xxN and /x! (where x is an asterisk, N is a non-asterisk) start doc comments. * Otherwise it's a regular comment. */ -static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState state, int level) { +static void ResumeBlockComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state, int level) { int c = styler.SafeGetCharAt(pos, '\0'); bool maybe_doc_comment = false; if (c == '*') { @@ -522,7 +522,7 @@ static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState * The rule for line-doc comments is as follows... ///N and //! (where N is a non slash) start doc comments. * Otherwise it's a normal line comment. */ -static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState state) { +static void ResumeLineComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state) { bool maybe_doc_comment = false; int c = styler.SafeGetCharAt(pos, '\0'); if (c == '/') { @@ -550,7 +550,7 @@ static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINE); } -static void ScanComments(Accessor &styler, int& pos, int max) { +static void ScanComments(Accessor &styler, Sci_Position& pos, Sci_Position max) { pos++; int c = styler.SafeGetCharAt(pos, '\0'); pos++; @@ -560,7 +560,7 @@ static void ScanComments(Accessor &styler, int& pos, int max) { ResumeBlockComment(styler, pos, max, UnknownComment, 1); } -static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) { +static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { int c = styler.SafeGetCharAt(pos, '\0'); bool error = false; while (c != '"' && !error) { @@ -600,7 +600,7 @@ static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) { styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING); } -static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, bool ascii_only) { +static void ResumeRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, int num_hashes, bool ascii_only) { for (;;) { if (pos == styler.LineEnd(styler.GetLine(pos))) styler.SetLineState(styler.GetLine(pos), num_hashes); @@ -628,7 +628,7 @@ static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR); } -static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) { +static void ScanRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { pos++; int num_hashes = 0; while (styler.SafeGetCharAt(pos, '\0') == '#') { @@ -643,11 +643,11 @@ static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) } } -void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerRust::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { PropSetSimple props; Accessor styler(pAccess, &props); - int pos = startPos; - int max = pos + length; + Sci_Position pos = startPos; + Sci_Position max = pos + length; styler.StartAt(pos); styler.StartSegment(pos); @@ -716,28 +716,28 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle, styler.Flush(); } -void SCI_METHOD LexerRust::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerRust::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; bool inLineComment = false; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - unsigned int lineStartNext = styler.LineStart(lineCurrent+1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -803,7 +803,7 @@ void SCI_METHOD LexerRust::Fold(unsigned int startPos, int length, int initStyle lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) { + if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } diff --git a/scintilla/lexers/LexSML.cxx b/scintilla/lexers/LexSML.cxx index 013a170..e083037 100644 --- a/scintilla/lexers/LexSML.cxx +++ b/scintilla/lexers/LexSML.cxx @@ -34,7 +34,7 @@ using namespace Scintilla; #endif
void ColouriseSMLDoc(
- unsigned int startPos, int length,
+ Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
@@ -46,7 +46,8 @@ void ColouriseSMLDoc( if (sc.state >= SCE_SML_COMMENT)
nesting = (sc.state & 0x0f) - SCE_SML_COMMENT;
- int chBase = 0, chToken = 0, chLit = 0;
+ Sci_PositionU chToken = 0;
+ int chBase = 0, chLit = 0;
WordList& keywords = *keywordlists[0];
WordList& keywords2 = *keywordlists[1];
WordList& keywords3 = *keywordlists[2];
@@ -54,7 +55,7 @@ void ColouriseSMLDoc( while (sc.More()) {
int state2 = -1;
- int chColor = sc.currentPos - 1;
+ Sci_Position chColor = sc.currentPos - 1;
bool advance = true;
switch (sc.state & 0x0f) {
@@ -89,10 +90,10 @@ void ColouriseSMLDoc( case SCE_SML_IDENTIFIER:
if (!(issml(sc.ch) || sc.Match('\''))) {
- const int n = sc.currentPos - chToken;
+ const Sci_Position n = sc.currentPos - chToken;
if (n < 24) {
char t[24];
- for (int i = -n; i < 0; i++)
+ for (Sci_Position i = -n; i < 0; i++)
t[n + i] = static_cast<char>(sc.GetRelative(i));
t[n] = '\0';
if ((n == 1 && sc.chPrev == '_') || keywords.InList(t))
@@ -205,7 +206,7 @@ void ColouriseSMLDoc( }
void FoldSMLDoc(
- unsigned int, int,
+ Sci_PositionU, Sci_Position,
int,
WordList *[],
Accessor &)
diff --git a/scintilla/lexers/LexSQL.cxx b/scintilla/lexers/LexSQL.cxx index a2314c5..442c3d4 100644 --- a/scintilla/lexers/LexSQL.cxx +++ b/scintilla/lexers/LexSQL.cxx @@ -66,7 +66,7 @@ typedef unsigned int sql_state_t; class SQLStates {
public :
- void Set(int lineNumber, unsigned short int sqlStatesLine) {
+ void Set(Sci_Position lineNumber, unsigned short int sqlStatesLine) {
sqlStatement.Set(lineNumber, sqlStatesLine);
}
@@ -214,7 +214,7 @@ public : return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0;
}
- sql_state_t ForLine(int lineNumber) {
+ sql_state_t ForLine(Sci_Position lineNumber) {
return sqlStatement.ValueAt(lineNumber);
}
@@ -328,7 +328,7 @@ public : return osSQL.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val) {
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) {
if (osSQL.PropertySet(&options, key, val)) {
return 0;
}
@@ -339,9 +339,9 @@ public : return osSQL.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex (unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -372,10 +372,10 @@ private: }
}
- bool IsCommentLine (int line, LexAccessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i + 1 < eol_pos; i++) {
+ bool IsCommentLine (Sci_Position line, LexAccessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i + 1 < eol_pos; i++) {
int style = styler.StyleAt(i);
// MySQL needs -- comments to be followed by space or control char
if (style == SCE_SQL_COMMENTLINE && styler.Match(i, "--"))
@@ -400,7 +400,7 @@ private: WordList kw_user4;
};
-int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -427,7 +427,7 @@ int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) { case 7:
wordListN = &kw_user4;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -439,11 +439,11 @@ int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) { return firstModification;
}
-void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
StyleContext sc(startPos, length, initStyle, styler);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
- int offset = 0;
+ Sci_Position offset = 0;
for (; sc.More(); sc.Forward(), offset++) {
// Determine if the current state should terminate.
@@ -561,7 +561,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, // Locate the unique Q operator character
sc.Complete();
char qOperator = 0x00;
- for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
+ for (Sci_Position styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) {
qOperator = styler.SafeGetCharAt(styleStartPos + 2);
break;
@@ -628,18 +628,18 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
// Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--').
- int lastNLPos = -1;
+ Sci_Position lastNLPos = -1;
// And keep going back until we find an operator ';' followed
// by white-space and/or comments. This will improve folding.
while (--startPos > 0) {
@@ -649,7 +649,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, } else if (ch == ';' &&
styler.StyleAt(startPos) == SCE_SQL_OPERATOR) {
bool isAllClear = true;
- for (int tempPos = startPos + 1;
+ for (Sci_Position tempPos = startPos + 1;
tempPos < lastNLPos;
++tempPos) {
int tempStyle = styler.StyleAt(tempPos);
@@ -672,7 +672,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, // And because folding ends at ';', keep going until we find one
// Otherwise if create ... view ... as is split over multiple
// lines the folding won't always update immediately.
- unsigned int docLength = styler.Length();
+ Sci_PositionU docLength = styler.Length();
for (; endPos < docLength; ++endPos) {
if (styler.SafeGetCharAt(endPos) == ';') {
break;
@@ -692,7 +692,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, if (!options.foldOnlyBegin) {
sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent);
}
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
diff --git a/scintilla/lexers/LexSTTXT.cxx b/scintilla/lexers/LexSTTXT.cxx index e1d2d37..b7ac8f4 100644 --- a/scintilla/lexers/LexSTTXT.cxx +++ b/scintilla/lexers/LexSTTXT.cxx @@ -60,7 +60,7 @@ static void ClassifySTTXTWord(WordList *keywordlists[], StyleContext &sc) sc.SetState(SCE_STTXT_DEFAULT); } -static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle, +static void ColouriseSTTXTDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); @@ -199,12 +199,12 @@ static const char * const STTXTWordListDesc[] = { 0 }; -static bool IsCommentLine(int line, Accessor &styler, bool type) +static bool IsCommentLine(Sci_Position line, Accessor &styler, bool type) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line + 1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eolPos; i++) + for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); @@ -221,7 +221,7 @@ static bool IsCommentLine(int line, Accessor &styler, bool type) return false; } - for (int i = eolPos-2; i>pos; i--) + for (Sci_Position i = eolPos-2; i>pos; i--) { char ch = styler[i]; char chPrev = styler.SafeGetCharAt(i-1); @@ -236,12 +236,12 @@ static bool IsCommentLine(int line, Accessor &styler, bool type) return false; } -static bool IsPragmaLine(int line, Accessor &styler) +static bool IsPragmaLine(Sci_Position line, Accessor &styler) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line+1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line+1) - 1; - for (int i = pos ; i < eolPos ; i++) + for (Sci_Position i = pos ; i < eolPos ; i++) { char ch = styler[i]; int style = styler.StyleAt(i); @@ -254,9 +254,9 @@ static bool IsPragmaLine(int line, Accessor &styler) return false; } -static void GetRangeUpper(unsigned int start,unsigned int end,Accessor &styler,char *s,unsigned int len) +static void GetRangeUpper(Sci_PositionU start,Sci_PositionU end,Accessor &styler,char *s,Sci_PositionU len) { - unsigned int i = 0; + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(toupper(styler[start + i])); i++; @@ -264,8 +264,8 @@ static void GetRangeUpper(unsigned int start,unsigned int end,Accessor &styler,c s[i] = '\0'; } -static void ClassifySTTXTWordFoldPoint(int &levelCurrent,unsigned int lastStart, - unsigned int currentPos, Accessor &styler) +static void ClassifySTTXTWordFoldPoint(int &levelCurrent,Sci_PositionU lastStart, + Sci_PositionU currentPos, Accessor &styler) { char s[256]; GetRangeUpper(lastStart, currentPos, styler, s, sizeof(s)); @@ -321,24 +321,24 @@ static void ClassifySTTXTWordFoldPoint(int &levelCurrent,unsigned int lastStart, } } -static void FoldSTTXTDoc(unsigned int startPos, int length, int initStyle, WordList *[],Accessor &styler) +static void FoldSTTXTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true); - for (unsigned int i = startPos; i < endPos; i++) + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/scintilla/lexers/LexScriptol.cxx b/scintilla/lexers/LexScriptol.cxx index 0b25068..808897a 100644 --- a/scintilla/lexers/LexScriptol.cxx +++ b/scintilla/lexers/LexScriptol.cxx @@ -25,11 +25,11 @@ using namespace Scintilla;
#endif
-static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
+static void ClassifyWordSol(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord)
{
char s[100] = "";
bool wordIsNumber = isdigit(styler[start]) != 0;
- for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
+ for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++)
{
s[i] = styler[start + i];
s[i + 1] = '\0';
@@ -38,7 +38,7 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw if (0 == strcmp(prevWord, "class")) chAttr = SCE_SCRIPTOL_CLASSNAME;
else if (wordIsNumber) chAttr = SCE_SCRIPTOL_NUMBER;
else if (keywords.InList(s)) chAttr = SCE_SCRIPTOL_KEYWORD;
- else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents
+ else for (Sci_PositionU i = 0; i < end - start + 1; i++) // test dotted idents
{
if (styler[start + i] == '.')
{
@@ -50,7 +50,7 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw strcpy(prevWord, s);
}
-static bool IsSolComment(Accessor &styler, int pos, int len)
+static bool IsSolComment(Accessor &styler, Sci_Position pos, Sci_Position len)
{
if(len > 0)
{
@@ -81,7 +81,7 @@ static bool IsSolWordStart(char ch) }
-static int GetSolStringState(Accessor &styler, int i, int *nextIndex)
+static int GetSolStringState(Accessor &styler, Sci_Position i, Sci_Position *nextIndex)
{
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
@@ -109,16 +109,16 @@ static int GetSolStringState(Accessor &styler, int i, int *nextIndex) }
-static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler)
{
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
char stringType = '\"';
if (startPos > 0)
{
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0)
{
startPos = styler.LineStart(lineCurrent-1);
@@ -137,12 +137,12 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle, int state = initStyle & 31;
- int nextIndex = 0;
+ Sci_Position nextIndex = 0;
char chPrev = ' ';
char chPrev2 = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
- for (int i = startPos; i < lengthDoc; i++)
+ for (Sci_Position i = startPos; i < lengthDoc; i++)
{
char ch = chNext;
@@ -317,12 +317,12 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle, }
}
-static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
+static void FoldSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler)
{
- int lengthDoc = startPos + length;
+ Sci_Position lengthDoc = startPos + length;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0)
{
if (lineCurrent > 0)
@@ -341,7 +341,7 @@ static void FoldSolDoc(unsigned int startPos, int length, int initStyle, if (state == SCE_SCRIPTOL_TRIPLE)
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
char chNext = styler[startPos];
- for (int i = startPos; i < lengthDoc; i++)
+ for (Sci_Position i = startPos; i < lengthDoc; i++)
{
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
diff --git a/scintilla/lexers/LexSmalltalk.cxx b/scintilla/lexers/LexSmalltalk.cxx index 448dd5e..9c34e18 100644 --- a/scintilla/lexers/LexSmalltalk.cxx +++ b/scintilla/lexers/LexSmalltalk.cxx @@ -265,7 +265,7 @@ static void handleLetter(StyleContext& sc, WordList* specialSelectorList) sc.ChangeState(state);
}
-static void colorizeSmalltalkDoc(unsigned int startPos, int length, int initStyle, WordList *wordLists[], Accessor &styler)
+static void colorizeSmalltalkDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *wordLists[], Accessor &styler)
{
StyleContext sc(startPos, length, initStyle, styler);
diff --git a/scintilla/lexers/LexSorcus.cxx b/scintilla/lexers/LexSorcus.cxx index 9a94ce6..aa74adb 100644 --- a/scintilla/lexers/LexSorcus.cxx +++ b/scintilla/lexers/LexSorcus.cxx @@ -61,7 +61,7 @@ static inline bool IsSorcusOperator(const int ch) }
-static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseSorcusDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler)
{
diff --git a/scintilla/lexers/LexSpecman.cxx b/scintilla/lexers/LexSpecman.cxx index d2f7e92..a17f150 100644 --- a/scintilla/lexers/LexSpecman.cxx +++ b/scintilla/lexers/LexSpecman.cxx @@ -40,7 +40,7 @@ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '`');
}
-static void ColouriseSpecmanDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler, bool caseSensitive) {
WordList &keywords = *keywordlists[0];
@@ -200,14 +200,14 @@ static void ColouriseSpecmanDoc(unsigned int startPos, int length, int initStyle // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-static void FoldNoBoxSpecmanDoc(unsigned int startPos, int length, int,
+static void FoldNoBoxSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int,
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -216,7 +216,7 @@ static void FoldNoBoxSpecmanDoc(unsigned int startPos, int length, int, char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
//int stylePrev = style;
@@ -269,7 +269,7 @@ static void FoldNoBoxSpecmanDoc(unsigned int startPos, int length, int, }
}
-static void FoldSpecmanDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void FoldSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
FoldNoBoxSpecmanDoc(startPos, length, initStyle, styler);
}
@@ -283,7 +283,7 @@ static const char * const specmanWordLists[] = { 0,
};
-static void ColouriseSpecmanDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseSpecmanDocSensitive(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColouriseSpecmanDoc(startPos, length, initStyle, keywordlists, styler, true);
}
diff --git a/scintilla/lexers/LexSpice.cxx b/scintilla/lexers/LexSpice.cxx index 6986ca9..df70f1c 100644 --- a/scintilla/lexers/LexSpice.cxx +++ b/scintilla/lexers/LexSpice.cxx @@ -34,8 +34,8 @@ using namespace Scintilla; */
static void ColouriseDocument(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
@@ -136,8 +136,8 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywor // ColouriseDocument
//
static void ColouriseDocument(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@@ -145,7 +145,7 @@ static void ColouriseDocument( WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
StyleContext sc(startPos, length, initStyle, styler);
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
while (sc.More()) {
if (sc.atLineEnd) {
diff --git a/scintilla/lexers/LexTACL.cxx b/scintilla/lexers/LexTACL.cxx index 8b85ac0..85dbb4a 100644 --- a/scintilla/lexers/LexTACL.cxx +++ b/scintilla/lexers/LexTACL.cxx @@ -45,12 +45,12 @@ inline bool isTACLwordstart(char ch) return ch == '#' || ch == '|' || ch == '_' || iswordstart(ch);
}
-static void getRange(unsigned int start,
- unsigned int end,
+static void getRange(Sci_PositionU start,
+ Sci_PositionU end,
Accessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -65,7 +65,7 @@ static bool IsStreamCommentStyle(int style) { style == SCE_C_COMMENTDOCKEYWORDERROR;
}
-static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
+static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr, bool bInAsm) {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
styler.ColourTo(end, SCE_C_REGEX);
} else
@@ -73,7 +73,7 @@ static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool }
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
-static int classifyWordTACL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) {
+static int classifyWordTACL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) {
int ret = 0;
WordList& keywords = *keywordlists[0];
@@ -122,7 +122,7 @@ static int classifyFoldPointTACL(const char* s) { return lev;
}
-static void ColouriseTACLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseTACLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
@@ -132,11 +132,11 @@ static void ColouriseTACLDoc(unsigned int startPos, int length, int initStyle, W state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
bool bInClassDefinition;
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
bInClassDefinition = (styler.GetLineState(currentLine) == 1);
@@ -151,7 +151,7 @@ static void ColouriseTACLDoc(unsigned int startPos, int length, int initStyle, W styler.StartSegment(startPos);
int visibleChars = 0;
- unsigned int i;
+ Sci_PositionU i;
for (i = startPos; i < lengthDoc; i++) {
char ch = chNext;
@@ -250,7 +250,7 @@ static void ColouriseTACLDoc(unsigned int startPos, int length, int initStyle, W if (ch == '}' || (ch == '\r' || ch == '\n')) {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
- (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
+ (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
@@ -280,14 +280,14 @@ static void ColouriseTACLDoc(unsigned int startPos, int length, int initStyle, W ColourTo(styler, lengthDoc - 1, state, bInAsm);
}
-static void FoldTACLDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void FoldTACLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
@@ -295,9 +295,9 @@ static void FoldTACLDoc(unsigned int startPos, int length, int initStyle, WordLi int style = initStyle;
bool section = false;
- int lastStart = 0;
+ Sci_Position lastStart = 0;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -346,7 +346,7 @@ static void FoldTACLDoc(unsigned int startPos, int length, int initStyle, WordLi if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
if (ch == '{' && chNext == '$') {
- unsigned int j=i+2; // skip {$
+ Sci_PositionU j=i+2; // skip {$
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
diff --git a/scintilla/lexers/LexTADS3.cxx b/scintilla/lexers/LexTADS3.cxx index 490f1f7..5f6f0ca 100644 --- a/scintilla/lexers/LexTADS3.cxx +++ b/scintilla/lexers/LexTADS3.cxx @@ -269,7 +269,7 @@ static void ColouriseTADS3HTMLTag(StyleContext &sc, int &lineState) { }
static void ColouriseTADS3Keyword(StyleContext &sc,
- WordList *keywordlists[], unsigned int endPos) {
+ WordList *keywordlists[], Sci_PositionU endPos) {
char s[250];
WordList &keywords = *keywordlists[0];
WordList &userwords1 = *keywordlists[1];
@@ -283,7 +283,7 @@ static void ColouriseTADS3Keyword(StyleContext &sc, sc.GetCurrent(s, sizeof(s));
if ( strcmp(s, "is") == 0 || strcmp(s, "not") == 0) {
// have to find if "in" is next
- int n = 1;
+ Sci_Position n = 1;
while (n + sc.currentPos < endPos && IsASpaceOrTab(sc.GetRelative(n)))
n++;
if (sc.GetRelative(n) == 'i' && sc.GetRelative(n+1) == 'n') {
@@ -513,13 +513,13 @@ static void ColouriseTADS3Number(StyleContext &sc) { sc.SetState(endState);
}
-static void ColouriseTADS3Doc(unsigned int startPos, int length, int initStyle,
+static void ColouriseTADS3Doc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int visibleChars = 0;
int bracketLevel = 0;
int lineState = 0;
- unsigned int endPos = startPos + length;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_PositionU endPos = startPos + length;
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
lineState = styler.GetLineState(lineCurrent-1);
}
@@ -707,9 +707,9 @@ static inline bool IsSpaceEquivalent(const int ch, const int style) { || style == SCE_T3_PREPROCESSOR;
}
-static char peekAhead(unsigned int startPos, unsigned int endPos,
+static char peekAhead(Sci_PositionU startPos, Sci_PositionU endPos,
Accessor &styler) {
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
int style = styler.StyleAt(i);
char ch = styler[i];
if (!IsSpaceEquivalent(ch, style)) {
@@ -728,10 +728,10 @@ static char peekAhead(unsigned int startPos, unsigned int endPos, return ' ';
}
-static void FoldTADS3Doc(unsigned int startPos, int length, int initStyle,
+static void FoldTADS3Doc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
- unsigned int endPos = startPos + length;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_PositionU endPos = startPos + length;
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -747,7 +747,7 @@ static void FoldTADS3Doc(unsigned int startPos, int length, int initStyle, char ch = chNext;
int stylePrev = style;
bool redo = false;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
if (redo) {
redo = false;
i--;
diff --git a/scintilla/lexers/LexTAL.cxx b/scintilla/lexers/LexTAL.cxx index 465e7c4..b543dcf 100644 --- a/scintilla/lexers/LexTAL.cxx +++ b/scintilla/lexers/LexTAL.cxx @@ -45,12 +45,12 @@ inline bool isTALwordstart(char ch) return ch == '$' || ch == '^' || iswordstart(ch);
}
-static void getRange(unsigned int start,
- unsigned int end,
+static void getRange(Sci_PositionU start,
+ Sci_PositionU end,
Accessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -65,7 +65,7 @@ static bool IsStreamCommentStyle(int style) { style == SCE_C_COMMENTDOCKEYWORDERROR;
}
-static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
+static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr, bool bInAsm) {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
styler.ColourTo(end, SCE_C_REGEX);
} else
@@ -73,7 +73,7 @@ static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool }
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
-static int classifyWordTAL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) {
+static int classifyWordTAL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) {
int ret = 0;
WordList& keywords = *keywordlists[0];
@@ -122,7 +122,7 @@ static int classifyFoldPointTAL(const char* s) { return lev;
}
-static void ColouriseTALDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+static void ColouriseTALDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
@@ -132,11 +132,11 @@ static void ColouriseTALDoc(unsigned int startPos, int length, int initStyle, Wo state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
- unsigned int lengthDoc = startPos + length;
+ Sci_PositionU lengthDoc = startPos + length;
bool bInClassDefinition;
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
bInClassDefinition = (styler.GetLineState(currentLine) == 1);
@@ -151,7 +151,7 @@ static void ColouriseTALDoc(unsigned int startPos, int length, int initStyle, Wo styler.StartSegment(startPos);
int visibleChars = 0;
- for (unsigned int i = startPos; i < lengthDoc; i++) {
+ for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -244,7 +244,7 @@ static void ColouriseTALDoc(unsigned int startPos, int length, int initStyle, Wo if (ch == '!' || (ch == '\r' || ch == '\n')) {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
- (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
+ (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
@@ -268,14 +268,14 @@ static void ColouriseTALDoc(unsigned int startPos, int length, int initStyle, Wo ColourTo(styler, lengthDoc - 1, state, bInAsm);
}
-static void FoldTALDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void FoldTALDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
@@ -284,9 +284,9 @@ static void FoldTALDoc(unsigned int startPos, int length, int initStyle, WordLis bool was_end = false;
bool section = false;
- int lastStart = 0;
+ Sci_Position lastStart = 0;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -345,7 +345,7 @@ static void FoldTALDoc(unsigned int startPos, int length, int initStyle, WordLis if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
if (ch == '{' && chNext == '$') {
- unsigned int j=i+2; // skip {$
+ Sci_PositionU j=i+2; // skip {$
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
diff --git a/scintilla/lexers/LexTCL.cxx b/scintilla/lexers/LexTCL.cxx index 5147cab..763ced1 100644 --- a/scintilla/lexers/LexTCL.cxx +++ b/scintilla/lexers/LexTCL.cxx @@ -45,7 +45,7 @@ static inline bool IsANumberChar(int ch) { ch == '.' || ch == '-' || ch == '+');
}
-static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *keywordlists[], Accessor &styler) {
+static void ColouriseTCLDoc(Sci_PositionU startPos, Sci_Position length, int , WordList *keywordlists[], Accessor &styler) {
#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT)
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool commentLevel = false;
@@ -58,7 +58,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k bool expected = 0;
bool subParen = 0;
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
if (currentLine > 0)
currentLine--;
length += startPos - styler.LineStart(currentLine);
diff --git a/scintilla/lexers/LexTCMD.cxx b/scintilla/lexers/LexTCMD.cxx index c4554d9..c4a14fd 100644 --- a/scintilla/lexers/LexTCMD.cxx +++ b/scintilla/lexers/LexTCMD.cxx @@ -33,7 +33,7 @@ static bool IsAlphabetic(int ch) { return IsASCII(ch) && isalpha(ch);
}
-static inline bool AtEOL(Accessor &styler, unsigned int i) {
+static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
@@ -92,12 +92,12 @@ static unsigned int GetBatchVarLen( char *wordBuffer ) }
-static void ColouriseTCMDLine( char *lineBuffer, unsigned int lengthLine, unsigned int startLine, unsigned int endPos, WordList *keywordlists[], Accessor &styler)
+static void ColouriseTCMDLine( char *lineBuffer, Sci_PositionU lengthLine, Sci_PositionU startLine, Sci_PositionU endPos, WordList *keywordlists[], Accessor &styler)
{
- unsigned int offset = 0; // Line Buffer Offset
+ Sci_PositionU offset = 0; // Line Buffer Offset
char wordBuffer[260]; // Word Buffer - large to catch long paths
- unsigned int wbl; // Word Buffer Length
- unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length
+ Sci_PositionU wbl; // Word Buffer Length
+ Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length
WordList &keywords = *keywordlists[0]; // Internal Commands
// WordList &keywords2 = *keywordlists[1]; // Aliases (optional)
bool isDelayedExpansion = 1; // !var!
@@ -252,7 +252,7 @@ static void ColouriseTCMDLine( char *lineBuffer, unsigned int lengthLine, unsign // no further Regular Keyword Checking
continueProcessing = false;
sKeywordFound = true;
- wbo = (unsigned int)strlen( sKeywordBuffer );
+ wbo = (Sci_PositionU)strlen( sKeywordBuffer );
// Colorize Special Keyword as Regular Keyword
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_WORD);
@@ -401,15 +401,15 @@ ColorizeArg: styler.ColourTo(endPos, SCE_TCMD_DEFAULT);
}
-static void ColouriseTCMDDoc( unsigned int startPos, int length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler )
+static void ColouriseTCMDDoc( Sci_PositionU startPos, Sci_Position length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler )
{
char lineBuffer[16384];
styler.StartAt(startPos);
styler.StartSegment(startPos);
- unsigned int linePos = 0;
- unsigned int startLine = startPos;
- for (unsigned int i = startPos; i < startPos + length; i++) {
+ Sci_PositionU linePos = 0;
+ Sci_PositionU startLine = startPos;
+ for (Sci_PositionU i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
@@ -434,18 +434,18 @@ static void StrUpr(char *s) { }
// Folding support (for DO, IFF, SWITCH, TEXT, and command groups)
-static void FoldTCMDDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldTCMDDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
- int line = styler.GetLine(startPos);
+ Sci_Position line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int levelIndent = 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
char s[16] = "";
char chPrev = styler.SafeGetCharAt(startPos - 1);
// Scan for ( and )
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
int c = styler.SafeGetCharAt(i, '\n');
int style = styler.StyleAt(i);
@@ -461,7 +461,7 @@ static void FoldTCMDDoc(unsigned int startPos, int length, int, WordList *[], Ac }
if (( bLineStart ) && ( style == SCE_TCMD_WORD )) {
- for (unsigned int j = 0; j < 10; j++) {
+ for (Sci_PositionU j = 0; j < 10; j++) {
if (!iswordchar(styler[i + j])) {
break;
}
diff --git a/scintilla/lexers/LexTeX.cxx b/scintilla/lexers/LexTeX.cxx index 66f3233..eff38ff 100644 --- a/scintilla/lexers/LexTeX.cxx +++ b/scintilla/lexers/LexTeX.cxx @@ -69,7 +69,7 @@ using namespace Scintilla; // Auxiliary functions:
-static inline bool endOfLine(Accessor &styler, unsigned int i) {
+static inline bool endOfLine(Accessor &styler, Sci_PositionU i) {
return
(styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ;
}
@@ -122,18 +122,18 @@ static inline bool isTeXseven(int ch) { // Interface determination
static int CheckTeXInterface(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
Accessor &styler,
int defaultInterface) {
char lineBuffer[1024] ;
- unsigned int linePos = 0 ;
+ Sci_PositionU linePos = 0 ;
// some day we can make something lexer.tex.mapping=(all,0)(nl,1)(en,2)...
if (styler.SafeGetCharAt(0) == '%') {
- for (unsigned int i = 0; i < startPos + length; i++) {
+ for (Sci_PositionU i = 0; i < startPos + length; i++) {
lineBuffer[linePos++] = styler.SafeGetCharAt(i) ;
if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
lineBuffer[linePos] = '\0';
@@ -170,8 +170,8 @@ static int CheckTeXInterface( }
static void ColouriseTeXDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int,
WordList *keywordlists[],
Accessor &styler) {
@@ -297,9 +297,9 @@ static inline bool isWordChar(int ch) { return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'));
}
-static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command)
+static int ParseTeXCommand(Sci_PositionU pos, Accessor &styler, char *command)
{
- int length=0;
+ Sci_Position length=0;
char ch=styler.SafeGetCharAt(pos+1);
if(ch==',' || ch==':' || ch==';' || ch=='%'){
@@ -362,11 +362,11 @@ static int classifyFoldPointTeXUnpaired(const char* s) { return lev;
}
-static bool IsTeXCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
+static bool IsTeXCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
- int startpos = pos;
+ Sci_Position startpos = pos;
while (startpos<eol_pos){
char ch = styler[startpos];
@@ -380,18 +380,18 @@ static bool IsTeXCommentLine(int line, Accessor &styler) { // FoldTeXDoc: borrowed from VisualTeX with modifications
-static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
+static void FoldTexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
- unsigned int endPos = startPos+length;
+ Sci_PositionU endPos = startPos+length;
int visibleChars=0;
- int lineCurrent=styler.GetLine(startPos);
+ Sci_Position lineCurrent=styler.GetLine(startPos);
int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent=levelPrev;
char chNext=styler[startPos];
char buffer[100]="";
- for (unsigned int i=startPos; i < endPos; i++) {
+ for (Sci_PositionU i=startPos; i < endPos; i++) {
char ch=chNext;
chNext=styler.SafeGetCharAt(i+1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
diff --git a/scintilla/lexers/LexTxt2tags.cxx b/scintilla/lexers/LexTxt2tags.cxx index 42d372b..5a77cb2 100644 --- a/scintilla/lexers/LexTxt2tags.cxx +++ b/scintilla/lexers/LexTxt2tags.cxx @@ -45,8 +45,8 @@ static inline bool IsNewline(const int ch) { }
// True if can follow ch down to the end with possibly trailing whitespace
-static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) {
- unsigned int i = 0;
+static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) {
+ Sci_PositionU i = 0;
while (sc.GetRelative(++i) == ch)
;
// Skip over whitespace
@@ -63,7 +63,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en // Does the previous line have more than spaces and tabs?
static bool HasPrevLineContent(StyleContext &sc) {
- int i = 0;
+ Sci_Position i = 0;
// Go back to the previous newline
while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))
;
@@ -77,9 +77,9 @@ static bool HasPrevLineContent(StyleContext &sc) { }
// Separator line
-static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
+static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) {
int count = 1;
- unsigned int i = 0;
+ Sci_PositionU i = 0;
for (;;) {
++i;
int c = sc.GetRelative(i);
@@ -103,9 +103,9 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) { }
}
-static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle,
+static void ColorizeTxt2tagsDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList **, Accessor &styler) {
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int precharCount = 0;
// Don't advance on a new loop iteration and retry at the same position.
// Useful in the corner case of having to start at the beginning file position
@@ -188,7 +188,7 @@ static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle if (IsNewline(sc.ch))
sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
if (sc.atLineStart && sc.Match("```")) {
- int i = 1;
+ Sci_Position i = 1;
while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos)
i++;
sc.Forward(i);
@@ -375,7 +375,7 @@ static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle }
// Ordered list
else if (IsADigit(sc.ch)) {
- int digitCount = 0;
+ Sci_Position digitCount = 0;
while (IsADigit(sc.GetRelative(++digitCount)))
;
if (sc.GetRelative(digitCount) == '.' &&
@@ -405,8 +405,8 @@ static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle // }
// Links and Images
if (sc.Match("![") || sc.ch == '[') {
- int i = 0, j = 0, k = 0;
- int len = endPos - sc.currentPos;
+ Sci_Position i = 0, j = 0, k = 0;
+ Sci_Position len = endPos - sc.currentPos;
while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
;
if (sc.GetRelative(i) == ']') {
diff --git a/scintilla/lexers/LexVB.cxx b/scintilla/lexers/LexVB.cxx index 60153cf..21aee77 100644 --- a/scintilla/lexers/LexVB.cxx +++ b/scintilla/lexers/LexVB.cxx @@ -31,7 +31,7 @@ using namespace Scintilla; #define SCE_B_FILENUMBER SCE_B_DEFAULT+100
-static bool IsVBComment(Accessor &styler, int pos, int len) {
+static bool IsVBComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
return len > 0 && styler[pos] == '\'';
}
@@ -58,7 +58,7 @@ static inline bool IsANumberChar(int ch) { ch == '.' || ch == '-' || ch == '+');
}
-static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler, bool vbScriptSyntax) {
WordList &keywords = *keywordlists[0];
@@ -254,12 +254,12 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle, sc.Complete();
}
-static void FoldVBDoc(unsigned int startPos, int length, int,
+static void FoldVBDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
- int endPos = startPos + length;
+ Sci_Position endPos = startPos + length;
// Backtrack to previous line in case need to fix its fold status
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
@@ -269,7 +269,7 @@ static void FoldVBDoc(unsigned int startPos, int length, int, int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment);
char chNext = styler[startPos];
- for (int i = startPos; i < endPos; i++) {
+ for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@@ -296,12 +296,12 @@ static void FoldVBDoc(unsigned int startPos, int length, int, }
}
-static void ColouriseVBNetDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseVBNetDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, false);
}
-static void ColouriseVBScriptDoc(unsigned int startPos, int length, int initStyle,
+static void ColouriseVBScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, true);
}
diff --git a/scintilla/lexers/LexVHDL.cxx b/scintilla/lexers/LexVHDL.cxx index 53e8377..5d89a8f 100644 --- a/scintilla/lexers/LexVHDL.cxx +++ b/scintilla/lexers/LexVHDL.cxx @@ -33,8 +33,8 @@ using namespace Scintilla; #endif
static void ColouriseVHDLDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
@@ -57,8 +57,8 @@ static inline bool IsABlank(unsigned int ch) { /***************************************/
static void ColouriseVHDLDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
@@ -157,10 +157,10 @@ static void ColouriseVHDLDoc( sc.Complete();
}
//=============================================================================
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
if ((ch == '-') && (chNext == '-'))
@@ -170,11 +170,11 @@ static bool IsCommentLine(int line, Accessor &styler) { }
return false;
}
-static bool IsCommentBlockStart(int line, Accessor &styler)
+static bool IsCommentBlockStart(Sci_Position line, Accessor &styler)
{
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
char style = styler.StyleAt(i);
@@ -184,12 +184,12 @@ static bool IsCommentBlockStart(int line, Accessor &styler) return false;
}
-static bool IsCommentBlockEnd(int line, Accessor &styler)
+static bool IsCommentBlockEnd(Sci_Position line, Accessor &styler)
{
- int pos = styler.LineStart(line);
- int eol_pos = styler.LineStart(line + 1) - 1;
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eol_pos; i++) {
+ for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
char style = styler.StyleAt(i);
@@ -207,8 +207,8 @@ static bool IsCommentStyle(char style) //=============================================================================
// Folding the code
static void FoldNoBoxVHDLDoc(
- unsigned int startPos,
- int length,
+ Sci_PositionU startPos,
+ Sci_Position length,
int,
Accessor &styler)
{
@@ -228,9 +228,9 @@ static void FoldNoBoxVHDLDoc( //bool foldAtWhen = styler.GetPropertyInt("fold.at.When", 1) != 0; //< fold at when in case statements
int visibleChars = 0;
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if(lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@@ -240,15 +240,15 @@ static void FoldNoBoxVHDLDoc( int levelNext = levelCurrent;
/***************************************/
- int lastStart = 0;
+ Sci_Position lastStart = 0;
char prevWord[32] = "";
/***************************************/
// Find prev word
// The logic for going up or down a level depends on a the previous keyword
// This code could be cleaned up.
- int end = 0;
- unsigned int j;
+ Sci_Position end = 0;
+ Sci_PositionU j;
for(j = startPos; j>0; j--)
{
char ch = styler.SafeGetCharAt(j);
@@ -267,7 +267,7 @@ static void FoldNoBoxVHDLDoc( if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0))
{
char s[32];
- unsigned int k;
+ Sci_PositionU k;
for(k=0; (k<31 ) && (k<end-j+1 ); k++) {
s[k] = static_cast<char>(tolower(styler[j+k]));
}
@@ -280,7 +280,7 @@ static void FoldNoBoxVHDLDoc( }
}
}
- for(j=j+static_cast<unsigned int>(strlen(prevWord)); j<endPos; j++)
+ for(j=j+static_cast<Sci_PositionU>(strlen(prevWord)); j<endPos; j++)
{
char ch = styler.SafeGetCharAt(j);
int style = styler.StyleAt(j);
@@ -300,13 +300,13 @@ static void FoldNoBoxVHDLDoc( //Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent);
/***************************************/
- for (unsigned int i = startPos; i < endPos; i++)
+ for (Sci_PositionU i = startPos; i < endPos; i++)
{
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chPrev = styler.SafeGetCharAt(i - 1);
chNextNonBlank = chNext;
- unsigned int j = i+1;
+ Sci_PositionU j = i+1;
while(IsABlank(chNextNonBlank) && j<endPos)
{
j ++ ;
@@ -365,7 +365,7 @@ static void FoldNoBoxVHDLDoc( if(IsAWordChar(ch) && !IsAWordChar(chNext)) {
char s[32];
- unsigned int k;
+ Sci_PositionU k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
}
@@ -399,7 +399,7 @@ static void FoldNoBoxVHDLDoc( {
if (strcmp(prevWord, "end") != 0 && lastStart)
{ // check for instantiated unit by backward searching for the colon.
- unsigned pos = lastStart;
+ Sci_PositionU pos = lastStart;
char chAtPos, styleAtPos;
do{// skip white spaces
pos--;
@@ -427,7 +427,7 @@ static void FoldNoBoxVHDLDoc( { // This code checks to see if the procedure / function is a definition within a "package"
// rather than the actual code in the body.
int BracketLevel = 0;
- for(int pos=i+1; pos<styler.Length(); pos++)
+ for(Sci_Position pos=i+1; pos<styler.Length(); pos++)
{
int styleAtPos = styler.StyleAt(pos);
char chAtPos = styler.SafeGetCharAt(pos);
@@ -510,7 +510,7 @@ static void FoldNoBoxVHDLDoc( }
//=============================================================================
-static void FoldVHDLDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+static void FoldVHDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
Accessor &styler) {
FoldNoBoxVHDLDoc(startPos, length, initStyle, styler);
}
diff --git a/scintilla/lexers/LexVerilog.cxx b/scintilla/lexers/LexVerilog.cxx index d8d958e..fc2bc2b 100644 --- a/scintilla/lexers/LexVerilog.cxx +++ b/scintilla/lexers/LexVerilog.cxx @@ -40,12 +40,12 @@ namespace { // Use an unnamed namespace to protect the functions and classes from name conflicts
struct PPDefinition {
- int line;
+ Sci_Position line;
std::string key;
std::string value;
bool isUndef;
std::string arguments;
- PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
+ PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
}
};
@@ -101,14 +101,14 @@ public: class PPStates {
std::vector<LinePPState> vlls;
public:
- LinePPState ForLine(int line) const {
+ LinePPState ForLine(Sci_Position line) const {
if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {
return vlls[line];
} else {
return LinePPState();
}
}
- void Add(int line, LinePPState lls) {
+ void Add(Sci_Position line, LinePPState lls) {
vlls.resize(line+1);
vlls[line] = lls;
}
@@ -209,7 +209,7 @@ class LexerVerilog : public ILexerWithSubStyles { // typdefFlag: EOL while parsing typedef statement, terminated by ';'
enum {foldExternFlag = 0x01, foldWaitDisableFlag = 0x02, typedefFlag = 0x04, protectedFlag = 0x08};
// map using line number as key to store fold state information
- std::map<int, int> foldState;
+ std::map<Sci_Position, int> foldState;
public:
LexerVerilog() :
@@ -232,15 +232,15 @@ public: const char* SCI_METHOD DescribeProperty(const char* name) {
return osVerilog.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char* key, const char* val) {
+ Sci_Position SCI_METHOD PropertySet(const char* key, const char* val) {
return osVerilog.PropertySet(&options, key, val);
}
const char* SCI_METHOD DescribeWordListSets() {
return osVerilog.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char* wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char* wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void* SCI_METHOD PrivateCall(int, void*) {
return 0;
}
@@ -285,7 +285,7 @@ public: std::vector<std::string> Tokenize(const std::string &expr) const;
};
-int SCI_METHOD LexerVerilog::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerVerilog::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -307,7 +307,7 @@ int SCI_METHOD LexerVerilog::WordListSet(int n, const char *wl) { wordListN = &ppDefinitions;
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -363,18 +363,18 @@ static inline bool AllUpperCase(const char *a) { // Functor used to truncate history
struct After {
- int line;
- explicit After(int line_) : line(line_) {}
+ Sci_Position line;
+ explicit After(Sci_Position line_) : line(line_) {}
bool operator()(PPDefinition &p) const {
return p.line > line;
}
};
-static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
+static std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) {
std::string restOfLine;
- int i =0;
+ Sci_Position i =0;
char ch = styler.SafeGetCharAt(start, '\n');
- int endLine = styler.LineEnd(styler.GetLine(start));
+ Sci_Position endLine = styler.LineEnd(styler.GetLine(start));
while (((start+i) < endLine) && (ch != '\r')) {
char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
if (ch == '/' && (chNext == '/' || chNext == '*'))
@@ -391,7 +391,7 @@ static bool IsSpaceOrTab(int ch) { return ch == ' ' || ch == '\t';
}
-void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess)
+void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess)
{
LexAccessor styler(pAccess);
@@ -399,7 +399,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty int lineState = kwOther;
bool continuationLine = false;
- int curLine = styler.GetLine(startPos);
+ Sci_Position curLine = styler.GetLine(startPos);
if (curLine > 0) lineState = styler.GetLineState(curLine - 1);
// Do not leak onto next line
@@ -411,7 +411,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty (MaskActive(initStyle) == SCE_V_COMMENTLINEBANG)) {
// Set continuationLine if last character of previous line is '\'
if (curLine > 0) {
- int endLinePrevious = styler.LineEnd(curLine - 1);
+ Sci_Position endLinePrevious = styler.LineEnd(curLine - 1);
if (endLinePrevious > 0) {
continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\';
}
@@ -443,7 +443,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty }
int activitySet = preproc.IsInactive() ? activeFlag : 0;
- int lineEndNext = styler.LineEnd(curLine);
+ Sci_Position lineEndNext = styler.LineEnd(curLine);
bool isEscapedId = false; // true when parsing an escaped Identifier
bool isProtected = (lineState&kwProtected) != 0; // true when parsing a protected region
@@ -473,7 +473,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty // Handle line continuation generically.
if (sc.ch == '\\') {
- if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) {
+ if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) {
curLine++;
lineEndNext = styler.LineEnd(curLine);
vlls.Add(curLine, preproc);
@@ -764,10 +764,10 @@ static bool IsStreamCommentStyle(int style) { return style == SCE_V_COMMENT;
}
-static bool IsCommentLine(int line, LexAccessor &styler) {
- int pos = styler.LineStart(line);
- int eolPos = styler.LineStart(line + 1) - 1;
- for (int i = pos; i < eolPos; i++) {
+static bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eolPos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eolPos; i++) {
char ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
@@ -784,17 +784,17 @@ static bool IsCommentLine(int line, LexAccessor &styler) { // Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess)
+void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess)
{
LexAccessor styler(pAccess);
bool foldAtBrace = 1;
bool foldAtParenthese = 1;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
// Move back one line to be compatible with LexerModule::Fold behavior, fixes problem with foldComment behavior
if (lineCurrent > 0) {
lineCurrent--;
- int newStartPos = styler.LineStart(lineCurrent);
+ Sci_Position newStartPos = styler.LineStart(lineCurrent);
length += startPos - newStartPos;
startPos = newStartPos;
initStyle = 0;
@@ -802,7 +802,7 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt initStyle = styler.StyleAt(startPos - 1);
}
}
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
@@ -815,7 +815,7 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt // restore fold state (if it exists) for prior line
int stateCurrent = 0;
- std::map<int,int>::iterator foldStateIterator = foldState.find(lineCurrent-1);
+ std::map<Sci_Position,int>::iterator foldStateIterator = foldState.find(lineCurrent-1);
if (foldStateIterator != foldState.end()) {
stateCurrent = foldStateIterator->second;
}
@@ -826,7 +826,7 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt foldState.erase(foldStateIterator, foldState.end());
}
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@@ -863,7 +863,7 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt }
}
if (ch == '`') {
- unsigned int j = i + 1;
+ Sci_PositionU j = i + 1;
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
@@ -943,7 +943,7 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt }
}
if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) {
- unsigned int j = i;
+ Sci_PositionU j = i;
if (styler.Match(j, "case") ||
styler.Match(j, "casex") ||
styler.Match(j, "casez") ||
diff --git a/scintilla/lexers/LexVisualProlog.cxx b/scintilla/lexers/LexVisualProlog.cxx index 66d997a..b28d1c5 100644 --- a/scintilla/lexers/LexVisualProlog.cxx +++ b/scintilla/lexers/LexVisualProlog.cxx @@ -91,13 +91,13 @@ public: const char * SCI_METHOD DescribeProperty(const char *name) {
return osVisualProlog.DescribeProperty(name);
}
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
return osVisualProlog.DescribeWordListSets();
}
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
@@ -108,14 +108,14 @@ public: }
};
-int SCI_METHOD LexerVisualProlog::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerVisualProlog::PropertySet(const char *key, const char *val) {
if (osVisualProlog.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
-int SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@@ -131,7 +131,7 @@ int SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) { wordListN = &docKeywords;
break;
}
- int firstModification = -1;
+ Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@@ -145,8 +145,8 @@ int SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) { // Functor used to truncate history
struct After {
- int line;
- After(int line_) : line(line_) {}
+ Sci_Position line;
+ After(Sci_Position line_) : line(line_) {}
};
static bool isLowerLetter(int ch){
@@ -208,13 +208,13 @@ static bool isOpenStringVerbatim(int next, int &closingQuote){ }
// Look ahead to see which colour "end" should have (takes colour after the following keyword)
-static void endLookAhead(char s[], LexAccessor &styler, int start) {
+static void endLookAhead(char s[], LexAccessor &styler, Sci_Position start) {
char ch = styler.SafeGetCharAt(start, '\n');
while (' ' == ch) {
start++;
ch = styler.SafeGetCharAt(start, '\n');
}
- int i = 0;
+ Sci_Position i = 0;
while (i < 100 && isLowerLetter(ch)){
s[i] = ch;
i++;
@@ -244,7 +244,7 @@ static void forwardEscapeLiteral(StyleContext &sc, int EscapeState) { }
}
-void SCI_METHOD LexerVisualProlog::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerVisualProlog::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
CharacterSet setDoxygen(CharacterSet::setAlpha, "");
CharacterSet setNumber(CharacterSet::setNone, "+-.0123456789abcdefABCDEFxoXO");
@@ -252,7 +252,7 @@ void SCI_METHOD LexerVisualProlog::Lex(unsigned int startPos, int length, int in StyleContext sc(startPos, length, initStyle, styler, 0x7f);
int styleBeforeDocKeyword = SCE_VISUALPROLOG_DEFAULT;
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
int closingQuote = '"';
int nestLevel = 0;
@@ -446,13 +446,13 @@ void SCI_METHOD LexerVisualProlog::Lex(unsigned int startPos, int length, int in // level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
-void SCI_METHOD LexerVisualProlog::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerVisualProlog::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length;
+ Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
- int currentLine = styler.GetLine(startPos);
+ Sci_Position currentLine = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (currentLine > 0)
levelCurrent = styler.LevelAt(currentLine-1) >> 16;
@@ -461,7 +461,7 @@ void SCI_METHOD LexerVisualProlog::Fold(unsigned int startPos, int length, int i char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
- for (unsigned int i = startPos; i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
style = styleNext;
@@ -492,7 +492,7 @@ void SCI_METHOD LexerVisualProlog::Fold(unsigned int startPos, int length, int i currentLine++;
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
- if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
+ if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) {
// There is an empty line at end of file so give it same level and empty
styler.SetLevel(currentLine, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
}
diff --git a/scintilla/lexers/LexYAML.cxx b/scintilla/lexers/LexYAML.cxx index 2118a10..71cb4e9 100644 --- a/scintilla/lexers/LexYAML.cxx +++ b/scintilla/lexers/LexYAML.cxx @@ -32,7 +32,7 @@ static const char * const yamlWordListDesc[] = { 0
};
-static inline bool AtEOL(Accessor &styler, unsigned int i) {
+static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
@@ -59,14 +59,14 @@ static unsigned int SpaceCount(char* lineBuffer) { static void ColouriseYAMLLine(
char *lineBuffer,
- unsigned int currentLine,
- unsigned int lengthLine,
- unsigned int startLine,
- unsigned int endPos,
+ Sci_PositionU currentLine,
+ Sci_PositionU lengthLine,
+ Sci_PositionU startLine,
+ Sci_PositionU endPos,
WordList &keywords,
Accessor &styler) {
- unsigned int i = 0;
+ Sci_PositionU i = 0;
bool bInQuotes = false;
unsigned int indentAmount = SpaceCount(lineBuffer);
@@ -111,7 +111,7 @@ static void ColouriseYAMLLine( i++;
while ((i < lengthLine) && isspacechar(lineBuffer[i]))
i++;
- unsigned int endValue = lengthLine - 1;
+ Sci_PositionU endValue = lengthLine - 1;
while ((endValue >= i) && isspacechar(lineBuffer[endValue]))
endValue--;
lineBuffer[endValue + 1] = '\0';
@@ -148,7 +148,7 @@ static void ColouriseYAMLLine( styler.ColourTo(endPos, SCE_YAML_KEYWORD);
return;
} else {
- unsigned int i2 = i;
+ Sci_PositionU i2 = i;
while ((i < lengthLine) && lineBuffer[i]) {
if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
styler.ColourTo(endPos, SCE_YAML_DEFAULT);
@@ -168,17 +168,17 @@ static void ColouriseYAMLLine( styler.ColourTo(endPos, SCE_YAML_DEFAULT);
}
-static void ColouriseYAMLDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
+static void ColouriseYAMLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) {
char lineBuffer[1024] = "";
styler.StartAt(startPos);
styler.StartSegment(startPos);
- unsigned int linePos = 0;
- unsigned int startLine = startPos;
- unsigned int endPos = startPos + length;
- unsigned int maxPos = styler.Length();
- unsigned int lineCurrent = styler.GetLine(startPos);
+ Sci_PositionU linePos = 0;
+ Sci_PositionU startLine = startPos;
+ Sci_PositionU endPos = startPos + length;
+ Sci_PositionU maxPos = styler.Length();
+ Sci_PositionU lineCurrent = styler.GetLine(startPos);
- for (unsigned int i = startPos; i < maxPos && i < endPos; i++) {
+ for (Sci_PositionU i = startPos; i < maxPos && i < endPos; i++) {
lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
@@ -194,18 +194,18 @@ static void ColouriseYAMLDoc(unsigned int startPos, int length, int, WordList *k }
}
-static bool IsCommentLine(int line, Accessor &styler) {
- int pos = styler.LineStart(line);
+static bool IsCommentLine(Sci_Position line, Accessor &styler) {
+ Sci_Position pos = styler.LineStart(line);
if (styler[pos] == '#')
return true;
return false;
}
-static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
+static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
- const int maxPos = startPos + length;
- const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
- const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
+ const Sci_Position maxPos = startPos + length;
+ const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
+ const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
const bool foldComment = styler.GetPropertyInt("fold.comment.yaml") != 0;
// Backtrack to previous non-blank line so we can determine indent level
@@ -213,7 +213,7 @@ static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unu // and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
@@ -236,7 +236,7 @@ static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unu // Gather info
int lev = indentCurrent;
- int lineNext = lineCurrent + 1;
+ Sci_Position lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
@@ -280,7 +280,7 @@ static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unu // which is indented more than the line after the end of
// the comment-block, use the level of the block before
- int skipLine = lineNext;
+ Sci_Position skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
diff --git a/scintilla/lexlib/Accessor.cxx b/scintilla/lexlib/Accessor.cxx index 7c8ffe4..0c3b564 100644 --- a/scintilla/lexlib/Accessor.cxx +++ b/scintilla/lexlib/Accessor.cxx @@ -32,8 +32,8 @@ int Accessor::GetPropertyInt(const char *key, int defaultValue) const { return pprops->GetInt(key, defaultValue);
}
-int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
- int end = Length();
+int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
+ Sci_Position end = Length();
int spaceFlags = 0;
// Determines the indentation level of the current line and also checks for consistent
@@ -41,11 +41,11 @@ int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsComment // Indentation is judged consistent when the indentation whitespace of each line lines
// the same or the indentation of one line is a prefix of the other.
- int pos = LineStart(line);
+ Sci_Position pos = LineStart(line);
char ch = (*this)[pos];
int indent = 0;
bool inPrevPrefix = line > 0;
- int posPrev = inPrevPrefix ? LineStart(line-1) : 0;
+ Sci_Position posPrev = inPrevPrefix ? LineStart(line-1) : 0;
while ((ch == ' ' || ch == '\t') && (pos < end)) {
if (inPrevPrefix) {
char chPrev = (*this)[posPrev++];
diff --git a/scintilla/lexlib/Accessor.h b/scintilla/lexlib/Accessor.h index c85032c..3fd48cc 100644 --- a/scintilla/lexlib/Accessor.h +++ b/scintilla/lexlib/Accessor.h @@ -18,14 +18,14 @@ class Accessor; class WordList;
class PropSetSimple;
-typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
+typedef bool (*PFNIsCommentLeader)(Accessor &styler, Sci_Position pos, Sci_Position len);
class Accessor : public LexAccessor {
public:
PropSetSimple *pprops;
Accessor(IDocument *pAccess_, PropSetSimple *pprops_);
int GetPropertyInt(const char *, int defaultValue=0) const;
- int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
+ int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/lexlib/LexAccessor.h b/scintilla/lexlib/LexAccessor.h index ba4a0e2..26fe129 100644 --- a/scintilla/lexlib/LexAccessor.h +++ b/scintilla/lexlib/LexAccessor.h @@ -24,18 +24,18 @@ private: * in case there is some backtracking. */
enum {bufferSize=4000, slopSize=bufferSize/8};
char buf[bufferSize+1];
- int startPos;
- int endPos;
+ Sci_Position startPos;
+ Sci_Position endPos;
int codePage;
enum EncodingType encodingType;
- int lenDoc;
+ Sci_Position lenDoc;
char styleBuf[bufferSize];
- int validLen;
- unsigned int startSeg;
- int startPosStyling;
+ Sci_Position validLen;
+ Sci_PositionU startSeg;
+ Sci_Position startPosStyling;
int documentVersion;
- void Fill(int position) {
+ void Fill(Sci_Position position) {
startPos = position - slopSize;
if (startPos + bufferSize > lenDoc)
startPos = lenDoc - bufferSize;
@@ -73,7 +73,7 @@ public: encodingType = encDBCS;
}
}
- char operator[](int position) {
+ char operator[](Sci_Position position) {
if (position < startPos || position >= endPos) {
Fill(position);
}
@@ -86,7 +86,7 @@ public: return 0;
}
/** Safe version of operator[], returning a defined value for invalid position. */
- char SafeGetCharAt(int position, char chDefault=' ') {
+ char SafeGetCharAt(Sci_Position position, char chDefault=' ') {
if (position < startPos || position >= endPos) {
Fill(position);
if (position < startPos || position >= endPos) {
@@ -102,7 +102,7 @@ public: EncodingType Encoding() const {
return encodingType;
}
- bool Match(int pos, const char *s) {
+ bool Match(Sci_Position pos, const char *s) {
for (int i=0; *s; i++) {
if (*s != SafeGetCharAt(pos+i))
return false;
@@ -110,21 +110,21 @@ public: }
return true;
}
- char StyleAt(int position) const {
+ char StyleAt(Sci_Position position) const {
return static_cast<char>(pAccess->StyleAt(position));
}
- int GetLine(int position) const {
+ Sci_Position GetLine(Sci_Position position) const {
return pAccess->LineFromPosition(position);
}
- int LineStart(int line) const {
+ Sci_Position LineStart(Sci_Position line) const {
return pAccess->LineStart(line);
}
- int LineEnd(int line) {
+ Sci_Position LineEnd(Sci_Position line) {
if (documentVersion >= dvLineEnd) {
return (static_cast<IDocumentWithLineEnd *>(pAccess))->LineEnd(line);
} else {
// Old interface means only '\r', '\n' and '\r\n' line ends.
- int startNext = pAccess->LineStart(line+1);
+ Sci_Position startNext = pAccess->LineStart(line+1);
char chLineEnd = SafeGetCharAt(startNext-1);
if (chLineEnd == '\n' && (SafeGetCharAt(startNext-2) == '\r'))
return startNext - 2;
@@ -132,10 +132,10 @@ public: return startNext - 1;
}
}
- int LevelAt(int line) const {
+ int LevelAt(Sci_Position line) const {
return pAccess->GetLevel(line);
}
- int Length() const {
+ Sci_Position Length() const {
return lenDoc;
}
void Flush() {
@@ -145,24 +145,24 @@ public: validLen = 0;
}
}
- int GetLineState(int line) const {
+ int GetLineState(Sci_Position line) const {
return pAccess->GetLineState(line);
}
- int SetLineState(int line, int state) {
+ int SetLineState(Sci_Position line, int state) {
return pAccess->SetLineState(line, state);
}
// Style setting
- void StartAt(unsigned int start) {
+ void StartAt(Sci_PositionU start) {
pAccess->StartStyling(start, '\377');
startPosStyling = start;
}
- unsigned int GetStartSegment() const {
+ Sci_PositionU GetStartSegment() const {
return startSeg;
}
- void StartSegment(unsigned int pos) {
+ void StartSegment(Sci_PositionU pos) {
startSeg = pos;
}
- void ColourTo(unsigned int pos, int chAttr) {
+ void ColourTo(Sci_PositionU pos, int chAttr) {
// Only perform styling if non empty range
if (pos != startSeg - 1) {
assert(pos >= startSeg);
@@ -176,7 +176,7 @@ public: // Too big for buffer so send directly
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
} else {
- for (unsigned int i = startSeg; i <= pos; i++) {
+ for (Sci_PositionU i = startSeg; i <= pos; i++) {
assert((startPosStyling + validLen) < Length());
styleBuf[validLen++] = static_cast<char>(chAttr);
}
@@ -184,15 +184,15 @@ public: }
startSeg = pos+1;
}
- void SetLevel(int line, int level) {
+ void SetLevel(Sci_Position line, int level) {
pAccess->SetLevel(line, level);
}
- void IndicatorFill(int start, int end, int indicator, int value) {
+ void IndicatorFill(Sci_Position start, Sci_Position end, int indicator, int value) {
pAccess->DecorationSetCurrentIndicator(indicator);
pAccess->DecorationFillRange(start, value, end - start);
}
- void ChangeLexerState(int start, int end) {
+ void ChangeLexerState(Sci_Position start, Sci_Position end) {
pAccess->ChangeLexerState(start, end);
}
};
diff --git a/scintilla/lexlib/LexerBase.cxx b/scintilla/lexlib/LexerBase.cxx index 0f75851..89f7461 100644 --- a/scintilla/lexlib/LexerBase.cxx +++ b/scintilla/lexlib/LexerBase.cxx @@ -61,7 +61,7 @@ const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { return "";
}
-int SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) {
const char *valOld = props.Get(key);
if (strcmp(val, valOld) != 0) {
props.Set(key, val);
@@ -75,7 +75,7 @@ const char * SCI_METHOD LexerBase::DescribeWordListSets() { return "";
}
-int SCI_METHOD LexerBase::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerBase::WordListSet(int n, const char *wl) {
if (n < numWordLists) {
WordList wlNew;
wlNew.Set(wl);
diff --git a/scintilla/lexlib/LexerBase.h b/scintilla/lexlib/LexerBase.h index 03c51a7..780d1fe 100644 --- a/scintilla/lexlib/LexerBase.h +++ b/scintilla/lexlib/LexerBase.h @@ -26,11 +26,11 @@ public: const char * SCI_METHOD PropertyNames();
int SCI_METHOD PropertyType(const char *name);
const char * SCI_METHOD DescribeProperty(const char *name);
- int SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets();
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
- void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
void * SCI_METHOD PrivateCall(int operation, void *pointer);
};
diff --git a/scintilla/lexlib/LexerModule.cxx b/scintilla/lexlib/LexerModule.cxx index 64b89d0..d3cc124 100644 --- a/scintilla/lexlib/LexerModule.cxx +++ b/scintilla/lexlib/LexerModule.cxx @@ -85,20 +85,20 @@ ILexer *LexerModule::Create() const { return new LexerSimple(this);
}
-void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
+void LexerModule::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const {
if (fnLexer)
fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
}
-void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
+void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const {
if (fnFolder) {
- int lineCurrent = styler.GetLine(startPos);
+ Sci_Position lineCurrent = styler.GetLine(startPos);
// Move back one line in case deletion wrecked current line fold state
if (lineCurrent > 0) {
lineCurrent--;
- int newStartPos = styler.LineStart(lineCurrent);
+ Sci_Position newStartPos = styler.LineStart(lineCurrent);
lengthDoc += startPos - newStartPos;
startPos = newStartPos;
initStyle = 0;
diff --git a/scintilla/lexlib/LexerModule.h b/scintilla/lexlib/LexerModule.h index 9c80f14..665e0f9 100644 --- a/scintilla/lexlib/LexerModule.h +++ b/scintilla/lexlib/LexerModule.h @@ -15,7 +15,7 @@ namespace Scintilla { class Accessor;
class WordList;
-typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
+typedef void (*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
typedef ILexer *(*LexerFactoryFunction)();
@@ -53,9 +53,9 @@ public: ILexer *Create() const;
- virtual void Lex(unsigned int startPos, int length, int initStyle,
+ virtual void Lex(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
- virtual void Fold(unsigned int startPos, int length, int initStyle,
+ virtual void Fold(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
friend class Catalogue;
diff --git a/scintilla/lexlib/LexerNoExceptions.cxx b/scintilla/lexlib/LexerNoExceptions.cxx index e179a74..ef1e1bb 100644 --- a/scintilla/lexlib/LexerNoExceptions.cxx +++ b/scintilla/lexlib/LexerNoExceptions.cxx @@ -28,7 +28,7 @@ using namespace Scintilla;
#endif
-int SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) {
+Sci_Position SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) {
try {
return LexerBase::PropertySet(key, val);
} catch (...) {
@@ -37,7 +37,7 @@ int SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) return -1;
}
-int SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) {
+Sci_Position SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) {
try {
return LexerBase::WordListSet(n, wl);
} catch (...) {
@@ -46,7 +46,7 @@ int SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { return -1;
}
-void SCI_METHOD LexerNoExceptions::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
try {
Accessor astyler(pAccess, &props);
Lexer(startPos, length, initStyle, pAccess, astyler);
@@ -56,7 +56,7 @@ void SCI_METHOD LexerNoExceptions::Lex(unsigned int startPos, int length, int in pAccess->SetErrorStatus(SC_STATUS_FAILURE);
}
}
-void SCI_METHOD LexerNoExceptions::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
try {
Accessor astyler(pAccess, &props);
Folder(startPos, length, initStyle, pAccess, astyler);
diff --git a/scintilla/lexlib/LexerNoExceptions.h b/scintilla/lexlib/LexerNoExceptions.h index 6d1315d..a1d02b7 100644 --- a/scintilla/lexlib/LexerNoExceptions.h +++ b/scintilla/lexlib/LexerNoExceptions.h @@ -16,13 +16,13 @@ namespace Scintilla { class LexerNoExceptions : public LexerBase {
public:
// TODO Also need to prevent exceptions in constructor and destructor
- int SCI_METHOD PropertySet(const char *key, const char *val);
- int SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *);
- virtual void Lexer(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0;
- virtual void Folder(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0;
+ virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0;
+ virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0;
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/lexlib/LexerSimple.cxx b/scintilla/lexlib/LexerSimple.cxx index f1b5362..a6f0c03 100644 --- a/scintilla/lexlib/LexerSimple.cxx +++ b/scintilla/lexlib/LexerSimple.cxx @@ -42,13 +42,13 @@ const char * SCI_METHOD LexerSimple::DescribeWordListSets() { return wordLists.c_str();
}
-void SCI_METHOD LexerSimple::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerSimple::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) {
Accessor astyler(pAccess, &props);
module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler);
astyler.Flush();
}
-void SCI_METHOD LexerSimple::Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) {
+void SCI_METHOD LexerSimple::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) {
if (props.GetInt("fold")) {
Accessor astyler(pAccess, &props);
module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler);
diff --git a/scintilla/lexlib/LexerSimple.h b/scintilla/lexlib/LexerSimple.h index f5794bf..d599332 100644 --- a/scintilla/lexlib/LexerSimple.h +++ b/scintilla/lexlib/LexerSimple.h @@ -19,8 +19,8 @@ class LexerSimple : public LexerBase { public:
explicit LexerSimple(const LexerModule *module_);
const char * SCI_METHOD DescribeWordListSets();
- void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/lexlib/StyleContext.cxx b/scintilla/lexlib/StyleContext.cxx index dcd9891..9fc443c 100644 --- a/scintilla/lexlib/StyleContext.cxx +++ b/scintilla/lexlib/StyleContext.cxx @@ -21,12 +21,12 @@ using namespace Scintilla;
#endif
-static void getRange(unsigned int start,
- unsigned int end,
+static void getRange(Sci_PositionU start,
+ Sci_PositionU end,
LexAccessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = styler[start + i];
i++;
@@ -34,16 +34,16 @@ static void getRange(unsigned int start, s[i] = '\0';
}
-void StyleContext::GetCurrent(char *s, unsigned int len) {
+void StyleContext::GetCurrent(char *s, Sci_PositionU len) {
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}
-static void getRangeLowered(unsigned int start,
- unsigned int end,
+static void getRangeLowered(Sci_PositionU start,
+ Sci_PositionU end,
LexAccessor &styler,
char *s,
- unsigned int len) {
- unsigned int i = 0;
+ Sci_PositionU len) {
+ Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@@ -51,6 +51,6 @@ static void getRangeLowered(unsigned int start, s[i] = '\0';
}
-void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
+void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) {
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}
diff --git a/scintilla/lexlib/StyleContext.h b/scintilla/lexlib/StyleContext.h index 6473b3d..0b55289 100644 --- a/scintilla/lexlib/StyleContext.h +++ b/scintilla/lexlib/StyleContext.h @@ -26,13 +26,13 @@ static inline int MakeLowerCase(int ch) { class StyleContext {
LexAccessor &styler;
IDocumentWithLineEnd *multiByteAccess;
- unsigned int endPos;
- unsigned int lengthDocument;
+ Sci_PositionU endPos;
+ Sci_PositionU lengthDocument;
// Used for optimizing GetRelativeCharacter
- unsigned int posRelative;
- unsigned int currentPosLastRelative;
- int offsetRelative;
+ Sci_PositionU posRelative;
+ Sci_PositionU currentPosLastRelative;
+ Sci_Position offsetRelative;
StyleContext &operator=(const StyleContext &);
@@ -46,26 +46,26 @@ class StyleContext { // End of line determined from line end position, allowing CR, LF,
// CRLF and Unicode line ends as set by document.
if (currentLine < lineDocEnd)
- atLineEnd = static_cast<int>(currentPos) >= (lineStartNext-1);
+ atLineEnd = static_cast<Sci_Position>(currentPos) >= (lineStartNext-1);
else // Last line
- atLineEnd = static_cast<int>(currentPos) >= lineStartNext;
+ atLineEnd = static_cast<Sci_Position>(currentPos) >= lineStartNext;
}
public:
- unsigned int currentPos;
- int currentLine;
- int lineDocEnd;
- int lineStartNext;
+ Sci_PositionU currentPos;
+ Sci_Position currentLine;
+ Sci_Position lineDocEnd;
+ Sci_Position lineStartNext;
bool atLineStart;
bool atLineEnd;
int state;
int chPrev;
int ch;
- int width;
+ Sci_Position width;
int chNext;
- int widthNext;
+ Sci_Position widthNext;
- StyleContext(unsigned int startPos, unsigned int length,
+ StyleContext(Sci_PositionU startPos, Sci_PositionU length,
int initStyle, LexAccessor &styler_, char chMask='\377') :
styler(styler_),
multiByteAccess(0),
@@ -90,11 +90,11 @@ public: styler.StartSegment(startPos);
currentLine = styler.GetLine(startPos);
lineStartNext = styler.LineStart(currentLine+1);
- lengthDocument = static_cast<unsigned int>(styler.Length());
+ lengthDocument = static_cast<Sci_PositionU>(styler.Length());
if (endPos == lengthDocument)
endPos++;
lineDocEnd = styler.GetLine(lengthDocument);
- atLineStart = static_cast<unsigned int>(styler.LineStart(currentLine)) == startPos;
+ atLineStart = static_cast<Sci_PositionU>(styler.LineStart(currentLine)) == startPos;
// Variable width is now 0 so GetNextChar gets the char at currentPos into chNext/widthNext
width = 0;
@@ -131,13 +131,13 @@ public: atLineEnd = true;
}
}
- void Forward(int nb) {
- for (int i = 0; i < nb; i++) {
+ void Forward(Sci_Position nb) {
+ for (Sci_Position i = 0; i < nb; i++) {
Forward();
}
}
- void ForwardBytes(int nb) {
- size_t forwardPos = currentPos + nb;
+ void ForwardBytes(Sci_Position nb) {
+ Sci_PositionU forwardPos = currentPos + nb;
while (forwardPos > currentPos) {
Forward();
}
@@ -154,13 +154,13 @@ public: styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state);
state = state_;
}
- int LengthCurrent() const {
+ Sci_Position LengthCurrent() const {
return currentPos - styler.GetStartSegment();
}
- int GetRelative(int n) {
+ int GetRelative(Sci_Position n) {
return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n, 0));
}
- int GetRelativeCharacter(int n) {
+ int GetRelativeCharacter(Sci_Position n) {
if (n == 0)
return ch;
if (multiByteAccess) {
@@ -170,8 +170,8 @@ public: posRelative = currentPos;
offsetRelative = 0;
}
- int diffRelative = n - offsetRelative;
- int posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative);
+ Sci_Position diffRelative = n - offsetRelative;
+ Sci_Position posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative);
int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0);
posRelative = posNew;
currentPosLastRelative = currentPos;
@@ -220,8 +220,8 @@ public: return true;
}
// Non-inline
- void GetCurrent(char *s, unsigned int len);
- void GetCurrentLowered(char *s, unsigned int len);
+ void GetCurrent(char *s, Sci_PositionU len);
+ void GetCurrentLowered(char *s, Sci_PositionU len);
};
#ifdef SCI_NAMESPACE
diff --git a/scintilla/scripts/HeaderOrder.txt b/scintilla/scripts/HeaderOrder.txt index 67854c5..eb00e16 100644 --- a/scintilla/scripts/HeaderOrder.txt +++ b/scintilla/scripts/HeaderOrder.txt @@ -87,6 +87,7 @@ // src #include "Catalogue.h" +#include "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" diff --git a/scintilla/src/AutoComplete.cxx b/scintilla/src/AutoComplete.cxx index bd3aa99..9fd3b1d 100644 --- a/scintilla/src/AutoComplete.cxx +++ b/scintilla/src/AutoComplete.cxx @@ -10,6 +10,7 @@ #include <stdio.h>
#include <assert.h>
+#include <stdexcept>
#include <string>
#include <vector>
#include <algorithm>
@@ -18,6 +19,7 @@ #include "Scintilla.h"
#include "CharacterSet.h"
+#include "Position.h"
#include "AutoComplete.h"
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/CallTip.cxx b/scintilla/src/CallTip.cxx index f0f2a20..3cf7454 100644 --- a/scintilla/src/CallTip.cxx +++ b/scintilla/src/CallTip.cxx @@ -9,6 +9,7 @@ #include <string.h>
#include <stdio.h>
+#include <stdexcept>
#include <string>
#include "Platform.h"
@@ -16,6 +17,7 @@ #include "Scintilla.h"
#include "StringCopy.h"
+#include "Position.h"
#include "CallTip.h"
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/CaseConvert.cxx b/scintilla/src/CaseConvert.cxx index 5108ddc..b4c8bcf 100644 --- a/scintilla/src/CaseConvert.cxx +++ b/scintilla/src/CaseConvert.cxx @@ -10,6 +10,7 @@ #include <cstring>
+#include <stdexcept>
#include <vector>
#include <algorithm>
diff --git a/scintilla/src/CaseFolder.cxx b/scintilla/src/CaseFolder.cxx index 200ac99..4e095df 100644 --- a/scintilla/src/CaseFolder.cxx +++ b/scintilla/src/CaseFolder.cxx @@ -5,6 +5,7 @@ // Copyright 1998-2013 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. +#include <stdexcept> #include <vector> #include <algorithm> diff --git a/scintilla/src/Catalogue.cxx b/scintilla/src/Catalogue.cxx index 057fed3..5eedabc 100644 --- a/scintilla/src/Catalogue.cxx +++ b/scintilla/src/Catalogue.cxx @@ -12,6 +12,7 @@ #include <assert.h>
#include <ctype.h>
+#include <stdexcept>
#include <vector>
#include "ILexer.h"
diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 4203f0a..e9f8779 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -16,6 +16,7 @@ #include "Platform.h"
#include "Scintilla.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "CellBuffer.h"
diff --git a/scintilla/src/CharClassify.cxx b/scintilla/src/CharClassify.cxx index d4e5aa4..5eaba45 100644 --- a/scintilla/src/CharClassify.cxx +++ b/scintilla/src/CharClassify.cxx @@ -8,6 +8,8 @@ #include <stdlib.h>
#include <ctype.h>
+#include <stdexcept>
+
#include "CharClassify.h"
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/ContractionState.cxx b/scintilla/src/ContractionState.cxx index 7d19b57..bd2d120 100644 --- a/scintilla/src/ContractionState.cxx +++ b/scintilla/src/ContractionState.cxx @@ -7,10 +7,12 @@ #include <string.h>
+#include <stdexcept>
#include <algorithm>
#include "Platform.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
diff --git a/scintilla/src/Decoration.cxx b/scintilla/src/Decoration.cxx index 4ffbcff..51cf9b7 100644 --- a/scintilla/src/Decoration.cxx +++ b/scintilla/src/Decoration.cxx @@ -9,11 +9,13 @@ #include <stdio.h>
#include <stdarg.h>
+#include <stdexcept>
#include <algorithm>
#include "Platform.h"
#include "Scintilla.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index 34b8138..31ef548 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -26,6 +26,7 @@ #include "Scintilla.h"
#include "CharacterSet.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@@ -339,7 +340,7 @@ int Document::LineFromHandle(int markerHandle) { return static_cast<LineMarkers *>(perLineData[ldMarkers])->LineFromHandle(markerHandle);
}
-int SCI_METHOD Document::LineStart(int line) const {
+Sci_Position SCI_METHOD Document::LineStart(Sci_Position line) const {
return cb.LineStart(line);
}
@@ -347,7 +348,7 @@ bool Document::IsLineStartPosition(int position) const { return LineStart(LineFromPosition(position)) == position;
}
-int SCI_METHOD Document::LineEnd(int line) const {
+Sci_Position SCI_METHOD Document::LineEnd(Sci_Position line) const {
if (line >= LinesTotal() - 1) {
return LineStart(line + 1);
} else {
@@ -381,7 +382,7 @@ void SCI_METHOD Document::SetErrorStatus(int status) { }
}
-int SCI_METHOD Document::LineFromPosition(int pos) const {
+Sci_Position SCI_METHOD Document::LineFromPosition(Sci_Position pos) const {
return cb.LineFromPosition(pos);
}
@@ -410,7 +411,7 @@ int Document::VCHomePosition(int position) const { return startText;
}
-int SCI_METHOD Document::SetLevel(int line, int level) {
+int SCI_METHOD Document::SetLevel(Sci_Position line, int level) {
int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal());
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
@@ -422,7 +423,7 @@ int SCI_METHOD Document::SetLevel(int line, int level) { return prev;
}
-int SCI_METHOD Document::GetLevel(int line) const {
+int SCI_METHOD Document::GetLevel(Sci_Position line) const {
return static_cast<LineLevels *>(perLineData[ldLevels])->GetLevel(line);
}
@@ -770,7 +771,7 @@ bool Document::NextCharacter(int &pos, int moveDir) const { }
// Return -1 on out-of-bounds
-int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOffset) const {
+Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const {
int pos = positionStart;
if (dbcsCodePage) {
const int increment = (characterOffset > 0) ? 1 : -1;
@@ -810,7 +811,7 @@ int Document::GetRelativePositionUTF16(int positionStart, int characterOffset) c return pos;
}
-int SCI_METHOD Document::GetCharacterAndWidth(int position, int *pWidth) const {
+int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const {
int character;
int bytesInCharacter = 1;
if (dbcsCodePage) {
@@ -1050,7 +1051,7 @@ void Document::ChangeInsertion(const char *s, int length) { insertion.assign(s, length);
}
-int SCI_METHOD Document::AddData(char *data, int length) {
+int SCI_METHOD Document::AddData(char *data, Sci_Position length) {
try {
int position = Length();
InsertString(position, data, length);
@@ -1247,7 +1248,7 @@ static std::string CreateIndentation(int indent, int tabSize, bool insertSpaces) return indentation;
}
-int SCI_METHOD Document::GetLineIndentation(int line) {
+int SCI_METHOD Document::GetLineIndentation(Sci_Position line) {
int indent = 0;
if ((line >= 0) && (line < LinesTotal())) {
int lineStart = LineStart(line);
@@ -1827,11 +1828,11 @@ int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *bu return charClass.GetCharsOfClass(characterClass, buffer);
}
-void SCI_METHOD Document::StartStyling(int position, char) {
+void SCI_METHOD Document::StartStyling(Sci_Position position, char) {
endStyled = position;
}
-bool SCI_METHOD Document::SetStyleFor(int length, char style) {
+bool SCI_METHOD Document::SetStyleFor(Sci_Position length, char style) {
if (enteredStyling != 0) {
return false;
} else {
@@ -1848,7 +1849,7 @@ bool SCI_METHOD Document::SetStyleFor(int length, char style) { }
}
-bool SCI_METHOD Document::SetStyles(int length, const char *styles) {
+bool SCI_METHOD Document::SetStyles(Sci_Position length, const char *styles) {
if (enteredStyling != 0) {
return false;
} else {
@@ -1900,7 +1901,7 @@ void Document::LexerChanged() { }
}
-int SCI_METHOD Document::SetLineState(int line, int state) {
+int SCI_METHOD Document::SetLineState(Sci_Position line, int state) {
int statePrevious = static_cast<LineState *>(perLineData[ldState])->SetLineState(line, state);
if (state != statePrevious) {
DocModification mh(SC_MOD_CHANGELINESTATE, LineStart(line), 0, 0, 0, line);
@@ -1909,7 +1910,7 @@ int SCI_METHOD Document::SetLineState(int line, int state) { return statePrevious;
}
-int SCI_METHOD Document::GetLineState(int line) const {
+int SCI_METHOD Document::GetLineState(Sci_Position line) const {
return static_cast<LineState *>(perLineData[ldState])->GetLineState(line);
}
@@ -1917,7 +1918,7 @@ int Document::GetMaxLineState() { return static_cast<LineState *>(perLineData[ldState])->GetMaxLineState();
}
-void SCI_METHOD Document::ChangeLexerState(int start, int end) {
+void SCI_METHOD Document::ChangeLexerState(Sci_Position start, Sci_Position end) {
DocModification mh(SC_MOD_LEXERSTATE, start, end-start, 0, 0, 0);
NotifyModified(mh);
}
@@ -1997,7 +1998,7 @@ void Document::IncrementStyleClock() { styleClock = (styleClock + 1) % 0x100000;
}
-void SCI_METHOD Document::DecorationFillRange(int position, int value, int fillLength) {
+void SCI_METHOD Document::DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) {
if (decorations.FillRange(position, value, fillLength)) {
DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER,
position, fillLength);
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h index 86b7174..d0ca953 100644 --- a/scintilla/src/Document.h +++ b/scintilla/src/Document.h @@ -270,7 +270,7 @@ public: void SCI_METHOD SetErrorStatus(int status);
- int SCI_METHOD LineFromPosition(int pos) const;
+ Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const;
int ClampPositionIntoDocument(int pos) const;
bool IsCrLf(int pos) const;
int LenChar(int pos);
@@ -278,9 +278,9 @@ public: int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const;
int NextPosition(int pos, int moveDir) const;
bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed
- int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const;
+ Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const;
int GetRelativePositionUTF16(int positionStart, int characterOffset) const;
- int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const;
+ int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const;
int SCI_METHOD CodePage() const;
bool SCI_METHOD IsDBCSLeadByte(char ch) const;
int SafeSegment(const char *text, int length, int lengthSegment) const;
@@ -292,7 +292,7 @@ public: bool DeleteChars(int pos, int len);
int InsertString(int position, const char *s, int insertLength);
void ChangeInsertion(const char *s, int length);
- int SCI_METHOD AddData(char *data, int length);
+ int SCI_METHOD AddData(char *data, Sci_Position length);
void * SCI_METHOD ConvertToDocument();
int Undo();
int Redo();
@@ -318,7 +318,7 @@ public: const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); }
int GapPosition() const { return cb.GapPosition(); }
- int SCI_METHOD GetLineIndentation(int line);
+ int SCI_METHOD GetLineIndentation(Sci_Position line);
int SetLineIndentation(int line, int indent);
int GetLineIndentPosition(int line) const;
int GetColumn(int position);
@@ -335,10 +335,10 @@ public: void DelCharBack(int pos);
char CharAt(int position) const { return cb.CharAt(position); }
- void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const {
+ void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const {
cb.GetCharRange(buffer, position, lengthRetrieve);
}
- char SCI_METHOD StyleAt(int position) const { return cb.StyleAt(position); }
+ char SCI_METHOD StyleAt(Sci_Position position) const { return cb.StyleAt(position); }
void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const {
cb.GetStyleRange(buffer, position, lengthRetrieve);
}
@@ -350,16 +350,16 @@ public: void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
- int SCI_METHOD LineStart(int line) const;
+ Sci_Position SCI_METHOD LineStart(Sci_Position line) const;
bool IsLineStartPosition(int position) const;
- int SCI_METHOD LineEnd(int line) const;
+ Sci_Position SCI_METHOD LineEnd(Sci_Position line) const;
int LineEndPosition(int position) const;
bool IsLineEndPosition(int position) const;
bool IsPositionInLineEnd(int position) const;
int VCHomePosition(int position) const;
- int SCI_METHOD SetLevel(int line, int level);
- int SCI_METHOD GetLevel(int line) const;
+ int SCI_METHOD SetLevel(Sci_Position line, int level);
+ int SCI_METHOD GetLevel(Sci_Position line) const;
void ClearLevels();
int GetLastChild(int lineParent, int level=-1, int lastLine=-1);
int GetFoldParent(int line) const;
@@ -369,7 +369,7 @@ public: int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);
int NextWordStart(int pos, int delta);
int NextWordEnd(int pos, int delta);
- int SCI_METHOD Length() const { return cb.Length(); }
+ Sci_Position SCI_METHOD Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); }
struct CharacterExtracted {
@@ -395,9 +395,9 @@ public: void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
int GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer);
- void SCI_METHOD StartStyling(int position, char mask);
- bool SCI_METHOD SetStyleFor(int length, char style);
- bool SCI_METHOD SetStyles(int length, const char *styles);
+ void SCI_METHOD StartStyling(Sci_Position position, char mask);
+ bool SCI_METHOD SetStyleFor(Sci_Position length, char style);
+ bool SCI_METHOD SetStyles(Sci_Position length, const char *styles);
int GetEndStyled() const { return endStyled; }
void EnsureStyledTo(int pos);
void LexerChanged();
@@ -406,12 +406,12 @@ public: void SCI_METHOD DecorationSetCurrentIndicator(int indicator) {
decorations.SetCurrentIndicator(indicator);
}
- void SCI_METHOD DecorationFillRange(int position, int value, int fillLength);
+ void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength);
- int SCI_METHOD SetLineState(int line, int state);
- int SCI_METHOD GetLineState(int line) const;
+ int SCI_METHOD SetLineState(Sci_Position line, int state);
+ int SCI_METHOD GetLineState(Sci_Position line) const;
int GetMaxLineState();
- void SCI_METHOD ChangeLexerState(int start, int end);
+ void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end);
StyledText MarginStyledText(int line) const;
void MarginSetStyle(int line, int style);
diff --git a/scintilla/src/EditModel.cxx b/scintilla/src/EditModel.cxx index b50ade2..35903c6 100644 --- a/scintilla/src/EditModel.cxx +++ b/scintilla/src/EditModel.cxx @@ -25,6 +25,7 @@ #include "Scintilla.h" #include "StringCopy.h" +#include "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index 5372e3a..f8912a9 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -25,6 +25,7 @@ #include "Scintilla.h" #include "StringCopy.h" +#include "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -389,9 +390,17 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); - else // Style::caseUpper + else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); + else { // Style::caseCamel + if ((model.pdoc->WordCharClass(ll->chars[numCharsInLine]) == CharClassify::ccWord) && + ((numCharsInLine == 0) || (model.pdoc->WordCharClass(ll->chars[numCharsInLine - 1]) != CharClassify::ccWord))) { + allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); + } else { + allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); + } + } numCharsInLine++; } allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled @@ -434,6 +443,14 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co ll->chars[charInLine] = static_cast<char>(toupper(chDoc)); else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) ll->chars[charInLine] = static_cast<char>(tolower(chDoc)); + else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) { + if ((model.pdoc->WordCharClass(ll->chars[charInLine]) == CharClassify::ccWord) && + ((charInLine == 0) || (model.pdoc->WordCharClass(ll->chars[charInLine - 1]) != CharClassify::ccWord))) { + ll->chars[charInLine] = static_cast<char>(toupper(chDoc)); + } else { + ll->chars[charInLine] = static_cast<char>(tolower(chDoc)); + } + } } } ll->xHighlightGuide = 0; @@ -756,6 +773,8 @@ static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourDesired static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment, const char *s, ColourDesired textBack, ColourDesired textFore, bool fillBackground) { + if (rcSegment.Empty()) + return; if (fillBackground) { surface->FillRectangle(rcSegment, textBack); } @@ -1268,7 +1287,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi rcSegment.right = ll->positions[ts.end()] + xStart - static_cast<XYPOSITION>(subLineStart); // Only try to draw if really visible - enhances performance by not calling environment to // draw strings that are completely past the right side of the window. - if (rcSegment.Intersects(rcLine)) { + if (!rcSegment.Empty() && rcSegment.Intersects(rcLine)) { // Clip to line rectangle, since may have a huge position which will not work with some platforms if (rcSegment.left < rcLine.left) rcSegment.left = rcLine.left; diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 7170aa2..a7de643 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -25,6 +25,7 @@ #include "Scintilla.h"
#include "StringCopy.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@@ -731,7 +732,7 @@ void Editor::MultipleSelectAdd(AddNumber addNumber) { int searchStart = it->start;
const int searchEnd = it->end;
for (;;) {
- int lengthFound = selectedText.length();
+ int lengthFound = static_cast<int>(selectedText.length());
int pos = pdoc->FindText(searchStart, searchEnd, selectedText.c_str(),
searchFlags, &lengthFound);
if (pos >= 0) {
@@ -803,9 +804,37 @@ SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int mov return pos;
}
+void Editor::MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible) {
+ const int currentLine = pdoc->LineFromPosition(newPos.Position());
+ if (ensureVisible) {
+ // In case in need of wrapping to ensure DisplayFromDoc works.
+ if (currentLine >= wrapPending.start)
+ WrapLines(wsAll);
+ XYScrollPosition newXY = XYScrollToMakeVisible(
+ SelectionRange(posDrag.IsValid() ? posDrag : newPos), xysDefault);
+ if (previousPos.IsValid() && (newXY.xOffset == xOffset)) {
+ // simple vertical scroll then invalidate
+ ScrollTo(newXY.topLine);
+ InvalidateSelection(SelectionRange(previousPos), true);
+ } else {
+ SetXYScroll(newXY);
+ }
+ }
+
+ ShowCaretAtCurrentPosition();
+
+ ClaimSelection();
+ SetHoverIndicatorPosition(sel.MainCaret());
+ QueueIdleWork(WorkNeeded::workUpdateUI);
+
+ if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) {
+ RedrawSelMargin();
+ }
+}
+
void Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, bool ensureVisible) {
- const bool simpleCaret = (sel.Count() == 1) && sel.Empty();
- const SelectionPosition spCaret = sel.Last();
+ const SelectionPosition spCaret = ((sel.Count() == 1) && sel.Empty()) ?
+ sel.Last() : SelectionPosition(INVALID_POSITION);
int delta = newPos.Position() - sel.MainCaret();
newPos = ClampPositionIntoDocument(newPos);
@@ -830,27 +859,8 @@ void Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, } else {
SetEmptySelection(newPos);
}
- ShowCaretAtCurrentPosition();
- const int currentLine = pdoc->LineFromPosition(newPos.Position());
- if (ensureVisible) {
- // In case in need of wrapping to ensure DisplayFromDoc works.
- if (currentLine >= wrapPending.start)
- WrapLines(wsAll);
- XYScrollPosition newXY = XYScrollToMakeVisible(
- SelectionRange(posDrag.IsValid() ? posDrag : sel.RangeMain().caret), xysDefault);
- if (simpleCaret && (newXY.xOffset == xOffset)) {
- // simple vertical scroll then invalidate
- ScrollTo(newXY.topLine);
- InvalidateSelection(SelectionRange(spCaret), true);
- } else {
- SetXYScroll(newXY);
- }
- }
-
- if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) {
- RedrawSelMargin();
- }
+ MovedCaret(newPos, spCaret, ensureVisible);
}
void Editor::MovePositionTo(int newPos, Selection::selTypes selt, bool ensureVisible) {
@@ -2952,30 +2962,36 @@ void Editor::CancelModes() { }
void Editor::NewLine() {
- // Remove non-main ranges
InvalidateWholeSelection();
- sel.DropAdditionalRanges();
- sel.RangeMain().ClearVirtualSpace();
+ if (sel.IsRectangular() || !additionalSelectionTyping) {
+ // Remove non-main ranges
+ sel.DropAdditionalRanges();
+ }
- // Clear main range and insert line end
- bool needGroupUndo = !sel.Empty();
- if (needGroupUndo)
- pdoc->BeginUndoAction();
+ UndoGroup ug(pdoc, !sel.Empty() || (sel.Count() > 1));
- if (!sel.Empty())
+ // Clear each range
+ if (!sel.Empty()) {
ClearSelection();
- const char *eol = "\n";
- if (pdoc->eolMode == SC_EOL_CRLF) {
- eol = "\r\n";
- } else if (pdoc->eolMode == SC_EOL_CR) {
- eol = "\r";
- } // else SC_EOL_LF -> "\n" already set
- const int insertLength = pdoc->InsertString(sel.MainCaret(), eol, istrlen(eol));
- // Want to end undo group before NotifyChar as applications often modify text here
- if (needGroupUndo)
- pdoc->EndUndoAction();
- if (insertLength > 0) {
- SetEmptySelection(sel.MainCaret() + insertLength);
+ }
+
+ // Insert each line end
+ size_t countInsertions = 0;
+ for (size_t r = 0; r < sel.Count(); r++) {
+ sel.Range(r).ClearVirtualSpace();
+ const char *eol = StringFromEOLMode(pdoc->eolMode);
+ const int positionInsert = sel.Range(r).caret.Position();
+ const int insertLength = pdoc->InsertString(positionInsert, eol, istrlen(eol));
+ if (insertLength > 0) {
+ sel.Range(r) = SelectionRange(positionInsert + insertLength);
+ countInsertions++;
+ }
+ }
+
+ // Perform notifications after all the changes as the application may change the
+ // selections in response to the characters.
+ for (size_t i = 0; i < countInsertions; i++) {
+ const char *eol = StringFromEOLMode(pdoc->eolMode);
while (*eol) {
NotifyChar(*eol);
if (recordingMacro) {
@@ -2987,6 +3003,7 @@ void Editor::NewLine() { eol++;
}
}
+
SetLastXChosen();
SetScrollBars();
EnsureCaretVisible();
@@ -2994,26 +3011,17 @@ void Editor::NewLine() { ShowCaretAtCurrentPosition();
}
-void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) {
- SelectionPosition caretToUse = sel.Range(sel.Main()).caret;
- if (sel.IsRectangular()) {
- if (selt == Selection::noSel) {
- caretToUse = (direction > 0) ? sel.Limits().end : sel.Limits().start;
- } else {
- caretToUse = sel.Rectangular().caret;
- }
- }
-
- Point pt = LocationFromPosition(caretToUse);
+SelectionPosition Editor::PositionUpOrDown(SelectionPosition spStart, int direction, int lastX) {
+ const Point pt = LocationFromPosition(spStart);
int skipLines = 0;
if (vs.annotationVisible) {
- int lineDoc = pdoc->LineFromPosition(caretToUse.Position());
- Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc));
- int subLine = static_cast<int>(pt.y - ptStartLine.y) / vs.lineHeight;
+ const int lineDoc = pdoc->LineFromPosition(spStart.Position());
+ const Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc));
+ const int subLine = static_cast<int>(pt.y - ptStartLine.y) / vs.lineHeight;
if (direction < 0 && subLine == 0) {
- int lineDisplay = cs.DisplayFromDoc(lineDoc);
+ const int lineDisplay = cs.DisplayFromDoc(lineDoc);
if (lineDisplay > 0) {
skipLines = pdoc->AnnotationLines(cs.DocFromDisplay(lineDisplay - 1));
}
@@ -3022,9 +3030,12 @@ void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { }
}
- int newY = static_cast<int>(pt.y) + (1 + skipLines) * direction * vs.lineHeight;
+ const int newY = static_cast<int>(pt.y) + (1 + skipLines) * direction * vs.lineHeight;
+ if (lastX < 0) {
+ lastX = static_cast<int>(pt.x) + xOffset;
+ }
SelectionPosition posNew = SPositionFromLocation(
- Point::FromInts(lastXChosen - xOffset, newY), false, false, UserVirtualSpace());
+ Point::FromInts(lastX - xOffset, newY), false, false, UserVirtualSpace());
if (direction < 0) {
// Line wrapping may lead to a location on the same line, so
@@ -3039,14 +3050,53 @@ void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { // There is an equivalent case when moving down which skips
// over a line.
Point ptNew = LocationFromPosition(posNew.Position());
- while ((posNew.Position() > caretToUse.Position()) && (ptNew.y > newY)) {
+ while ((posNew.Position() > spStart.Position()) && (ptNew.y > newY)) {
posNew.Add(-1);
posNew.SetVirtualSpace(0);
ptNew = LocationFromPosition(posNew.Position());
}
}
+ return posNew;
+}
- MovePositionTo(MovePositionSoVisible(posNew, direction), selt);
+void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) {
+ SelectionPosition caretToUse = sel.Range(sel.Main()).caret;
+ if (sel.IsRectangular()) {
+ if (selt == Selection::noSel) {
+ caretToUse = (direction > 0) ? sel.Limits().end : sel.Limits().start;
+ } else {
+ caretToUse = sel.Rectangular().caret;
+ }
+ }
+ if (selt == Selection::selRectangle) {
+ const SelectionRange rangeBase = sel.IsRectangular() ? sel.Rectangular() : sel.RangeMain();
+ if (!sel.IsRectangular()) {
+ InvalidateWholeSelection();
+ sel.DropAdditionalRanges();
+ }
+ const SelectionPosition posNew = MovePositionSoVisible(
+ PositionUpOrDown(caretToUse, direction, lastXChosen), direction);
+ sel.selType = Selection::selRectangle;
+ sel.Rectangular() = SelectionRange(posNew, rangeBase.anchor);
+ SetRectangularRange();
+ MovedCaret(posNew, caretToUse, true);
+ } else {
+ InvalidateWholeSelection();
+ if (!additionalSelectionTyping || (sel.IsRectangular())) {
+ sel.DropAdditionalRanges();
+ }
+ sel.selType = Selection::selStream;
+ for (size_t r = 0; r < sel.Count(); r++) {
+ const int lastX = (r == sel.Main()) ? lastXChosen : -1;
+ const SelectionPosition spCaretNow = sel.Range(r).caret;
+ const SelectionPosition posNew = MovePositionSoVisible(
+ PositionUpOrDown(spCaretNow, direction, lastX), direction);
+ sel.Range(r) = selt == Selection::selStream ?
+ SelectionRange(posNew, sel.Range(r).anchor) : SelectionRange(posNew);
+ }
+ sel.RemoveDuplicates();
+ MovedCaret(sel.RangeMain().caret, caretToUse, true);
+ }
}
void Editor::ParaUpOrDown(int direction, Selection::selTypes selt) {
@@ -3076,6 +3126,402 @@ int Editor::StartEndDisplayLine(int pos, bool start) { }
}
+namespace {
+
+unsigned int WithExtends(unsigned int iMessage) {
+ switch (iMessage) {
+ case SCI_CHARLEFT: return SCI_CHARLEFTEXTEND;
+ case SCI_CHARRIGHT: return SCI_CHARRIGHTEXTEND;
+
+ case SCI_WORDLEFT: return SCI_WORDLEFTEXTEND;
+ case SCI_WORDRIGHT: return SCI_WORDRIGHTEXTEND;
+ case SCI_WORDLEFTEND: return SCI_WORDLEFTENDEXTEND;
+ case SCI_WORDRIGHTEND: return SCI_WORDRIGHTENDEXTEND;
+ case SCI_WORDPARTLEFT: return SCI_WORDPARTLEFTEXTEND;
+ case SCI_WORDPARTRIGHT: return SCI_WORDPARTRIGHTEXTEND;
+
+ case SCI_HOME: return SCI_HOMEEXTEND;
+ case SCI_HOMEDISPLAY: return SCI_HOMEDISPLAYEXTEND;
+ case SCI_HOMEWRAP: return SCI_HOMEWRAPEXTEND;
+ case SCI_VCHOME: return SCI_VCHOMEEXTEND;
+ case SCI_VCHOMEDISPLAY: return SCI_VCHOMEDISPLAYEXTEND;
+ case SCI_VCHOMEWRAP: return SCI_VCHOMEWRAPEXTEND;
+
+ case SCI_LINEEND: return SCI_LINEENDEXTEND;
+ case SCI_LINEENDDISPLAY: return SCI_LINEENDDISPLAYEXTEND;
+ case SCI_LINEENDWRAP: return SCI_LINEENDWRAPEXTEND;
+
+ default: return iMessage;
+ }
+}
+
+int NaturalDirection(unsigned int iMessage) {
+ switch (iMessage) {
+ case SCI_CHARLEFT:
+ case SCI_CHARLEFTEXTEND:
+ case SCI_CHARLEFTRECTEXTEND:
+ case SCI_WORDLEFT:
+ case SCI_WORDLEFTEXTEND:
+ case SCI_WORDLEFTEND:
+ case SCI_WORDLEFTENDEXTEND:
+ case SCI_WORDPARTLEFT:
+ case SCI_WORDPARTLEFTEXTEND:
+ case SCI_HOME:
+ case SCI_HOMEEXTEND:
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_HOMEWRAP:
+ case SCI_HOMEWRAPEXTEND:
+ // VC_HOME* mostly goes back
+ case SCI_VCHOME:
+ case SCI_VCHOMEEXTEND:
+ case SCI_VCHOMEDISPLAY:
+ case SCI_VCHOMEDISPLAYEXTEND:
+ case SCI_VCHOMEWRAP:
+ case SCI_VCHOMEWRAPEXTEND:
+ return -1;
+
+ default:
+ return 1;
+ }
+}
+
+bool IsRectExtend(unsigned int iMessage) {
+ switch (iMessage) {
+ case SCI_CHARLEFTRECTEXTEND:
+ case SCI_CHARRIGHTRECTEXTEND:
+ case SCI_HOMERECTEXTEND:
+ case SCI_VCHOMERECTEXTEND:
+ case SCI_LINEENDRECTEXTEND:
+ return true;
+ default:
+ return false;
+ }
+}
+
+}
+
+int Editor::VCHomeDisplayPosition(int position) {
+ const int homePos = pdoc->VCHomePosition(position);
+ const int viewLineStart = StartEndDisplayLine(position, true);
+ if (viewLineStart > homePos)
+ return viewLineStart;
+ else
+ return homePos;
+}
+
+int Editor::VCHomeWrapPosition(int position) {
+ const int homePos = pdoc->VCHomePosition(position);
+ const int viewLineStart = StartEndDisplayLine(position, true);
+ if ((viewLineStart < position) && (viewLineStart > homePos))
+ return viewLineStart;
+ else
+ return homePos;
+}
+
+int Editor::LineEndWrapPosition(int position) {
+ const int endPos = StartEndDisplayLine(position, false);
+ const int realEndPos = pdoc->LineEndPosition(position);
+ if (endPos > realEndPos // if moved past visible EOLs
+ || position >= endPos) // if at end of display line already
+ return realEndPos;
+ else
+ return endPos;
+}
+
+int Editor::HorizontalMove(unsigned int iMessage) {
+ if (sel.MoveExtends()) {
+ iMessage = WithExtends(iMessage);
+ }
+
+ if (!multipleSelection && !sel.IsRectangular()) {
+ // Simplify selection down to 1
+ sel.SetSelection(sel.RangeMain());
+ }
+
+ // Invalidate each of the current selections
+ InvalidateWholeSelection();
+
+ if (IsRectExtend(iMessage)) {
+ const SelectionRange rangeBase = sel.IsRectangular() ? sel.Rectangular() : sel.RangeMain();
+ if (!sel.IsRectangular()) {
+ sel.DropAdditionalRanges();
+ }
+ // Will change to rectangular if not currently rectangular
+ SelectionPosition spCaret = rangeBase.caret;
+ switch (iMessage) {
+ case SCI_CHARLEFTRECTEXTEND:
+ if (pdoc->IsLineEndPosition(spCaret.Position()) && spCaret.VirtualSpace()) {
+ spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
+ } else {
+ spCaret = SelectionPosition(spCaret.Position() - 1);
+ }
+ break;
+ case SCI_CHARRIGHTRECTEXTEND:
+ if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) && pdoc->IsLineEndPosition(sel.MainCaret())) {
+ spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1);
+ } else {
+ spCaret = SelectionPosition(spCaret.Position() + 1);
+ }
+ break;
+ case SCI_HOMERECTEXTEND:
+ spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position())));
+ break;
+ case SCI_VCHOMERECTEXTEND:
+ spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position()));
+ break;
+ case SCI_LINEENDRECTEXTEND:
+ spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position()));
+ break;
+ }
+ const int directionMove = (spCaret < rangeBase.caret) ? -1 : 1;
+ spCaret = MovePositionSoVisible(spCaret, directionMove);
+ sel.selType = Selection::selRectangle;
+ sel.Rectangular() = SelectionRange(spCaret, rangeBase.anchor);
+ SetRectangularRange();
+ } else {
+ if (sel.IsRectangular()) {
+ // Not a rectangular extension so switch to stream.
+ SelectionPosition selAtLimit = (NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start;
+ sel.selType = Selection::selStream;
+ sel.SetSelection(SelectionRange(selAtLimit));
+ }
+ if (!additionalSelectionTyping) {
+ InvalidateWholeSelection();
+ sel.DropAdditionalRanges();
+ }
+ for (size_t r = 0; r < sel.Count(); r++) {
+ const SelectionPosition spCaretNow = sel.Range(r).caret;
+ SelectionPosition spCaret = spCaretNow;
+ switch (iMessage) {
+ case SCI_CHARLEFT:
+ case SCI_CHARLEFTEXTEND:
+ if (spCaret.VirtualSpace()) {
+ spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
+ } else {
+ spCaret = SelectionPosition(spCaret.Position() - 1);
+ }
+ break;
+ case SCI_CHARRIGHT:
+ case SCI_CHARRIGHTEXTEND:
+ if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(spCaret.Position())) {
+ spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1);
+ } else {
+ spCaret = SelectionPosition(spCaret.Position() + 1);
+ }
+ break;
+ case SCI_WORDLEFT:
+ case SCI_WORDLEFTEXTEND:
+ spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1));
+ break;
+ case SCI_WORDRIGHT:
+ case SCI_WORDRIGHTEXTEND:
+ spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1));
+ break;
+ case SCI_WORDLEFTEND:
+ case SCI_WORDLEFTENDEXTEND:
+ spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1));
+ break;
+ case SCI_WORDRIGHTEND:
+ case SCI_WORDRIGHTENDEXTEND:
+ spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1));
+ break;
+ case SCI_WORDPARTLEFT:
+ case SCI_WORDPARTLEFTEXTEND:
+ spCaret = SelectionPosition(pdoc->WordPartLeft(spCaret.Position()));
+ break;
+ case SCI_WORDPARTRIGHT:
+ case SCI_WORDPARTRIGHTEXTEND:
+ spCaret = SelectionPosition(pdoc->WordPartRight(spCaret.Position()));
+ break;
+ case SCI_HOME:
+ case SCI_HOMEEXTEND:
+ spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position())));
+ break;
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), true));
+ break;
+ case SCI_HOMEWRAP:
+ case SCI_HOMEWRAPEXTEND:
+ spCaret = MovePositionSoVisible(StartEndDisplayLine(spCaret.Position(), true), -1);
+ if (spCaretNow <= spCaret)
+ spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position())));
+ break;
+ case SCI_VCHOME:
+ case SCI_VCHOMEEXTEND:
+ // VCHome alternates between beginning of line and beginning of text so may move back or forwards
+ spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position()));
+ break;
+ case SCI_VCHOMEDISPLAY:
+ case SCI_VCHOMEDISPLAYEXTEND:
+ spCaret = SelectionPosition(VCHomeDisplayPosition(spCaret.Position()));
+ break;
+ case SCI_VCHOMEWRAP:
+ case SCI_VCHOMEWRAPEXTEND:
+ spCaret = SelectionPosition(VCHomeWrapPosition(spCaret.Position()));
+ break;
+ case SCI_LINEEND:
+ case SCI_LINEENDEXTEND:
+ spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position()));
+ break;
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDDISPLAYEXTEND:
+ spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), false));
+ break;
+ case SCI_LINEENDWRAP:
+ case SCI_LINEENDWRAPEXTEND:
+ spCaret = SelectionPosition(LineEndWrapPosition(spCaret.Position()));
+ break;
+
+ default:
+ PLATFORM_ASSERT(false);
+ }
+
+ const int directionMove = (spCaret < spCaretNow) ? -1 : 1;
+ spCaret = MovePositionSoVisible(spCaret, directionMove);
+
+ // Handle move versus extend, and special behaviour for non-emoty left/right
+ switch (iMessage) {
+ case SCI_CHARLEFT:
+ case SCI_CHARRIGHT:
+ if (sel.Range(r).Empty()) {
+ sel.Range(r) = SelectionRange(spCaret);
+ } else {
+ sel.Range(r) = SelectionRange(
+ (iMessage == SCI_CHARLEFT) ? sel.Range(r).Start() : sel.Range(r).End());
+ }
+ break;
+
+ case SCI_WORDLEFT:
+ case SCI_WORDRIGHT:
+ case SCI_WORDLEFTEND:
+ case SCI_WORDRIGHTEND:
+ case SCI_WORDPARTLEFT:
+ case SCI_WORDPARTRIGHT:
+ case SCI_HOME:
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEWRAP:
+ case SCI_VCHOME:
+ case SCI_VCHOMEDISPLAY:
+ case SCI_VCHOMEWRAP:
+ case SCI_LINEEND:
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDWRAP:
+ sel.Range(r) = SelectionRange(spCaret);
+ break;
+
+ case SCI_CHARLEFTEXTEND:
+ case SCI_CHARRIGHTEXTEND:
+ case SCI_WORDLEFTEXTEND:
+ case SCI_WORDRIGHTEXTEND:
+ case SCI_WORDLEFTENDEXTEND:
+ case SCI_WORDRIGHTENDEXTEND:
+ case SCI_WORDPARTLEFTEXTEND:
+ case SCI_WORDPARTRIGHTEXTEND:
+ case SCI_HOMEEXTEND:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_HOMEWRAPEXTEND:
+ case SCI_VCHOMEEXTEND:
+ case SCI_VCHOMEDISPLAYEXTEND:
+ case SCI_VCHOMEWRAPEXTEND:
+ case SCI_LINEENDEXTEND:
+ case SCI_LINEENDDISPLAYEXTEND:
+ case SCI_LINEENDWRAPEXTEND: {
+ SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor);
+ sel.TrimOtherSelections(r, SelectionRange(rangeNew));
+ sel.Range(r) = rangeNew;
+ }
+ break;
+
+ default:
+ PLATFORM_ASSERT(false);
+ }
+ }
+ }
+
+ sel.RemoveDuplicates();
+
+ MovedCaret(sel.RangeMain().caret, SelectionPosition(INVALID_POSITION), true);
+
+ // Invalidate the new state of the selection
+ InvalidateWholeSelection();
+
+ SetLastXChosen();
+ // Need the line moving and so forth from MovePositionTo
+ return 0;
+}
+
+int Editor::DelWordOrLine(unsigned int iMessage) {
+ // Virtual space may be realised for SCI_DELWORDRIGHT or SCI_DELWORDRIGHTEND
+ // which means 2 actions so wrap in an undo group.
+
+ // Rightwards and leftwards deletions differ in treatment of virtual space.
+ // Clear virtual space for leftwards, realise for rightwards.
+ const bool leftwards = (iMessage == SCI_DELWORDLEFT) || (iMessage == SCI_DELLINELEFT);
+
+ if (!additionalSelectionTyping) {
+ InvalidateWholeSelection();
+ sel.DropAdditionalRanges();
+ }
+
+ UndoGroup ug0(pdoc, (sel.Count() > 1) || !leftwards);
+
+ for (size_t r = 0; r < sel.Count(); r++) {
+ if (leftwards) {
+ // Delete to the left so first clear the virtual space.
+ sel.Range(r).ClearVirtualSpace();
+ } else {
+ // Delete to the right so first realise the virtual space.
+ sel.Range(r) = SelectionRange(
+ InsertSpace(sel.Range(r).caret.Position(), sel.Range(r).caret.VirtualSpace()));
+ }
+
+ Range rangeDelete;
+ switch (iMessage) {
+ case SCI_DELWORDLEFT:
+ rangeDelete = Range(
+ pdoc->NextWordStart(sel.Range(r).caret.Position(), -1),
+ sel.Range(r).caret.Position());
+ break;
+ case SCI_DELWORDRIGHT:
+ rangeDelete = Range(
+ sel.Range(r).caret.Position(),
+ pdoc->NextWordStart(sel.Range(r).caret.Position(), 1));
+ break;
+ case SCI_DELWORDRIGHTEND:
+ rangeDelete = Range(
+ sel.Range(r).caret.Position(),
+ pdoc->NextWordEnd(sel.Range(r).caret.Position(), 1));
+ break;
+ case SCI_DELLINELEFT:
+ rangeDelete = Range(
+ pdoc->LineStart(pdoc->LineFromPosition(sel.Range(r).caret.Position())),
+ sel.Range(r).caret.Position());
+ break;
+ case SCI_DELLINERIGHT:
+ rangeDelete = Range(
+ sel.Range(r).caret.Position(),
+ pdoc->LineEnd(pdoc->LineFromPosition(sel.Range(r).caret.Position())));
+ break;
+ }
+ if (!RangeContainsProtected(rangeDelete.start, rangeDelete.end)) {
+ pdoc->DeleteChars(rangeDelete.start, rangeDelete.end - rangeDelete.start);
+ }
+ }
+
+ // May need something stronger here: can selections overlap at this point?
+ sel.RemoveDuplicates();
+
+ MovedCaret(sel.RangeMain().caret, SelectionPosition(INVALID_POSITION), true);
+
+ // Invalidate the new state of the selection
+ InvalidateWholeSelection();
+
+ SetLastXChosen();
+ return 0;
+}
+
int Editor::KeyCommand(unsigned int iMessage) {
switch (iMessage) {
case SCI_LINEDOWN:
@@ -3116,174 +3562,48 @@ int Editor::KeyCommand(unsigned int iMessage) { ScrollTo(topLine - 1);
MoveCaretInsideView(false);
break;
+
case SCI_CHARLEFT:
- if (SelectionEmpty() || sel.MoveExtends()) {
- if ((sel.Count() == 1) && pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) {
- SelectionPosition spCaret = sel.RangeMain().caret;
- spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
- MovePositionTo(spCaret);
- } else if (sel.MoveExtends() && sel.selType == Selection::selStream) {
- MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1));
- } else {
- MovePositionTo(MovePositionSoVisible(
- SelectionPosition((sel.LimitsForRectangularElseMain().start).Position() - 1), -1));
- }
- } else {
- MovePositionTo(sel.LimitsForRectangularElseMain().start);
- }
- SetLastXChosen();
- break;
case SCI_CHARLEFTEXTEND:
- if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) {
- SelectionPosition spCaret = sel.RangeMain().caret;
- spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
- MovePositionTo(spCaret, Selection::selStream);
- } else {
- MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1), Selection::selStream);
- }
- SetLastXChosen();
- break;
case SCI_CHARLEFTRECTEXTEND:
- if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) {
- SelectionPosition spCaret = sel.RangeMain().caret;
- spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1);
- MovePositionTo(spCaret, Selection::selRectangle);
- } else {
- MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1), Selection::selRectangle);
- }
- SetLastXChosen();
- break;
case SCI_CHARRIGHT:
- if (SelectionEmpty() || sel.MoveExtends()) {
- if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(sel.MainCaret())) {
- SelectionPosition spCaret = sel.RangeMain().caret;
- spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1);
- MovePositionTo(spCaret);
- } else if (sel.MoveExtends() && sel.selType == Selection::selStream) {
- MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1));
- } else {
- MovePositionTo(MovePositionSoVisible(
- SelectionPosition((sel.LimitsForRectangularElseMain().end).Position() + 1), 1));
- }
- } else {
- MovePositionTo(sel.LimitsForRectangularElseMain().end);
- }
- SetLastXChosen();
- break;
case SCI_CHARRIGHTEXTEND:
- if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(sel.MainCaret())) {
- SelectionPosition spCaret = sel.RangeMain().caret;
- spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1);
- MovePositionTo(spCaret, Selection::selStream);
- } else {
- MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1), Selection::selStream);
- }
- SetLastXChosen();
- break;
case SCI_CHARRIGHTRECTEXTEND:
- if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) && pdoc->IsLineEndPosition(sel.MainCaret())) {
- SelectionPosition spCaret = sel.RangeMain().caret;
- spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1);
- MovePositionTo(spCaret, Selection::selRectangle);
- } else {
- MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1), Selection::selRectangle);
- }
- SetLastXChosen();
- break;
case SCI_WORDLEFT:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), -1), -1));
- SetLastXChosen();
- break;
case SCI_WORDLEFTEXTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), -1), -1), Selection::selStream);
- SetLastXChosen();
- break;
case SCI_WORDRIGHT:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), 1), 1));
- SetLastXChosen();
- break;
case SCI_WORDRIGHTEXTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), 1), 1), Selection::selStream);
- SetLastXChosen();
- break;
-
case SCI_WORDLEFTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), -1), -1));
- SetLastXChosen();
- break;
case SCI_WORDLEFTENDEXTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), -1), -1), Selection::selStream);
- SetLastXChosen();
- break;
case SCI_WORDRIGHTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), 1), 1));
- SetLastXChosen();
- break;
case SCI_WORDRIGHTENDEXTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), 1), 1), Selection::selStream);
- SetLastXChosen();
- break;
-
+ case SCI_WORDPARTLEFT:
+ case SCI_WORDPARTLEFTEXTEND:
+ case SCI_WORDPARTRIGHT:
+ case SCI_WORDPARTRIGHTEXTEND:
case SCI_HOME:
- MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())));
- SetLastXChosen();
- break;
case SCI_HOMEEXTEND:
- MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())), Selection::selStream);
- SetLastXChosen();
- break;
case SCI_HOMERECTEXTEND:
- MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())), Selection::selRectangle);
- SetLastXChosen();
- break;
+ case SCI_HOMEDISPLAY:
+ case SCI_HOMEDISPLAYEXTEND:
+ case SCI_HOMEWRAP:
+ case SCI_HOMEWRAPEXTEND:
+ case SCI_VCHOME:
+ case SCI_VCHOMEEXTEND:
+ case SCI_VCHOMERECTEXTEND:
+ case SCI_VCHOMEDISPLAY:
+ case SCI_VCHOMEDISPLAYEXTEND:
+ case SCI_VCHOMEWRAP:
+ case SCI_VCHOMEWRAPEXTEND:
case SCI_LINEEND:
- MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()));
- SetLastXChosen();
- break;
case SCI_LINEENDEXTEND:
- MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()), Selection::selStream);
- SetLastXChosen();
- break;
case SCI_LINEENDRECTEXTEND:
- MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()), Selection::selRectangle);
- SetLastXChosen();
- break;
- case SCI_HOMEWRAP: {
- SelectionPosition homePos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1);
- if (sel.RangeMain().caret <= homePos)
- homePos = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())));
- MovePositionTo(homePos);
- SetLastXChosen();
- }
- break;
- case SCI_HOMEWRAPEXTEND: {
- SelectionPosition homePos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1);
- if (sel.RangeMain().caret <= homePos)
- homePos = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())));
- MovePositionTo(homePos, Selection::selStream);
- SetLastXChosen();
- }
- break;
- case SCI_LINEENDWRAP: {
- SelectionPosition endPos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), false), 1);
- SelectionPosition realEndPos = SelectionPosition(pdoc->LineEndPosition(sel.MainCaret()));
- if (endPos > realEndPos // if moved past visible EOLs
- || sel.RangeMain().caret >= endPos) // if at end of display line already
- endPos = realEndPos;
- MovePositionTo(endPos);
- SetLastXChosen();
- }
- break;
- case SCI_LINEENDWRAPEXTEND: {
- SelectionPosition endPos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), false), 1);
- SelectionPosition realEndPos = SelectionPosition(pdoc->LineEndPosition(sel.MainCaret()));
- if (endPos > realEndPos // if moved past visible EOLs
- || sel.RangeMain().caret >= endPos) // if at end of display line already
- endPos = realEndPos;
- MovePositionTo(endPos, Selection::selStream);
- SetLastXChosen();
- }
- break;
+ case SCI_LINEENDDISPLAY:
+ case SCI_LINEENDDISPLAYEXTEND:
+ case SCI_LINEENDWRAP:
+ case SCI_LINEENDWRAPEXTEND:
+ return HorizontalMove(iMessage);
+
case SCI_DOCUMENTSTART:
MovePositionTo(0);
SetLastXChosen();
@@ -3381,38 +3701,6 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_FORMFEED:
AddChar('\f');
break;
- case SCI_VCHOME:
- MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()));
- SetLastXChosen();
- break;
- case SCI_VCHOMEEXTEND:
- MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()), Selection::selStream);
- SetLastXChosen();
- break;
- case SCI_VCHOMERECTEXTEND:
- MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()), Selection::selRectangle);
- SetLastXChosen();
- break;
- case SCI_VCHOMEWRAP: {
- SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret()));
- SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1);
- if ((viewLineStart < sel.RangeMain().caret) && (viewLineStart > homePos))
- homePos = viewLineStart;
-
- MovePositionTo(homePos);
- SetLastXChosen();
- }
- break;
- case SCI_VCHOMEWRAPEXTEND: {
- SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret()));
- SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1);
- if ((viewLineStart < sel.RangeMain().caret) && (viewLineStart > homePos))
- homePos = viewLineStart;
-
- MovePositionTo(homePos, Selection::selStream);
- SetLastXChosen();
- }
- break;
case SCI_ZOOMIN:
if (vs.zoomLevel < 20) {
vs.zoomLevel++;
@@ -3427,46 +3715,14 @@ int Editor::KeyCommand(unsigned int iMessage) { NotifyZoom();
}
break;
- case SCI_DELWORDLEFT: {
- int startWord = pdoc->NextWordStart(sel.MainCaret(), -1);
- pdoc->DeleteChars(startWord, sel.MainCaret() - startWord);
- sel.RangeMain().ClearVirtualSpace();
- SetLastXChosen();
- }
- break;
- case SCI_DELWORDRIGHT: {
- UndoGroup ug(pdoc);
- InvalidateWholeSelection();
- sel.RangeMain().caret = SelectionPosition(
- InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace()));
- sel.RangeMain().anchor = sel.RangeMain().caret;
- int endWord = pdoc->NextWordStart(sel.MainCaret(), 1);
- pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret());
- }
- break;
- case SCI_DELWORDRIGHTEND: {
- UndoGroup ug(pdoc);
- InvalidateWholeSelection();
- sel.RangeMain().caret = SelectionPosition(
- InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace()));
- int endWord = pdoc->NextWordEnd(sel.MainCaret(), 1);
- pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret());
- }
- break;
- case SCI_DELLINELEFT: {
- int line = pdoc->LineFromPosition(sel.MainCaret());
- int start = pdoc->LineStart(line);
- pdoc->DeleteChars(start, sel.MainCaret() - start);
- sel.RangeMain().ClearVirtualSpace();
- SetLastXChosen();
- }
- break;
- case SCI_DELLINERIGHT: {
- int line = pdoc->LineFromPosition(sel.MainCaret());
- int end = pdoc->LineEnd(line);
- pdoc->DeleteChars(sel.MainCaret(), end - sel.MainCaret());
- }
- break;
+
+ case SCI_DELWORDLEFT:
+ case SCI_DELWORDRIGHT:
+ case SCI_DELWORDRIGHTEND:
+ case SCI_DELLINELEFT:
+ case SCI_DELLINERIGHT:
+ return DelWordOrLine(iMessage);
+
case SCI_LINECOPY: {
int lineStart = pdoc->LineFromPosition(SelectionStart().Position());
int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position());
@@ -3506,62 +3762,6 @@ int Editor::KeyCommand(unsigned int iMessage) { case SCI_UPPERCASE:
ChangeCaseOfSelection(cmUpper);
break;
- case SCI_WORDPARTLEFT:
- MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1));
- SetLastXChosen();
- break;
- case SCI_WORDPARTLEFTEXTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1), Selection::selStream);
- SetLastXChosen();
- break;
- case SCI_WORDPARTRIGHT:
- MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(sel.MainCaret()), 1));
- SetLastXChosen();
- break;
- case SCI_WORDPARTRIGHTEXTEND:
- MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(sel.MainCaret()), 1), Selection::selStream);
- SetLastXChosen();
- break;
- case SCI_HOMEDISPLAY:
- MovePositionTo(MovePositionSoVisible(
- StartEndDisplayLine(sel.MainCaret(), true), -1));
- SetLastXChosen();
- break;
- case SCI_VCHOMEDISPLAY: {
- SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret()));
- SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1);
- if (viewLineStart > homePos)
- homePos = viewLineStart;
-
- MovePositionTo(homePos);
- SetLastXChosen();
- }
- break;
- case SCI_HOMEDISPLAYEXTEND:
- MovePositionTo(MovePositionSoVisible(
- StartEndDisplayLine(sel.MainCaret(), true), -1), Selection::selStream);
- SetLastXChosen();
- break;
- case SCI_VCHOMEDISPLAYEXTEND: {
- SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret()));
- SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1);
- if (viewLineStart > homePos)
- homePos = viewLineStart;
-
- MovePositionTo(homePos, Selection::selStream);
- SetLastXChosen();
- }
- break;
- case SCI_LINEENDDISPLAY:
- MovePositionTo(MovePositionSoVisible(
- StartEndDisplayLine(sel.MainCaret(), false), 1));
- SetLastXChosen();
- break;
- case SCI_LINEENDDISPLAYEXTEND:
- MovePositionTo(MovePositionSoVisible(
- StartEndDisplayLine(sel.MainCaret(), false), 1), Selection::selStream);
- SetLastXChosen();
- break;
case SCI_SCROLLTOSTART:
ScrollTo(0);
break;
@@ -6194,7 +6394,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return pdoc->ExtendWordSelect(static_cast<int>(wParam), 1, lParam != 0);
case SCI_ISRANGEWORD:
- return pdoc->IsWordAt(static_cast<int>(wParam), lParam);
+ return pdoc->IsWordAt(static_cast<int>(wParam), static_cast<int>(lParam));
case SCI_SETWRAPMODE:
if (vs.SetWrapState(static_cast<int>(wParam))) {
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 909c82a..a83062f 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -326,6 +326,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool SelectionContainsProtected();
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const;
SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const;
+ void MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible);
void MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true);
void MovePositionTo(int newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true);
SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir);
@@ -458,9 +459,15 @@ protected: // ScintillaBase subclass needs access to much of Editor void Duplicate(bool forLine);
virtual void CancelModes();
void NewLine();
+ SelectionPosition PositionUpOrDown(SelectionPosition spStart, int direction, int lastX);
void CursorUpOrDown(int direction, Selection::selTypes selt);
void ParaUpOrDown(int direction, Selection::selTypes selt);
int StartEndDisplayLine(int pos, bool start);
+ int VCHomeDisplayPosition(int position);
+ int VCHomeWrapPosition(int position);
+ int LineEndWrapPosition(int position);
+ int HorizontalMove(unsigned int iMessage);
+ int DelWordOrLine(unsigned int iMessage);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDownWithModifiers(int key, int modifiers, bool *consumed);
diff --git a/scintilla/src/ExternalLexer.cxx b/scintilla/src/ExternalLexer.cxx index 8ccb34f..75396a7 100644 --- a/scintilla/src/ExternalLexer.cxx +++ b/scintilla/src/ExternalLexer.cxx @@ -11,6 +11,7 @@ #include <assert.h>
#include <ctype.h>
+#include <stdexcept>
#include <string>
#include "Platform.h"
diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx index ec5db53..6b012a9 100644 --- a/scintilla/src/Indicator.cxx +++ b/scintilla/src/Indicator.cxx @@ -5,6 +5,7 @@ // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
+#include <stdexcept>
#include <vector>
#include <map>
diff --git a/scintilla/src/KeyMap.cxx b/scintilla/src/KeyMap.cxx index 60729d0..93a3a0a 100644 --- a/scintilla/src/KeyMap.cxx +++ b/scintilla/src/KeyMap.cxx @@ -7,6 +7,7 @@ #include <stdlib.h>
+#include <stdexcept>
#include <vector>
#include <map>
diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index f6a0490..4456664 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -8,6 +8,7 @@ #include <string.h>
#include <math.h>
+#include <stdexcept>
#include <vector>
#include <map>
diff --git a/scintilla/src/MarginView.cxx b/scintilla/src/MarginView.cxx index a6fc1f4..f164a7c 100644 --- a/scintilla/src/MarginView.cxx +++ b/scintilla/src/MarginView.cxx @@ -25,6 +25,7 @@ #include "Scintilla.h" #include "StringCopy.h" +#include "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" diff --git a/scintilla/src/PerLine.cxx b/scintilla/src/PerLine.cxx index 4e241f8..8cc3818 100644 --- a/scintilla/src/PerLine.cxx +++ b/scintilla/src/PerLine.cxx @@ -7,12 +7,14 @@ #include <string.h>
+#include <stdexcept>
#include <vector>
#include <algorithm>
#include "Platform.h"
#include "Scintilla.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "CellBuffer.h"
diff --git a/scintilla/src/Position.h b/scintilla/src/Position.h new file mode 100644 index 0000000..4ef6552 --- /dev/null +++ b/scintilla/src/Position.h @@ -0,0 +1,22 @@ +// Scintilla source code edit control +/** @file Position.h + ** Will define global type name Position in the Sci internal namespace. + **/ +// Copyright 2015 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef POSITION_H +#define POSITION_H + +namespace Sci { + +// After 3.6.0: +// typedef int Position; + +// A later version (4.x) of this file may: +//#if defined(SCI_LARGE_FILE_SUPPORT) +//typedef ptrdiff_t Position; + +} + +#endif diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index 930e898..c9cf637 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -21,6 +21,7 @@ #include "ILexer.h"
#include "Scintilla.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx index 4c60f55..ecb9ec4 100644 --- a/scintilla/src/RESearch.cxx +++ b/scintilla/src/RESearch.cxx @@ -202,9 +202,11 @@ #include <stdlib.h>
+#include <stdexcept>
#include <string>
#include <algorithm>
+#include "Position.h"
#include "CharClassify.h"
#include "RESearch.h"
diff --git a/scintilla/src/RunStyles.cxx b/scintilla/src/RunStyles.cxx index 733cc0b..9b310a6 100644 --- a/scintilla/src/RunStyles.cxx +++ b/scintilla/src/RunStyles.cxx @@ -15,6 +15,7 @@ #include "Platform.h"
#include "Scintilla.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index 914b54d..092a24e 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -33,6 +33,7 @@ #include "Catalogue.h"
#endif
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@@ -168,10 +169,10 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { EnsureCaretVisible();
return 0;
case SCI_TAB:
- AutoCompleteCompleted();
+ AutoCompleteCompleted(0, SC_AC_TAB);
return 0;
case SCI_NEWLINE:
- AutoCompleteCompleted();
+ AutoCompleteCompleted(0, SC_AC_NEWLINE);
return 0;
default:
@@ -202,7 +203,7 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { void ScintillaBase::AutoCompleteDoubleClick(void *p) {
ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p);
- sci->AutoCompleteCompleted();
+ sci->AutoCompleteCompleted(0, SC_AC_DOUBLECLICK);
}
void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {
@@ -340,7 +341,7 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() { void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
if (ac.IsFillUpChar(ch)) {
- AutoCompleteCompleted();
+ AutoCompleteCompleted(ch, SC_AC_FILLUP);
} else if (ac.IsStopChar(ch)) {
AutoCompleteCancel();
} else {
@@ -363,7 +364,7 @@ void ScintillaBase::AutoCompleteCharacterDeleted() { NotifyParent(scn);
}
-void ScintillaBase::AutoCompleteCompleted() {
+void ScintillaBase::AutoCompleteCompleted(char ch, unsigned int completionMethod) {
int item = ac.GetSelection();
if (item == -1) {
AutoCompleteCancel();
@@ -376,6 +377,8 @@ void ScintillaBase::AutoCompleteCompleted() { SCNotification scn = {};
scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
scn.message = 0;
+ scn.ch = ch;
+ scn.listCompletionMethod = completionMethod;
scn.wParam = listType;
scn.listType = listType;
Position firstPos = ac.posStart - ac.startLen;
@@ -398,6 +401,10 @@ void ScintillaBase::AutoCompleteCompleted() { return;
AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast<int>(selected.length()));
SetLastXChosen();
+
+ scn.nmhdr.code = SCN_AUTOCCOMPLETED;
+ NotifyParent(scn);
+
}
int ScintillaBase::AutoCompleteGetCurrent() const {
@@ -733,6 +740,7 @@ void LexState::FreeSubStyles() { void LexState::SetIdentifiers(int style, const char *identifiers) {
if (instance && (interfaceVersion >= lvSubStyles)) {
static_cast<ILexerWithSubStyles *>(instance)->SetIdentifiers(style, identifiers);
+ pdoc->ModifiedAt(0);
}
}
@@ -788,7 +796,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return ac.posStart;
case SCI_AUTOCCOMPLETE:
- AutoCompleteCompleted();
+ AutoCompleteCompleted(0, SC_AC_COMMAND);
break;
case SCI_AUTOCSETSEPARATOR:
diff --git a/scintilla/src/ScintillaBase.h b/scintilla/src/ScintillaBase.h index 9cffce5..e2eb7f1 100644 --- a/scintilla/src/ScintillaBase.h +++ b/scintilla/src/ScintillaBase.h @@ -75,7 +75,7 @@ protected: int AutoCompleteGetCurrentText(char *buffer) const;
void AutoCompleteCharacterAdded(char ch);
void AutoCompleteCharacterDeleted();
- void AutoCompleteCompleted();
+ void AutoCompleteCompleted(char ch, unsigned int completionMethod);
void AutoCompleteMoveToCurrentWord();
static void AutoCompleteDoubleClick(void *p);
diff --git a/scintilla/src/Selection.cxx b/scintilla/src/Selection.cxx index 498c4c0..8133537 100644 --- a/scintilla/src/Selection.cxx +++ b/scintilla/src/Selection.cxx @@ -7,6 +7,7 @@ #include <stdlib.h>
+#include <stdexcept>
#include <vector>
#include <algorithm>
@@ -14,6 +15,7 @@ #include "Scintilla.h"
+#include "Position.h"
#include "Selection.h"
#ifdef SCI_NAMESPACE
@@ -311,6 +313,14 @@ void Selection::TrimSelection(SelectionRange range) { }
}
+void Selection::TrimOtherSelections(size_t r, SelectionRange range) {
+ for (size_t i = 0; i<ranges.size(); ++i) {
+ if (i != r) {
+ ranges[i].Trim(range);
+ }
+ }
+}
+
void Selection::SetSelection(SelectionRange range) {
ranges.clear();
ranges.push_back(range);
diff --git a/scintilla/src/Selection.h b/scintilla/src/Selection.h index 0e605bb..fc14408 100644 --- a/scintilla/src/Selection.h +++ b/scintilla/src/Selection.h @@ -168,6 +168,7 @@ public: int Length() const;
void MovePositions(bool insertion, int startChange, int length);
void TrimSelection(SelectionRange range);
+ void TrimOtherSelections(size_t r, SelectionRange range);
void SetSelection(SelectionRange range);
void AddSelection(SelectionRange range);
void AddSelectionWithoutTrim(SelectionRange range);
diff --git a/scintilla/src/SplitVector.h b/scintilla/src/SplitVector.h index 0fc27dd..cd75e35 100644 --- a/scintilla/src/SplitVector.h +++ b/scintilla/src/SplitVector.h @@ -85,6 +85,9 @@ public: /// copy exisiting contents to the new buffer.
/// Must not be used to decrease the size of the buffer.
void ReAllocate(int newSize) {
+ if (newSize < 0)
+ throw std::runtime_error("SplitVector::ReAllocate: negative size.");
+
if (newSize > size) {
// Move the gap to the end
GapTo(lengthBody);
diff --git a/scintilla/src/Style.cxx b/scintilla/src/Style.cxx index 467a26f..15192ca 100644 --- a/scintilla/src/Style.cxx +++ b/scintilla/src/Style.cxx @@ -7,6 +7,8 @@ #include <string.h>
+#include <stdexcept>
+
#include "Platform.h"
#include "Scintilla.h"
diff --git a/scintilla/src/Style.h b/scintilla/src/Style.h index a4be6d9..2fb378b 100644 --- a/scintilla/src/Style.h +++ b/scintilla/src/Style.h @@ -61,7 +61,7 @@ public: ColourDesired back;
bool eolFilled;
bool underline;
- enum ecaseForced {caseMixed, caseUpper, caseLower};
+ enum ecaseForced {caseMixed, caseUpper, caseLower, caseCamel};
ecaseForced caseForce;
bool visible;
bool changeable;
diff --git a/scintilla/src/UniConversion.cxx b/scintilla/src/UniConversion.cxx index 4421d1a..639ccbf 100644 --- a/scintilla/src/UniConversion.cxx +++ b/scintilla/src/UniConversion.cxx @@ -7,6 +7,8 @@ #include <stdlib.h>
+#include <stdexcept>
+
#include "UniConversion.h"
#ifdef SCI_NAMESPACE
diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index d815614..eff7a82 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -8,12 +8,14 @@ #include <string.h>
#include <assert.h>
+#include <stdexcept>
#include <vector>
#include <map>
#include "Platform.h"
#include "Scintilla.h"
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
diff --git a/scintilla/src/XPM.cxx b/scintilla/src/XPM.cxx index 3e3faf0..05fbc22 100644 --- a/scintilla/src/XPM.cxx +++ b/scintilla/src/XPM.cxx @@ -8,6 +8,7 @@ #include <stdlib.h>
#include <string.h>
+#include <stdexcept>
#include <vector>
#include <map>
diff --git a/scintilla/version.txt b/scintilla/version.txt index 385a7e5..0f1ef13 100644 --- a/scintilla/version.txt +++ b/scintilla/version.txt @@ -1 +1 @@ -357
+360
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index 76c88cb..afecb61 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -893,46 +893,15 @@ typedef VarBuffer<int, stackBufferLength> TextPositionsI; void SurfaceGDI::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT fuOptions) {
SetFont(font_);
- RECT rcw = RectFromPRectangle(rc);
- SIZE sz={0,0};
- int pos = 0;
- int x = static_cast<int>(rc.left);
+ const RECT rcw = RectFromPRectangle(rc);
+ const int x = static_cast<int>(rc.left);
const int yBaseInt = static_cast<int>(ybase);
- // Text drawing may fail if the text is too big.
- // If it does fail, slice up into segments and draw each segment.
- const int maxSegmentLength = 0x200;
-
- if (!unicodeMode) {
- // Use ANSI calls
- int lenDraw = Platform::Minimum(len, maxLenText);
- if (!::ExtTextOutA(hdc, x, yBaseInt, fuOptions, &rcw, s, lenDraw, NULL)) {
- while (lenDraw > pos) {
- int seglen = Platform::Minimum(maxSegmentLength, lenDraw - pos);
- if (!::ExtTextOutA(hdc, x, yBaseInt, fuOptions, &rcw, s + pos, seglen, NULL)) {
- PLATFORM_ASSERT(false);
- return;
- }
- ::GetTextExtentPoint32A(hdc, s+pos, seglen, &sz);
- x += sz.cx;
- pos += seglen;
- }
- }
- } else {
- // Use Unicode calls
+ if (unicodeMode) {
const TextWide tbuf(s, len, unicodeMode, codePage);
- if (!::ExtTextOutW(hdc, x, yBaseInt, fuOptions, &rcw, tbuf.buffer, tbuf.tlen, NULL)) {
- while (tbuf.tlen > pos) {
- int seglen = Platform::Minimum(maxSegmentLength, tbuf.tlen - pos);
- if (!::ExtTextOutW(hdc, x, yBaseInt, fuOptions, &rcw, tbuf.buffer + pos, seglen, NULL)) {
- PLATFORM_ASSERT(false);
- return;
- }
- ::GetTextExtentPoint32W(hdc, tbuf.buffer+pos, seglen, &sz);
- x += sz.cx;
- pos += seglen;
- }
- }
+ ::ExtTextOutW(hdc, x, yBaseInt, fuOptions, &rcw, tbuf.buffer, tbuf.tlen, NULL);
+ } else {
+ ::ExtTextOutA(hdc, x, yBaseInt, fuOptions, &rcw, s, len, NULL);
}
}
@@ -977,75 +946,43 @@ XYPOSITION SurfaceGDI::WidthText(Font &font_, const char *s, int len) { }
void SurfaceGDI::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) {
+ // Zero positions to avoid random behaviour on failure.
+ std::fill(positions, positions + len, 0.0f);
SetFont(font_);
SIZE sz={0,0};
int fit = 0;
+ int i = 0;
if (unicodeMode) {
const TextWide tbuf(s, len, unicodeMode, codePage);
TextPositionsI poses(tbuf.tlen);
- fit = tbuf.tlen;
if (!::GetTextExtentExPointW(hdc, tbuf.buffer, tbuf.tlen, maxWidthMeasure, &fit, poses.buffer, &sz)) {
- // Likely to have failed because on Windows 9x where function not available
- // So measure the character widths by measuring each initial substring
- // Turns a linear operation into a quadratic but seems fast enough on test files
- for (int widthSS=0; widthSS < tbuf.tlen; widthSS++) {
- ::GetTextExtentPoint32W(hdc, tbuf.buffer, widthSS+1, &sz);
- poses.buffer[widthSS] = sz.cx;
- }
+ // Failure
+ return;
}
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
- int ui=0;
- const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
- int i=0;
- while (ui<fit) {
- unsigned char uch = us[i];
- unsigned int lenChar = 1;
- if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) {
- lenChar = 4;
+ for (int ui = 0; ui < fit; ui++) {
+ unsigned int lenChar = UTF8BytesOfLead[static_cast<unsigned char>(s[i])];
+ if (lenChar == 4) { // Non-BMP
ui++;
- } else if (uch >= (0x80 + 0x40 + 0x20)) {
- lenChar = 3;
- } else if (uch >= (0x80)) {
- lenChar = 2;
}
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
positions[i++] = static_cast<XYPOSITION>(poses.buffer[ui]);
}
- ui++;
- }
- XYPOSITION lastPos = 0.0f;
- if (i > 0)
- lastPos = positions[i-1];
- while (i<len) {
- positions[i++] = lastPos;
}
} else {
- // Zero positions to avoid random behaviour on failure.
- std::fill(positions, positions + len, 0.0f);
- // len may be larger than platform supports so loop over segments small enough for platform
- int startOffset = 0;
- while (len > 0) {
- int lenBlock = Platform::Minimum(len, maxLenText);
- TextPositionsI poses(len);
- if (!::GetTextExtentExPointA(hdc, s, lenBlock, maxWidthMeasure, &fit, poses.buffer, &sz)) {
- // Eeek - a NULL DC or other foolishness could cause this.
- return;
- } else if (fit < lenBlock) {
- // For some reason, such as an incomplete DBCS character
- // Not all the positions are filled in so make them equal to end.
- if (fit == 0)
- poses.buffer[fit++] = 0;
- for (int i = fit; i<lenBlock; i++)
- poses.buffer[i] = poses.buffer[fit-1];
- }
- for (int i=0; i<lenBlock; i++)
- positions[i] = static_cast<XYPOSITION>(poses.buffer[i] + startOffset);
- startOffset = poses.buffer[lenBlock-1];
- len -= lenBlock;
- positions += lenBlock;
- s += lenBlock;
+ TextPositionsI poses(len);
+ if (!::GetTextExtentExPointA(hdc, s, len, maxWidthMeasure, &fit, poses.buffer, &sz)) {
+ // Eeek - a NULL DC or other foolishness could cause this.
+ return;
+ }
+ while (i<fit) {
+ positions[i] = static_cast<XYPOSITION>(poses.buffer[i]);
+ i++;
}
}
+ // If any positions not filled in then use the last position for them
+ const XYPOSITION lastPos = (fit > 0) ? positions[fit - 1] : 0.0f;
+ std::fill(positions+i, positions + len, lastPos);
}
XYPOSITION SurfaceGDI::WidthChar(Font &font_, char ch) {
@@ -2809,7 +2746,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam WS_CHILD | WS_VSCROLL | WS_VISIBLE |
LBS_OWNERDRAWFIXED | LBS_NODATA | LBS_NOINTEGRALHEIGHT,
0, 0, 150,80, hWnd,
- reinterpret_cast<HMENU>(ctrlID),
+ reinterpret_cast<HMENU>(static_cast<ptrdiff_t>(ctrlID)),
hinstanceParent,
0);
WNDPROC prevWndProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(lb, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(ControlWndProc)));
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 56ef1e3..38b576e 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -52,6 +52,7 @@ #ifdef SCI_LEXER
#include "LexerModule.h"
#endif
+#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@@ -235,10 +236,10 @@ class ScintillaWin : static sptr_t DirectFunction(
sptr_t ptr, UINT iMessage, uptr_t wParam, sptr_t lParam);
- static sptr_t PASCAL SWndProc(
- HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam);
- static sptr_t PASCAL CTWndProc(
- HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam);
+ static LRESULT PASCAL SWndProc(
+ HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);
+ static LRESULT PASCAL CTWndProc(
+ HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);
enum { invalidTimerID, standardTimerID, idleTimerID, fineTimerStart };
@@ -704,7 +705,7 @@ int ScintillaWin::EncodedFromUTF8(char *utf8, char *encoded) const { }
}
-LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
+sptr_t ScintillaWin::WndPaint(uptr_t wParam) {
//ElapsedTime et;
// Redirect assertions to debug output and save current state
@@ -1067,6 +1068,7 @@ sptr_t ScintillaWin::HandleCompositionInline(uptr_t, sptr_t lParam) { i += ucWidth;
}
}
+ EnsureCaretVisible();
SetCandidateWindowPos();
ShowCaretAtCurrentPosition();
::ImmReleaseContext(MainHWND(), hIMC);
@@ -3128,8 +3130,8 @@ BOOL ScintillaWin::DestroySystemCaret() { return retval;
}
-sptr_t PASCAL ScintillaWin::CTWndProc(
- HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam) {
+LRESULT PASCAL ScintillaWin::CTWndProc(
+ HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
// Find C++ object associated with window.
ScintillaWin *sciThis = reinterpret_cast<ScintillaWin *>(PointerFromWindow(hWnd));
try {
@@ -3246,8 +3248,8 @@ sptr_t __stdcall Scintilla_DirectFunction( return sci->WndProc(iMessage, wParam, lParam);
}
-sptr_t PASCAL ScintillaWin::SWndProc(
- HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam) {
+LRESULT PASCAL ScintillaWin::SWndProc(
+ HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
//Platform::DebugPrintf("S W:%x M:%x WP:%x L:%x\n", hWnd, iMessage, wParam, lParam);
// Find C++ object associated with window.
|