[UPDATE] Update Scintilla from v1.75 to v1.77.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@464 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/x64
Don Ho 2009-04-25 23:38:15 +00:00
parent 19befa9797
commit 9b645c68d3
73 changed files with 3481 additions and 2710 deletions

View File

@ -44,10 +44,10 @@ The current make file only supports static linking between SciTE and Scintilla.
*** Windows version ***
A C++ compiler is required. Visual Studio .NET 2003 is the development system
used for most development although Mingw32 3.1 and Borland C++ are also
supported.
For older versions of Borland make such as version 5.02, add the -l option.
A C++ compiler is required. Visual Studio .NET 2008 is the development system
used for most development although Mingw32 3.1 is also supported.
Borland did work but the command lines are now too long and the most recent
Borland version does not work. For older versions such as version 5.02, add the -l option.
To build Scintilla, make in the scintilla/win32 directory
cd scintilla\win32

View File

@ -116,7 +116,7 @@
<td>Arguments point at text buffers that Scintilla will fill with text. In some cases,
another argument will tell Scintilla the buffer size. In others, you must make sure that
the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed
then, for SCI_* calls, the length that should be allocated is returned.</td>
then, for SCI_* calls, the length that should be allocated is returned.</td>
</tr>
<tr>
@ -134,11 +134,11 @@
<th align="left" id="alpha">alpha</th>
<td>Translucency is set using an alpha value.
Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
translucency and only some Scintilla features implement translucency.
The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to
255 (SC_ALPHA_OPAQUE) which is opaque. The value 256 (SC_ALPHA_NOALPHA)
is opaque and uses code that is not alpha-aware and may be faster. Not all platforms support
translucency and only some Scintilla features implement translucency.
The default alpha value for most features is SC_ALPHA_NOALPHA.</td>
</tr>
<tr>
@ -515,7 +515,10 @@ struct TextRange {
<h2 id="Searching">Searching</h2>
<p>
There are methods to search for text and for regular expressions. The regular expression support
is limited and should only be used for simple cases and initial development.
is limited and should only be used for simple cases and initial development. A different regular expression
library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
or can be called from the container using direct access to the buffer contents through
<a class="jump" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
</p>
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, TextToFind
*ttf)</a><br />
@ -561,7 +564,7 @@ struct TextRange {
<td><code>SCFIND_POSIX</code></td>
<td>Treat regular expression in a more POSIX compatible manner
by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
by interpreting bare ( and ) for tagged sections rather than \( and \).</td>
</tr>
</tbody>
</table>
@ -609,7 +612,7 @@ struct TextRange {
</tr>
<tr>
<td>\&gt;</td>
<td><code>\&gt;</code></td>
<td>This matches the end of a word using Scintilla's definition of words.</td>
</tr>
@ -785,8 +788,8 @@ struct TextToFind {
<p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
<code>length</code> sets the number of character to replace the target with.
After replacement, the target range refers to the replacement text.
The return value
After replacement, the target range refers to the replacement text.
The return value
is the length of the replacement string.<br />
Note that the recommended way to delete text in the document is to set the target to the text to be removed,
and to perform a replace target with an empty string.</p>
@ -797,8 +800,8 @@ struct TextToFind {
characters to use. The replacement string is formed from the text string with any sequences of
<code>\1</code> through <code>\9</code> replaced by tagged matches from the most recent regular
expression search.
After replacement, the target range refers to the replacement text.
The return value is the length of the replacement string.</p>
After replacement, the target range refers to the replacement text.
The return value is the length of the replacement string.</p>
<p>See also: <a class="message" href="#SCI_FINDTEXT"><code>SCI_FINDTEXT</code></a></p>
@ -1630,8 +1633,8 @@ struct TextToFind {
If you never wish to see it, call
<code>SCI_SETHSCROLLBAR(0)</code>. Use <code>SCI_SETHSCROLLBAR(1)</code> to enable it again.
<code>SCI_GETHSCROLLBAR</code> returns the current state. The default state is to display it
when needed.
See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
when needed.</p>
<p>See also: <a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH</a>.</p>
<p><b id="SCI_SETVSCROLLBAR">SCI_SETVSCROLLBAR(bool visible)</b><br />
<b id="SCI_GETVSCROLLBAR">SCI_GETVSCROLLBAR</b><br />
@ -1716,7 +1719,7 @@ struct TextToFind {
<p>The effect of using any other <code>wsMode</code> value is undefined.</p>
<p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE&lt;(bool useWhitespaceForeColour, int <a
<p><b id="SCI_SETWHITESPACEFORE">SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int <a
class="jump" href="#colour">colour</a>)</b><br />
<b id="SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int <a
class="jump" href="#colour">colour</a>)</b><br />
@ -1880,8 +1883,8 @@ struct TextToFind {
<h2 id="StyleDefinition">Style definition</h2>
<p>While the style setting messages mentioned above change the style numbers associated with
text, these messages define how those style numbers are interpreted visually. There are 128
lexer styles that can be set, numbered 0 to <code>STYLEMAX</code> (127). Unless you use <a
text, these messages define how those style numbers are interpreted visually. There are 256
lexer styles that can be set, numbered 0 to <code>STYLE_MAX</code> (255). Unless you use <a
class="message" href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> to change the number
of style bits, styles 0 to 31 are used to set the text attributes. There are also some
predefined numbered styles starting at 32, The following <code>STYLE_</code>* constants are
@ -1937,8 +1940,8 @@ struct TextToFind {
<td>36</td>
<td>This style sets the font used when drawing control characters.
Only the font, size, bold, italics, and character set attributes are used and not
the colour attributes. See
Only the font, size, bold, italics, and character set attributes are used and not
the colour attributes. See
also: <a class="message"
href="#SCI_SETCONTROLCHARSYMBOL"><code>SCI_SETCONTROLCHARSYMBOL</code></a>.</td>
</tr>
@ -1959,7 +1962,7 @@ struct TextToFind {
<td> Call tips normally use the font attributes defined by <code>STYLE_DEFAULT</code>.
Use of <a class="message" href="#SCI_CALLTIPUSESTYLE"><code>SCI_CALLTIPUSESTYLE</code></a>
causes call tips to use this style instead. Only the font face name, font size,
causes call tips to use this style instead. Only the font face name, font size,
foreground and background colours and character set attributes are used.</td>
</tr>
@ -1977,7 +1980,7 @@ struct TextToFind {
<tr>
<th align="left"><code>STYLE_MAX</code></th>
<td>127</td>
<td>255</td>
<td>This is not a style but is the number of the maximum style that can be set. Styles
between <code>STYLE_LASTPREDEFINED</code> and <code>STYLE_MAX</code> would be appropriate
@ -2036,7 +2039,7 @@ struct TextToFind {
<a class="message" href="#SCI_STYLEGETCHANGEABLE">SCI_STYLEGETCHANGEABLE(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLESETHOTSPOT">SCI_STYLESETHOTSPOT(int styleNumber, bool
hotspot)</a><br />
<a class="message" href="#SCI_STYLGSETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
<a class="message" href="#SCI_STYLEGETHOTSPOT">SCI_STYLEGETHOTSPOT(int styleNumber)</a><br />
</code>
<p><b id="SCI_STYLERESETDEFAULT">SCI_STYLERESETDEFAULT</b><br />
@ -2223,7 +2226,7 @@ struct TextToFind {
href="#colour">colour</a>)</b><br />
<b id="SCI_GETCARETFORE">SCI_GETCARETFORE</b><br />
The colour of the caret can be set with <code>SCI_SETCARETFORE</code> and retrieved with
<code>SCI_CETCARETFORE</code>.</p>
<code>SCI_GETCARETFORE</code>.</p>
<p><b id="SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</b><br />
<b id="SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</b><br />
@ -2239,11 +2242,11 @@ struct TextToFind {
The two <code>SCI_GETCARET*</code> functions return the state and the colour. This form of
background colouring has highest priority when a line has markers that would otherwise change
the background colour.
The caret line may also be drawn translucently which allows other background colours to show
through. This is done by setting the alpha (translucency) value by calling
SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA,
the caret line is drawn after all other features so will affect the colour of all other features.
</p>
The caret line may also be drawn translucently which allows other background colours to show
through. This is done by setting the alpha (translucency) value by calling
SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA,
the caret line is drawn after all other features so will affect the colour of all other features.
</p>
<p><b id="SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</b><br />
<b id="SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</b><br />
@ -2428,6 +2431,8 @@ struct TextToFind {
<a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br />
<a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br />
<a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br />
<a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br />
<a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br />
<a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char
*chars)</a><br />
<a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char
@ -2524,6 +2529,12 @@ struct TextToFind {
<p>Setting <code>codePage</code> to a non-zero value that is not <code>SC_CP_UTF8</code> is
operating system dependent.</p>
<p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br />
<b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br />
On Windows, character keys are normally handled differently depending on whether Scintilla is a wide
or narrow character window with character messages treated as Unicode when wide and as 8 bit otherwise.
Set this property to always treat as Unicode. This option is needed for Delphi.</p>
<p><b id="SCI_SETWORDCHARS">SCI_SETWORDCHARS(&lt;unused&gt;, const char *chars)</b><br />
Scintilla has several functions that operate on words, which are defined to be contiguous
sequences of characters from a particular set of characters. This message defines which
@ -2535,11 +2546,11 @@ struct TextToFind {
<p><b id="SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(&lt;unused&gt;, const char *chars)</b><br />
Similar to <code>SCI_SETWORDCHARS</code>, this message allows the user to define which chars Scintilla considers
as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing
such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars
as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right.
This function should be called after <code>SCI_SETWORDCHARS</code> as it will
reset the whitespace characters to the default set.</p>
as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing
such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars
as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right.
This function should be called after <code>SCI_SETWORDCHARS</code> as it will
reset the whitespace characters to the default set.</p>
<p><b id="SCI_SETCHARSDEFAULT">SCI_SETCHARSDEFAULT</b><br />
Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other
characters with codes less than 0x20, with word characters set to alphanumeric and '_'.
@ -2550,7 +2561,7 @@ struct TextToFind {
<b id="SCI_SETFOCUS">SCI_SETFOCUS(bool focus)</b><br />
<b id="SCI_GETFOCUS">SCI_GETFOCUS</b><br />
Scintilla can be told to grab the focus with this message. This is needed more on GTK+ where
focus handling is more complicated than on Windows.</p>
focus handling is more complicated than on Windows.</p>
<p>The internal focus flag can be set with <code>SCI_SETFOCUS</code>. This is used by clients
that have complex focus requirements such as having their own window that gets the real focus
@ -2639,14 +2650,13 @@ struct TextToFind {
(0) to create all tabs and indents out of spaces. The default is <code>true</code>. You can use
<a class="message" href="#SCI_GETCOLUMN"><code>SCI_GETCOLUMN</code></a> to get the column of a
position taking the width of a tab into account.</p>
<b id="SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</b><br />
<p><b id="SCI_SETINDENT">SCI_SETINDENT(int widthInChars)</b><br />
<b id="SCI_GETINDENT">SCI_GETINDENT</b><br />
<code>SCI_SETINDENT</code> sets the size of indentation in terms of the width of a space in <a
class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>. If you set a width of
0, the indent size is the same as the tab size. There are no limits on indent sizes, but values
less than 0 or large values may have undesirable effects. <br />
<br />
less than 0 or large values may have undesirable effects.
</p>
<p><b id="SCI_SETTABINDENTS">SCI_SETTABINDENTS(bool tabIndents)</b><br />
<b id="SCI_GETTABINDENTS">SCI_GETTABINDENTS</b><br />
@ -2693,16 +2703,16 @@ struct TextToFind {
<tr>
<td><code>SC_IV_LOOKFORWARD</code></td>
<td>Indentation guides are shown beyond the actual indentation up to the level of the
next non-empty line.
If the previous non-empty line was a fold header then indentation guides are shown for
one more level of indent than that line. This setting is good for Python.</td>
next non-empty line.
If the previous non-empty line was a fold header then indentation guides are shown for
one more level of indent than that line. This setting is good for Python.</td>
</tr>
<tr>
<td><code>SC_IV_LOOKBOTH</code></td>
<td>Indentation guides are shown beyond the actual indentation up to the level of the
next non-empty line or previous non-empty line whichever is the greater.
This setting is good for most languages.</td>
next non-empty line or previous non-empty line whichever is the greater.
This setting is good for most languages.</td>
</tr>
</table>
@ -2774,7 +2784,7 @@ struct TextToFind {
and <code>SC_MARK_FULLRECT</code>.</p>
<p>The <code>SC_MARK_BACKGROUND</code> marker changes the background colour of the line only.
The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour.
The <code>SC_MARK_FULLRECT</code> symbol mirrors this, changing only the margin background colour.
The <code>SC_MARK_EMPTY</code> symbol is invisible, allowing client code to track the movement
of lines. You would also use it if you changed the folding style and wanted one or more of the
<code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p>
@ -3091,7 +3101,7 @@ struct TextToFind {
<td align="center">7</td>
<td>A rectangle with rounded corners around the text using translucent drawing with the
interior more transparent than the border.</td>
interior more transparent than the border.</td>
</tr>
</tbody>
</table>
@ -3173,14 +3183,14 @@ struct TextToFind {
and <a class="message" href="#SCI_SETSTYLING"><code>SCI_SETSTYLING</code></a> with the values
<code>INDIC0_MASK</code>, <code>INDIC1_MASK</code> and <code>INDIC2_MASK</code>.</p>
<p>If you are using indicators in a buffer that has a lexer active
(see <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a>),
you must save lexing state information before setting any indicators and restore it afterwards.
Use <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a>
to retrieve the current "styled to" position and
<a class="message" href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a>
to reset the styling position and mask (<code>0x1f </code> in the default layout of 5 style bits and 3 indicator bits)
when you are done.</p>
<p>If you are using indicators in a buffer that has a lexer active
(see <a class="message" href="#SCI_SETLEXER"><code>SCI_SETLEXER</code></a>),
you must save lexing state information before setting any indicators and restore it afterwards.
Use <a class="message" href="#SCI_GETENDSTYLED"><code>SCI_GETENDSTYLED</code></a>
to retrieve the current "styled to" position and
<a class="message" href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a>
to reset the styling position and mask (<code>0x1f </code> in the default layout of 5 style bits and 3 indicator bits)
when you are done.</p>
<p>The number of bits used for styles can be altered with <a class="message"
href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> from 0 to 7 bits. The remaining bits
@ -3421,7 +3431,7 @@ struct TextToFind {
<p>The mouse may be clicked on call tips and this causes a
<code><a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a></code>
notification to be sent to the container. Small up an down arrows may be displayed within
notification to be sent to the container. Small up and down arrows may be displayed within
a call tip by, respectively, including the characters '\001', or '\002'. This is useful
for showing that there are overloaded variants of one function name and that the user can
click on the arrows to cycle through the overloads.</p>
@ -3979,6 +3989,7 @@ struct RangeToFormat {
<h2 id="DirectAccess">Direct access</h2>
<code><a class="message" href="#SCI_GETDIRECTFUNCTION">SCI_GETDIRECTFUNCTION</a><br />
<a class="message" href="#SCI_GETDIRECTPOINTER">SCI_GETDIRECTPOINTER</a><br />
<a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a><br />
</code>
<p>On Windows, the message-passing scheme used to communicate between the container and
@ -4023,6 +4034,25 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
this once for each Scintilla window you create. When you call the direct function, you must
pass in the direct pointer associated with the target window.</p>
<p><b id="SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</b><br />
Move the gap within Scintilla so that the text of the document is stored consecutively
and ensure there is a NUL character after the text, then return a pointer to the first character.
Applications may then pass this to a function that accepts a character pointer such as a regular
expression search or a parser. The pointer should <em>not</em> be written to as that may desynchronize
the internal state of Scintilla.</p>
<p>Since any action in Scintilla may change its internal state
this pointer becomes invalid after any call or by allowing user interface activity. The application
should reacquire the pointer after making any call to Scintilla or performing any user-interface calls such
as modifying a progress indicator.</p>
<p>This call takes similar time to inserting a character at the end of the document and this may
include moving the document contents. Specifically, all the characters after the document gap
are moved to before the gap. This compacted state should persist over calls and user interface
actions that do not change the document contents so reacquiring the pointer afterwards is very
quick. If this call is used to implement a global replace operation, then each replacement will
move the gap so if <code>SCI_GETCHARACTERPOINTER</code> is called after
each replacement then the operation will become O(n^2) rather than O(n). Instead, all
matches should be found and remembered, then all the replacements performed.</p>
<h2 id="MultipleViews">Multiple views</h2>
<p>A Scintilla window and the document that it displays are separate entities. When you create
@ -4148,7 +4178,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
The first two messages mark a range of lines as visible or invisible and then redraw the
display. The third message reports on the visible state of a line and returns 1 if it is
visible and 0 if it is not visible. These messages have no effect on fold levels or fold
flags.</p>
flags. The first line can not be hidden.</p>
<p><b id="SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(int line, int level)</b><br />
<b id="SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(int line)</b><br />
@ -4278,6 +4308,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<a class="message" href="#SCI_GETWRAPMODE">SCI_GETWRAPMODE</a><br />
<a class="message" href="#SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</a><br />
<a class="message" href="#SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</a><br />
<a class="message" href="#SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</a><br />
<a class="message" href="#SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</a><br />
<a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</a><br />
<a class="message" href="#SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</a><br />
<a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
@ -4295,10 +4327,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
style is wider than the window then the break occurs after the last character that completely
fits on the line. The horizontal scroll bar does not appear when wrap mode is on.</p>
<p>For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a
wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla
draws the visual flag at begin of the next subline this subline will be indented by one char.
Independent from drawing a visual flag at the begin the subline can have an indention.</p>
<p>For wrapped lines Scintilla can draw visual flags (little arrows) at end of a a subline of a
wrapped line and at begin of the next subline. These can be enabled individually, but if Scintilla
draws the visual flag at begin of the next subline this subline will be indented by one char.
Independent from drawing a visual flag at the begin the subline can have an indention.</p>
<p>Much of the time used by Scintilla is spent on laying out and drawing text. The same text
layout calculations may be performed many times even when the data used in these calculations
@ -4331,8 +4363,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<p><b id="SCI_SETWRAPVISUALFLAGS">SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)</b><br />
<b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br />
You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
wrapVisualFlags determine which visual flags are drawn.
You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
wrapVisualFlags determine which visual flags are drawn.
<table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags">
<tbody>
@ -4360,16 +4392,16 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<td align="left"><code>SC_WRAPVISUALFLAG_START</code></td>
<td align="center">2</td>
<td>Visual flag at begin of subline of a wrapped line.<br />
Subline is indented by at least 1 to make room for the flag.<br />
</td>
Subline is indented by at least 1 to make room for the flag.<br />
</td>
</tr>
</tbody>
</table>
<p><b id="SCI_SETWRAPVISUALFLAGSLOCATION">SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)</b><br />
<b id="SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</b><br />
You can set wether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
You can set wether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
<table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
<tbody>
@ -4400,18 +4432,17 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
</tr>
</tbody>
</table>
<br />
</p>
<p><b id="SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</b><br />
<b id="SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</b><br />
<code>SCI_SETWRAPSTARTINDENT</code> sets the size of indentation of sublines for
wrapped lines in terms of the width of a space in
<a class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>.
There are no limits on indent sizes, but values less than 0 or large values may have
undesirable effects.<br />
The indention of sublines is independent of visual flags, but if
<code>SC_WRAPVISUALFLAG_START</code> is set an indent of at least 1 is used.
wrapped lines in terms of the width of a space in
<a class="message" href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>.
There are no limits on indent sizes, but values less than 0 or large values may have
undesirable effects.<br />
The indention of sublines is independent of visual flags, but if
<code>SC_WRAPVISUALFLAG_START</code> is set an indent of at least 1 is used.
</p>
<p><b id="SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</b><br />
@ -4463,7 +4494,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
</tr>
</tbody>
</table>
<br />
</p>
<p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
<b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
@ -4557,7 +4588,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
of a space character in <a class="message"
href="#StyleDefinition"><code>STYLE_DEFAULT</code></a>, so it may not work very well if
your styles use proportional fonts or if your style have varied font sizes or you use a
mixture of bold, italic and normal text. .</td>
mixture of bold, italic and normal text.</td>
</tr>
<tr>
@ -4570,9 +4601,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
</tr>
</tbody>
</table>
<br />
<br />
<p><b id="SCI_SETEDGECOLUMN">SCI_SETEDGECOLUMN(int column)</b><br />
<b id="SCI_GETEDGECOLUMN">SCI_GETEDGECOLUMN</b><br />
@ -4670,6 +4698,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
interpreted as integers. Search the lexer sources for <code>GetPropertyInt</code> to see how
properties are used.</p>
<p>There is a convention for naming properties used by lexers so that the set of properties can be found by scripts.
Property names should start with "lexer.&lt;lexer&gt;." or "fold.&lt;lexer&gt;." when they apply to one
lexer or start with "lexer." or "fold." if they apply to multiple lexers.</p>
<p><b id="SCI_GETPROPERTY">SCI_GETPROPERTY(const char *key, char *value)</b><br />
Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied
buffer and return the length (not including the terminating 0). If not found, copy an empty string
@ -4736,7 +4768,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<pre id="SCNotification">
struct NotifyHeader { // This matches the Win32 NMHDR structure
void *hwndFrom; // environment specific window handle/pointer
uptr_t idFrom; // CtrlID of the window issuing the notification
uptr_t idFrom; // CtrlID of the window issuing the notification
unsigned int code; // The SCN_* notification code
};
@ -4791,6 +4823,7 @@ struct SCNotification {
<a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
<a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
<a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br />
<a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br />
</code>
<p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
@ -4831,8 +4864,8 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
character) that is entered into the text. The container can use this to decide to display a <a
class="jump" href="#CallTips">call tip</a> or an <a class="jump" href="#Autocompletion">auto
completion list</a>. The character is in <code>SCNotification.ch</code>.
This notification is sent before the character has been styled so processing that depends on
styling should instead be performed in the SCN_UPDATEUI notification.</p>
This notification is sent before the character has been styled so processing that depends on
styling should instead be performed in the SCN_UPDATEUI notification.</p>
<p><b id="SCN_SAVEPOINTREACHED">SCN_SAVEPOINTREACHED</b><br />
<b id="SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT</b><br />
@ -4919,8 +4952,8 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
<td align="left">Valid for text changes, not for style changes. If we are collecting undo
information this holds a pointer to the text that is handed to the Undo system, otherwise
it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0 and
for user performed SC_MOD_BEFOREINSERT the text field points to an array of cells,
not bytes and the length is the number of cells.</td>
for user performed SC_MOD_BEFOREINSERT the text field points to an array of cells,
not bytes and the length is the number of cells.</td>
</tr>
<tr>
@ -5101,7 +5134,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
<td align="center">0x8000</td>
<td>A line state has changed because <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE</a>
was called.</td>
was called.</td>
<td><code>line</code></td>
</tr>
@ -5122,11 +5155,11 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
<td align="center">0x2000</td>
<td>This is set on a SC_PERFORMED_USER action when it is the
first or only step in an undo transaction. This can be used to integrate the Scintilla
undo stack with an undo stack in the container application by adding a Scintilla
action to the container's stack for the currently opened container transaction or
to open a new container transaction if there is no open container transaction.
</td>
first or only step in an undo transaction. This can be used to integrate the Scintilla
undo stack with an undo stack in the container application by adding a Scintilla
action to the container's stack for the currently opened container transaction or
to open a new container transaction if there is no open container transaction.
</td>
<td>None</td>
</tr>
@ -5426,9 +5459,13 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
</tbody>
</table>
<p><b id="SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</b><br />
The user has cancelled an <a class="jump" href="#Autocompletion">autocompletion list</a>.
There is no other information in SCNotification.
<h2 id="GTK">GTK+</h2>
<p>On GTK+, the following functions create a Scintilla widget, communicate with it and allow
resources to be released after all Scintilla widgets hace been destroyed.</p>
resources to be released after all Scintilla widgets have been destroyed.</p>
<code><a class="message" href="#scintilla_new">GtkWidget *scintilla_new()</a><br />
<a class="message" href="#scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</a><br />
<a class="message" href="#scintilla_send_message">sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)</a><br />
@ -5589,7 +5626,16 @@ EM_SETTARGETDEVICE
following the patterns of other lexers. The important thing is to include
<code>LINK_LEXER(lmMyLexer);</code> to correspond with the <code>LexerModule
lmMyLexer(...);</code> in your lexer source code.</p>
<h3>Building with an alternative Regular Expression implementation</h3>
<p id="AlternativeRegEx">A simple interface provides support for switching the Regular Expressions engine at
compile time. You must implement <code>RegexSearchBase</code> for your chosen engine,
look at the built-in implementation <code>BuiltinRegex</code> to see how this is done.
You then need to implement the factory method <code>CreateRegexSearch</code>
to create an instance of your class. You must disable the built-in implementation by defining
<code>SCI_OWNREGEX</code>.</p>
</body>
</html>

View File

@ -25,9 +25,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla175.zip?download">
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla177.zip?download">
Windows</a>&nbsp;&nbsp;
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla175.tgz?download">
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla177.tgz?download">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -41,7 +41,7 @@
containing very few restrictions.
</p>
<h3>
Release 1.75
Release 1.77
</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://prdownloads.sourceforge.net/scintilla/scintilla175.zip?download">zip format</a> (890K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla175.tgz?download">tgz format</a> (770K) commonly used on Linux and compatible operating systems</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla177.zip?download">zip format</a> (910K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla177.tgz?download">tgz format</a> (770K) 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>

View File

@ -313,6 +313,12 @@
</tr><tr>
<td>Sam Harwell</td>
<td>Boris</td>
<td>Jason Oster</td>
<td>Gertjan Kloosterman</td>
</tr><tr>
<td>alexbodn</td>
<td>Sergiu Dotenco</td>
<td>Anders Karlsson</td>
</tr>
</table>
<p>
@ -324,6 +330,197 @@
Icons</a> Copyright(C) 1998 by Dean S. Jones<br />
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite177.zip?download">Release 1.77</a>
</h3>
<ul>
<li>
Released on 18 October 2008.
</li>
<li>
Direct temporary access to Scintilla's text buffer to allow simple efficient interfacing
to libraries like regular expression libraries.
</li>
<li>
Scintilla on Windows can interpret keys as Unicode even when a narrow character
window with SCI_SETKEYSUNICODE.
</li>
<li>
Notification sent when autocompletion cancelled.
</li>
<li>
MySQL lexer added.
</li>
<li>
Lexer for gettext .po files added.
</li>
<li>
Abaqus lexer handles program structure more correctly.
</li>
<li>
Assembler lexer works with non-ASCII text.
</li>
<li>
C++ lexer allows mixed case doc comment tags.
</li>
<li>
CSS lexer updated and works with non-ASCII.
</li>
<li>
Diff lexer adds style for changed lines, handles subversion diffs better and
fixes styling and folding for lines containing chunk dividers ("---").
</li>
<li>
FORTRAN lexer accepts more styles of compiler directive.
</li>
<li>
Haskell lexer allows hexadecimal literals.
</li>
<li>
HTML lexer improves PHP and JavaScript folding.
PHP heredocs, nowdocs, strings and comments processed more accurately.
Internet Explorer's non-standard &gt;comment&lt; tag supported.
Script recognition in XML can be controlled with lexer.xml.allow.scripts property.
</li>
<li>
Lua lexer styles last character correctly.
</li>
<li>
Perl lexer update.
</li>
<li>
Comment folding implemented for Ruby.
</li>
<li>
Better TeX folding.
</li>
<li>
Verilog lexer updated.
</li>
<li>
Windows Batch file lexer handles %~ and %*.
</li>
<li>
YAML lexer allows non-ASCII text.
</li>
<li>
SciTE on GTK+ implements "Replace in Buffers" in advanced mode.
</li>
<li>
The extender OnBeforeSave method can override the default file saving behaviour by retuning true.
</li>
<li>
Window position and recent files list may be saved into the session file.
</li>
<li>
Right button press outside the selection moves the caret.
</li>
<li>
SciTE load.on.activate works when closing a document reveals a changed document.
</li>
<li>
SciTE bug fixed where eol.mode not used for initial buffer.
</li>
<li>
SciTE bug fixed where a file could be saved as the same name as another
buffer leading to confusing behaviour.
</li>
<li>
Fixed display bug for long lines in same style on Windows.
</li>
<li>
Fixed SciTE crash when finding matching preprocessor command used on some files.
</li>
<li>
Drawing performance improved for files with many blank lines.
</li>
<li>
Folding bugs fixed where changing program text produced a decrease in fold level on a fold header line.
</li>
<li>
Clearing document style now clears all indicators.
</li>
<li>
SciTE's embedded Lua updated to 5.1.4.
</li>
<li>
SciTE will compile with versions of GTK+ before 2.8 again.
</li>
<li>
SciTE on GTK+ bug fixed where multiple files not opened.
</li>
<li>
Bug fixed with SCI_VCHOMEWRAP and SCI_VCHOMEWRAPEXTEND on white last line.
</li>
<li>
Regular expression bug fixed where "^[^(]+$" matched empty lines.
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite176.zip?download">Release 1.76</a>
</h3>
<ul>
<li>
Released on 16 March 2008.
</li>
<li>
Support for PowerShell.
</li>
<li>
Lexer added for Magik.
</li>
<li>
Director extension working on GTK+.
</li>
<li>
Director extension may set focus to SciTE through "focus:" message on GTK+.
</li>
<li>
C++ folder handles final line better in some cases.
</li>
<li>
SCI_COPYALLOWLINE added which is similar to SCI_COPY except that if the selection is empty then
the line holding the caret is copied. On Windows an extra clipboard format allows pasting this as a whole
line before the current selection. This behaviour is compatible with Visual Studio.
</li>
<li>
On Windows, the horizontal scroll bar can handle wider files.
</li>
<li>
On Windows, a system palette leak was fixed. Should not affect many as palette mode is rarely used.
</li>
<li>
Install command on GTK+ no longer tries to set explicit owner.
</li>
<li>
Perl lexer handles defined-or operator "//".
</li>
<li>
Octave lexer fixes "!=" operator.
</li>
<li>
Optimized selection change drawing to not redraw as much when not needed.
</li>
<li>
SciTE on GTK+ no longer echoes Lua commands so is same as on Windows.
</li>
<li>
Automatic vertical scrolling limited to one line at a time so is not too fast.
</li>
<li>
Crash fixed when line states set beyond end of line states. This occurred when lexers did not
set a line state for each line.
</li>
<li>
Crash in SciTE on Windows fixed when search for 513 character string fails.
</li>
<li>
SciTE disables translucent features on Windows 9x due to crashes reported when using translucency.
</li>
<li>
Bug fixed where whitespace background was not seen on wrapped lines.
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite175.zip?download">Release 1.75</a>
</h3>
@ -5831,4 +6028,3 @@
</body>
</html>

View File

@ -122,6 +122,22 @@
<h3>
Projects using Scintilla
</h3>
<p>
<a href="http://www.flexedit.org/">FlexEdit</a>
is Free Text/Hex Editor for Windows.
</p>
<p>
<a href="http://www.assembla.com/wiki/show/FileWorkbench">File Workbench:</a>
a file manager / text editor environment with Squirrel scripting.
</p>
<p>
<a href="http://kephra.sf.net">Kephra</a>
is a free, easy and comfortable cross-platform editor written in Perl.
</p>
<p>
<a href="http://top.gresham-computing.com">TOP</a>
is an interface to HP's NonStop servers which run a proprietary OS.
</p>
<p>
<a href="http://universalindent.sourceforge.net/">UniversalIndentGUI</a>
is a cross platform GUI for several code formatters, beautifiers and indenters
@ -132,7 +148,7 @@
watches and backs up every change made in your source code.
</p>
<p>
<a href="http://www.applepanic.com/">ReportBuilder Primary</a>
<a href="http://elementaryreports.com/">Elementary Reports</a>
is designed to reduce the time to compose detailed and professional primary school reports.
</p>
<p>
@ -500,4 +516,3 @@
</body>
</html>

View File

@ -99,9 +99,6 @@
There is <a href="http://www.pnotepad.org/scintilla/">some work</a>
on this available.
</p>
<p>
Port to MacOS X.
</p>
<p>
More lexers for other languages.
</p>

View File

@ -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="20071122" />
<meta name="Date.Modified" content="20081018" />
<style type="text/css">
.versionlist {
color: #FFCC99;
@ -36,8 +36,8 @@
GTK+</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 1.75<br />
Site last modified November 22 2007</font>
<font color="#FFCC99" size="3"> Release version 1.77<br />
Site last modified October 18 2008</font>
</td>
<td width="20%">
&nbsp;
@ -52,6 +52,16 @@
</tr>
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="6" border="0">
<tr>
<td width="100%">
<span class="versionlist">Version 1.77 allows direct temporary access to the text buffer.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.76 fixes some minor bugs.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.75 displays invalid UTF-8 bytes as hexadecimal and
@ -144,8 +154,8 @@ if (IsRemote()) {
</p>
<p>
Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating
systems with GTK+. They have been run on Windows 95, NT 4.0, Windows 2000, and on Red Hat
Linux 8 and 9 with GTK+ 1.2 and 2.0. <a href="http://scintilla.sourceforge.net/SciTEImage.html">Here is a screenshot of
systems with GTK+. They have been run on Windows 95, NT 4.0, Windows 2000, and on Fedora 8
with GTK+ 2.12. <a href="http://scintilla.sourceforge.net/SciTEImage.html">Here is a screenshot of
SciTE.</a><br />
</p>
<p>
@ -197,4 +207,3 @@ if (IsRemote()) {
</body>
</html>

View File

@ -1071,22 +1071,22 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated
guint32 valOutline = *(reinterpret_cast<guint32 *>(pixVal));
guint32 *pixels = reinterpret_cast<guint32 *>(gdk_pixbuf_get_pixels(pixalpha));
int stride = gdk_pixbuf_get_rowstride(pixalpha) / 4;
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
if ((x==0) || (x==width-1) || (y == 0) || (y == height-1)) {
pixels[y*stride+x] = valOutline;
for (int yr=0; yr<height; yr++) {
for (int xr=0; xr<width; xr++) {
if ((xr==0) || (xr==width-1) || (yr == 0) || (yr == height-1)) {
pixels[yr*stride+xr] = valOutline;
} else {
pixels[y*stride+x] = valFill;
pixels[yr*stride+xr] = valFill;
}
}
}
for (int c=0;c<cornerSize; c++) {
for (int x=0;x<c+1; x++) {
AllFour(pixels, stride, width, height, x, c-x, valEmpty);
for (int xr=0;xr<c+1; xr++) {
AllFour(pixels, stride, width, height, xr, c-xr, valEmpty);
}
}
for (int x=1;x<cornerSize; x++) {
AllFour(pixels, stride, width, height, x, cornerSize-x, valOutline);
for (int xr=1;xr<cornerSize; xr++) {
AllFour(pixels, stride, width, height, xr, cornerSize-xr, valOutline);
}
// Draw with alpha
@ -1246,7 +1246,7 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
ColourAllocated fore) {
PenColour(fore);
if (gc && drawable) {
int x = rc.left;
int xText = rc.left;
#ifdef USE_PANGO
if (PFont(font_)->pfd) {
char *utfForm = 0;
@ -1271,7 +1271,7 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
}
pango_layout_set_font_description(layout, PFont(font_)->pfd);
PangoLayoutLine *pll = pango_layout_get_line(layout,0);
gdk_draw_layout_line(drawable, gc, x, ybase, pll);
gdk_draw_layout_line(drawable, gc, xText, ybase, pll);
if (useGFree) {
g_free(utfForm);
} else {
@ -1302,13 +1302,13 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
draw8bit = false;
wctext[wclen] = L'\0';
GdkWChar *wcp = wctext;
while ((wclen > 0) && (x < maxCoordinate)) {
while ((wclen > 0) && (xText < maxCoordinate)) {
int lenDraw = Platform::Minimum(wclen, segmentLength);
gdk_draw_text_wc(drawable, PFont(font_)->pfont, gc,
x, ybase, wcp, lenDraw);
xText, ybase, wcp, lenDraw);
wclen -= lenDraw;
if (wclen > 0) { // Avoid next calculation if possible as may be expensive
x += gdk_text_width_wc(PFont(font_)->pfont,
xText += gdk_text_width_wc(PFont(font_)->pfont,
wcp, lenDraw);
}
wcp += lenDraw;
@ -1316,13 +1316,13 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
}
}
if (draw8bit) {
while ((len > 0) && (x < maxCoordinate)) {
while ((len > 0) && (xText < maxCoordinate)) {
int lenDraw = Platform::Minimum(len, segmentLength);
gdk_draw_text(drawable, PFont(font_)->pfont, gc,
x, ybase, s, lenDraw);
xText, ybase, s, lenDraw);
len -= lenDraw;
if (len > 0) { // Avoid next calculation if possible as may be expensive
x += gdk_text_width(PFont(font_)->pfont, s, lenDraw);
xText += gdk_text_width(PFont(font_)->pfont, s, lenDraw);
}
s += lenDraw;
}
@ -1985,7 +1985,7 @@ public:
doubleClickAction = action;
doubleClickActionData = data;
}
virtual void SetList(const char* list, char separator, char typesep);
virtual void SetList(const char *listText, char separator, char typesep);
};
ListBox *ListBox::Allocate() {
@ -2490,12 +2490,12 @@ void ListBoxX::ClearRegisteredImages() {
xset.Clear();
}
void ListBoxX::SetList(const char* list, char separator, char typesep) {
void ListBoxX::SetList(const char *listText, char separator, char typesep) {
Clear();
int count = strlen(list) + 1;
int count = strlen(listText) + 1;
char *words = new char[count];
if (words) {
memcpy(words, list, count);
memcpy(words, listText, count);
char *startword = words;
char *numword = NULL;
int i = 0;

View File

@ -15,7 +15,7 @@
#include "Platform.h"
#if PLAT_GTK_WIN32
#include "Windows.h"
#include "windows.h"
#endif
#include "Scintilla.h"
@ -314,15 +314,15 @@ GdkAtom ScintillaGTK::atomUriList = 0;
GdkAtom ScintillaGTK::atomDROPFILES_DND = 0;
static const GtkTargetEntry clipboardCopyTargets[] = {
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ "STRING", 0, TARGET_STRING },
{ (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ (gchar *) "STRING", 0, TARGET_STRING },
};
static const gint nClipboardCopyTargets = sizeof(clipboardCopyTargets) / sizeof(clipboardCopyTargets[0]);
static const GtkTargetEntry clipboardPasteTargets[] = {
{ "text/uri-list", 0, TARGET_URI },
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ "STRING", 0, TARGET_STRING },
{ (gchar *) "text/uri-list", 0, TARGET_URI },
{ (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ (gchar *) "STRING", 0, TARGET_STRING },
};
static const gint nClipboardPasteTargets = sizeof(clipboardPasteTargets) / sizeof(clipboardPasteTargets[0]);
@ -1406,10 +1406,10 @@ void ScintillaGTK::ClaimSelection() {
void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText) {
char *data = reinterpret_cast<char *>(selectionData->data);
int len = selectionData->length;
GdkAtom selectionType = selectionData->type;
GdkAtom selectionTypeData = selectionData->type;
// Return empty string if selection is not a string
if ((selectionType != GDK_TARGET_STRING) && (selectionType != atomUTF8)) {
if ((selectionTypeData != GDK_TARGET_STRING) && (selectionTypeData != atomUTF8)) {
char *empty = new char[1];
empty[0] = '\0';
selText.Set(empty, 0, SC_CP_UTF8, 0, false, false);
@ -1425,7 +1425,7 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio
#endif
char *dest;
if (selectionType == GDK_TARGET_STRING) {
if (selectionTypeData == GDK_TARGET_STRING) {
dest = Document::TransformLineEnds(&len, data, len, pdoc->eolMode);
if (IsUnicodeMode()) {
// Unknown encoding so assume in Latin1
@ -1511,8 +1511,8 @@ void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) {
void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *text) {
#if PLAT_GTK_WIN32
// Many native win32 programs require \n line endings, so make a copy of
// the clip text now with newlines converted. Use { } to hide symbols
// GDK on Win32 expands any \n into \r\n, so make a copy of
// the clip text now with newlines converted to \n. Use { } to hide symbols
// from code below
SelectionText *newline_normalized = NULL;
{

View File

@ -69,11 +69,10 @@ LexConf.o LexCPP.o LexCrontab.o LexCsound.o LexCSS.o LexD.o LexEiffel.o \
LexErlang.o LexEScript.o LexFlagship.o LexForth.o LexFortran.o LexGAP.o \
LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o LexLisp.o LexLout.o \
LexLua.o LexMagik.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o LexMSSQL.o \
LexNsis.o LexObjC.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
LexMySQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
LexPLM.o LexPOV.o LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o \
LexRebol.o LexRuby.o LexScriptol.o LexSearchResult.o LexSmalltalk.o \
LexSpecman.o LexSpice.o LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexUser.o \
LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o \
LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
all: $(COMPLIB)

View File

@ -185,8 +185,8 @@ LEXOBJS=\
$(DIR_O)\LexMMIXAL.obj \
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexObjC.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
$(DIR_O)\LexPascal.obj \
@ -202,7 +202,6 @@ LEXOBJS=\
$(DIR_O)\LexRebol.obj \
$(DIR_O)\LexRuby.obj \
$(DIR_O)\LexScriptol.obj \
$(DIR_O)\LexSearchResult.obj \
$(DIR_O)\LexSmalltalk.obj \
$(DIR_O)\LexSpecman.obj \
$(DIR_O)\LexSpice.obj \
@ -210,7 +209,6 @@ LEXOBJS=\
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexUser.obj \
$(DIR_O)\LexVB.obj \
$(DIR_O)\LexVerilog.obj \
$(DIR_O)\LexVHDL.obj \
@ -441,9 +439,9 @@ $(DIR_O)\LexMPT.obj: ..\src\LexMPT.cxx $(LEX_HEADERS)
$(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexObjC.obj: ..\src\LexObjC.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
@ -475,8 +473,6 @@ $(DIR_O)\LexRuby.obj: ..\src\LexRuby.cxx $(LEX_HEADERS)
$(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS)
$(DIR_O)\LexSearchResult.obj: ..\src\LexSearchResult.cxx $(LEX_HEADERS)
$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS)
@ -491,8 +487,6 @@ $(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS)
$(DIR_O)\LexUser.obj: ..\src\LexUser.cxx $(LEX_HEADERS)
$(DIR_O)\LexVB.obj: ..\src\LexVB.cxx $(LEX_HEADERS)
$(DIR_O)\LexVerilog.obj: ..\src\LexVerilog.cxx $(LEX_HEADERS)

View File

@ -42,7 +42,7 @@
#undef PLAT_GTK
#define PLAT_GTK 1
#ifdef _MSC_VER
#if defined(__WIN32__) || defined(_MSC_VER)
#undef PLAT_GTK_WIN32
#define PLAT_GTK_WIN32 1
#endif
@ -131,7 +131,7 @@ public:
}
int Width() { return right - left; }
int Height() { return bottom - top; }
bool Empty() {
bool Empty() {
return (Height() <= 0) || (Width() <= 0);
}
};

View File

@ -101,6 +101,8 @@
#define SCLEX_R 86
#define SCLEX_MAGIK 87
#define SCLEX_POWERSHELL 88
#define SCLEX_MYSQL 89
#define SCLEX_PO 90
#define SCLEX_SEARCHRESULT 98
#define SCLEX_OBJC 99
#define SCLEX_USER 100
@ -113,11 +115,6 @@
#define SCE_UNIVERSAL_FOUND_STYLE_INC 28
#define SCE_UNIVERSAL_TAGMATCH 27
#define SCE_UNIVERSAL_TAGATTR 26
#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25
#define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24
#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23
#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22
#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@ -497,6 +494,7 @@
#define SCE_DIFF_POSITION 4
#define SCE_DIFF_DELETED 5
#define SCE_DIFF_ADDED 6
#define SCE_DIFF_CHANGED 7
#define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2
@ -661,6 +659,11 @@
#define SCE_CSS_SINGLESTRING 14
#define SCE_CSS_IDENTIFIER2 15
#define SCE_CSS_ATTRIBUTE 16
#define SCE_CSS_IDENTIFIER3 17
#define SCE_CSS_PSEUDOELEMENT 18
#define SCE_CSS_EXTENDED_IDENTIFIER 19
#define SCE_CSS_EXTENDED_PSEUDOCLASS 20
#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21
#define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2
@ -1278,6 +1281,36 @@
#define SCE_POWERSHELL_KEYWORD 8
#define SCE_POWERSHELL_CMDLET 9
#define SCE_POWERSHELL_ALIAS 10
#define SCE_MYSQL_DEFAULT 0
#define SCE_MYSQL_COMMENT 1
#define SCE_MYSQL_COMMENTLINE 2
#define SCE_MYSQL_VARIABLE 3
#define SCE_MYSQL_SYSTEMVARIABLE 4
#define SCE_MYSQL_KNOWNSYSTEMVARIABLE 5
#define SCE_MYSQL_NUMBER 6
#define SCE_MYSQL_MAJORKEYWORD 7
#define SCE_MYSQL_KEYWORD 8
#define SCE_MYSQL_DATABASEOBJECT 9
#define SCE_MYSQL_PROCEDUREKEYWORD 10
#define SCE_MYSQL_STRING 11
#define SCE_MYSQL_SQSTRING 12
#define SCE_MYSQL_DQSTRING 13
#define SCE_MYSQL_OPERATOR 14
#define SCE_MYSQL_FUNCTION 15
#define SCE_MYSQL_IDENTIFIER 16
#define SCE_MYSQL_QUOTEDIDENTIFIER 17
#define SCE_MYSQL_USER1 18
#define SCE_MYSQL_USER2 19
#define SCE_MYSQL_USER3 20
#define SCE_PO_DEFAULT 0
#define SCE_PO_COMMENT 1
#define SCE_PO_MSGID 2
#define SCE_PO_MSGID_TEXT 3
#define SCE_PO_MSGSTR 4
#define SCE_PO_MSGSTR_TEXT 5
#define SCE_PO_MSGCTXT 6
#define SCE_PO_MSGCTXT_TEXT 7
#define SCE_PO_FUZZY 8
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface

View File

@ -248,6 +248,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICGETFORE 2083
#define SCI_INDICSETUNDER 2510
#define SCI_INDICGETUNDER 2511
#define SCI_GETCARETLINEVISIBLEALWAYS 3095
#define SCI_SETCARETLINEVISIBLEALWAYS 3096
#define SCI_INDICSETALPHA 3097
#define SCI_INDICGETALPHA 3098
#define SCI_SETWHITESPACEFORE 2084
@ -259,8 +261,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMAXLINESTATE 2094
#define SCI_GETCARETLINEVISIBLE 2095
#define SCI_SETCARETLINEVISIBLE 2096
#define SCI_GETCARETLINEVISIBLEALWAYS 3095
#define SCI_SETCARETLINEVISIBLEALWAYS 3096
#define SCI_GETCARETLINEBACK 2097
#define SCI_SETCARETLINEBACK 2098
#define SCI_STYLESETCHANGEABLE 2099
@ -672,6 +672,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETPOSITIONCACHE 2514
#define SCI_GETPOSITIONCACHE 2515
#define SCI_COPYALLOWLINE 2519
#define SCI_GETCHARACTERPOINTER 2520
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@ -755,6 +758,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_AUTOCSELECTION 2022
#define SCN_INDICATORCLICK 2023
#define SCN_INDICATORRELEASE 2024
#define SCN_AUTOCCANCELLED 2025
#define SCN_SCROLLED 2080
//--Autogenerated -- end of section automatically generated from Scintilla.iface
@ -838,6 +842,7 @@ struct SearchResultMarkings {
SearchResultMarking *_markings;
};
#ifdef SCI_NAMESPACE
}
#endif

View File

@ -104,7 +104,7 @@ fun void ClearAll=2004(,)
# Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,)
# Returns the number of characters in the document.
# Returns the number of bytes in the document.
get int GetLength=2006(,)
# Returns the character byte at the position.
@ -516,7 +516,7 @@ get int GetCaretPeriod=2075(,)
set void SetCaretPeriod=2076(int periodMilliseconds,)
# Set the set of characters making up words for when moving or selecting by word.
# First sets deaults like SetCharsDefault.
# First sets defaults like SetCharsDefault.
set void SetWordChars=2077(, string characters)
# Start a sequence of actions that is undone and redone as a unit.
@ -1536,7 +1536,7 @@ fun void ChooseCaretX=2399(,)
# Set the focus to this Scintilla widget.
fun void GrabFocus=2400(,)
enu CaretPolicy = CARET_
enu CaretPolicy=CARET_
# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
# If CARET_SLOP is set, we can define a slop value: caretSlop.
# This value defines an unwanted zone (UZ) where the caret is... unwanted.
@ -1800,6 +1800,16 @@ get int GetPositionCache=2515(,)
# Copy the selection, if selection empty copy the line with the caret
fun void CopyAllowLine=2519(,)
# Compact the document buffer and return a read-only pointer to the
# characters in the document.
get int GetCharacterPointer=2520(,)
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -1997,6 +2007,8 @@ val SCLEX_ASYMPTOTE=85
val SCLEX_R=86
val SCLEX_MAGIK=87
val SCLEX_POWERSHELL=88
val SCLEX_MYSQL=89
val SCLEX_PO=90
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2400,6 +2412,7 @@ val SCE_DIFF_HEADER=3
val SCE_DIFF_POSITION=4
val SCE_DIFF_DELETED=5
val SCE_DIFF_ADDED=6
val SCE_DIFF_CHANGED=7
# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
lex Conf=SCLEX_CONF SCE_CONF_
val SCE_CONF_DEFAULT=0
@ -2593,6 +2606,11 @@ val SCE_CSS_DOUBLESTRING=13
val SCE_CSS_SINGLESTRING=14
val SCE_CSS_IDENTIFIER2=15
val SCE_CSS_ATTRIBUTE=16
val SCE_CSS_IDENTIFIER3=17
val SCE_CSS_PSEUDOELEMENT=18
val SCE_CSS_EXTENDED_IDENTIFIER=19
val SCE_CSS_EXTENDED_PSEUDOCLASS=20
val SCE_CSS_EXTENDED_PSEUDOELEMENT=21
# Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0
@ -3294,6 +3312,40 @@ val SCE_POWERSHELL_IDENTIFIER=7
val SCE_POWERSHELL_KEYWORD=8
val SCE_POWERSHELL_CMDLET=9
val SCE_POWERSHELL_ALIAS=10
# Lexical state for SCLEX_MYSQL
lex MySQL=SCLEX_MYSQL SCE_MYSQL_
val SCE_MYSQL_DEFAULT=0
val SCE_MYSQL_COMMENT=1
val SCE_MYSQL_COMMENTLINE=2
val SCE_MYSQL_VARIABLE=3
val SCE_MYSQL_SYSTEMVARIABLE=4
val SCE_MYSQL_KNOWNSYSTEMVARIABLE=5
val SCE_MYSQL_NUMBER=6
val SCE_MYSQL_MAJORKEYWORD=7
val SCE_MYSQL_KEYWORD=8
val SCE_MYSQL_DATABASEOBJECT=9
val SCE_MYSQL_PROCEDUREKEYWORD=10
val SCE_MYSQL_STRING=11
val SCE_MYSQL_SQSTRING=12
val SCE_MYSQL_DQSTRING=13
val SCE_MYSQL_OPERATOR=14
val SCE_MYSQL_FUNCTION=15
val SCE_MYSQL_IDENTIFIER=16
val SCE_MYSQL_QUOTEDIDENTIFIER=17
val SCE_MYSQL_USER1=18
val SCE_MYSQL_USER2=19
val SCE_MYSQL_USER3=20
# Lexical state for SCLEX_PO
lex Po=SCLEX_PO SCE_PO_
val SCE_PO_DEFAULT=0
val SCE_PO_COMMENT=1
val SCE_PO_MSGID=2
val SCE_PO_MSGID_TEXT=3
val SCE_PO_MSGSTR=4
val SCE_PO_MSGSTR_TEXT=5
val SCE_PO_MSGCTXT=6
val SCE_PO_MSGCTXT_TEXT=7
val SCE_PO_FUZZY=8
# Events
@ -3322,6 +3374,7 @@ evt void CallTipClick=2021(int position)
evt void AutoCSelection=2022(string text)
evt void IndicatorClick=2023(int modifiers, int position)
evt void IndicatorRelease=2024(int modifiers, int position)
evt void AutoCCancelled=2025(void)
cat Deprecated

View File

@ -176,4 +176,3 @@ void AutoComplete::Select(const char *word) {
lb->Select(location);
}

View File

@ -587,6 +587,10 @@ char CellBuffer::StyleAt(int position) {
return style.ValueAt(position);
}
const char *CellBuffer::BufferPointer() {
return substance.BufferPointer();
}
// The char* returned is to an allocation owned by the undo history
const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) {
char *data = 0;

View File

@ -171,6 +171,7 @@ public:
char CharAt(int position) const;
void GetCharRange(char *buffer, int position, int lengthRetrieve);
char StyleAt(int position);
const char *BufferPointer();
int Length() const;
void Allocate(int newSize);

View File

@ -21,6 +21,78 @@
using namespace Scintilla;
#endif
//Vitaliy
#include "UniConversion.h"
// Win32 only !!!
static bool IsMustDie9x(void)
{
OSVERSIONINFO osver;
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( GetVersionEx( &osver ) )
{
if ( (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
(osver.dwMajorVersion == 4) )
{
//MessageBox(NULL, "MustDie9x == true", "Test", MB_OK);
return true;
}
}
//MessageBox(NULL, "MustDie9x == false", "Test", MB_OK);
return false;
}
static inline void Platform_MakeUpperW(wchar_t* wstr, unsigned int len) {
// TODO: Add platform-specific function here
// Win32 example:
static bool bIsMustDie9x = IsMustDie9x();
if ( !bIsMustDie9x )
{
::CharUpperW(wstr);
}
else
{
char* str = new char[len + 1];
if ( str )
{
::WideCharToMultiByte(CP_ACP, 0, wstr, len, str, len, NULL, NULL);
str[len] = 0;
::CharUpperA(str);
::MultiByteToWideChar(CP_ACP, 0, str, len, wstr, len);
wstr[len] = 0;
delete [] str;
}
}
}
static inline char Platform_MakeUpperChar(char ch) {
// TODO: Add platform-specific function here
// Win32 example:
char str[2] = {ch, 0};
::CharUpperA(str);
ch = str[0];
// default: no conversion
return ch;
}
static inline char Platform_MakeLowerChar(char ch) {
// TODO: Add platform-specific function here
// Win32 example:
char str[2] = {ch, 0};
::CharLowerA(str);
ch = str[0];
// default: no conversion
return ch;
}
// yilatiV
Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) {
}

View File

@ -144,8 +144,7 @@ Document::Document() {
lenWatchers = 0;
matchesValid = false;
pre = 0;
substituted = 0;
regex = 0;
}
Document::~Document() {
@ -155,10 +154,8 @@ Document::~Document() {
delete []watchers;
watchers = 0;
lenWatchers = 0;
delete pre;
pre = 0;
delete []substituted;
substituted = 0;
delete regex;
regex = 0;
}
// Increase reference count and return its previous value.
@ -244,7 +241,7 @@ int Document::LineEndPosition(int position) {
int Document::VCHomePosition(int position) {
int line = LineFromPosition(position);
int startPosition = LineStart(line);
int endLine = LineStart(line + 1) - 1;
int endLine = LineEnd(line);
int startText = startPosition;
while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) )
startText++;
@ -1098,123 +1095,18 @@ static inline char MakeLowerCase(char ch) {
}
//yilatiV
// Define a way for the Regular Expression code to access the document
class DocumentIndexer : public CharacterIndexer {
Document *pdoc;
int end;
public:
DocumentIndexer(Document *pdoc_, int end_) :
pdoc(pdoc_), end(end_) {
}
virtual ~DocumentIndexer() {
}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
else
return pdoc->CharAt(index);
}
};
/**
* Find text in document, supporting both forward and backward
* searches (just pass minPos > maxPos to do a backward search)
* Has not been tested with backwards DBCS searches yet.
*/
long Document::FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix,
bool caseSensitive, bool word, bool wordStart, bool regExp, int flags,
int *length) {
if (regExp) {
if (!pre)
pre = new RESearch(&charClass);
if (!pre)
return -1;
int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos;
int endPos = maxPos;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, 1, false);
const char *errmsg = pre->Compile(s, *length, caseSensitive, posix);
if (errmsg) {
return -1;
}
// Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
// Replace first '.' with '-' in each property file variable reference:
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2)
int lineRangeStart = LineFromPosition(startPos);
int lineRangeEnd = LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = LineStart(lineRangeStart);
}
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = LineStart(line);
int endOfLine = LineEnd(line);
if (increment == 1) {
if (line == lineRangeStart) {
if ((startPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if start position after start of line
startOfLine = startPos;
}
if (line == lineRangeEnd) {
if ((endPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
} else {
if (line == lineRangeEnd) {
if ((endPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if end position after start of line
startOfLine = endPos;
}
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
}
}
DocumentIndexer di(this, endOfLine);
int success = pre->Execute(di, startOfLine, endOfLine);
if (success) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine);
if (success) {
if (pre->eopat[0] <= minPos) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
} else {
success = 0;
}
}
}
}
break;
}
}
*length = lenRet;
return pos;
if (!regex)
regex = CreateRegexSearch(&charClass);
return regex->FindText(this, minPos, maxPos, s, caseSensitive, word, wordStart, flags, length);
} else {
bool forward = minPos <= maxPos;
@ -1234,41 +1126,9 @@ long Document::FindText(int minPos, int maxPos, const char *s,
}
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
char firstChar = s[0];
wchar_t* ws_upr = NULL;
int ws_len = 0;
char str[8];
wchar_t wstr[4];
if (!caseSensitive && !dbcsCodePage)
if (!caseSensitive)
firstChar = static_cast<char>(MakeUpperCase(firstChar));
int pos = forward ? startPos : (startPos - 1);
if (dbcsCodePage) {
if (!caseSensitive && dbcsCodePage == SC_CP_UTF8) {
ws_len = (int) UTF16Length(s, lengthFind);
if (ws_len != lengthFind) {
int ws_size = (((ws_len + 1) >> 4) + 1) << 4; // 16-chars alignment
ws_upr = new wchar_t[ws_size];
if (ws_upr != NULL) {
UTF16FromUTF8(s, lengthFind, ws_upr, ws_size);
ws_upr[ws_len] = 0;
Platform_MakeUpperW(ws_upr, ws_len);
// now ws_upr is UCS2 s in upper-case
}
}
}
if (!caseSensitive && ws_upr == NULL) {
// the text is Latin i.e. one character is one byte
// ws_upr is NULL
// BUT !!! ws_upr can be NULL if dbcsCodePage != SC_CP_UTF8
// (also ws_upr = new wchar_t[ws_size] can be NULL)
// for latin characters in non-UTF8 Unicode text
// (thanks to Airix Z)
if (isascii(firstChar))
firstChar = static_cast<char>(MakeUpperCase(firstChar));
}
if (pos >= 0)
pos = MovePositionOutsideChar(pos, increment, false);
}
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) {
@ -1288,98 +1148,19 @@ long Document::FindText(int minPos, int maxPos, const char *s,
}
}
} else {
bool bMatch = false;
int charLen = 0;
if (!dbcsCodePage) {
bMatch = (MakeUpperCase(ch) == firstChar);
}
else if (ws_upr == NULL) {
// for latin characters in non-UTF8 Unicode text
// (thanks to Airix Z)
if (isascii(ch))
bMatch = (MakeUpperCase(ch) == firstChar);
else
bMatch = (ch == firstChar);
}
else {
// LenChar returns 2 for "\r\n"
// this is wrong for UTF8 because "\r\n"
// is not one character with length=2
charLen = IsCrLf(pos) ? 1 : LenChar(pos);
for (int i = 0; i < charLen; i++) {
str[i] = CharAt(pos+i);
}
str[charLen] = 0;
UTF16FromUTF8(str, charLen, wstr, 2);
wstr[1] = 0;
Platform_MakeUpperW(wstr, 1);
bMatch = (ws_upr[0] == wstr[0]);
/*
if (bMatch)
MessageBoxA(NULL, "MatchCaseInsensitive is true!!!", "", 0);
// OK
*/
}
if (bMatch) {
if (MakeUpperCase(ch) == firstChar) {
bool found = true;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
if (!dbcsCodePage || ws_upr == NULL) {
/*
MessageBoxA(NULL, "Text is Latin (ws_upr == NULL)", "First character matched", 0);
*/
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
char ch2 = s[posMatch];
// for latin characters in non-UTF8 Unicode text
// (thanks to Airix Z)
if (!dbcsCodePage || (isascii(ch) && isascii(ch2))) {
if (MakeUpperCase(ch) != MakeUpperCase(ch2))
found = false;
} else {
if (ch != ch2)
found = false;
}
}
}
else {
int i1, i2;
/*
MessageBoxA(NULL, "first matched!!!", "", 0);
// OK
*/
i1 = 1;
i2 = pos + charLen;
while (found && i1 < ws_len) {
// LenChar returns 2 for "\r\n"
// this is wrong for UTF8 because "\r\n"
// is not one character with length=2
charLen = IsCrLf(i2) ? 1 : LenChar(i2);
for (int i = 0; i < charLen; i++) {
str[i] = CharAt(i2+i);
}
str[charLen] = 0;
UTF16FromUTF8(str, charLen, wstr, 2);
wstr[1] = 0;
Platform_MakeUpperW(wstr, 1);
found = (ws_upr[i1] == wstr[0]);
i1++;
i2 += charLen;
}
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
found = false;
}
if (found) {
if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos)) {
if (ws_upr != NULL) {
delete [] ws_upr;
ws_upr = NULL;
}
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
return pos;
}
}
}
}
@ -1389,96 +1170,13 @@ long Document::FindText(int minPos, int maxPos, const char *s,
pos = MovePositionOutsideChar(pos, increment, false);
}
}
if (ws_upr != NULL) {
delete [] ws_upr;
ws_upr = NULL;
}
}
//Platform::DebugPrintf("Not found\n");
return -1;
}
const char *Document::SubstituteByPosition(const char *text, int *length) {
if (!pre)
return 0;
delete []substituted;
substituted = 0;
DocumentIndexer di(this, Length());
if (!pre->GrabMatches(di))
return 0;
unsigned int lenResult = 0;
for (int i = 0; i < *length; i++) {
if (text[i] == '\\') {
if (text[i + 1] >= '1' && text[i + 1] <= '9') {
unsigned int patNum = text[i + 1] - '0';
lenResult += pre->eopat[patNum] - pre->bopat[patNum];
i++;
} else {
switch (text[i + 1]) {
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
i++;
}
lenResult++;
}
} else {
lenResult++;
}
}
substituted = new char[lenResult + 1];
if (!substituted)
return 0;
char *o = substituted;
for (int j = 0; j < *length; j++) {
if (text[j] == '\\') {
if (text[j + 1] >= '1' && text[j + 1] <= '9') {
unsigned int patNum = text[j + 1] - '0';
unsigned int len = pre->eopat[patNum] - pre->bopat[patNum];
if (pre->pat[patNum]) // Will be null if try for a match that did not occur
memcpy(o, pre->pat[patNum], len);
o += len;
j++;
} else {
j++;
switch (text[j]) {
case 'a':
*o++ = '\a';
break;
case 'b':
*o++ = '\b';
break;
case 'f':
*o++ = '\f';
break;
case 'n':
*o++ = '\n';
break;
case 'r':
*o++ = '\r';
break;
case 't':
*o++ = '\t';
break;
case 'v':
*o++ = '\v';
break;
default:
*o++ = '\\';
j--;
}
}
} else {
*o++ = text[j];
}
}
*o = '\0';
*length = lenResult;
return substituted;
return regex->SubstituteByPosition(this, text, length);
}
int Document::LinesTotal() const {
@ -1578,7 +1276,7 @@ void Document::EnsureStyledTo(int pos) {
}
}
int Document::SetLineState(int line, int state) {
int Document::SetLineState(int line, int state) {
int statePrevious = cb.SetLineState(line, state);
if (state != statePrevious) {
DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line);
@ -1828,3 +1526,222 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
}
return - 1;
}
/**
* Implementation of RegexSearchBase for the default built-in regular expression engine
*/
class BuiltinRegex : public RegexSearchBase {
public:
BuiltinRegex(CharClassify *charClassTable) : search(charClassTable), substituted(NULL) {}
virtual ~BuiltinRegex() {
delete substituted;
}
virtual long FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, int flags,
int *length);
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length);
private:
RESearch search;
char *substituted;
};
// Define a way for the Regular Expression code to access the document
class DocumentIndexer : public CharacterIndexer {
Document *pdoc;
int end;
public:
DocumentIndexer(Document *pdoc_, int end_) :
pdoc(pdoc_), end(end_) {
}
virtual ~DocumentIndexer() {
}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
else
return pdoc->CharAt(index);
}
};
long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool, bool, int flags,
int *length) {
bool posix = (flags & SCFIND_POSIX) != 0;
int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos;
int endPos = maxPos;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
startPos = doc->MovePositionOutsideChar(startPos, 1, false);
endPos = doc->MovePositionOutsideChar(endPos, 1, false);
const char *errmsg = search.Compile(s, *length, caseSensitive, posix);
if (errmsg) {
return -1;
}
// Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
// Replace first '.' with '-' in each property file variable reference:
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2)
int lineRangeStart = doc->LineFromPosition(startPos);
int lineRangeEnd = doc->LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= doc->LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = doc->LineStart(lineRangeStart);
}
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line);
int endOfLine = doc->LineEnd(line);
if (increment == 1) {
if (line == lineRangeStart) {
if ((startPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if start position after start of line
startOfLine = startPos;
}
if (line == lineRangeEnd) {
if ((endPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
} else {
if (line == lineRangeEnd) {
if ((endPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if end position after start of line
startOfLine = endPos;
}
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
}
}
DocumentIndexer di(doc, endOfLine);
int success = search.Execute(di, startOfLine, endOfLine);
if (success) {
pos = search.bopat[0];
lenRet = search.eopat[0] - search.bopat[0];
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) {
success = search.Execute(di, pos+1, endOfLine);
if (success) {
if (search.eopat[0] <= minPos) {
pos = search.bopat[0];
lenRet = search.eopat[0] - search.bopat[0];
} else {
success = 0;
}
}
}
}
break;
}
}
*length = lenRet;
return pos;
}
const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, int *length) {
delete []substituted;
substituted = 0;
DocumentIndexer di(doc, doc->Length());
if (!search.GrabMatches(di))
return 0;
unsigned int lenResult = 0;
for (int i = 0; i < *length; i++) {
if (text[i] == '\\') {
if (text[i + 1] >= '1' && text[i + 1] <= '9') {
unsigned int patNum = text[i + 1] - '0';
lenResult += search.eopat[patNum] - search.bopat[patNum];
i++;
} else {
switch (text[i + 1]) {
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
i++;
}
lenResult++;
}
} else {
lenResult++;
}
}
substituted = new char[lenResult + 1];
if (!substituted)
return 0;
char *o = substituted;
for (int j = 0; j < *length; j++) {
if (text[j] == '\\') {
if (text[j + 1] >= '1' && text[j + 1] <= '9') {
unsigned int patNum = text[j + 1] - '0';
unsigned int len = search.eopat[patNum] - search.bopat[patNum];
if (search.pat[patNum]) // Will be null if try for a match that did not occur
memcpy(o, search.pat[patNum], len);
o += len;
j++;
} else {
j++;
switch (text[j]) {
case 'a':
*o++ = '\a';
break;
case 'b':
*o++ = '\b';
break;
case 'f':
*o++ = '\f';
break;
case 'n':
*o++ = '\n';
break;
case 'r':
*o++ = '\r';
break;
case 't':
*o++ = '\t';
break;
case 'v':
*o++ = '\v';
break;
default:
*o++ = '\\';
j--;
}
}
} else {
*o++ = text[j];
}
}
*o = '\0';
*length = lenResult;
return substituted;
}
#ifndef SCI_OWNREGEX
RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable) {
return new BuiltinRegex(charClassTable);
}
#endif

View File

@ -74,7 +74,24 @@ public:
class DocWatcher;
class DocModification;
class RESearch;
class Document;
/**
* Interface class for regular expression searching
*/
class RegexSearchBase {
public:
virtual ~RegexSearchBase(){}
virtual long FindText(Document* doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0;
///@return String with the substitutions, must remain valid until the next call or destruction
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length) = 0;
};
/// Factory function for RegexSearchBase
extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable);
/**
*/
@ -109,8 +126,7 @@ private:
int lenWatchers;
bool matchesValid;
RESearch *pre;
char *substituted;
RegexSearchBase* regex;
public:
int stylingBits;
@ -159,6 +175,7 @@ public:
void EndUndoAction() { cb.EndUndoAction(); }
void SetSavePoint();
bool IsSavePoint() { return cb.IsSavePoint(); }
const char *BufferPointer() { return cb.BufferPointer(); }
int GetLineIndentation(int line);
void SetLineIndentation(int line, int indent);
@ -207,7 +224,7 @@ public:
int Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); }
long FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length);
bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, int *length);
long FindText(int iMessage, unsigned long wParam, long lParam);
const char *SubstituteByPosition(const char *text, int *length);
int LinesTotal() const;

View File

@ -197,4 +197,3 @@ void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int valu
pdoc->decorations.SetCurrentIndicator(indicator);
pdoc->DecorationFillRange(start, value, end - start);
}

View File

@ -916,7 +916,6 @@ void Editor::HorizontalScrollTo(int xPos) {
SetHorizontalScrollPos();
RedrawRect(GetClientRectangle());
}
NotifyScrolled();
}
@ -2103,13 +2102,6 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
rcSegment.right = rcLine.right;
if (overrideBackground) {
surface->FillRectangle(rcSegment, background);
} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) {
surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
} else {
surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated);
}
if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw));
@ -2393,8 +2385,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
if (ll->chars[cpos + startseg] == ' ') {
if (drawWhitespaceBackground &&
(!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) {
PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top,
ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom);
PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart,
rcSegment.top,
ll->positions[cpos + startseg + 1] + xStart - subLineStart,
rcSegment.bottom);
surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated);
}
} else {
@ -2526,7 +2520,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
if (!twoPhaseDraw && drawWhitespaceBackground &&
(!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) {
textBack = vsDraw.whitespaceBackground.allocated;
PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom);
PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart,
rcSegment.top,
ll->positions[cpos + startseg + 1] + xStart - subLineStart,
rcSegment.bottom);
surface->FillRectangle(rcSpace, textBack);
}
PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0);
@ -2572,7 +2569,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// Find the most recent line with some text
int lineLastWithText = line;
while (lineLastWithText > 0 && pdoc->IsWhiteLine(lineLastWithText)) {
while (lineLastWithText > Platform::Maximum(line-20, 0) && pdoc->IsWhiteLine(lineLastWithText)) {
lineLastWithText--;
}
if (lineLastWithText < line) {
@ -2594,7 +2591,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
int lineNextWithText = line;
while (lineNextWithText < pdoc->LinesTotal() && pdoc->IsWhiteLine(lineNextWithText)) {
while (lineNextWithText < Platform::Minimum(line+20, pdoc->LinesTotal()) && pdoc->IsWhiteLine(lineNextWithText)) {
lineNextWithText++;
}
if (lineNextWithText > line) {
@ -4829,7 +4826,7 @@ long Editor::FindText(
(wParam & SCFIND_WHOLEWORD) != 0,
(wParam & SCFIND_WORDSTART) != 0,
(wParam & SCFIND_REGEXP) != 0,
(wParam & SCFIND_POSIX) != 0,
wParam,
&lengthFound);
if (pos != -1) {
ft->chrgText.cpMin = pos;
@ -4873,7 +4870,7 @@ long Editor::SearchText(
(wParam & SCFIND_WHOLEWORD) != 0,
(wParam & SCFIND_WORDSTART) != 0,
(wParam & SCFIND_REGEXP) != 0,
(wParam & SCFIND_POSIX) != 0,
wParam,
&lengthFound);
} else {
pos = pdoc->FindText(searchAnchor, 0, txt,
@ -4881,7 +4878,7 @@ long Editor::SearchText(
(wParam & SCFIND_WHOLEWORD) != 0,
(wParam & SCFIND_WORDSTART) != 0,
(wParam & SCFIND_REGEXP) != 0,
(wParam & SCFIND_POSIX) != 0,
wParam,
&lengthFound);
}
@ -4903,7 +4900,7 @@ long Editor::SearchInTarget(const char *text, int length) {
(searchFlags & SCFIND_WHOLEWORD) != 0,
(searchFlags & SCFIND_WORDSTART) != 0,
(searchFlags & SCFIND_REGEXP) != 0,
(searchFlags & SCFIND_POSIX) != 0,
searchFlags,
&lengthFound);
if (pos != -1) {
targetStart = pos;
@ -5454,11 +5451,11 @@ void Editor::ButtonMove(Point pt) {
if (lineMove < 0) {
lineMove = cs.DisplayFromDoc(pdoc->LinesTotal() - 1);
}
ScrollTo(lineMove - LinesOnScreen() + 1);
ScrollTo(lineMove - LinesOnScreen() + 5);
Redraw();
} else if (pt.y < rcClient.top) {
int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
ScrollTo(lineMove - 1);
ScrollTo(lineMove - 5);
Redraw();
}
EnsureCaretVisible(false, false, true);
@ -7009,7 +7006,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
vs.showCaretLineBackgroundAlways = wParam != 0;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEBACK:
return vs.caretLineBackground.desired.AsLong();
case SCI_SETCARETLINEBACK:
@ -7057,7 +7053,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_HIDELINES:
cs.SetVisible(wParam, lParam, false);
if (wParam > 0)
cs.SetVisible(wParam, lParam, false);
SetScrollBars();
Redraw();
break;
@ -7240,7 +7237,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_INDICGETUNDER:
return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0;
case SCI_INDICSETALPHA:
if (wParam <= INDIC_MAX && lParam <= SC_ALPHA_OPAQUE && lParam > 0) {
vs.indicators[wParam].alpha = lParam;
@ -7619,6 +7615,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETPASTECONVERTENDINGS:
return convertPastes ? 1 : 0;
case SCI_GETCHARACTERPOINTER:
return reinterpret_cast<sptr_t>(pdoc->BufferPointer());
default:
return DefWndProc(iMessage, wParam, lParam);
}

View File

@ -172,13 +172,13 @@ LexerLibrary::~LexerLibrary() {
void LexerLibrary::Release() {
//TODO maintain a list of lexers created, and delete them!
LexerMinder *lm;
LexerMinder *next;
LexerMinder *lmNext;
lm = first;
while (NULL != lm) {
next = lm->next;
lmNext = lm->next;
delete lm->self;
delete lm;
lm = next;
lm = lmNext;
}
first = NULL;

View File

@ -79,4 +79,3 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
}
}

View File

@ -150,4 +150,3 @@ const KeyToCommand KeyMap::MapDefault[] = {
{0,0,0},
};

View File

@ -193,6 +193,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmMETAPOST);
LINK_LEXER(lmMMIXAL);
LINK_LEXER(lmMSSQL);
LINK_LEXER(lmMySQL);
LINK_LEXER(lmNncrontab);
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
@ -205,6 +206,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmPHP);
LINK_LEXER(lmPHPSCRIPT);
LINK_LEXER(lmPLM);
LINK_LEXER(lmPo);
LINK_LEXER(lmPOV);
LINK_LEXER(lmPowerShell);
LINK_LEXER(lmProgress);

View File

@ -226,4 +226,3 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W
LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave", FoldAveDoc);

View File

@ -2,6 +2,7 @@
/** @file LexABAQUS.cxx
** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz.
** By Sergio Lucato.
** Sort of completely rewritten by Gertjan Kloosterman
**/
// The License.txt file describes the conditions under which this software may be distributed.
@ -27,7 +28,15 @@ using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || ch == '_'));
return (ch < 0x80 && (isalnum(ch) || (ch == '_')));
}
static inline bool IsAKeywordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' ')));
}
static inline bool IsASetChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
}
static inline bool IsAnOperator(char ch) {
@ -41,90 +50,228 @@ static inline bool IsAnOperator(char ch) {
return false;
}
static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
Accessor &styler) {
int stringStart = ' ';
WordList &processors = *keywordlists[0];
WordList &commands = *keywordlists[1];
WordList &slashcommands = *keywordlists[2];
WordList &starcommands = *keywordlists[3];
WordList &arguments = *keywordlists[4];
WordList &functions = *keywordlists[5];
enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \
DAT_LINE_VAL, DAT_LINE_COMMA,\
COMMENT_LINE,\
ST_ERROR, LINE_END } state ;
// Do not leak onto next line
state = LINE_END ;
initStyle = SCE_ABAQUS_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
// Determine if the current state should terminate.
if (sc.state == SCE_ABAQUS_NUMBER) {
if (!(IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') ||
((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
sc.SetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_COMMENT) {
if (sc.atLineEnd) {
sc.SetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_COMMENTBLOCK) {
if (sc.atLineEnd) {
if (sc.ch == '\r') {
sc.Forward();
}
sc.ForwardSetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_STRING) {
if (sc.atLineEnd) {
sc.SetState(SCE_ABAQUS_DEFAULT);
} else if ((sc.ch == '\'' && stringStart == '\'') || (sc.ch == '\"' && stringStart == '\"')) {
sc.ForwardSetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_WORD) {
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (processors.InList(s)) {
sc.ChangeState(SCE_ABAQUS_PROCESSOR);
} else if (slashcommands.InList(s)) {
sc.ChangeState(SCE_ABAQUS_SLASHCOMMAND);
} else if (starcommands.InList(s)) {
sc.ChangeState(SCE_ABAQUS_STARCOMMAND);
} else if (commands.InList(s)) {
sc.ChangeState(SCE_ABAQUS_COMMAND);
} else if (arguments.InList(s)) {
sc.ChangeState(SCE_ABAQUS_ARGUMENT);
} else if (functions.InList(s)) {
sc.ChangeState(SCE_ABAQUS_FUNCTION);
}
sc.SetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_OPERATOR) {
if (!IsAnOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_ABAQUS_DEFAULT);
}
}
// Things are actually quite simple
// we have commentlines
// keywordlines and datalines
// On a data line there will only be colouring of numbers
// a keyword line is constructed as
// *word,[ paramname[=paramvalue]]*
// if the line ends with a , the keyword line continues onto the new line
// Determine if a new state should be entered.
if (sc.state == SCE_ABAQUS_DEFAULT) {
if (sc.ch == '*' && sc.chNext == '*') {
sc.SetState(SCE_ABAQUS_COMMENTBLOCK);
} else if (sc.ch == '!') {
sc.SetState(SCE_ABAQUS_COMMENT);
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_ABAQUS_NUMBER);
} else if (sc.ch == '\'' || sc.ch == '\"') {
sc.SetState(SCE_ABAQUS_STRING);
stringStart = sc.ch;
} else if (IsAWordChar(sc.ch) || ((sc.ch == '*' || sc.ch == '/') && !isgraph(sc.chPrev))) {
sc.SetState(SCE_ABAQUS_WORD);
} else if (IsAnOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_ABAQUS_OPERATOR);
}
}
}
sc.Complete();
for (; sc.More(); sc.Forward()) {
switch ( state ) {
case KW_LINE_KW :
if ( sc.atLineEnd ) {
// finished the line in keyword state, switch to LINE_END
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
} else if ( IsAKeywordChar(sc.ch) ) {
// nothing changes
state = KW_LINE_KW ;
} else if ( sc.ch == ',' ) {
// Well well we say a comma, arguments *MUST* follow
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = KW_LINE_COMMA ;
} else {
// Flag an error
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
// Done with processing
break ;
case KW_LINE_COMMA :
// acomma on a keywordline was seen
if ( IsAKeywordChar(sc.ch)) {
sc.SetState(SCE_ABAQUS_ARGUMENT) ;
state = KW_LINE_PAR ;
} else if ( sc.atLineEnd || (sc.ch == ',') ) {
// we remain in keyword mode
state = KW_LINE_COMMA ;
} else if ( sc.ch == ' ' ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = KW_LINE_COMMA ;
} else {
// Anything else constitutes an error
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
break ;
case KW_LINE_PAR :
if ( sc.atLineEnd ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
} else if ( IsAKeywordChar(sc.ch) || (sc.ch == '-') ) {
// remain in this state
state = KW_LINE_PAR ;
} else if ( sc.ch == ',' ) {
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = KW_LINE_COMMA ;
} else if ( sc.ch == '=' ) {
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = KW_LINE_EQ ;
} else {
// Anything else constitutes an error
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
break ;
case KW_LINE_EQ :
if ( sc.ch == ' ' ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
// remain in this state
state = KW_LINE_EQ ;
} else if ( IsADigit(sc.ch) || (sc.ch == '-') || (sc.ch == '.' && IsADigit(sc.chNext)) ) {
sc.SetState(SCE_ABAQUS_NUMBER) ;
state = KW_LINE_VAL ;
} else if ( IsAKeywordChar(sc.ch) ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = KW_LINE_VAL ;
} else if ( (sc.ch == '\'') || (sc.ch == '\"') ) {
sc.SetState(SCE_ABAQUS_STRING) ;
state = KW_LINE_VAL ;
} else {
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
break ;
case KW_LINE_VAL :
if ( sc.atLineEnd ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
} else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) {
// nothing changes
state = KW_LINE_VAL ;
} else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') ||
((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) &&
(sc.state == SCE_ABAQUS_NUMBER)) {
// remain in number mode
state = KW_LINE_VAL ;
} else if (sc.state == SCE_ABAQUS_STRING) {
// accept everything until a closing quote
if ( sc.ch == '\'' || sc.ch == '\"' ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = KW_LINE_VAL ;
}
} else if ( sc.ch == ',' ) {
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = KW_LINE_COMMA ;
} else {
// anything else is an error
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
break ;
case DAT_LINE_VAL :
if ( sc.atLineEnd ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
} else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) {
// nothing changes
state = DAT_LINE_VAL ;
} else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') ||
((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) &&
(sc.state == SCE_ABAQUS_NUMBER)) {
// remain in number mode
state = DAT_LINE_VAL ;
} else if (sc.state == SCE_ABAQUS_STRING) {
// accept everything until a closing quote
if ( sc.ch == '\'' || sc.ch == '\"' ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = DAT_LINE_VAL ;
}
} else if ( sc.ch == ',' ) {
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = DAT_LINE_COMMA ;
} else {
// anything else is an error
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
break ;
case DAT_LINE_COMMA :
// a comma on a data line was seen
if ( sc.atLineEnd ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
} else if ( sc.ch == ' ' ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = DAT_LINE_COMMA ;
} else if (sc.ch == ',') {
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = DAT_LINE_COMMA ;
} else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) {
sc.SetState(SCE_ABAQUS_NUMBER) ;
state = DAT_LINE_VAL ;
} else if ( IsAKeywordChar(sc.ch) ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = DAT_LINE_VAL ;
} else if ( (sc.ch == '\'') || (sc.ch == '\"') ) {
sc.SetState(SCE_ABAQUS_STRING) ;
state = DAT_LINE_VAL ;
} else {
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
break ;
case COMMENT_LINE :
if ( sc.atLineEnd ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
}
break ;
case ST_ERROR :
if ( sc.atLineEnd ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = LINE_END ;
}
break ;
case LINE_END :
if ( sc.atLineEnd || sc.ch == ' ' ) {
// nothing changes
state = LINE_END ;
} else if ( sc.ch == '*' ) {
if ( sc.chNext == '*' ) {
state = COMMENT_LINE ;
sc.SetState(SCE_ABAQUS_COMMENT) ;
} else {
state = KW_LINE_KW ;
sc.SetState(SCE_ABAQUS_STARCOMMAND) ;
}
} else {
// it must be a data line, things are as if we are in DAT_LINE_COMMA
if ( sc.ch == ',' ) {
sc.SetState(SCE_ABAQUS_OPERATOR) ;
state = DAT_LINE_COMMA ;
} else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) {
sc.SetState(SCE_ABAQUS_NUMBER) ;
state = DAT_LINE_VAL ;
} else if ( IsAKeywordChar(sc.ch) ) {
sc.SetState(SCE_ABAQUS_DEFAULT) ;
state = DAT_LINE_VAL ;
} else if ( (sc.ch == '\'') || (sc.ch == '\"') ) {
sc.SetState(SCE_ABAQUS_STRING) ;
state = DAT_LINE_VAL ;
} else {
sc.SetState(SCE_ABAQUS_PROCESSOR) ;
state = ST_ERROR ;
}
}
break ;
}
}
sc.Complete();
}
//------------------------------------------------------------------------------
@ -166,85 +313,295 @@ static int LowerCase(int c)
return c;
}
static int CheckABAQUSFoldPoint(char const *token, int &level) {
if (!strcmp(token, "*step") ||
!strcmp(token, "*part") ||
!strcmp(token, "*instance") ||
!strcmp(token, "*assembly") ||
!strcmp(token, "***region") ) {
level |= SC_FOLDLEVELHEADERFLAG;
return 1;
}
if (!strcmp(token, "*end step") ||
!strcmp(token, "*end part") ||
!strcmp(token, "*end instance") ||
!strcmp(token, "*end assembly") ||
!strcmp(token, "***end region") ) {
return -1;
}
return 0;
static int LineEnd(int line, Accessor &styler)
{
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
int 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 )
eol_pos = styler.Length() ;
else
eol_pos = styler.LineStart(line + 1) - 1;
return eol_pos ;
}
static int LineStart(int line, Accessor &styler)
{
return styler.LineStart(line) ;
}
// LineType
//
// bits determines the line type
// 1 : data line
// 2 : only whitespace
// 3 : data line with only whitespace
// 4 : keyword line
// 5 : block open keyword line
// 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) ;
int c ;
char ch = ' ';
int i = pos ;
while ( i < eol_pos ) {
c = styler.SafeGetCharAt(i);
ch = static_cast<char>(LowerCase(c));
// We can say something as soon as no whitespace
// was encountered
if ( !IsSpace(c) )
break ;
i++ ;
}
if ( i >= eol_pos ) {
// This is a whitespace line, currently
// classifies as data line
return 3 ;
}
if ( ch != '*' ) {
// This is a data line
return 1 ;
}
if ( i == eol_pos - 1 ) {
// Only a single *, error but make keyword line
return 4+3 ;
}
// This means we can have a second character
// if that is also a * this means a comment
// otherwise it is a keyword.
c = styler.SafeGetCharAt(i+1);
ch = static_cast<char>(LowerCase(c));
if ( ch == '*' ) {
return 8 ;
}
// At this point we know this is a keyword line
// the character at position i is a *
// it is not a comment line
char word[256] ;
int wlen = 0;
word[wlen] = '*' ;
wlen++ ;
i++ ;
while ( (i < eol_pos) && (wlen < 255) ) {
c = styler.SafeGetCharAt(i);
ch = static_cast<char>(LowerCase(c));
if ( (!IsSpace(c)) && (!IsIdentifier(c)) )
break ;
if ( IsIdentifier(c) ) {
word[wlen] = ch ;
wlen++ ;
}
i++ ;
}
word[wlen] = 0 ;
// Make a comparison
if ( !strcmp(word, "*step") ||
!strcmp(word, "*part") ||
!strcmp(word, "*instance") ||
!strcmp(word, "*assembly")) {
return 4+1 ;
}
if ( !strcmp(word, "*endstep") ||
!strcmp(word, "*endpart") ||
!strcmp(word, "*endinstance") ||
!strcmp(word, "*endassembly")) {
return 4+2 ;
}
return 4 ;
}
static void SafeSetLevel(int line, int level, Accessor &styler)
{
if ( line < 0 )
return ;
int mask = ((~SC_FOLDLEVELHEADERFLAG) | (~SC_FOLDLEVELWHITEFLAG));
if ( (level & mask) < 0 )
return ;
if ( styler.LevelAt(line) != level )
styler.SetLevel(line, level) ;
}
static void FoldABAQUSDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
WordList *[], Accessor &styler) {
int startLine = styler.GetLine(startPos) ;
int endLine = styler.GetLine(startPos+length-1) ;
int line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int go = 0, done = 0;
int endPos = startPos + length;
char word[256];
int wordlen = 0;
int 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"
for (i = startPos; i < endPos; i++) {
int c = styler.SafeGetCharAt(i);
if (!done && !go) {
if (wordlen) { // are we scanning a token already?
word[wordlen] = static_cast<char>(LowerCase(c));
if (!IsIdentifier(c)) { // done with token
word[wordlen] = '\0';
go = CheckABAQUSFoldPoint(word, level);
if (!go) {
// Treat any whitespace as single blank, for
// things like "End Function".
if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) {
word[wordlen] = ' ';
if (wordlen < 255)
wordlen++;
}
else // done with this line
done = 1;
}
} else if (wordlen < 255) {
wordlen++;
}
} else { // start scanning at first non-whitespace character
if (!IsSpace(c)) {
if (IsIdentifier(c)) {
word[0] = static_cast<char>(LowerCase(c));
wordlen = 1;
} else // done with this line
done = 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 ;
// Scan until we find the previous keyword line
// this will give us the level reference that we need
while ( prvKeyLine > 0 ) {
prvKeyLine-- ;
prvKeyLineTp = LineType(prvKeyLine, styler) ;
if ( prvKeyLineTp & 4 )
break ;
}
// Determine the base line level of all lines following
// the previous keyword
// new keyword lines are placed on this level
//if ( prvKeyLineTp & 4 ) {
int level = styler.LevelAt(prvKeyLine) & ~SC_FOLDLEVELHEADERFLAG ;
//}
// uncomment line below if weird behaviour continues
prvKeyLine = -1 ;
// Now start scanning over the lines.
for ( int line = startLine; line <= endLine; line++ ) {
int lineType = LineType(line, styler) ;
// Check for comment line
if ( lineType == 8 ) {
if ( beginComment < 0 ) {
beginComment = line ;
}
}
// Check for data line
if ( (lineType == 1) || (lineType == 3) ) {
if ( beginData < 0 ) {
if ( beginComment >= 0 ) {
beginData = beginComment ;
} else {
beginData = line ;
}
}
beginComment = -1 ;
}
if (c == '\n') { // line end
if (!done && wordlen == 0 && foldCompact) // line was only space
level |= SC_FOLDLEVELWHITEFLAG;
if (level != styler.LevelAt(line))
styler.SetLevel(line, level);
level += go;
line++;
// reset state
wordlen = 0;
level &= ~SC_FOLDLEVELHEADERFLAG;
level &= ~SC_FOLDLEVELWHITEFLAG;
go = 0;
done = 0;
}
// Check for keywordline.
// As soon as a keyword line is encountered, we can set the
// levels of everything from the previous keyword line to this one
if ( lineType & 4 ) {
// this is a keyword, we can now place the previous keyword
// all its data lines and the remainder
// Write comments and data line
if ( beginComment < 0 ) {
beginComment = line ;
}
if ( beginData < 0 ) {
beginData = beginComment ;
if ( prvKeyLineTp != 5 )
SafeSetLevel(prvKeyLine, level, styler) ;
else
SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
} else {
SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
}
int datLevel = level + 1 ;
if ( !(prvKeyLineTp & 4) ) {
datLevel = level ;
}
for ( int ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
// The keyword we just found is going to be written at another level
// if we have a type 5 and type 6
if ( prvKeyLineTp == 5 ) {
level += 1 ;
}
if ( prvKeyLineTp == 6 ) {
level -= 1 ;
if ( level < 0 ) {
level = 0 ;
}
}
for ( int lll = beginComment; lll < line; lll++ )
SafeSetLevel(lll, level, styler) ;
// wrap and reset
beginComment = -1 ;
beginData = -1 ;
prvKeyLine = line ;
prvKeyLineTp = lineType ;
}
}
if ( beginComment < 0 ) {
beginComment = endLine + 1 ;
} 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);
for ( int line = endLine + 1; line <= docLines; line++ ) {
int lineType = LineType(line, styler) ;
if ( lineType != 8 ) {
if ( !(lineType & 4) ) {
beginComment = endLine + 1 ;
}
break ;
}
}
}
if ( beginData < 0 ) {
beginData = beginComment ;
if ( prvKeyLineTp != 5 )
SafeSetLevel(prvKeyLine, level, styler) ;
else
SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
} else {
SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
}
int datLevel = level + 1 ;
if ( !(prvKeyLineTp & 4) ) {
datLevel = level ;
}
for ( int ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
if ( prvKeyLineTp == 5 ) {
level += 1 ;
}
if ( prvKeyLineTp == 6 ) {
level -= 1 ;
}
for ( int m = beginComment; m <= endLine; m++ )
SafeSetLevel(m, level, styler) ;
}
static const char * const abaqusWordListDesc[] = {

View File

@ -37,8 +37,8 @@ static inline bool IsAWordStart(const int ch) {
ch == '%' || ch == '@' || ch == '$' || ch == '?');
}
static inline bool IsAsmOperator(char ch) {
if (isalnum(ch))
static inline bool IsAsmOperator(const int ch) {
if ((ch < 0x80) && (isalnum(ch)))
return false;
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
@ -89,7 +89,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
// Determine if the current state should terminate.
if (sc.state == SCE_ASM_OPERATOR) {
if (!IsAsmOperator(static_cast<char>(sc.ch))) {
if (!IsAsmOperator(sc.ch)) {
sc.SetState(SCE_ASM_DEFAULT);
}
}else if (sc.state == SCE_ASM_NUMBER) {
@ -149,7 +149,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.state == SCE_ASM_DEFAULT) {
if (sc.ch == ';'){
sc.SetState(SCE_ASM_COMMENT);
} else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
} else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) {
sc.SetState(SCE_ASM_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_ASM_IDENTIFIER);
@ -157,7 +157,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_ASM_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_ASM_CHARACTER);
} else if (IsAsmOperator(static_cast<char>(sc.ch))) {
} else if (IsAsmOperator(sc.ch)) {
sc.SetState(SCE_ASM_OPERATOR);
}
}
@ -178,4 +178,3 @@ static const char * const asmWordListDesc[] = {
LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc);

View File

@ -2,8 +2,8 @@
/** @file LexBash.cxx
** Lexer for Bash.
**/
// Copyright 2004-2007 by Neil Hodgson <neilh@scintilla.org>
// Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004
// Copyright 2004-2008 by Neil Hodgson <neilh@scintilla.org>
// Adapted from LexPerl by Kein-Hong Man 2004
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@ -16,9 +16,17 @@
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define HERE_DELIM_MAX 256
// define this if you want 'invalid octals' to be marked as errors
// usually, this is not a good idea, permissive lexing is better
@ -32,13 +40,7 @@
#define BASH_BASE_OCTAL_ERROR 69
#endif
#define HERE_DELIM_MAX 256
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline int translateBashDigit(char ch) {
static inline int translateBashDigit(int ch) {
if (ch >= '0' && ch <= '9') {
return ch - '0';
} else if (ch >= 'a' && ch <= 'z') {
@ -53,407 +55,210 @@ static inline int translateBashDigit(char ch) {
return BASH_BASE_ERROR;
}
static inline bool isEOLChar(char ch) {
return (ch == '\r') || (ch == '\n');
}
static bool isSingleCharOp(char ch) {
char strCharSet[2];
strCharSet[0] = ch;
strCharSet[1] = '\0';
return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMACahGLNn", strCharSet));
}
static inline bool isBashOperator(char ch) {
if (ch == '^' || ch == '&' || ch == '\\' || ch == '%' ||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
ch == '>' || ch == ',' || ch == '/' || ch == '<' ||
ch == '?' || ch == '!' || ch == '.' || ch == '~' ||
ch == '@')
return true;
return false;
}
static int classifyWordBash(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_SH_IDENTIFIER;
if (keywords.InList(s))
chAttr = SCE_SH_WORD;
styler.ColourTo(end, chAttr);
return chAttr;
}
static inline int getBashNumberBase(unsigned int start, unsigned int end, Accessor &styler) {
static inline int getBashNumberBase(char *s) {
int i = 0;
int base = 0;
for (unsigned int i = 0; i < end - start + 1 && i < 10; i++) {
base = base * 10 + (styler[start + i] - '0');
while (*s) {
base = base * 10 + (*s++ - '0');
i++;
}
if (base > 64 || (end - start) > 1) {
if (base > 64 || i > 2) {
return BASH_BASE_ERROR;
}
return base;
}
static inline bool isEndVar(char ch) {
return !isalnum(ch) && ch != '$' && ch != '_';
}
static inline bool isNonQuote(char ch) {
return isalnum(ch) || ch == '_';
}
static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) {
return false;
}
while (*val) {
if (*val != styler[pos++]) {
return false;
}
val++;
}
return true;
}
static char opposite(char ch) {
if (ch == '(')
return ')';
if (ch == '[')
return ']';
if (ch == '{')
return '}';
if (ch == '<')
return '>';
static int opposite(int ch) {
if (ch == '(') return ')';
if (ch == '[') return ']';
if (ch == '{') return '}';
if (ch == '<') return '>';
return ch;
}
static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
// Lexer for bash often has to backtrack to start of current style to determine
// which characters are being used as quotes, how deeply nested is the
// start position and what the termination string is for here documents
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
class HereDocCls {
CharacterSet setWordStart(CharacterSet::setAlpha, "_");
// note that [+-] are often parts of identifiers in shell scripts
CharacterSet setWord(CharacterSet::setAlphaNum, "._+-");
CharacterSet setBashOperator(CharacterSet::setNone, "^&\\%()-+=|{}[]:;>,*/<?!.~@");
CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn");
CharacterSet setParam(CharacterSet::setAlphaNum, "$_");
CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!");
CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!");
CharacterSet setLeftShift(CharacterSet::setDigits, "=$");
class HereDocCls { // Class to manage HERE document elements
public:
int State; // 0: '<<' encountered
// 1: collect the delimiter
// 2: here doc text (lines after the delimiter)
char Quote; // the char after '<<'
int Quote; // the char after '<<'
bool Quoted; // true if Quote in ('\'','"','`')
bool Indent; // indented delimiter (for <<-)
int DelimiterLength; // strlen(Delimiter)
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
HereDocCls() {
State = 0;
Quote = 0;
Quoted = false;
Indent = 0;
Quote = 0;
Quoted = false;
Indent = 0;
DelimiterLength = 0;
Delimiter = new char[HERE_DELIM_MAX];
Delimiter[0] = '\0';
}
void Append(int ch) {
Delimiter[DelimiterLength++] = static_cast<char>(ch);
Delimiter[DelimiterLength] = '\0';
}
~HereDocCls() {
delete []Delimiter;
}
};
HereDocCls HereDoc;
class QuoteCls {
class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl)
public:
int Rep;
int Count;
char Up;
char Down;
int Count;
int Up, Down;
QuoteCls() {
this->New(1);
}
void New(int r) {
Rep = r;
Count = 0;
Up = '\0';
Down = '\0';
}
void Open(char u) {
void Open(int u) {
Count++;
Up = u;
Down = opposite(Up);
}
void Start(int u) {
Count = 0;
Open(u);
}
};
QuoteCls Quote;
int state = initStyle;
int numBase = 0;
unsigned int lengthDoc = startPos + length;
int digit;
unsigned int endPos = startPos + length;
// If in a long distance lexical state, seek to the beginning to find quote characters
// Bash strings can be multi-line with embedded newlines, so backtrack.
// Bash numbers have additional state during lexing, so backtrack too.
if (state == SCE_SH_HERE_Q) {
// Backtrack to beginning of style if required...
// If in a long distance lexical state, backtrack to find quote characters
if (initStyle == SCE_SH_HERE_Q) {
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) {
startPos--;
}
startPos = styler.LineStart(styler.GetLine(startPos));
state = styler.StyleAt(startPos - 1);
initStyle = styler.StyleAt(startPos - 1);
}
if (state == SCE_SH_STRING
|| state == SCE_SH_BACKTICKS
|| state == SCE_SH_CHARACTER
|| state == SCE_SH_NUMBER
|| state == SCE_SH_IDENTIFIER
|| state == SCE_SH_COMMENTLINE
) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
// Bash strings can be multi-line with embedded newlines, so backtrack.
// Bash numbers have additional state during lexing, so backtrack too.
if (initStyle == SCE_SH_STRING
|| initStyle == SCE_SH_BACKTICKS
|| initStyle == SCE_SH_CHARACTER
|| initStyle == SCE_SH_NUMBER
|| initStyle == SCE_SH_IDENTIFIER
|| initStyle == SCE_SH_COMMENTLINE) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == initStyle)) {
startPos--;
}
state = SCE_SH_DEFAULT;
initStyle = SCE_SH_DEFAULT;
}
styler.StartAt(startPos);
char chPrev = styler.SafeGetCharAt(startPos - 1);
if (startPos == 0)
chPrev = '\n';
char chNext = styler[startPos];
styler.StartSegment(startPos);
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
// if the current character is not consumed due to the completion of an
// earlier style, lexing can be restarted via a simple goto
restartLexer:
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
for (; sc.More(); sc.Forward()) {
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if ((chPrev == '\r' && ch == '\n')) { // skip on DOS/Windows
styler.ColourTo(i, state);
chPrev = ch;
continue;
}
if (HereDoc.State == 1 && isEOLChar(ch)) {
// Begin of here-doc (the line after the here-doc delimiter):
// Lexically, the here-doc starts from the next line after the >>, but the
// first line of here-doc seem to follow the style of the last EOL sequence
HereDoc.State = 2;
if (HereDoc.Quoted) {
if (state == SCE_SH_HERE_DELIM) {
// Missing quote at end of string! We are stricter than bash.
// Colour here-doc anyway while marking this bit as an error.
state = SCE_SH_ERROR;
}
styler.ColourTo(i - 1, state);
// HereDoc.Quote always == '\''
state = SCE_SH_HERE_Q;
} else {
styler.ColourTo(i - 1, state);
// always switch
state = SCE_SH_HERE_Q;
}
}
if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character
if (i < lengthDoc - 1)
i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_SH_IDENTIFIER);
} else if (isdigit(ch)) {
state = SCE_SH_NUMBER;
numBase = BASH_BASE_DECIMAL;
if (ch == '0') { // hex,octal
if (chNext == 'x' || chNext == 'X') {
numBase = BASH_BASE_HEX;
i++;
ch = chNext;
chNext = chNext2;
} else if (isdigit(chNext)) {
#ifdef PEDANTIC_OCTAL
numBase = BASH_BASE_OCTAL;
#else
numBase = BASH_BASE_HEX;
#endif
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SH_OPERATOR:
sc.SetState(SCE_SH_DEFAULT);
break;
case SCE_SH_WORD:
// "." never used in Bash variable names but used in file names
if (!setWord.Contains(sc.ch)) {
char s[1000];
sc.GetCurrent(s, sizeof(s));
if (s[0] != '-' && // for file operators
!keywords.InList(s)) {
sc.ChangeState(SCE_SH_IDENTIFIER);
}
sc.SetState(SCE_SH_DEFAULT);
}
} else if (iswordstart(ch)) {
state = SCE_SH_WORD;
if (!iswordchar(chNext) && chNext != '+' && chNext != '-') {
// We need that if length of word == 1!
// This test is copied from the SCE_SH_WORD handler.
classifyWordBash(styler.GetStartSegment(), i, keywords, styler);
state = SCE_SH_DEFAULT;
break;
case SCE_SH_IDENTIFIER:
if (sc.chPrev == '\\') { // for escaped chars
sc.ForwardSetState(SCE_SH_DEFAULT);
} else if (!setWord.Contains(sc.ch)) {
sc.SetState(SCE_SH_DEFAULT);
}
} else if (ch == '#') {
state = SCE_SH_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_SH_STRING;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '\'') {
state = SCE_SH_CHARACTER;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '`') {
state = SCE_SH_BACKTICKS;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '$') {
if (chNext == '{') {
state = SCE_SH_PARAM;
goto startQuote;
} else if (chNext == '\'') {
state = SCE_SH_CHARACTER;
goto startQuote;
} else if (chNext == '"') {
state = SCE_SH_STRING;
goto startQuote;
} else if (chNext == '(' && chNext2 == '(') {
styler.ColourTo(i, SCE_SH_OPERATOR);
state = SCE_SH_DEFAULT;
goto skipChar;
} else if (chNext == '(' || chNext == '`') {
state = SCE_SH_BACKTICKS;
startQuote:
Quote.New(1);
Quote.Open(chNext);
goto skipChar;
} else {
state = SCE_SH_SCALAR;
skipChar:
i++;
ch = chNext;
chNext = chNext2;
}
} else if (ch == '*') {
if (chNext == '*') { // exponentiation
i++;
ch = chNext;
chNext = chNext2;
}
styler.ColourTo(i, SCE_SH_OPERATOR);
} else if (ch == '<' && chNext == '<') {
state = SCE_SH_HERE_DELIM;
HereDoc.State = 0;
HereDoc.Indent = false;
} else if (ch == '-' // file test operators
&& isSingleCharOp(chNext)
&& !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))
&& isspace(chPrev)) {
styler.ColourTo(i + 1, SCE_SH_WORD);
state = SCE_SH_DEFAULT;
i++;
ch = chNext;
chNext = chNext2;
} else if (isBashOperator(ch)) {
styler.ColourTo(i, SCE_SH_OPERATOR);
} else {
// keep colouring defaults to make restart easier
styler.ColourTo(i, SCE_SH_DEFAULT);
}
} else if (state == SCE_SH_NUMBER) {
int digit = translateBashDigit(ch);
if (numBase == BASH_BASE_DECIMAL) {
if (ch == '#') {
numBase = getBashNumberBase(styler.GetStartSegment(), i - 1, styler);
if (numBase == BASH_BASE_ERROR) // take the rest as comment
goto numAtEnd;
} else if (!isdigit(ch))
goto numAtEnd;
} else if (numBase == BASH_BASE_HEX) {
if ((digit < 16) || (digit >= 36 && digit <= 41)) {
// hex digit 0-9a-fA-F
} else
goto numAtEnd;
break;
case SCE_SH_NUMBER:
digit = translateBashDigit(sc.ch);
if (numBase == BASH_BASE_DECIMAL) {
if (sc.ch == '#') {
char s[10];
sc.GetCurrent(s, sizeof(s));
numBase = getBashNumberBase(s);
if (numBase != BASH_BASE_ERROR)
break;
} else if (IsADigit(sc.ch))
break;
} else if (numBase == BASH_BASE_HEX) {
if (IsADigit(sc.ch, 16))
break;
#ifdef PEDANTIC_OCTAL
} else if (numBase == BASH_BASE_OCTAL ||
numBase == BASH_BASE_OCTAL_ERROR) {
if (digit > 7) {
} else if (numBase == BASH_BASE_OCTAL ||
numBase == BASH_BASE_OCTAL_ERROR) {
if (digit <= 7)
break;
if (digit <= 9) {
numBase = BASH_BASE_OCTAL_ERROR;
} else
goto numAtEnd;
}
#endif
} else if (numBase == BASH_BASE_ERROR) {
if (digit > 9)
goto numAtEnd;
} else { // DD#DDDD number style handling
if (digit != BASH_BASE_ERROR) {
if (numBase <= 36) {
// case-insensitive if base<=36
if (digit >= 36) digit -= 26;
numBase = BASH_BASE_OCTAL_ERROR;
break;
}
if (digit >= numBase) {
#endif
} else if (numBase == BASH_BASE_ERROR) {
if (digit <= 9)
break;
} else { // DD#DDDD number style handling
if (digit != BASH_BASE_ERROR) {
if (numBase <= 36) {
// case-insensitive if base<=36
if (digit >= 36) digit -= 26;
}
if (digit < numBase)
break;
if (digit <= 9) {
numBase = BASH_BASE_ERROR;
} else
goto numAtEnd;
break;
}
}
} else {
numAtEnd:
if (numBase == BASH_BASE_ERROR
}
// fallthrough when number is at an end or error
if (numBase == BASH_BASE_ERROR
#ifdef PEDANTIC_OCTAL
|| numBase == BASH_BASE_OCTAL_ERROR
|| numBase == BASH_BASE_OCTAL_ERROR
#endif
)
state = SCE_SH_ERROR;
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;
goto restartLexer;
) {
sc.ChangeState(SCE_SH_ERROR);
}
}
} else if (state == SCE_SH_WORD) {
if (!iswordchar(chNext) && chNext != '+' && chNext != '-') {
// "." never used in Bash variable names
// but used in file names
classifyWordBash(styler.GetStartSegment(), i, keywords, styler);
state = SCE_SH_DEFAULT;
ch = ' ';
}
} else if (state == SCE_SH_IDENTIFIER) {
if (!iswordchar(chNext) && chNext != '+' && chNext != '-') {
styler.ColourTo(i, SCE_SH_IDENTIFIER);
state = SCE_SH_DEFAULT;
ch = ' ';
}
} else {
if (state == SCE_SH_COMMENTLINE) {
if (ch == '\\' && isEOLChar(chNext)) {
sc.SetState(SCE_SH_DEFAULT);
break;
case SCE_SH_COMMENTLINE:
if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) {
// comment continuation
if (chNext == '\r' && chNext2 == '\n') {
i += 2;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
} else {
i++;
ch = chNext;
chNext = chNext2;
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
} else if (isEOLChar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;
goto restartLexer;
} else if (isEOLChar(chNext)) {
styler.ColourTo(i, state);
state = SCE_SH_DEFAULT;
} else if (sc.atLineEnd) {
sc.ForwardSetState(SCE_SH_DEFAULT);
}
} else if (state == SCE_SH_HERE_DELIM) {
//
break;
case SCE_SH_HERE_DELIM:
// From Bash info:
// ---------------
// Specifier format is: <<[-]WORD
@ -461,150 +266,194 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
// Whitespace acceptable after <<[-] operator
//
if (HereDoc.State == 0) { // '<<' encountered
HereDoc.State = 1;
HereDoc.Quote = chNext;
HereDoc.Quote = sc.chNext;
HereDoc.Quoted = false;
HereDoc.DelimiterLength = 0;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (chNext == '\'' || chNext == '\"') { // a quoted here-doc delimiter (' or ")
i++;
ch = chNext;
chNext = chNext2;
if (sc.chNext == '\'' || sc.chNext == '\"') { // a quoted here-doc delimiter (' or ")
sc.Forward();
HereDoc.Quoted = true;
} else if (!HereDoc.Indent && chNext == '-') { // <<- indent case
HereDoc.State = 1;
} else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case
HereDoc.Indent = true;
HereDoc.State = 0;
} else if (isalpha(chNext) || chNext == '_' || chNext == '\\'
|| chNext == '-' || chNext == '+' || chNext == '!') {
} else if (setHereDoc.Contains(sc.chNext)) {
// an unquoted here-doc delimiter, no special handling
// TODO check what exactly bash considers part of the delim
} else if (chNext == '<') { // HERE string <<<
i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_SH_HERE_DELIM);
state = SCE_SH_DEFAULT;
HereDoc.State = 0;
} else if (isspacechar(chNext)) {
// TODO check what exactly bash considers part of the delim
HereDoc.State = 1;
} else if (sc.chNext == '<') { // HERE string <<<
sc.Forward();
sc.ForwardSetState(SCE_SH_DEFAULT);
} else if (IsASpace(sc.chNext)) {
// eat whitespace
HereDoc.State = 0;
} else if (isdigit(chNext) || chNext == '=' || chNext == '$') {
} else if (setLeftShift.Contains(sc.chNext)) {
// left shift << or <<= operator cases
styler.ColourTo(i, SCE_SH_OPERATOR);
state = SCE_SH_DEFAULT;
HereDoc.State = 0;
sc.ChangeState(SCE_SH_OPERATOR);
sc.ForwardSetState(SCE_SH_DEFAULT);
} else {
// symbols terminates; deprecated zero-length delimiter
HereDoc.State = 1;
}
} else if (HereDoc.State == 1) { // collect the delimiter
if (HereDoc.Quoted) { // a quoted here-doc delimiter
if (ch == HereDoc.Quote) { // closing quote => end of delimiter
styler.ColourTo(i, state);
state = SCE_SH_DEFAULT;
if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
sc.ForwardSetState(SCE_SH_DEFAULT);
} else {
if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote
i++;
ch = chNext;
chNext = chNext2;
if (sc.ch == '\\' && sc.chNext == HereDoc.Quote) { // escaped quote
sc.Forward();
}
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
HereDoc.Append(sc.ch);
}
} else { // an unquoted here-doc delimiter
if (isalnum(ch) || ch == '_' || ch == '-' || ch == '+' || ch == '!') {
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
} else if (ch == '\\') {
if (setHereDoc2.Contains(sc.ch)) {
HereDoc.Append(sc.ch);
} else if (sc.ch == '\\') {
// skip escape prefix
} else {
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;
goto restartLexer;
sc.SetState(SCE_SH_DEFAULT);
}
}
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) {
styler.ColourTo(i - 1, state);
state = SCE_SH_ERROR;
goto restartLexer;
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup
sc.SetState(SCE_SH_ERROR);
HereDoc.State = 0;
}
}
} else if (HereDoc.State == 2) {
// state == SCE_SH_HERE_Q
if (isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) {
if (!HereDoc.Indent && isEOLChar(chPrev)) {
endHereDoc:
// standard HERE delimiter
i += HereDoc.DelimiterLength;
chPrev = styler.SafeGetCharAt(i - 1);
ch = styler.SafeGetCharAt(i);
if (isEOLChar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;
HereDoc.State = 0;
goto restartLexer;
}
chNext = styler.SafeGetCharAt(i + 1);
} else if (HereDoc.Indent) {
// indented HERE delimiter
unsigned int bk = (i > 0)? i - 1: 0;
while (i > 0) {
ch = styler.SafeGetCharAt(bk--);
if (isEOLChar(ch)) {
goto endHereDoc;
} else if (!isspacechar(ch)) {
break; // got leading non-whitespace
}
break;
case SCE_SH_HERE_Q:
// HereDoc.State == 2
if (sc.atLineStart) {
sc.SetState(SCE_SH_HERE_Q);
int prefixws = 0;
while (IsASpace(sc.ch) && !sc.atLineEnd) { // whitespace prefix
sc.Forward();
prefixws++;
}
if (prefixws > 0)
sc.SetState(SCE_SH_HERE_Q);
while (!sc.atLineEnd) {
sc.Forward();
}
char s[HERE_DELIM_MAX];
sc.GetCurrent(s, sizeof(s));
if (strcmp(HereDoc.Delimiter, s) == 0) {
if ((prefixws > 0 && HereDoc.Indent) || // indentation rule
(prefixws == 0 && !HereDoc.Indent)) {
sc.SetState(SCE_SH_DEFAULT);
break;
}
}
}
} else if (state == SCE_SH_SCALAR) { // variable names
if (isEndVar(ch)) {
if ((state == SCE_SH_SCALAR)
&& i == (styler.GetStartSegment() + 1)) {
break;
case SCE_SH_SCALAR: // variable names
if (!setParam.Contains(sc.ch)) {
if (sc.LengthCurrent() == 1) {
// Special variable: $(, $_ etc.
styler.ColourTo(i, state);
state = SCE_SH_DEFAULT;
sc.ForwardSetState(SCE_SH_DEFAULT);
} else {
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;
goto restartLexer;
sc.SetState(SCE_SH_DEFAULT);
}
}
} else if (state == SCE_SH_STRING
|| state == SCE_SH_CHARACTER
|| state == SCE_SH_BACKTICKS
|| state == SCE_SH_PARAM
) {
if (!Quote.Down && !isspacechar(ch)) {
Quote.Open(ch);
} else if (ch == '\\' && Quote.Up != '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == Quote.Down) {
break;
case SCE_SH_STRING: // delimited styles
case SCE_SH_CHARACTER:
case SCE_SH_BACKTICKS:
case SCE_SH_PARAM:
if (sc.ch == '\\' && Quote.Up != '\\') {
sc.Forward();
} else if (sc.ch == Quote.Down) {
Quote.Count--;
if (Quote.Count == 0) {
Quote.Rep--;
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_SH_DEFAULT;
ch = ' ';
}
if (Quote.Up == Quote.Down) {
Quote.Count++;
}
sc.ForwardSetState(SCE_SH_DEFAULT);
}
} else if (ch == Quote.Up) {
} else if (sc.ch == Quote.Up) {
Quote.Count++;
}
break;
}
// Must check end of HereDoc state 1 before default state is handled
if (HereDoc.State == 1 && sc.atLineEnd) {
// Begin of here-doc (the line after the here-doc delimiter):
// Lexically, the here-doc starts from the next line after the >>, but the
// first line of here-doc seem to follow the style of the last EOL sequence
HereDoc.State = 2;
if (HereDoc.Quoted) {
if (sc.state == SCE_SH_HERE_DELIM) {
// Missing quote at end of string! We are stricter than bash.
// Colour here-doc anyway while marking this bit as an error.
sc.ChangeState(SCE_SH_ERROR);
}
// HereDoc.Quote always == '\''
}
sc.SetState(SCE_SH_HERE_Q);
}
// Determine if a new state should be entered.
if (sc.state == SCE_SH_DEFAULT) {
if (sc.ch == '\\') { // escaped character
sc.SetState(SCE_SH_IDENTIFIER);
} else if (IsADigit(sc.ch)) {
sc.SetState(SCE_SH_NUMBER);
numBase = BASH_BASE_DECIMAL;
if (sc.ch == '0') { // hex,octal
if (sc.chNext == 'x' || sc.chNext == 'X') {
numBase = BASH_BASE_HEX;
sc.Forward();
} else if (IsADigit(sc.chNext)) {
#ifdef PEDANTIC_OCTAL
numBase = BASH_BASE_OCTAL;
#else
numBase = BASH_BASE_HEX;
#endif
}
}
} else if (setWordStart.Contains(sc.ch)) {
sc.SetState(SCE_SH_WORD);
} else if (sc.ch == '#') {
sc.SetState(SCE_SH_COMMENTLINE);
} else if (sc.ch == '\"') {
sc.SetState(SCE_SH_STRING);
Quote.Start(sc.ch);
} else if (sc.ch == '\'') {
sc.SetState(SCE_SH_CHARACTER);
Quote.Start(sc.ch);
} else if (sc.ch == '`') {
sc.SetState(SCE_SH_BACKTICKS);
Quote.Start(sc.ch);
} else if (sc.ch == '$') {
sc.SetState(SCE_SH_SCALAR);
sc.Forward();
if (sc.ch == '{') {
sc.ChangeState(SCE_SH_PARAM);
} else if (sc.ch == '\'') {
sc.ChangeState(SCE_SH_CHARACTER);
} else if (sc.ch == '"') {
sc.ChangeState(SCE_SH_STRING);
} else if (sc.ch == '(' || sc.ch == '`') {
sc.ChangeState(SCE_SH_BACKTICKS);
if (sc.chNext == '(') { // $(( is lexed as operator
sc.ChangeState(SCE_SH_OPERATOR);
}
} else {
continue; // scalar has no delimiter pair
}
// fallthrough, open delim for $[{'"(`]
Quote.Start(sc.ch);
} else if (sc.Match('<', '<')) {
sc.SetState(SCE_SH_HERE_DELIM);
HereDoc.State = 0;
HereDoc.Indent = false;
} else if (sc.ch == '-' && // one-char file test operators
setSingleCharOp.Contains(sc.chNext) &&
!setWord.Contains(sc.GetRelative(2)) &&
IsASpace(sc.chPrev)) {
sc.SetState(SCE_SH_WORD);
sc.Forward();
} else if (setBashOperator.Contains(sc.ch)) {
sc.SetState(SCE_SH_OPERATOR);
}
}
if (state == SCE_SH_ERROR) {
break;
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
sc.Complete();
}
static bool IsCommentLine(int line, Accessor &styler) {
@ -621,7 +470,7 @@ static bool IsCommentLine(int line, Accessor &styler) {
}
static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
@ -637,16 +486,16 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
// Comment folding
// Comment folding
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent + 1, styler))
levelCurrent--;
}
if (style == SCE_SH_OPERATOR) {
if (ch == '{') {
levelCurrent++;

View File

@ -371,4 +371,3 @@ LexerModule lmPureBasic(SCLEX_PUREBASIC, ColourisePureBasicDoc, "purebasic",
LexerModule lmFreeBasic(SCLEX_FREEBASIC, ColouriseFreeBasicDoc, "freebasic",
FoldFreeBasicDoc, freebasicWordListDesc);

View File

@ -63,7 +63,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]");
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
@ -445,10 +445,6 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
visibleChars = 0;
}
}
char lastChar = styler.SafeGetCharAt(endPos-1);
if ((unsigned)styler.Length() == endPos && (lastChar == '\n' || lastChar == '\r')) {
styler.SetLevel(lineCurrent, levelCurrent);
}
}
static const char * const cppWordLists[] = {

View File

@ -1,9 +1,9 @@
// Scintilla source code edit control
/** @file LexCSS.cxx
** Lexer for Cascading Style Sheets
** Written by Jakub Vr?na
** Improved by Philippe Lhoste (CSS2)
**/
** Lexer for Cascading Style Sheets
** Written by Jakub Vrána
** Improved by Philippe Lhoste (CSS2)
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -28,7 +28,12 @@ using namespace Scintilla;
static inline bool IsAWordChar(const unsigned int ch) {
return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character
/* FIXME:
* The CSS spec allows "ISO 10646 characters U+00A1 and higher" to be treated as word chars.
* Unfortunately, we are only getting string bytes here, and not full unicode characters. We cannot guarantee
* that our byte is between U+0080 - U+00A0 (to return false), so we have to allow all characters U+0080 and higher
*/
return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_';
}
inline bool IsCssOperator(const int ch) {
@ -44,15 +49,21 @@ inline bool IsCssOperator(const int ch) {
}
static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &css1Props = *keywordlists[0];
WordList &pseudoClasses = *keywordlists[1];
WordList &keywords2 = *keywordlists[2];
WordList &css2Props = *keywordlists[2];
WordList &css3Props = *keywordlists[3];
WordList &pseudoElements = *keywordlists[4];
WordList &exProps = *keywordlists[5];
WordList &exPseudoClasses = *keywordlists[6];
WordList &exPseudoElements = *keywordlists[7];
StyleContext sc(startPos, length, initStyle, styler);
int lastState = -1; // before operator
int lastStateC = -1; // before comment
int op = ' '; // last operator
int opPrev = ' '; // last operator
for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) {
@ -64,6 +75,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) {
if (lastStateC == SCE_CSS_OPERATOR) {
op = styler.SafeGetCharAt(i-1);
opPrev = styler.SafeGetCharAt(i-2);
while (--i) {
lastState = styler.StyleAt(i-1);
if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT)
@ -100,6 +112,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (op == ' ') {
unsigned int i = startPos;
op = styler.SafeGetCharAt(i-1);
opPrev = styler.SafeGetCharAt(i-2);
while (--i) {
lastState = styler.StyleAt(i-1);
if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT)
@ -111,19 +124,15 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (lastState == SCE_CSS_DEFAULT)
sc.SetState(SCE_CSS_DIRECTIVE);
break;
case '*':
if (lastState == SCE_CSS_DEFAULT)
sc.SetState(SCE_CSS_TAG);
break;
case '>':
case '+':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_CLASS
|| lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_DEFAULT);
break;
case '[':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_ATTRIBUTE);
break;
case ']':
@ -138,27 +147,44 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
break;
case '}':
if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT ||
lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2)
lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_IDENTIFIER3)
sc.SetState(SCE_CSS_DEFAULT);
break;
case '(':
if (lastState == SCE_CSS_PSEUDOCLASS)
sc.SetState(SCE_CSS_TAG);
else if (lastState == SCE_CSS_EXTENDED_PSEUDOCLASS)
sc.SetState(SCE_CSS_EXTENDED_PSEUDOCLASS);
break;
case ')':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS ||
lastState == SCE_CSS_PSEUDOELEMENT || lastState == SCE_CSS_EXTENDED_PSEUDOELEMENT)
sc.SetState(SCE_CSS_TAG);
break;
case ':':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS ||
lastState == SCE_CSS_PSEUDOELEMENT || lastState == SCE_CSS_EXTENDED_PSEUDOELEMENT)
sc.SetState(SCE_CSS_PSEUDOCLASS);
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 ||
lastState == SCE_CSS_IDENTIFIER3 || lastState == SCE_CSS_EXTENDED_IDENTIFIER ||
lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
sc.SetState(SCE_CSS_VALUE);
break;
case '.':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_CLASS);
break;
case '#':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_ID);
break;
case ',':
case '|':
case '~':
if (lastState == SCE_CSS_TAG)
sc.SetState(SCE_CSS_DEFAULT);
break;
@ -181,11 +207,19 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
continue;
}
if (sc.ch == '*' && sc.state == SCE_CSS_DEFAULT) {
sc.SetState(SCE_CSS_TAG);
continue;
}
if (IsAWordChar(sc.chPrev) && (
sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2
|| sc.state == SCE_CSS_UNKNOWN_IDENTIFIER
|| sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS
|| sc.state == SCE_CSS_IMPORTANT
sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2 ||
sc.state == SCE_CSS_IDENTIFIER3 || sc.state == SCE_CSS_EXTENDED_IDENTIFIER ||
sc.state == SCE_CSS_UNKNOWN_IDENTIFIER ||
sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT ||
sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT ||
sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS ||
sc.state == SCE_CSS_IMPORTANT
)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
@ -195,21 +229,35 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
switch (sc.state) {
case SCE_CSS_IDENTIFIER:
case SCE_CSS_IDENTIFIER2:
case SCE_CSS_IDENTIFIER3:
case SCE_CSS_EXTENDED_IDENTIFIER:
case SCE_CSS_UNKNOWN_IDENTIFIER:
if (keywords.InList(s2))
if (css1Props.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER);
else if (keywords2.InList(s2))
else if (css2Props.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER2);
else if (css3Props.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER3);
else if (exProps.InList(s2))
sc.ChangeState(SCE_CSS_EXTENDED_IDENTIFIER);
else
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
break;
case SCE_CSS_PSEUDOCLASS:
if (!pseudoClasses.InList(s2))
sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS);
break;
case SCE_CSS_PSEUDOELEMENT:
case SCE_CSS_EXTENDED_PSEUDOCLASS:
case SCE_CSS_EXTENDED_PSEUDOELEMENT:
case SCE_CSS_UNKNOWN_PSEUDOCLASS:
if (pseudoClasses.InList(s2))
if (op == ':' && opPrev != ':' && pseudoClasses.InList(s2))
sc.ChangeState(SCE_CSS_PSEUDOCLASS);
else if (opPrev == ':' && pseudoElements.InList(s2))
sc.ChangeState(SCE_CSS_PSEUDOELEMENT);
else if ((op == ':' || (op == '(' && lastState == SCE_CSS_EXTENDED_PSEUDOCLASS)) && opPrev != ':' && exPseudoClasses.InList(s2))
sc.ChangeState(SCE_CSS_EXTENDED_PSEUDOCLASS);
else if (opPrev == ':' && exPseudoElements.InList(s2))
sc.ChangeState(SCE_CSS_EXTENDED_PSEUDOELEMENT);
else
sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS);
break;
case SCE_CSS_IMPORTANT:
if (strcmp(s2, "important") != 0)
@ -218,7 +266,14 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
}
}
if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_ID))
if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (
sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_ID ||
(sc.ch != '(' && sc.ch != ')' && ( /* This line of the condition makes it possible to extend pseudo-classes with parentheses */
sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT ||
sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT ||
sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS
))
))
sc.SetState(SCE_CSS_TAG);
if (sc.Match('/', '*')) {
@ -236,6 +291,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
lastState = sc.state;
sc.SetState(SCE_CSS_OPERATOR);
op = sc.ch;
opPrev = sc.chPrev;
}
}
@ -293,9 +349,14 @@ static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Acc
}
static const char * const cssWordListDesc[] = {
"CSS1 Keywords",
"Pseudo classes",
"CSS2 Keywords",
"CSS1 Properties",
"Pseudo-classes",
"CSS2 Properties",
"CSS3 Properties",
"Pseudo-elements",
"Browser-Specific CSS Properties",
"Browser-Specific Pseudo-classes",
"Browser-Specific Pseudo-elements",
0
};

View File

@ -524,4 +524,3 @@ LexerModule lmErlang(
FoldErlangDoc,
erlangWordListDesc);

View File

@ -228,4 +228,3 @@ LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFla

View File

@ -84,7 +84,15 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
int toLineStart = sc.currentPos - posLineStart;
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') {
sc.SetState(SCE_F_COMMENT);
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") ||
sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);
}
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
} else if (toLineStart > 72) {
sc.SetState(SCE_F_COMMENT);
@ -198,7 +206,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// Determine if a new state should be entered.
if (sc.state == SCE_F_DEFAULT) {
if (sc.ch == '!') {
if (sc.chNext == '$') {
if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);

View File

@ -230,6 +230,7 @@ def RegenerateAll():
if os.path.exists(root + "scite"):
Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles)
Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles)
Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties)
Generate(root + "scite/boundscheck/vcproj.gen",
root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles)

View File

@ -311,4 +311,3 @@ LexerModule lmGui4Cli(SCLEX_GUI4CLI, ColouriseGui4CliDoc, "gui4cli", FoldGui4Cli
#undef debug

View File

@ -29,7 +29,7 @@ using namespace Scintilla;
#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START)
#define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START)
enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };
enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock, eScriptComment };
enum script_mode { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc };
static inline bool IsAWordChar(const int ch) {
@ -251,7 +251,7 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
static int classifyTagHTML(unsigned int start, unsigned int end,
WordList &keywords, Accessor &styler, bool &tagDontFold,
bool caseSensitive, bool isXml) {
bool caseSensitive, bool isXml, bool allowScripts) {
char s[30 + 2];
// Copy after the '<'
unsigned int i = 0;
@ -270,31 +270,28 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
// if the current language is XML, I can fold any tag
// if the current language is HTML, I don't want to fold certain tags (input, meta, etc.)
//...to find it in the list of no-container-tags
tagDontFold = (!isXml) && (NULL != strstr("meta link img area br hr input ",s));
tagDontFold = (!isXml) && (NULL != strstr("meta link img area br hr input ", s));
//now we can remove the trailing space
s[i] = '\0';
bool isScript = false;
// No keywords -> all are known
// Name of a closing tag starts at s + 1
char chAttr = SCE_H_TAGUNKNOWN;
if (s[0] == '!') {
chAttr = SCE_H_SGML_DEFAULT;
} else if (s[0] == '/') { // Closing tag
if (keywords.InList(s + 1))
chAttr = SCE_H_TAG;
} else {
if (keywords.InList(s)) {
chAttr = SCE_H_TAG;
isScript = 0 == strcmp(s, "script");
}
}
if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords) {
// No keywords -> all are known
} else if (!keywords || keywords.InList(s[0] == '/' ? s + 1 : s)) {
chAttr = SCE_H_TAG;
isScript = 0 == strcmp(s, "script");
}
styler.ColourTo(end, chAttr);
return isScript ? SCE_H_SCRIPT : chAttr;
if (chAttr == SCE_H_TAG) {
if (allowScripts && 0 == strcmp(s, "script")) {
chAttr = SCE_H_SCRIPT;
} else if (!isXml && 0 == strcmp(s, "comment")) {
chAttr = SCE_H_COMMENT;
}
}
return chAttr;
}
static void classifyWordHTJS(unsigned int start, unsigned int end,
@ -420,6 +417,9 @@ static int StateForScript(script_type scriptLanguage) {
case eScriptSGML:
Result = SCE_H_SGML_DEFAULT;
break;
case eScriptComment:
Result = SCE_H_COMMENT;
break;
default :
// Modif by Don
//Result = SCE_HJ_START;
@ -481,19 +481,51 @@ 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) {
static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler, bool &isSimpleString) {
int j;
const int beginning = i - 1;
bool isValidSimpleString = false;
while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t'))
i++;
phpStringDelimiter[0] = '\n';
for (j = i; j < lengthDoc && styler[j] != '\n' && styler[j] != '\r'; j++) {
char ch = styler.SafeGetCharAt(i);
const char chNext = styler.SafeGetCharAt(i + 1);
if (!IsPhpWordStart(ch)) {
if (ch == '\'' && IsPhpWordStart(chNext)) {
i++;
ch = chNext;
isSimpleString = true;
} else {
phpStringDelimiter[0] = '\0';
return beginning;
}
}
phpStringDelimiter[0] = ch;
i++;
for (j = i; j < lengthDoc && !isLineEnd(styler[j]); j++) {
if (!IsPhpWordChar(styler[j])) {
if (isSimpleString && (styler[j] == '\'') && isLineEnd(styler.SafeGetCharAt(j + 1))) {
isValidSimpleString = true;
j++;
break;
} else {
phpStringDelimiter[0] = '\0';
return beginning;
}
}
if (j - i < phpStringDelimiterSize - 2)
phpStringDelimiter[j-i+1] = styler[j];
else
i++;
}
phpStringDelimiter[j-i+1] = '\0';
return j;
if (isSimpleString && !isValidSimpleString) {
phpStringDelimiter[0] = '\0';
return beginning;
}
phpStringDelimiter[j-i+1 - (isSimpleString ? 1 : 0)] = '\0';
return j - 1;
}
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
@ -522,11 +554,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
state = SCE_H_DEFAULT;
}
// String can be heredoc, must find a delimiter first
while (startPos > 0 && isPHPStringState(state) && state != SCE_HPHP_SIMPLESTRING) {
startPos--;
length++;
state = styler.StyleAt(startPos);
// String can be heredoc, must find a delimiter first. Reread from beginning of line containing the string, to get the correct lineState
if (isPHPStringState(state)) {
while (startPos > 0 && (isPHPStringState(state) || !isLineEnd(styler[startPos - 1]))) {
startPos--;
length++;
state = styler.StyleAt(startPos);
}
if (startPos == 0)
state = SCE_H_DEFAULT;
}
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
@ -551,12 +587,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state
script_type scriptLanguage = ScriptOfState(state);
// If eNonHtmlScript coincides with SCE_H_COMMENT, assume eScriptComment
if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) {
scriptLanguage = eScriptComment;
}
const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0;
const bool fold = foldHTML && styler.GetPropertyInt("fold", 0);
const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1);
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
const bool foldComment = fold && styler.GetPropertyInt("fold.hypertext.comment", 0) != 0;
const bool foldHeredoc = fold && styler.GetPropertyInt("fold.hypertext.heredoc", 0) != 0;
const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0;
const bool allowScripts = styler.GetPropertyInt("lexer.xml.allow.scripts", 1) != 0;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true);
const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true);
@ -619,9 +662,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC) && (!isStringState(state))) {
//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 == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) {
levelCurrent += ((ch == '{') || (ch == '/')) ? 1 : -1;
}
} else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT)) && foldComment && (ch == '*') && (chNext == '/')) {
levelCurrent--;
}
break;
case eScriptPython:
@ -701,19 +746,22 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HP_STRING:
case SCE_HP_TRIPLE:
case SCE_HP_TRIPLEDOUBLE:
case SCE_HPHP_HSTRING:
case SCE_HPHP_SIMPLESTRING:
case SCE_HPHP_COMMENT:
case SCE_HPHP_COMMENTLINE:
break;
default :
// check if the closing tag is a script tag
if (state == SCE_HJ_COMMENTLINE || isXml) {
char tag[7]; // room for the <script> tag
int j = 0;
char chr = styler.SafeGetCharAt(i+2);
while (j < 6 && !IsASpace(chr)) {
tag[j++] = static_cast<char>(MakeLowerCase(chr));
chr = styler.SafeGetCharAt(i+2+j);
}
tag[j] = '\0';
if (strcmp(tag, "script") != 0) break;
if (const char *tag =
state == SCE_HJ_COMMENTLINE || isXml ? "script" :
state == SCE_H_COMMENT ? "comment" : 0) {
int j = i + 2;
int chr;
do {
chr = static_cast<int>(*tag++);
} while (chr != 0 && chr == MakeLowerCase(styler.SafeGetCharAt(j++)));
if (chr != 0) break;
}
// closing tag of the script (it's a closing HTML tag anyway)
styler.ColourTo(i - 1, StateToPrint);
@ -736,13 +784,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state) ) {
scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 10, eScriptPHP);
scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
i++;
visibleChars++;
i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 10);
i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 6);
if (scriptLanguage == eScriptXML)
styler.ColourTo(i, SCE_H_XMLSTART);
else
@ -1020,7 +1068,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_COMMENT:
if ((chPrev2 == '-') && (chPrev == '-') && (ch == '>')) {
if ((scriptLanguage != eScriptComment) && (chPrev2 == '-') && (chPrev == '-') && (ch == '>')) {
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
levelCurrent--;
@ -1065,16 +1113,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_H_TAGUNKNOWN:
if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) {
int eClass = classifyTagHTML(styler.GetStartSegment(),
i - 1, keywords, styler, tagDontFold, caseSensitive, isXml);
if (eClass == SCE_H_SCRIPT) {
i - 1, keywords, styler, tagDontFold, caseSensitive, isXml, allowScripts);
if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) {
if (!tagClosing) {
inScriptType = eNonHtmlScript;
scriptLanguage = clientScript;
eClass = SCE_H_TAG;
scriptLanguage = eClass == SCE_H_SCRIPT ? clientScript : eScriptComment;
} else {
scriptLanguage = eScriptNone;
eClass = SCE_H_TAG;
}
eClass = SCE_H_TAG;
}
if (ch == '>') {
styler.ColourTo(i, eClass);
@ -1084,7 +1131,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (!tagDontFold){
if (!tagDontFold) {
if (tagClosing) {
levelCurrent--;
} else {
@ -1132,8 +1179,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (!tagDontFold){
if (tagClosing){
if (!tagDontFold) {
if (tagClosing) {
levelCurrent--;
} else {
levelCurrent++;
@ -1158,8 +1205,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (!tagDontFold){
if (tagClosing){
if (!tagDontFold) {
if (tagClosing) {
levelCurrent--;
} else {
levelCurrent++;
@ -1232,8 +1279,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (!tagDontFold){
if (tagClosing){
if (!tagDontFold) {
if (tagClosing) {
levelCurrent--;
} else {
levelCurrent++;
@ -1592,10 +1639,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_HSTRING;
strcpy(phpStringDelimiter, "\"");
} else if (styler.Match(i, "<<<")) {
state = SCE_HPHP_HSTRING;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler);
bool isSimpleString = false;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString);
if (strlen(phpStringDelimiter)) {
state = (isSimpleString ? SCE_HPHP_SIMPLESTRING : SCE_HPHP_HSTRING);
if (foldHeredoc) levelCurrent++;
}
} else if (ch == '\'') {
state = SCE_HPHP_SIMPLESTRING;
strcpy(phpStringDelimiter, "\'");
} else if (ch == '$' && IsPhpWordStart(chNext)) {
state = SCE_HPHP_VARIABLE;
} else if (IsOperator(ch)) {
@ -1618,12 +1670,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_HPHP_VARIABLE:
if (!IsPhpWordChar(ch)) {
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
if (IsOperator(ch))
state = SCE_HPHP_OPERATOR;
else
state = SCE_HPHP_DEFAULT;
if (!IsPhpWordChar(chNext)) {
styler.ColourTo(i, SCE_HPHP_VARIABLE);
state = SCE_HPHP_DEFAULT;
}
break;
case SCE_HPHP_COMMENT:
@ -1650,26 +1699,48 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HPHP_HSTRING_VARIABLE;
} else if (styler.Match(i, phpStringDelimiter)) {
if (phpStringDelimiter[0] == '\"') {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
} else if (isLineEnd(chPrev)) {
const int psdLength = strlen(phpStringDelimiter);
if ((psdLength > 1) && ((i + psdLength) < lengthDoc))
i += psdLength - 1;
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
const char chAfterPsd = styler.SafeGetCharAt(i + psdLength);
const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1);
if (isLineEnd(chAfterPsd) ||
(chAfterPsd == ';' && isLineEnd(chAfterPsd2))) {
i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1;
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
if (foldHeredoc) levelCurrent--;
}
}
}
break;
case SCE_HPHP_SIMPLESTRING:
if (ch == '\\') {
// skip the next char
i++;
} else if (ch == '\'') {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
if (phpStringDelimiter[0] == '\'') {
if (ch == '\\') {
// skip the next char
i++;
} else if (ch == '\'') {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
}
} else if (isLineEnd(chPrev) && styler.Match(i, phpStringDelimiter)) {
const int psdLength = strlen(phpStringDelimiter);
const char chAfterPsd = styler.SafeGetCharAt(i + psdLength);
const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1);
if (isLineEnd(chAfterPsd) ||
(chAfterPsd == ';' && isLineEnd(chAfterPsd2))) {
i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1;
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
if (foldHeredoc) levelCurrent--;
}
}
break;
case SCE_HPHP_HSTRING_VARIABLE:
if (!IsPhpWordChar(ch)) {
styler.ColourTo(i - 1, StateToPrint);
i--; // strange but it works
if (!IsPhpWordChar(chNext)) {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_HSTRING;
}
break;
@ -1698,10 +1769,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_HSTRING;
strcpy(phpStringDelimiter, "\"");
} else if (styler.Match(i, "<<<")) {
state = SCE_HPHP_HSTRING;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler);
bool isSimpleString = false;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString);
if (strlen(phpStringDelimiter)) {
state = (isSimpleString ? SCE_HPHP_SIMPLESTRING : SCE_HPHP_HSTRING);
if (foldHeredoc) levelCurrent++;
}
} else if (ch == '\'') {
state = SCE_HPHP_SIMPLESTRING;
strcpy(phpStringDelimiter, "\'");
} else if (ch == '$' && IsPhpWordStart(chNext)) {
state = SCE_HPHP_VARIABLE;
} else if (IsOperator(ch)) {
@ -1757,8 +1833,24 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
}
StateToPrint = statePrintForState(state, inScriptType);
switch (state) {
case SCE_HJ_WORD:
classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywords2, styler, inScriptType);
break;
case SCE_HB_WORD:
classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, styler, inScriptType);
break;
case SCE_HP_WORD:
classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType);
break;
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, styler);
break;
default:
StateToPrint = statePrintForState(state, inScriptType);
styler.ColourTo(lengthDoc - 1, StateToPrint);
break;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (fold) {
@ -1770,13 +1862,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
static void ColouriseXMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
// Passing in true because we're lexing XML
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists,styler, true);
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, true);
}
static void ColouriseHTMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
// Passing in false because we're notlexing XML
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists,styler, false);
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, false);
}
static bool isASPScript(int state) {
@ -2073,9 +2165,10 @@ static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, Wo
}
static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
if(startPos == 0) initStyle = SCE_HPHP_DEFAULT;
ColouriseHTMLDoc(startPos,length,initStyle,keywordlists,styler);
Accessor &styler) {
if (startPos == 0)
initStyle = SCE_HPHP_DEFAULT;
ColouriseHTMLDoc(startPos, length, initStyle, keywordlists, styler);
}
static const char * const htmlWordListDesc[] = {

View File

@ -179,6 +179,9 @@ static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
// Digit
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_HA_NUMBER);
if (sc.ch == '0' && (sc.chNext == 'X' || sc.chNext == 'x')) { // Match anything starting with "0x" or "0X", too
sc.Forward(1);
}
}
// Comment line
else if (sc.Match("--")) {
@ -269,4 +272,3 @@ void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
LexerModule lmHaskell(SCLEX_HASKELL, ColorizeHaskellDoc, "haskell");

View File

@ -223,72 +223,42 @@ static const char * const innoWordListDesc[] = {
};
static void FoldInnoDoc(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;
char chNext = styler[startPos];
int lineCurrent = styler.GetLine(startPos);
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
bool headerPoint = false;
int lev;
bool sectionFlag = false;
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE;
int level;
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');
int style = styler.StyleAt(i);
if (style == SCE_INNO_SECTION)
headerPoint = true;
sectionFlag = 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 (atEOL || i == endPos - 1) {
if (sectionFlag) {
level = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
if (level == levelPrev)
styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG);
} else {
level = levelPrev & SC_FOLDLEVELNUMBERMASK;
if (levelPrev & SC_FOLDLEVELHEADERFLAG)
level++;
}
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);
styler.SetLevel(lineCurrent, level);
levelPrev = level;
lineCurrent++;
visibleChars = 0;
headerPoint = false;
sectionFlag = 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);
}
LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);

View File

@ -124,4 +124,3 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
LexerModule lmKix(SCLEX_KIX, ColouriseKixDoc, "kix");

View File

@ -21,48 +21,12 @@
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 ||
(isalpha(ch) || ch == '_');
}
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+' ||
(ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'));
}
static inline bool IsLuaOperator(int ch) {
if (ch >= 0x80 || isalnum(ch)) {
return false;
}
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
ch == '(' || ch == ')' || ch == '=' ||
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
ch == '.' || ch == '^' || ch == '%' || ch == ':' ||
ch == '#') {
return true;
}
return false;
}
// Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ],
// return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on.
// The maximum number of '=' characters allowed is 254.
@ -91,6 +55,15 @@ static void ColouriseLuaDoc(
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
// Accepts accented characters
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefABCDEF");
CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#");
CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\");
int 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,
@ -136,7 +109,7 @@ static void ColouriseLuaDoc(
// Handle string line continuation
if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
sc.ch == '\\') {
sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
@ -151,14 +124,14 @@ static void ColouriseLuaDoc(
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
// We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
if (!IsANumberChar(sc.ch)) {
if (!setNumber.Contains(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.ch == '-' || sc.ch == '+') {
if (sc.chPrev != 'E' && sc.chPrev != 'e')
sc.SetState(SCE_LUA_DEFAULT);
}
if (sc.chPrev != 'E' && sc.chPrev != 'e')
sc.SetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || sc.Match('.', '.')) {
if (!setWord.Contains(sc.ch) || sc.Match('.', '.')) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
@ -186,7 +159,7 @@ static void ColouriseLuaDoc(
}
} else if (sc.state == SCE_LUA_STRING) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
if (setEscapeSkip.Contains(sc.chNext)) {
sc.Forward();
}
} else if (sc.ch == '\"') {
@ -197,7 +170,7 @@ static void ColouriseLuaDoc(
}
} else if (sc.state == SCE_LUA_CHARACTER) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
if (setEscapeSkip.Contains(sc.chNext)) {
sc.Forward();
}
} else if (sc.ch == '\'') {
@ -233,9 +206,9 @@ static void ColouriseLuaDoc(
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_LUA_NUMBER);
if (sc.ch == '0' && toupper(sc.chNext) == 'X') {
sc.Forward(1);
sc.Forward();
}
} else if (IsAWordStart(sc.ch)) {
} else if (setWordStart.Contains(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.ch == '\"') {
sc.SetState(SCE_LUA_STRING);
@ -265,11 +238,34 @@ static void ColouriseLuaDoc(
}
} else if (sc.atLineStart && sc.Match('$')) {
sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
} else if (IsLuaOperator(static_cast<char>(sc.ch))) {
} else if (setLuaOperator.Contains(sc.ch)) {
sc.SetState(SCE_LUA_OPERATOR);
}
}
}
if (setWord.Contains(sc.chPrev)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_LUA_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_LUA_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_LUA_WORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_LUA_WORD4);
} else if (keywords5.InList(s)) {
sc.ChangeState(SCE_LUA_WORD5);
} else if (keywords6.InList(s)) {
sc.ChangeState(SCE_LUA_WORD6);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_LUA_WORD7);
} else if (keywords8.InList(s)) {
sc.ChangeState(SCE_LUA_WORD8);
}
}
sc.Complete();
}

View File

@ -184,4 +184,3 @@ static const char * const MMIXALWordListDesc[] = {
LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc);

View File

@ -128,7 +128,7 @@ static void ColouriseMatlabOctaveDoc(
if (sc.state == SCE_MATLAB_DEFAULT) {
if (IsCommentChar(sc.ch)) {
sc.SetState(SCE_MATLAB_COMMENT);
} else if (sc.ch == '!') {
} else if (sc.ch == '!' && sc.chNext != '=' ) {
sc.SetState(SCE_MATLAB_COMMAND);
} else if (sc.ch == '\'') {
if (transpose) {

View File

@ -98,7 +98,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &
return false;
}
static int NsisCmp( char *s1, char *s2, bool bIgnoreCase )
static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase )
{
if( bIgnoreCase )
return CompareCaseInsensitive( s1, s2);
@ -652,4 +652,3 @@ static const char * const nsisWordLists[] = {
LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);

View File

@ -24,6 +24,10 @@
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');
}
@ -58,7 +62,6 @@ static void ColouriseBatchLine(
Accessor &styler) {
unsigned int offset = 0; // Line Buffer Offset
unsigned int enVarEnd; // Environment Variable End point
unsigned int cmdLoc; // External Command / Program Location
char wordBuffer[81]; // Word Buffer - large to catch long paths
unsigned int wbl; // Word Buffer Length
@ -111,39 +114,6 @@ static void ColouriseBatchLine(
if (lineBuffer[offset] == '@') {
styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
offset++;
// Check for Argument (%n) or Environment Variable (%x...%)
} else if (lineBuffer[offset] == '%') {
enVarEnd = offset + 1;
// Search end of word for second % (can be a long path)
while ((enVarEnd < lengthLine) &&
(!isspacechar(lineBuffer[enVarEnd])) &&
(lineBuffer[enVarEnd] != '%') &&
(!IsBOperator(lineBuffer[enVarEnd])) &&
(!IsBSeparator(lineBuffer[enVarEnd]))) {
enVarEnd++;
}
// Check for Argument (%n)
if ((Is0To9(lineBuffer[offset + 1])) &&
(lineBuffer[enVarEnd] != '%')) {
// Colorize Argument
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
offset += 2;
// Check for External Command / Program
if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
// Check for Environment Variable (%x...%)
} else if ((lineBuffer[offset + 1] != '%') &&
(lineBuffer[enVarEnd] == '%')) {
offset = enVarEnd;
// Colorize Environment Variable
styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
offset++;
// Check for External Command / Program
if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
}
}
// Skip next spaces
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
@ -350,8 +320,8 @@ static void ColouriseBatchLine(
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Check for Argument (%n)
if ((Is0To9(wordBuffer[1])) &&
// Check for Argument (%n) or (%*)
if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) &&
(wordBuffer[wbo] != '%')) {
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
@ -361,6 +331,17 @@ static void ColouriseBatchLine(
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] == '%')) {
@ -491,9 +472,13 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
// 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, "--- ", 4)) {
} else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff
styler.ColourTo(endLine, SCE_DIFF_COMMAND);
} else if (0 == strncmp(lineBuffer, "---", 3)) {
// In a context diff, --- appears in both the header and the position markers
if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/'))
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);
@ -526,6 +511,8 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
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 {
@ -552,25 +539,24 @@ static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[
}
}
static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Accessor &styler) {
static void FoldDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
int curLine = styler.GetLine(startPos);
int prevLevel = SC_FOLDLEVELBASE;
if (curLine > 0)
prevLevel = styler.LevelAt(curLine-1);
int curLineStart = styler.LineStart(curLine);
do {
int nextLevel = prevLevel;
if (prevLevel & SC_FOLDLEVELHEADERFLAG)
nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
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_HEADER) {
else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-')
nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG;
} else if (lineType == SCE_DIFF_POSITION)
nextLevel = (SC_FOLDLEVELBASE + 3) | 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);
@ -582,6 +568,78 @@ static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Acc
} while (static_cast<int>(startPos) + length > curLineStart);
}
static void ColourisePoLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
Accessor &styler) {
unsigned int i = 0;
static unsigned int state = SCE_PO_DEFAULT;
unsigned int state_start = SCE_PO_DEFAULT;
while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces
i++;
if (i < lengthLine) {
if (lineBuffer[i] == '#') {
// check if the comment contains any flags ("#, ") and
// then whether the flags contain "fuzzy"
if (strstart(lineBuffer, "#, ") && strstr(lineBuffer, "fuzzy"))
styler.ColourTo(endPos, SCE_PO_FUZZY);
else
styler.ColourTo(endPos, SCE_PO_COMMENT);
} else {
if (lineBuffer[0] == '"') {
// line continuation, use previous style
styler.ColourTo(endPos, state);
return;
// this implicitly also matches "msgid_plural"
} else if (strstart(lineBuffer, "msgid")) {
state_start = SCE_PO_MSGID;
state = SCE_PO_MSGID_TEXT;
} else if (strstart(lineBuffer, "msgstr")) {
state_start = SCE_PO_MSGSTR;
state = SCE_PO_MSGSTR_TEXT;
} else if (strstart(lineBuffer, "msgctxt")) {
state_start = SCE_PO_MSGCTXT;
state = SCE_PO_MSGCTXT_TEXT;
}
if (state_start != SCE_PO_DEFAULT) {
// find the next space
while ((i < lengthLine) && ! isspacechar(lineBuffer[i]))
i++;
styler.ColourTo(startLine + i - 1, state_start);
styler.ColourTo(startLine + i, SCE_PO_DEFAULT);
styler.ColourTo(endPos, state);
}
}
} else {
styler.ColourTo(endPos, SCE_PO_DEFAULT);
}
}
static void ColourisePoDoc(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';
ColourisePoLine(lineBuffer, linePos, startLine, i, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColourisePoLine(lineBuffer, linePos, startLine, startPos + length - 1, styler);
}
}
static void ColourisePropsLine(
char *lineBuffer,
@ -814,10 +872,6 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
}
}
static bool strstart(const char *haystack, const char *needle) {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) {
if (lineBuffer[0] == '>') {
// Command or return status
@ -921,7 +975,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) {
// This check is not completely accurate as may be on
// GTK+ with a file name that includes ':'.
state = stGccStart;
state = stGccStart;
} else if (chNext == ' ') { // indicates a Lua 5.1 error message
initialColonPart = true;
}
@ -1169,6 +1223,7 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);
LexerModule lmPo(SCLEX_PO, ColourisePoDoc, "po", 0, 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);

File diff suppressed because it is too large Load Diff

View File

@ -106,6 +106,70 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt
sc.Complete();
}
// 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,
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;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelMinCurrent = levelCurrent;
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_POWERSHELL_OPERATOR) {
if (ch == '{') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}') {
levelNext--;
}
}
if (!IsASpace(ch))
visibleChars++;
if (atEOL || (i == endPos-1)) {
int levelUse = levelCurrent;
if (foldAtElse) {
levelUse = levelMinCurrent;
}
int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
visibleChars = 0;
}
}
}
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell");
static const char * const powershellWordLists[] = {
"Commands",
"Cmdlets",
"Aliases",
0
};
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists);

View File

@ -65,22 +65,25 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
// Handle line continuation generically.
if (sc.ch == '~') {
// Skip whitespace between ~ and EOL
/* do {
sc.Forward();
} */
while ((sc.chNext == ' ' || sc.chNext == '\t') ) {
sc.Forward();
sc.More();
}
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
if (sc.chNext > ' ') {
// skip special char after ~
sc.Forward();
continue;
}
else {
// Skip whitespace between ~ and EOL
while (sc.More() && (sc.chNext == ' ' || sc.chNext == '\t') ) {
sc.Forward();
}
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
sc.Forward();
continue;
}
}
}
// Determine if a new state should be terminated.
mask = sc.state & 0x10;
@ -269,3 +272,5 @@ static const char * const FglWordLists[] = {
};
LexerModule lmProgress(SCLEX_PS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists);

View File

@ -320,4 +320,3 @@ static const char * const rebolWordListDesc[] = {
LexerModule lmREBOL(SCLEX_REBOL, ColouriseRebolDoc, "rebol", FoldRebolDoc, rebolWordListDesc);

View File

@ -1641,7 +1641,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
if (foldComment && stylePrev != SCE_RB_COMMENTLINE) {
if (chNext == '{') {
levelCurrent++;
} else if (chNext == '}') {
} else if (chNext == '}' && levelCurrent > 0) {
levelCurrent--;
}
}
@ -1692,6 +1692,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
visibleChars++;
buffer_ends_with_eol = false;
}
stylePrev = style;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (!buffer_ends_with_eol) {

View File

@ -395,7 +395,7 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc
levelCurrent += classifyFoldPointTeXPaired(buffer)+classifyFoldPointTeXUnpaired(buffer);
}
if((ch == '\r' || ch=='\n') && (chNext == '\\')){
if (levelCurrent > SC_FOLDLEVELBASE && ((ch == '\r' || ch=='\n') && (chNext == '\\'))) {
ParseTeXCommand(i+1, styler, buffer);
levelCurrent -= classifyFoldPointTeXUnpaired(buffer);
}

View File

@ -280,4 +280,3 @@ static const char * const vbWordListDesc[] = {
LexerModule lmVB(SCLEX_VB, ColouriseVBNetDoc, "vb", FoldVBDoc, vbWordListDesc);
LexerModule lmVBScript(SCLEX_VBSCRIPT, ColouriseVBScriptDoc, "vbscript", FoldVBDoc, vbWordListDesc);

View File

@ -475,4 +475,3 @@ LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLi
// std_logic_vector X01 X01Z UX01 UX01Z unsigned signed
//

View File

@ -97,7 +97,7 @@ static void ColouriseVerilogDoc(unsigned int startPos, int length, int initStyle
sc.ForwardSetState(SCE_V_DEFAULT);
}
} else if (sc.state == SCE_V_COMMENTLINE || sc.state == SCE_V_COMMENTLINEBANG) {
if (sc.atLineEnd) {
if (sc.atLineStart) {
sc.SetState(SCE_V_DEFAULT);
}
} else if (sc.state == SCE_V_STRING) {
@ -164,11 +164,11 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
// Generally used methodology in verilog code is
// one module per file, so folding at module definition is useless.
// fold_at_brace/parenthese -
// Folding of long port lists can be convenient.
// Folding of long port lists can be convenient.
bool foldAtModule = styler.GetPropertyInt("fold.verilog.flags", 0) != 0;
bool foldAtBrace = 1;
bool foldAtParenthese = 1;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
@ -238,22 +238,24 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
}
if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) {
unsigned int j = i;
if (styler.Match(j, "case") ||
styler.Match(j, "casex") ||
styler.Match(j, "casez") ||
styler.Match(j, "function") ||
styler.Match(j, "fork") ||
styler.Match(j, "table") ||
styler.Match(j, "task") ||
styler.Match(j, "specify") ||
styler.Match(j, "primitive") ||
styler.Match(j, "module") && foldAtModule ||
if (styler.Match(j, "case") ||
styler.Match(j, "casex") ||
styler.Match(j, "casez") ||
styler.Match(j, "function") ||
styler.Match(j, "fork") ||
styler.Match(j, "table") ||
styler.Match(j, "task") ||
styler.Match(j, "generate") ||
styler.Match(j, "specify") ||
styler.Match(j, "primitive") ||
styler.Match(j, "module") && foldAtModule ||
styler.Match(j, "begin")) {
levelNext++;
} else if (styler.Match(j, "endcase") ||
} else if (styler.Match(j, "endcase") ||
styler.Match(j, "endfunction") ||
styler.Match(j, "join") ||
styler.Match(j, "endtask") ||
styler.Match(j, "endgenerate") ||
styler.Match(j, "endtable") ||
styler.Match(j, "endspecify") ||
styler.Match(j, "endprimitive") ||

View File

@ -147,7 +147,7 @@ static void ColouriseYAMLLine(
} else {
unsigned int i2 = i;
while ((i < lengthLine) && lineBuffer[i]) {
if (!isdigit(lineBuffer[i]) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
if (!(isascii(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
styler.ColourTo(endPos, SCE_YAML_DEFAULT);
return;
}

View File

@ -33,7 +33,7 @@
* Interfaces:
* RESearch::Compile: compile a regular expression into a NFA.
*
* const char *RESearch::Compile(const char *pat, int length,
* const char *RESearch::Compile(const char *pattern, int length,
* bool caseSensitive, bool posix)
*
* Returns a short error string if they fail.
@ -347,13 +347,13 @@ static int GetHexaChar(unsigned char hd1, unsigned char hd2) {
/**
* Called when the parser finds a backslash not followed
* by a valid expression (like \( in non-Posix mode).
* @param pat: pointer on the char after the backslash.
* @param pattern: pointer on the char after the backslash.
* @param incr: (out) number of chars to skip after expression evaluation.
* @return the char if it resolves to a simple char,
* or -1 for a char class. In this case, bittab is changed.
*/
int RESearch::GetBackslashExpression(
const char *pat,
const char *pattern,
int &incr) {
// Since error reporting is primitive and messages are not used anyway,
// I choose to interpret unexpected syntax in a logical way instead
@ -361,7 +361,7 @@ int RESearch::GetBackslashExpression(
incr = 0; // Most of the time, will skip the char "naturally".
int c;
int result = -1;
unsigned char bsc = *pat;
unsigned char bsc = *pattern;
if (!bsc) {
// Avoid overrun
result = '\\'; // \ at end of pattern, take it literally
@ -379,8 +379,8 @@ int RESearch::GetBackslashExpression(
result = escapeValue(bsc);
break;
case 'x': {
unsigned char hd1 = *(pat + 1);
unsigned char hd2 = *(pat + 2);
unsigned char hd1 = *(pattern + 1);
unsigned char hd2 = *(pattern + 2);
int hexValue = GetHexaChar(hd1, hd2);
if (hexValue >= 0) {
result = hexValue;
@ -436,7 +436,7 @@ int RESearch::GetBackslashExpression(
return result;
}
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
const char *RESearch::Compile(const char *pattern, int length, bool caseSensitive, bool posix) {
char *mp=nfa; /* nfa pointer */
char *lp; /* saved pointer */
char *sp=nfa; /* another one */
@ -449,14 +449,14 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
char mask; /* xor mask -CCL/NCL */
int c1, c2, prevChar;
if (!pat || !length)
if (!pattern || !length)
if (sta)
return 0;
else
return badpat("No previous regular expression");
sta = NOP;
const char *p=pat; /* pattern pointer */
const char *p=pattern; /* pattern pointer */
for (int i=0; i<length; i++, p++) {
if (mp > mpMax)
return badpat("Pattern too long");
@ -468,7 +468,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
break;
case '^': /* match beginning */
if (p == pat)
if (p == pattern)
*mp++ = BOL;
else {
*mp++ = CHR;
@ -588,7 +588,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
case '*': /* match 0 or more... */
case '+': /* match 1 or more... */
if (p == pat)
if (p == pattern)
return badpat("Empty closure");
lp = sp; /* previous opcode */
if (*lp == CLO) /* equivalence... */
@ -853,6 +853,8 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
return NOTFOUND;
break;
case CCL:
if (lp >= endp)
return NOTFOUND;
c = ci.CharAt(lp++);
if (!isinset(ap,c))
return NOTFOUND;
@ -978,4 +980,3 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
return 1;
}

View File

@ -34,7 +34,7 @@ public:
RESearch(CharClassify *charClassTable);
~RESearch();
bool GrabMatches(CharacterIndexer &ci);
const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
int Execute(CharacterIndexer &ci, int lp, int endp);
int Substitute(CharacterIndexer &ci, char *src, char *dst);
@ -51,7 +51,7 @@ private:
void Clear();
void ChSet(unsigned char c);
void ChSetWithCase(unsigned char c, bool caseSensitive);
int GetBackslashExpression(const char *pat, int &incr);
int GetBackslashExpression(const char *pattern, int &incr);
int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
@ -73,4 +73,3 @@ private:
#endif

View File

@ -7,6 +7,9 @@
/// Styling buffer using one element for each run rather than using
/// a filled buffer.
#ifndef RUNSTYLES_H
#define RUNSTYLES_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
@ -39,3 +42,5 @@ public:
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -173,7 +173,7 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) {
return 0;
default:
ac.Cancel();
AutoCompleteCancel();
}
}
@ -287,6 +287,13 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
}
void ScintillaBase::AutoCompleteCancel() {
if (ac.Active()) {
SCNotification scn = {0};
scn.nmhdr.code = SCN_AUTOCCANCELLED;
scn.wParam = 0;
scn.listType = 0;
NotifyParent(scn);
}
ac.Cancel();
}
@ -308,7 +315,7 @@ void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
if (ac.IsFillUpChar(ch)) {
AutoCompleteCompleted();
} else if (ac.IsStopChar(ch)) {
ac.Cancel();
AutoCompleteCancel();
} else {
AutoCompleteMoveToCurrentWord();
}
@ -316,9 +323,9 @@ void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
void ScintillaBase::AutoCompleteCharacterDeleted() {
if (currentPos < ac.posStart - ac.startLen) {
ac.Cancel();
AutoCompleteCancel();
} else if (ac.cancelAtStartPos && (currentPos <= ac.posStart)) {
ac.Cancel();
AutoCompleteCancel();
} else {
AutoCompleteMoveToCurrentWord();
}
@ -331,7 +338,7 @@ void ScintillaBase::AutoCompleteCompleted() {
if (item != -1) {
ac.lb->GetValue(item, selected, sizeof(selected));
} else {
ac.Cancel();
AutoCompleteCancel();
return;
}
@ -378,7 +385,7 @@ int ScintillaBase::AutoCompleteGetCurrent() {
}
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
AutoCompleteCancel();
ac.Cancel();
pt.y += vs.lineHeight;
// If container knows about STYLE_CALLTIP then use it in place of the
// STYLE_DEFAULT for the face name, size and character set. Also use it
@ -518,7 +525,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
break;
case SCI_AUTOCCANCEL:
AutoCompleteCancel();
ac.Cancel();
break;
case SCI_AUTOCACTIVE:

View File

@ -238,6 +238,12 @@ public:
DeleteRange(0, lengthBody);
}
T* BufferPointer() {
RoomFor(1);
GapTo(lengthBody);
body[lengthBody] = 0;
return body;
}
};
#endif

View File

@ -10,4 +10,3 @@ void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned
unsigned int UTF16Length(const char *s, unsigned int len);
unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen);

View File

@ -189,4 +189,3 @@ void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value)
Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start);
}
}

View File

@ -7,19 +7,19 @@
CFG=SciLexer - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "SciLexer.mak".
!MESSAGE
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "SciLexer.mak" CFG="SciLexer - Win32 Debug"
!MESSAGE
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE
!MESSAGE "SciLexer - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "SciLexer - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
@ -43,8 +43,8 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SciLexer_EXPORTS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /G6 /MT /W4 /O1 /I "..\include" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /FD /c
# SUBTRACT CPP /Fr /YX /Yc /Yu
# ADD CPP /nologo /G6 /MT /W4 /O1 /I "..\include" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /Fr /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@ -83,7 +83,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib comctl32.lib /nologo /dll /debug /machine:I386
!ENDIF
!ENDIF
# Begin Target
@ -314,6 +314,10 @@ SOURCE=..\src\LexMSSQL.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexMySQL.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexNsis.cxx
# End Source File
# Begin Source File

View File

@ -1 +1 @@
175
177

View File

@ -77,6 +77,10 @@ bool IsNT() {
return onNT;
}
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
Point Point::FromLong(long lpoint) {
return Point(static_cast<short>(LOWORD(lpoint)), static_cast<short>(HIWORD(lpoint)));
}
@ -219,7 +223,7 @@ FontCached *FontCached::first = 0;
FontCached::FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_) :
next(0), usage(0), hash(0) {
::SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_);
SetLogFont(lf, faceName_, characterSet_, size_, bold_, italic_);
hash = HashFont(faceName_, characterSet_, size_, bold_, italic_);
id = ::CreateFontIndirectA(&lf);
usage = 1;
@ -296,7 +300,7 @@ void Font::Create(const char *faceName, int characterSet, int size,
Release();
#ifndef FONTS_CACHED
LOGFONT lf;
::SetLogFont(lf, faceName, characterSet, size, bold, italic);
SetLogFont(lf, faceName, characterSet, size, bold, italic);
id = ::CreateFontIndirect(&lf);
#else
id = FontCached::FindOrCreate(faceName, characterSet, size, bold, italic);
@ -314,6 +318,10 @@ void Font::Release() {
id = 0;
}
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
class SurfaceImpl : public Surface {
bool unicodeMode;
HDC hdc;
@ -387,6 +395,10 @@ public:
void SetDBCSMode(int codePage_);
};
#ifdef SCI_NAMESPACE
} //namespace Scintilla
#endif
SurfaceImpl::SurfaceImpl() :
unicodeMode(false),
hdc(0), hdcOwned(false),
@ -651,7 +663,44 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
static_cast<SurfaceImpl &>(surfaceSource).hdc, from.x, from.y, SRCCOPY);
}
const int MAX_US_LEN = 10000;
// Buffer to hold strings and string position arrays without always allocating on heap.
// May sometimes have string too long to allocate on stack. So use a fixed stack-allocated buffer
// when less than safe size otherwise allocate on heap and free automatically.
template<typename T, int lengthStandard>
class VarBuffer {
T bufferStandard[lengthStandard];
public:
T *buffer;
VarBuffer(size_t length) : buffer(0) {
if (length > lengthStandard) {
buffer = new T[length];
} else {
buffer = bufferStandard;
}
}
~VarBuffer() {
if (buffer != bufferStandard) {
delete []buffer;
buffer = 0;
}
}
};
const int stackBufferLength = 10000;
class TextWide : public VarBuffer<wchar_t, stackBufferLength> {
public:
int tlen;
TextWide(const char *s, int len, bool unicodeMode, int codePage=0) :
VarBuffer<wchar_t, stackBufferLength>(len) {
if (unicodeMode) {
tlen = UTF16FromUTF8(s, len, buffer, len);
} else {
// Support Asian string display in 9x English
tlen = ::MultiByteToWideChar(codePage, 0, s, len, buffer, len);
}
}
};
typedef VarBuffer<int, stackBufferLength> TextPositions;
void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const char *s, int len, UINT fuOptions) {
SetFont(font_);
@ -681,25 +730,15 @@ void SurfaceImpl::DrawTextCommon(PRectangle rc, Font &font_, int ybase, const ch
}
} else {
// Use Unicode calls
wchar_t tbuf[MAX_US_LEN];
int tlen;
if (unicodeMode) {
tlen = UTF16FromUTF8(s, len, tbuf, MAX_US_LEN);
} else {
// Support Asian string display in 9x English
tlen = ::MultiByteToWideChar(codePage, 0, s, len, NULL, 0);
if (tlen > MAX_US_LEN)
tlen = MAX_US_LEN;
::MultiByteToWideChar(codePage, 0, s, len, tbuf, tlen);
}
if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf, tlen, NULL)) {
while (tlen > pos) {
int seglen = Platform::Minimum(maxSegmentLength, tlen - pos);
if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf+pos, seglen, NULL)) {
const TextWide tbuf(s, len, unicodeMode, codePage);
if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf.buffer, tbuf.tlen, NULL)) {
while (tbuf.tlen > pos) {
int seglen = Platform::Minimum(maxSegmentLength, tbuf.tlen - pos);
if (!::ExtTextOutW(hdc, x, ybase, fuOptions, &rcw, tbuf.buffer+pos, seglen, NULL)) {
PLATFORM_ASSERT(false);
return;
}
::GetTextExtentPoint32W(hdc, tbuf+pos, seglen, &sz);
::GetTextExtentPoint32W(hdc, tbuf.buffer+pos, seglen, &sz);
x += sz.cx;
pos += seglen;
}
@ -738,18 +777,11 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, con
int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
SetFont(font_);
SIZE sz={0,0};
if (unicodeMode) {
wchar_t tbuf[MAX_US_LEN];
int tlen = UTF16FromUTF8(s, len, tbuf, MAX_US_LEN);
::GetTextExtentPoint32W(hdc, tbuf, tlen, &sz);
} else if (IsNT() || (codePage==0) || win9xACPSame) {
if ((!unicodeMode) && (IsNT() || (codePage==0) || win9xACPSame)) {
::GetTextExtentPoint32A(hdc, s, Platform::Minimum(len, maxLenText), &sz);
} else {
// Support Asian string display in 9x English
wchar_t tbuf[MAX_US_LEN];
int tlen = ::MultiByteToWideChar(codePage, 0, s, len, NULL, 0);
::MultiByteToWideChar(codePage, 0, s, len, tbuf, tlen);
::GetTextExtentPoint32W(hdc, tbuf, tlen, &sz);
const TextWide tbuf(s, len, unicodeMode, codePage);
::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &sz);
}
return sz.cx;
}
@ -759,20 +791,19 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
SIZE sz={0,0};
int fit = 0;
if (unicodeMode) {
wchar_t tbuf[MAX_US_LEN];
int tlen = UTF16FromUTF8(s, len, tbuf, MAX_US_LEN);
int poses[MAX_US_LEN];
fit = tlen;
if (!::GetTextExtentExPointW(hdc, tbuf, tlen, maxWidthMeasure, &fit, poses, &sz)) {
const TextWide tbuf(s, len, unicodeMode, codePage);
TextPositions 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 qudratic but seems fast enough on test files
for (int widthSS=0; widthSS < tlen; widthSS++) {
::GetTextExtentPoint32W(hdc, tbuf, widthSS+1, &sz);
poses[widthSS] = sz.cx;
for (int widthSS=0; widthSS < tbuf.tlen; widthSS++) {
::GetTextExtentPoint32W(hdc, tbuf.buffer, widthSS+1, &sz);
poses.buffer[widthSS] = sz.cx;
}
}
// Map the widths given for UCS-2 characters back onto the UTF-8 input string
// 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;
@ -788,7 +819,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
lenChar = 2;
}
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
positions[i++] = poses[ui];
positions[i++] = poses.buffer[ui];
}
ui++;
}
@ -799,37 +830,46 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
positions[i++] = lastPos;
}
} else if (IsNT() || (codePage==0) || win9xACPSame) {
if (!::GetTextExtentExPointA(hdc, s, Platform::Minimum(len, maxLenText),
maxWidthMeasure, &fit, positions, &sz)) {
// Eeek - a NULL DC or other foolishness could cause this.
// The least we can do is set the positions to zero!
memset(positions, 0, len * sizeof(*positions));
} else if (fit < len) {
// For some reason, such as an incomplete DBCS character
// Not all the positions are filled in so make them equal to end.
for (int i=fit;i<len;i++)
positions[i] = positions[fit-1];
// Zero positions to avoid random behaviour on failure.
memset(positions, 0, len * sizeof(*positions));
// 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);
if (!::GetTextExtentExPointA(hdc, s, lenBlock, maxWidthMeasure, &fit, positions, &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.
for (int i=fit;i<lenBlock;i++)
positions[i] = positions[fit-1];
} else if (startOffset > 0) {
for (int i=0;i<lenBlock;i++)
positions[i] += startOffset;
}
startOffset = positions[lenBlock-1];
len -= lenBlock;
positions += lenBlock;
s += lenBlock;
}
} else {
// Support Asian string display in 9x English
wchar_t tbuf[MAX_US_LEN];
int tlen = ::MultiByteToWideChar(codePage, 0, s, len, NULL, 0);
::MultiByteToWideChar(codePage, 0, s, len, tbuf, tlen);
int poses[MAX_US_LEN];
for (int widthSS=0; widthSS<tlen; widthSS++) {
::GetTextExtentPoint32W(hdc, tbuf, widthSS+1, &sz);
poses[widthSS] = sz.cx;
const TextWide tbuf(s, len, unicodeMode, codePage);
TextPositions poses(tbuf.tlen);
for (int widthSS=0; widthSS<tbuf.tlen; widthSS++) {
::GetTextExtentPoint32W(hdc, tbuf.buffer, widthSS+1, &sz);
poses.buffer[widthSS] = sz.cx;
}
int ui = 0;
for (int i=0;i<len;) {
if (::IsDBCSLeadByteEx(codePage, s[i])) {
positions[i] = poses[ui];
positions[i+1] = poses[ui];
positions[i] = poses.buffer[ui];
positions[i+1] = poses.buffer[ui];
i += 2;
} else {
positions[i] = poses[ui];
positions[i] = poses.buffer[ui];
i++;
}
@ -1342,10 +1382,8 @@ PRectangle ListBoxX::GetDesiredRect() {
SIZE textSize = {0, 0};
int len = widestItem ? strlen(widestItem) : 0;
if (unicodeMode) {
wchar_t tbuf[MAX_US_LEN];
len = UTF16FromUTF8(widestItem, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1);
tbuf[len] = L'\0';
::GetTextExtentPoint32W(hdc, tbuf, len, &textSize);
const TextWide tbuf(widestItem, len, unicodeMode);
::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize);
} else {
::GetTextExtentPoint32A(hdc, widestItem, len, &textSize);
}
@ -1461,10 +1499,8 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
::InsetRect(&rcText, TextInset.x, TextInset.y);
if (unicodeMode) {
wchar_t tbuf[MAX_US_LEN];
int tlen = UTF16FromUTF8(text, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1);
tbuf[tlen] = L'\0';
::DrawTextW(pDrawItem->hDC, tbuf, tlen, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
const TextWide tbuf(text, len, unicodeMode);
::DrawTextW(pDrawItem->hDC, tbuf.buffer, tbuf.tlen, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
} else {
::DrawTextA(pDrawItem->hDC, text, len, &rcText, DT_NOPREFIX|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOCLIP);
}

View File

@ -9,8 +9,8 @@
#include "PlatformRes.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 7, 5, 0
PRODUCTVERSION 1, 7, 5, 0
FILEVERSION 1, 7, 7, 0
PRODUCTVERSION 1, 7, 7, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
@ -27,12 +27,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0"
VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0"
VALUE "FileVersion", "1.75\0"
VALUE "FileVersion", "1.77\0"
VALUE "InternalName", "Scintilla\0"
VALUE "LegalCopyright", "Copyright 1998-2007 by Neil Hodgson\0"
VALUE "LegalCopyright", "Copyright 1998-2008 by Neil Hodgson\0"
VALUE "OriginalFilename", "Scintilla.DLL\0"
VALUE "ProductName", "Scintilla\0"
VALUE "ProductVersion", "1.75\0"
VALUE "ProductVersion", "1.77\0"
END
END
END

View File

@ -99,6 +99,10 @@ extern void Platform_Finalise();
const TCHAR scintillaClassName[] = TEXT("Scintilla");
const TCHAR callClassName[] = TEXT("CallTip");
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
class ScintillaWin; // Forward declaration for COM interface subobjects
/**
@ -279,6 +283,7 @@ private:
HBITMAP sysCaretBitmap;
int sysCaretWidth;
int sysCaretHeight;
bool keysAlwaysUnicode;
};
HINSTANCE ScintillaWin::hInstance = 0;
@ -316,6 +321,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
sysCaretWidth = 0;
sysCaretHeight = 0;
keysAlwaysUnicode = false;
Initialise();
}
@ -732,6 +739,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
(wParam & MK_CONTROL) != 0);
break;
case WM_RBUTTONDOWN:
if (!PointInSelection(Point::FromLong(lParam)))
SetEmptySelection(PositionFromLocation(Point::FromLong(lParam)));
break;
case WM_SETCURSOR:
if (LoWord(lParam) == HTCLIENT) {
if (inDragDrop == ddDragging) {
@ -758,7 +770,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case WM_CHAR:
if (((wParam >= 128) || !iscntrl(wParam)) || !lastKeyDownConsumed) {
if (::IsWindowUnicode(MainHWND())) {
if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) {
wchar_t wcs[2] = {wParam, 0};
if (IsUnicodeMode()) {
// For a wide character version of the window:
@ -1006,6 +1018,13 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
::SetFocus(MainHWND());
break;
case SCI_SETKEYSUNICODE:
keysAlwaysUnicode = wParam != 0;
break;
case SCI_GETKEYSUNICODE:
return keysAlwaysUnicode;
#ifdef SCI_LEXER
case SCI_LOADLEXERLIBRARY:
LexerManager::GetInstance()->Load(reinterpret_cast<const char*>(lParam));
@ -2246,7 +2265,7 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) {
WNDCLASSEXW wndclass;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = ::ScintillaWin::SWndProc;
wndclass.lpfnWndProc = ScintillaWin::SWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ScintillaWin *);
wndclass.hInstance = hInstance;
@ -2263,7 +2282,7 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) {
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = ::ScintillaWin::SWndProc;
wndclass.lpfnWndProc = ScintillaWin::SWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(ScintillaWin *);
wndclass.hInstance = hInstance;
@ -2425,7 +2444,11 @@ sptr_t ScintillaWin::DirectFunction(
return sci->WndProc(iMessage, wParam, lParam);
}
extern "C" __declspec(dllexport) sptr_t __stdcall Scintilla_DirectFunction(
extern "C"
#ifndef STATIC_BUILD
__declspec(dllexport)
#endif
sptr_t __stdcall Scintilla_DirectFunction(
ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
return sci->WndProc(iMessage, wParam, lParam);
}

View File

@ -57,11 +57,10 @@ LexConf.o LexCPP.o LexCrontab.o LexCsound.o LexCSS.o LexD.o LexEiffel.o \
LexErlang.o LexEScript.o LexFlagship.o LexForth.o LexFortran.o LexGAP.o \
LexGui4Cli.o LexHaskell.o LexHTML.o LexInno.o LexKix.o LexLisp.o LexLout.o \
LexLua.o LexMagik.o LexMatlab.o LexMetapost.o LexMMIXAL.o LexMPT.o LexMSSQL.o \
LexNsis.o LexObjC.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
LexMySQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
LexPLM.o LexPOV.o LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o \
LexRebol.o LexRuby.o LexScriptol.o LexSearchResult.o LexSmalltalk.o \
LexSpecman.o LexSpice.o LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexUser.o \
LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o \
LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
SOBJS = ScintillaWin.o ScintillaBase.o Editor.o CharClassify.o Decoration.o \
@ -114,4 +113,3 @@ ScintillaWinL.o:
ScintRes.o: ScintRes.rc PlatformRes.h
windres ScintRes.rc $@

View File

@ -155,8 +155,8 @@ LEXOBJS=\
$(DIR_O)\LexMMIXAL.obj \
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexObjC.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
$(DIR_O)\LexPascal.obj \
@ -172,7 +172,6 @@ LEXOBJS=\
$(DIR_O)\LexRebol.obj \
$(DIR_O)\LexRuby.obj \
$(DIR_O)\LexScriptol.obj \
$(DIR_O)\LexSearchResult.obj \
$(DIR_O)\LexSmalltalk.obj \
$(DIR_O)\LexSpecman.obj \
$(DIR_O)\LexSpice.obj \
@ -180,7 +179,6 @@ LEXOBJS=\
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexUser.obj \
$(DIR_O)\LexVB.obj \
$(DIR_O)\LexVerilog.obj \
$(DIR_O)\LexVHDL.obj \
@ -392,9 +390,9 @@ $(DIR_O)\LexMPT.obj: ..\src\LexMPT.cxx $(LEX_HEADERS)
$(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexObjC.obj: ..\src\LexObjC.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
@ -426,8 +424,6 @@ $(DIR_O)\LexRuby.obj: ..\src\LexRuby.cxx $(LEX_HEADERS)
$(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS)
$(DIR_O)\LexSearchResult.obj: ..\src\LexSearchResult.cxx $(LEX_HEADERS)
$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS)
@ -442,8 +438,6 @@ $(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS)
$(DIR_O)\LexUser.obj: ..\src\LexUser.cxx $(LEX_HEADERS)
$(DIR_O)\LexVB.obj: ..\src\LexVB.cxx $(LEX_HEADERS)
$(DIR_O)\LexVerilog.obj: ..\src\LexVerilog.cxx $(LEX_HEADERS)

View File

@ -157,8 +157,8 @@ LEXOBJS=\
$(DIR_O)\LexMMIXAL.obj \
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexObjC.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
$(DIR_O)\LexPascal.obj \
@ -174,7 +174,6 @@ LEXOBJS=\
$(DIR_O)\LexRebol.obj \
$(DIR_O)\LexRuby.obj \
$(DIR_O)\LexScriptol.obj \
$(DIR_O)\LexSearchResult.obj \
$(DIR_O)\LexSmalltalk.obj \
$(DIR_O)\LexSpecman.obj \
$(DIR_O)\LexSpice.obj \
@ -182,7 +181,6 @@ LEXOBJS=\
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexUser.obj \
$(DIR_O)\LexVB.obj \
$(DIR_O)\LexVerilog.obj \
$(DIR_O)\LexVHDL.obj \
@ -394,9 +392,9 @@ $(DIR_O)\LexMPT.obj: ..\src\LexMPT.cxx $(LEX_HEADERS)
$(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexObjC.obj: ..\src\LexObjC.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
@ -428,8 +426,6 @@ $(DIR_O)\LexRuby.obj: ..\src\LexRuby.cxx $(LEX_HEADERS)
$(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS)
$(DIR_O)\LexSearchResult.obj: ..\src\LexSearchResult.cxx $(LEX_HEADERS)
$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS)
@ -444,8 +440,6 @@ $(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS)
$(DIR_O)\LexUser.obj: ..\src\LexUser.cxx $(LEX_HEADERS)
$(DIR_O)\LexVB.obj: ..\src\LexVB.cxx $(LEX_HEADERS)
$(DIR_O)\LexVerilog.obj: ..\src\LexVerilog.cxx $(LEX_HEADERS)