[UPDATE] Upgrade Scintilla from v1.73 to v1.75

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@124 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-02-09 23:08:34 +00:00
parent e240ac8c6d
commit 850b690237
150 changed files with 11953 additions and 4001 deletions

View File

@ -38,7 +38,7 @@
<h1>Scintilla Documentation</h1>
<p>Last edited 4/February/2006 NH</p>
<p>Last edited 20/June/2007 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@ -279,7 +279,12 @@
<p>Each character in a Scintilla document is followed by an associated byte of styling
information. The combination of a character byte and a style byte is called a cell. Style bytes
are interpreted as a style index in the low 5 bits and as 3 individual bits of <a class="jump"
are interpreted an index into an array of styles.
Style bytes may be split into an index and a set of indicator bits
but this use is discouraged and indicators should now use
<a class="message" href ="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>
and related calls.
The default split is with the index in the low 5 bits and 3 high bits as <a class="jump"
href="#Indicators">indicators</a>. This allows 32 fundamental styles, which is enough for most
languages, and three independent indicators so that, for example, syntax errors, deprecated
names and bad indentation could all be displayed at once. The number of bits used for styles
@ -508,6 +513,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.
</p>
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, TextToFind
*ttf)</a><br />
<a class="message" href="#SCI_SEARCHANCHOR">SCI_SEARCHANCHOR</a><br />
@ -813,6 +822,7 @@ struct TextToFind {
<a class="message" href="#SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</a><br />
<a class="message" href="#SCI_COPYTEXT">SCI_COPYTEXT(int length,
const char *text)</a><br />
<a class="message" href="#SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</a><br />
<a class="message" href="#SCI_SETPASTECONVERTENDINGS">SCI_SETPASTECONVERTENDINGS(bool convert)</a><br />
<a class="message" href="#SCI_GETPASTECONVERTENDINGS">SCI_GETPASTECONVERTENDINGS</a><br />
</code>
@ -822,6 +832,7 @@ struct TextToFind {
<b id="SCI_PASTE">SCI_PASTE</b><br />
<b id="SCI_CLEAR">SCI_CLEAR</b><br />
<b id="SCI_CANPASTE">SCI_CANPASTE</b><br />
<b id="SCI_COPYALLOWLINE">SCI_COPYALLOWLINE</b><br />
These commands perform the standard tasks of cutting and copying data to the clipboard,
pasting from the clipboard into the document, and clearing the document.
<code>SCI_CANPASTE</code> returns non-zero if the document isn't read-only and if the selection
@ -836,6 +847,11 @@ struct TextToFind {
the destination and source applications. Data from SCI_PASTE will not arrive in the
document immediately.</p>
<p><code>SCI_COPYALLOWLINE</code> works the same as SCI_COPY except that if the
selection is empty then the current line is copied. On Windows, an extra "MSDEVLineSelect" marker
is added to the clipboard which is then used in <code>SCI_PASTE</code> to paste
the whole line before the current line.</p>
<b id="SCI_COPYRANGE">SCI_COPYRANGE(int start, int end)</b><br />
<b id="SCI_COPYTEXT">SCI_COPYTEXT(int length, const char *text)</b><br />
<p><code>SCI_COPYRANGE</code> copies a range of text from the document to
@ -1328,6 +1344,8 @@ struct TextToFind {
<a class="message" href="#SCI_SETXOFFSET">SCI_SETXOFFSET(int xOffset)</a><br />
<a class="message" href="#SCI_SETSCROLLWIDTH">SCI_SETSCROLLWIDTH(int pixelWidth)</a><br />
<a class="message" href="#SCI_GETSCROLLWIDTH">SCI_GETSCROLLWIDTH</a><br />
<a class="message" href="#SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</a><br />
<a class="message" href="#SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</a><br />
<a class="message" href="#SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool
endAtLastLine)</a><br />
<a class="message" href="#SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</a><br />
@ -1634,7 +1652,14 @@ struct TextToFind {
For performance, Scintilla does not measure the display width of the document to determine
the properties of the horizontal scroll bar. Instead, an assumed width is used.
These messages set and get the document width in pixels assumed by Scintilla.
The default value is 2000.</p>
The default value is 2000.
To ensure the width of the currently visible lines can be scrolled use
<a class="message" href="#SCI_SETSCROLLWIDTHTRACKING"><code>SCI_SETSCROLLWIDTHTRACKING</code></a></p>
<p><b id="SCI_SETSCROLLWIDTHTRACKING">SCI_SETSCROLLWIDTHTRACKING(bool tracking)</b><br />
<b id="SCI_GETSCROLLWIDTHTRACKING">SCI_GETSCROLLWIDTHTRACKING</b><br />
If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently
displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.</p>
<p><b id="SCI_SETENDATLASTLINE">SCI_SETENDATLASTLINE(bool endAtLastLine)</b><br />
<b id="SCI_GETENDATLASTLINE">SCI_GETENDATLASTLINE</b><br />
@ -1845,7 +1870,9 @@ struct TextToFind {
As well as the 8 bits of lexical state stored for each character there is also an integer
stored for each line. This can be used for longer lived parse states such as what the current
scripting language is in an ASP page. Use <code>SCI_SETLINESTATE</code> to set the integer
value and <code>SCI_GETLINESTATE</code> to get the value.</p>
value and <code>SCI_GETLINESTATE</code> to get the value.
Changing the value produces a <a class="message" href="#SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</a> notification.
</p>
<p><b id="SCI_GETMAXLINESTATE">SCI_GETMAXLINESTATE</b><br />
This returns the last line that has any line state.</p>
@ -2153,6 +2180,8 @@ struct TextToFind {
<a class="message" href="#SCI_GETCARETLINEBACKALPHA">SCI_GETCARETLINEBACKALPHA</a><br />
<a class="message" href="#SCI_SETCARETPERIOD">SCI_SETCARETPERIOD(int milliseconds)</a><br />
<a class="message" href="#SCI_GETCARETPERIOD">SCI_GETCARETPERIOD</a><br />
<a class="message" href="#SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</a><br />
<a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
<a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
<a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
<a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting,
@ -2223,12 +2252,26 @@ struct TextToFind {
state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds.
<code>SCI_GETCARETPERIOD</code> returns the current setting.</p>
<p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int style)</b><br />
<b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</b><br />
The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
(CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all
(CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1).
You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>
<p>The block character draws most combining and multibyte character sequences successfully,
though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when
the cursor is positioned at these characters, which may result in only drawing a part of the
cursor character sequence. This is most notable on Windows platforms.</p>
<p><b id="SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</b><br />
<b id="SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</b><br />
The width of the caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of 0, 1, 2 or
3 pixels. The default width is 1 pixel. You can read back the current width with
The width of the line caret can be set with <code>SCI_SETCARETWIDTH</code> to a value of
0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with
<code>SCI_GETCARETWIDTH</code>. A width of 0 makes the caret invisible (added at version
1.50).</p>
1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangable).
This setting only affects the width of the cursor when the cursor style is set to line caret
mode, it does not affect the width for a block caret.</p>
<p><b id="SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int <a class="jump"
href="#colour">colour</a>)</b><br />
@ -2624,7 +2667,7 @@ struct TextToFind {
<p><b id="SCI_GETLINEINDENTPOSITION">SCI_GETLINEINDENTPOSITION(int line)</b><br />
This returns the position at the end of indentation of a line.</p>
<p><b id="SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(bool view)</b><br />
<p><b id="SCI_SETINDENTATIONGUIDES">SCI_SETINDENTATIONGUIDES(int indentView)</b><br />
<b id="SCI_GETINDENTATIONGUIDES">SCI_GETINDENTATIONGUIDES</b><br />
Indentation guides are dotted vertical lines that appear within indentation white space every
indent size columns. They make it easy to see which constructs line up especially when they
@ -2632,6 +2675,39 @@ struct TextToFind {
href="#StyleDefinition"><code>STYLE_INDENTGUIDE</code></a> (37) is used to specify the
foreground and background colour of the indentation guides.</p>
<p>There are 4 indentation guide views.
SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on
empty lines.
<table border="0" summary="Search flags">
<tbody>
<tr>
<td><code>SC_IV_NONE</code></td>
<td>No indentation guides are shown.</td>
</tr>
<tr>
<td><code>SC_IV_REAL</code></td>
<td>Indentation guides are shown inside real indentation white space.</td>
</tr>
<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>
</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>
</tr>
</table>
</p>
<p><b id="SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</b><br />
<b id="SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</b><br />
When brace highlighting occurs, the indentation guide corresponding to the braces may be
@ -2694,7 +2770,8 @@ struct TextToFind {
<code>SC_MARK_SMALLRECT</code>, <code>SC_MARK_SHORTARROW</code>, <code>SC_MARK_EMPTY</code>,
<code>SC_MARK_ARROWDOWN</code>, <code>SC_MARK_MINUS</code>, <code>SC_MARK_PLUS</code>,
<code>SC_MARK_ARROWS</code>, <code>SC_MARK_DOTDOTDOT</code>, <code>SC_MARK_EMPTY</code>,
<code>SC_MARK_BACKGROUND</code> and <code>SC_MARK_FULLRECT</code>.</p>
<code>SC_MARK_BACKGROUND</code>, <code>SC_MARK_LEFTRECT</code>
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.
@ -2836,7 +2913,9 @@ struct TextToFind {
<p><b id="SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber, const char
*xpm)</b><br />
Markers can be set to pixmaps with this message. The XPM format is used for the pixmap and it
is limited to pixmaps that use one character per pixel. The data should be null terminated.
is limited to pixmaps that use one character per pixel with no named colours.
The transparent colour may be named 'None'.
The data should be null terminated.
Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. You can find the full description of
the XPM format <a class="jump" href="http://koala.ilog.fr/lehors/xpm.html">here</a>.</p>
@ -2908,37 +2987,22 @@ struct TextToFind {
<h2 id="Indicators">Indicators</h2>
<p>By default, Scintilla organizes the style byte associated with each text byte as 5 bits of
style information (for 32 styles) and 3 bits of indicator information for 3 independent
indicators so that, for example, syntax errors, deprecated names and bad indentation could all
be displayed at once. Indicators may be displayed as simple underlines, squiggly underlines, a
<p>Indicators are used to display additional information over the top of styling.
They can be used to show, for example, syntax errors, deprecated names and bad indentation
by drawing underlines under text or boxes around text. Originally, Scintilla stored indicator information in
the style bytes but this has proved limiting, so now up to 32 separately stored indicators may be used.
While style byte indicators currently still work, they will soon be removed so all the bits in each style
byte can be used for lexical states.</p>
<p>Indicators may be displayed as simple underlines, squiggly underlines, a
line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.</p>
<p>The indicators are set using <a class="message"
href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a> with a <code>INDICS_MASK</code> mask
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>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
can be used for indicators, so there can be from 1 to 8 indicators. However, the
<code>INDIC*_MASK</code> constants defined in <code>Scintilla.h</code> all assume 5 bits of
styling information and 3 indicators. If you use a different arrangement, you must define your
own constants.</p>
<p>The <code>SCI_INDIC*</code> messages allow you to get and set the visual appearance of the
indicators. They all use an <code>indicatorNumber</code> argument in the range 0 to 7 to set
the indicator to style. With the default settings, only indicators 0, 1 and 2 will have any
visible effect.</p>
indicators. They all use an <code>indicatorNumber</code> argument in the range 0 to INDIC_MAX(31)
to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use
by lexers (0..7) and a range for use by containers
(8=<code>INDIC_CONTAINER</code> .. 31=<code>INDIC_MAX</code>).</p>
<code><a class="message" href="#SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
indicatorStyle)</a><br />
<a class="message" href="#SCI_INDICGETSTYLE">SCI_INDICGETSTYLE(int indicatorNumber)</a><br />
@ -3046,6 +3110,86 @@ struct TextToFind {
<code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
<code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
<p><b id="SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</b><br />
<b id="SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</b><br />
These two messages set and get whether an indicator is drawn under text or over(default).
Drawing under text works only for modern indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a>
is enabled.</p>
<h3 id="Modern Indicators">Modern Indicators</h3>
<p>Modern indicators are stored in a format similar to run length encoding which is efficient in both
speed and storage for sparse information.</p>
<p>An indicator may store different values for each range but currently all values are drawn the same.
In the future, it may be possible to draw different values in different styles.</p>
<p>
<b id="SCI_SETINDICATORCURRENT">SCI_SETINDICATORCURRENT(int indicator)</b><br />
<b id="SCI_GETINDICATORCURRENT">SCI_GETINDICATORCURRENT</b><br />
These two messages set and get the indicator that will be affected by calls to
<a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a> and
<a class="message" href="#SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE</a>.
</p>
<p>
<b id="SCI_SETINDICATORVALUE">SCI_SETINDICATORVALUE(int value)</b><br />
<b id="SCI_GETINDICATORVALUE">SCI_GETINDICATORVALUE</b><br />
These two messages set and get the value that will be set by calls to
<a class="message" href="#SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE</a>.
</p>
<p>
<b id="SCI_INDICATORFILLRANGE">SCI_INDICATORFILLRANGE(int position, int fillLength)</b><br />
<b id="SCI_INDICATORCLEARRANGE">SCI_INDICATORCLEARRANGE(int position, int clearLength)</b><br />
These two messages fill or clear a range for the current indicator.
<code>SCI_INDICATORFILLRANGE</code> fills with the
the current value.
</p>
<p>
<b id="SCI_INDICATORALLONFOR">SCI_INDICATORALLONFOR(int position)</b><br />
Retrieve a bitmap value representing which indicators are non-zero at a position.
</p>
<p>
<b id="SCI_INDICATORVALUEAT">SCI_INDICATORVALUEAT(int indicator, int position)</b><br />
Retrieve the value of a particular indicator at a position.
</p>
<p>
<b id="SCI_INDICATORSTART">SCI_INDICATORSTART(int indicator, int position)</b><br />
<b id="SCI_INDICATOREND">SCI_INDICATOREND(int indicator, int position)</b><br />
Find the start or end of a range with one value from a position within the range.
Can be used to iterate through the document to discover all the indicator positions.
</p>
<h3 id="Style Byte Indicators">Style Byte Indicators (deprecated)</h3>
<p>By default, Scintilla organizes the style byte associated with each text byte as 5 bits of
style information (for 32 styles) and 3 bits of indicator information for 3 independent
indicators so that, for example, syntax errors, deprecated names and bad indentation could all
be displayed at once.</p>
<p>The indicators are set using <a class="message"
href="#SCI_STARTSTYLING"><code>SCI_STARTSTYLING</code></a> with a <code>INDICS_MASK</code> mask
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>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
can be used for indicators, so there can be from 1 to 8 indicators. However, the
<code>INDIC*_MASK</code> constants defined in <code>Scintilla.h</code> all assume 5 bits of
styling information and 3 indicators. If you use a different arrangement, you must define your
own constants.</p>
<h2 id="Autocompletion">Autocompletion</h2>
<p>Autocompletion displays a list box showing likely identifiers based upon the user's typing.
@ -3542,10 +3686,14 @@ struct TextToFind {
<td><code>SCI_DELETEBACK</code></td>
<td><code>SCI_DELETEBACKNOTLINE</code></td>
</tr>
<tr>
<td><code>SCI_DELWORDLEFT</code></td>
<td><code>SCI_DELWORDRIGHT</code></td>
<td><code>SCI_DELWORDRIGHTEND</code></td>
</tr>
<tr>
@ -4134,6 +4282,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
<a class="message" href="#SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</a><br />
<a class="message" href="#SCI_SETLAYOUTCACHE">SCI_SETLAYOUTCACHE(int cacheMode)</a><br />
<a class="message" href="#SCI_GETLAYOUTCACHE">SCI_GETLAYOUTCACHE</a><br />
<a class="message" href="#SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</a><br />
<a class="message" href="#SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</a><br />
<a class="message" href="#SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</a><br />
<a class="message" href="#SCI_LINESJOIN">SCI_LINESJOIN</a><br />
<a class="message" href="#SCI_WRAPCOUNT">SCI_WRAPCOUNT(int docLine)</a><br />
@ -4315,6 +4465,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
</table>
<br />
<p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
<b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
The position cache stores position information for short runs of text
so that their layout can be determined more quickly if the run recurs.
The size in entries of this cache can be set with <code>SCI_SETPOSITIONCACHE</code>.</p>
<p><b id="SCI_LINESSPLIT">SCI_LINESSPLIT(int pixelWidth)</b><br />
Split a range of lines indicated by the target into lines that are at most pixelWidth wide.
Splitting occurs on word boundaries wherever possible in a similar manner to line wrapping.
@ -4631,6 +4787,8 @@ struct SCNotification {
<a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
<a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
<a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
<a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
<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 />
</code>
@ -4927,6 +5085,27 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
<td><code>position, length</code></td>
</tr>
<tr>
<td align="left"><code>SC_MOD_CHANGEINDICATOR</code></td>
<td align="center">0x4000</td>
<td>An indicator has been added or removed from a range of text.</td>
<td><code>position, length</code></td>
</tr>
<tr>
<td align="left"><code id="SC_MOD_CHANGELINESTATE">SC_MOD_CHANGELINESTATE</code></td>
<td align="center">0x8000</td>
<td>A line state has changed because <a class="message" href="#SCI_SETLINESTATE">SCI_SETLINESTATE</a>
was called.</td>
<td><code>line</code></td>
</tr>
<tr>
<td align="left"><code>SC_MULTILINEUNDOREDO</code></td>
@ -5202,6 +5381,15 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
double click and the <code>modifiers</code> field set to the key modifiers
held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
<p>
<b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
<b id="SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</b><br />
These notifications are generated when the user clicks or releases the mouse on
text that has an indicator.
The <code>position</code> field is set the text position of the click or
double click and the <code>modifiers</code> field set to the key modifiers
held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
<p><b id="SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</b><br />
This notification is generated when the user clicks on a calltip.
This notification can be used to display the next function prototype when a
@ -5404,3 +5592,4 @@ EM_SETTARGETDEVICE
</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/scintilla173.zip?download">
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla175.zip?download">
Windows</a>&nbsp;&nbsp;
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla173.tgz?download">
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla175.tgz?download">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -41,7 +41,7 @@
containing very few restrictions.
</p>
<h3>
Release 1.73
Release 1.75
</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/scintilla173.zip?download">zip format</a> (740K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla173.tgz?download">tgz format</a> (640K) commonly used on Linux and compatible operating systems</li>
<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>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -9,6 +9,16 @@
<title>
Scintilla and SciTE
</title>
<style type="text/css">
table {
border-collapse: collapse;
font-size: 80%;
}
td {
xborder: 1px solid #1F1F1F;
padding: 0px 4px;
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
@ -34,204 +44,277 @@
<p>
Source code and documentation have been contributed by
</p>
<ul>
<li>Atsuo Ishimoto</li>
<li>Mark Hammond</li>
<li>Francois Le Coguiec</li>
<li>Dale Nagata</li>
<li>Ralf Reinhardt</li>
<li>Philippe Lhoste</li>
<li>Andrew McKinlay</li>
<li>Stephan R. A. Deibel</li>
<li>Hans Eckardt</li>
<li>Vassili Bourdo</li>
<li>Maksim Lin</li>
<li>Robin Dunn</li>
<li>John Ehresman</li>
<li>Steffen Goeldner</li>
<li>Deepak S.</li>
<li>Yann Gaillard</li>
<li>Aubin Paul</li>
<li>Jason Diamond</li>
<li>Ahmad Baitalmal</li>
<li>Paul Winwood</li>
<li>Maxim Baranov</li>
<li>Ragnar Højland</li>
<li>Christian Obrecht</li>
<li>Andreas Neukoetter</li>
<li>Adam Gates</li>
<li>Steve Lhomme</li>
<li>Ferdinand Prantl</li>
<li>Jan Dries</li>
<li>Markus Gritsch</li>
<li>Tahir Karaca</li>
<li>Ahmad Zawawi</li>
<li>Laurent le Tynevez</li>
<li>Walter Braeu</li>
<li>Ashley Cambrell</li>
<li>Garrett Serack</li>
<li>Holger Schmidt</li>
<li><a href="http://www.activestate.com">ActiveState</a></li>
<li>James Larcombe</li>
<li>Alexey Yutkin</li>
<li>Jan Hercek</li>
<li>Richard Pecl</li>
<li>Edward K. Ream</li>
<li>Valery Kondakoff</li>
<li>Smári McCarthy</li>
<li>Clemens Wyss</li>
<li>Simon Steele</li>
<li>Serge A. Baranov</li>
<li>Xavier Nodet</li>
<li>Willy Devaux</li>
<li>David Clain</li>
<li>Brendon Yenson</li>
<li>Vamsi Potluru</li>
<li>Praveen Ambekar</li>
<li>Alan Knowles</li>
<li>Kengo Jinno</li>
<li>Valentin Valchev</li>
<li>Marcos E. Wurzius</li>
<li>Martin Alderson</li>
<li>Robert Gustavsson</li>
<li>José Fonseca</li>
<li>Holger Kiemes</li>
<li>Francis Irving</li>
<li>Scott Kirkwood</li>
<li>Brian Quinlan</li>
<li>Ubi</li>
<li>Michael R. Duerig</li>
<li>Deepak T</li>
<li>Don Paul Beletsky</li>
<li>Gerhard Kalab</li>
<li>Olivier Dagenais</li>
<li>Josh Wingstrom</li>
<li>Bruce Dodson</li>
<li>Sergey Koshcheyev</li>
<li>Chuan-jian Shen</li>
<li>Shane Caraveo</li>
<li>Alexander Scripnik</li>
<li>Ryan Christianson</li>
<li>Martin Steffensen</li>
<li>Jakub Vrána</li>
<li>The Black Horus</li>
<li>Bernd Kreuss</li>
<li>Thomas Lauer</li>
<li>Mike Lansdaal</li>
<li>Yukihiro Nakai</li>
<li>Jochen Tucht</li>
<li>Greg Smith</li>
<li>Steve Schoettler</li>
<li>Mauritius Thinnes</li>
<li>Darren Schroeder</li>
<li>Pedro Guerreiro</li>
<li>Dan Petitt</li>
<li>Biswapesh Chattopadhyay</li>
<li>Kein-Hong Man</li>
<li>Patrizio Bekerle</li>
<li>Nigel Hathaway</li>
<li>Hrishikesh Desai</li>
<li>Sergey Puljajev</li>
<li>Mathias Rauen</li>
<li>Angelo Mandato</li>
<li>Denis Sureau</li>
<li>Kaspar Schiess</li>
<li>Christoph Hösler</li>
<li>João Paulo F Farias</li>
<li>Ron Schofield</li>
<li>Stefan Wosnik</li>
<li>Marius Gheorghe</li>
<li>Naba Kumar</li>
<li>Sean O'Dell</li>
<li>Stefanos Togoulidis</li>
<li>Hans Hagen</li>
<li>Jim Cape</li>
<li>Roland Walter</li>
<li>Brian Mosher</li>
<li>Nicholas Nemtsev</li>
<li>Roy Wood</li>
<li>Peter-Henry Mander</li>
<li>Robert Boucher</li>
<li>Christoph Dalitz</li>
<li>April White</li>
<li>S. Umar</li>
<li>Trent Mick</li>
<li>Filip Yaghob</li>
<li>Avi Yegudin</li>
<li>Vivi Orunitia</li>
<li>Manfred Becker</li>
<li>Dimitris Keletsekis</li>
<li>Yuiga</li>
<li>Davide Scola</li>
<li>Jason Boggs</li>
<li>Reinhold Niesner</li>
<li>Jos van der Zande</li>
<li>Pescuma</li>
<li>Pavol Bosik</li>
<li>Johannes Schmid</li>
<li>Blair McGlashan</li>
<li>Mikael Hultgren</li>
<li>Florian Balmer</li>
<li>Hadar Raz</li>
<li>Herr Pfarrer</li>
<li>Ben Key</li>
<li>Gene Barry</li>
<li>Niki Spahiev</li>
<li>Carsten Sperber</li>
<li>Phil Reid</li>
<li>Iago Rubio</li>
<li>Régis Vaquette</li>
<li>Massimo Corà</li>
<li>Elias Pschernig</li>
<li>Chris Jones</li>
<li>Josiah Reynolds</li>
<li>Robert Roessler <a href="http://www.rftp.com">rftp.com</a></li>
<li>Steve Donovan</li>
<li>Jan Martin Pettersen</li>
<li>Sergey Philippov</li>
<li>Borujoa</li>
<li>Michael Owens</li>
<li>Franck Marcia</li>
<li>Massimo Maria Ghisalberti</li>
<li>Frank Wunderlich</li>
<li>Josepmaria Roca</li>
<li>Tobias Engvall</li>
<li>Suzumizaki Kimitaka</li>
<li>Michael Cartmell</li>
<li>Pascal Hurni</li>
<li>Andre</li>
<li>Randy Butler</li>
<li>Georg Ritter</li>
<li>Michael Goffioul</li>
<li>Ben Harper</li>
<li>Adam Strzelecki</li>
<li>Kamen Stanev</li>
<li>Steve Menard</li>
<li>Oliver Yeoh</li>
<li>Eric Promislow</li>
<li>Joseph Galbraith</li>
<li>Jeffrey Ren</li>
<li>Armel Asselin</li>
<li>Jim Pattee</li>
<li>Friedrich Vedder</li>
<li>Sebastian Pipping</li>
<li>Andre Arpin</li>
<li>Stanislav Maslovski</li>
<li>Martin Stone</li>
<li>Fabien Proriol</li>
<li>mimir</li>
<li>Nicola Civran</li>
<li>Snow</li>
<li>Mitchell Foral</li>
<li>Pieter Holtzhausen</li>
<li>Waldemar Augustyn</li>
<li>Jason Haslam</li>
<li>Sebastian Steinlechner</li>
<li>Chris Rickard</li>
<li>Rob McMullen</li>
<li>Stefan Schwendeler</li>
<li>Cristian Adam</li>
</ul>
<table>
<tr>
<td>Atsuo Ishimoto</td>
<td>Mark Hammond</td>
<td>Francois Le Coguiec</td>
<td>Dale Nagata</td>
</tr><tr>
<td>Ralf Reinhardt</td>
<td>Philippe Lhoste</td>
<td>Andrew McKinlay</td>
<td>Stephan R. A. Deibel</td>
</tr><tr>
<td>Hans Eckardt</td>
<td>Vassili Bourdo</td>
<td>Maksim Lin</td>
<td>Robin Dunn</td>
</tr><tr>
<td>John Ehresman</td>
<td>Steffen Goeldner</td>
<td>Deepak S.</td>
<td>Yann Gaillard</td>
</tr><tr>
<td>Aubin Paul</td>
<td>Jason Diamond</td>
<td>Ahmad Baitalmal</td>
<td>Paul Winwood</td>
</tr><tr>
<td>Maxim Baranov</td>
<td>Ragnar Højland</td>
<td>Christian Obrecht</td>
<td>Andreas Neukoetter</td>
</tr><tr>
<td>Adam Gates</td>
<td>Steve Lhomme</td>
<td>Ferdinand Prantl</td>
<td>Jan Dries</td>
</tr><tr>
<td>Markus Gritsch</td>
<td>Tahir Karaca</td>
<td>Ahmad Zawawi</td>
<td>Laurent le Tynevez</td>
</tr><tr>
<td>Walter Braeu</td>
<td>Ashley Cambrell</td>
<td>Garrett Serack</td>
<td>Holger Schmidt</td>
</tr><tr>
<td><a href="http://www.activestate.com">ActiveState</a></td>
<td>James Larcombe</td>
<td>Alexey Yutkin</td>
<td>Jan Hercek</td>
</tr><tr>
<td>Richard Pecl</td>
<td>Edward K. Ream</td>
<td>Valery Kondakoff</td>
<td>Smári McCarthy</td>
</tr><tr>
<td>Clemens Wyss</td>
<td>Simon Steele</td>
<td>Serge A. Baranov</td>
<td>Xavier Nodet</td>
</tr><tr>
<td>Willy Devaux</td>
<td>David Clain</td>
<td>Brendon Yenson</td>
<td>Vamsi Potluru</td>
</tr><tr>
<td>Praveen Ambekar</td>
<td>Alan Knowles</td>
<td>Kengo Jinno</td>
<td>Valentin Valchev</td>
</tr><tr>
<td>Marcos E. Wurzius</td>
<td>Martin Alderson</td>
<td>Robert Gustavsson</td>
<td>José Fonseca</td>
</tr><tr>
<td>Holger Kiemes</td>
<td>Francis Irving</td>
<td>Scott Kirkwood</td>
<td>Brian Quinlan</td>
</tr><tr>
<td>Ubi</td>
<td>Michael R. Duerig</td>
<td>Deepak T</td>
<td>Don Paul Beletsky</td>
</tr><tr>
<td>Gerhard Kalab</td>
<td>Olivier Dagenais</td>
<td>Josh Wingstrom</td>
<td>Bruce Dodson</td>
</tr><tr>
<td>Sergey Koshcheyev</td>
<td>Chuan-jian Shen</td>
<td>Shane Caraveo</td>
<td>Alexander Scripnik</td>
</tr><tr>
<td>Ryan Christianson</td>
<td>Martin Steffensen</td>
<td>Jakub Vrána</td>
<td>The Black Horus</td>
</tr><tr>
<td>Bernd Kreuss</td>
<td>Thomas Lauer</td>
<td>Mike Lansdaal</td>
<td>Yukihiro Nakai</td>
</tr><tr>
<td>Jochen Tucht</td>
<td>Greg Smith</td>
<td>Steve Schoettler</td>
<td>Mauritius Thinnes</td>
</tr><tr>
<td>Darren Schroeder</td>
<td>Pedro Guerreiro</td>
<td>Dan Petitt</td>
<td>Biswapesh Chattopadhyay</td>
</tr><tr>
<td>Kein-Hong Man</td>
<td>Patrizio Bekerle</td>
<td>Nigel Hathaway</td>
<td>Hrishikesh Desai</td>
</tr><tr>
<td>Sergey Puljajev</td>
<td>Mathias Rauen</td>
<td>Angelo Mandato</td>
<td>Denis Sureau</td>
</tr><tr>
<td>Kaspar Schiess</td>
<td>Christoph Hösler</td>
<td>João Paulo F Farias</td>
<td>Ron Schofield</td>
</tr><tr>
<td>Stefan Wosnik</td>
<td>Marius Gheorghe</td>
<td>Naba Kumar</td>
<td>Sean O'Dell</td>
</tr><tr>
<td>Stefanos Togoulidis</td>
<td>Hans Hagen</td>
<td>Jim Cape</td>
<td>Roland Walter</td>
</tr><tr>
<td>Brian Mosher</td>
<td>Nicholas Nemtsev</td>
<td>Roy Wood</td>
<td>Peter-Henry Mander</td>
</tr><tr>
<td>Robert Boucher</td>
<td>Christoph Dalitz</td>
<td>April White</td>
<td>S. Umar</td>
</tr><tr>
<td>Trent Mick</td>
<td>Filip Yaghob</td>
<td>Avi Yegudin</td>
<td>Vivi Orunitia</td>
</tr><tr>
<td>Manfred Becker</td>
<td>Dimitris Keletsekis</td>
<td>Yuiga</td>
<td>Davide Scola</td>
</tr><tr>
<td>Jason Boggs</td>
<td>Reinhold Niesner</td>
<td>Jos van der Zande</td>
<td>Pescuma</td>
</tr><tr>
<td>Pavol Bosik</td>
<td>Johannes Schmid</td>
<td>Blair McGlashan</td>
<td>Mikael Hultgren</td>
</tr><tr>
<td>Florian Balmer</td>
<td>Hadar Raz</td>
<td>Herr Pfarrer</td>
<td>Ben Key</td>
</tr><tr>
<td>Gene Barry</td>
<td>Niki Spahiev</td>
<td>Carsten Sperber</td>
<td>Phil Reid</td>
</tr><tr>
<td>Iago Rubio</td>
<td>Régis Vaquette</td>
<td>Massimo Corà</td>
<td>Elias Pschernig</td>
</tr><tr>
<td>Chris Jones</td>
<td>Josiah Reynolds</td>
<td>Robert Roessler <a href="http://www.rftp.com">rftp.com</a></td>
<td>Steve Donovan</td>
</tr><tr>
<td>Jan Martin Pettersen</td>
<td>Sergey Philippov</td>
<td>Borujoa</td>
<td>Michael Owens</td>
</tr><tr>
<td>Franck Marcia</td>
<td>Massimo Maria Ghisalberti</td>
<td>Frank Wunderlich</td>
<td>Josepmaria Roca</td>
</tr><tr>
<td>Tobias Engvall</td>
<td>Suzumizaki Kimitaka</td>
<td>Michael Cartmell</td>
<td>Pascal Hurni</td>
</tr><tr>
<td>Andre</td>
<td>Randy Butler</td>
<td>Georg Ritter</td>
<td>Michael Goffioul</td>
</tr><tr>
<td>Ben Harper</td>
<td>Adam Strzelecki</td>
<td>Kamen Stanev</td>
<td>Steve Menard</td>
</tr><tr>
<td>Oliver Yeoh</td>
<td>Eric Promislow</td>
<td>Joseph Galbraith</td>
<td>Jeffrey Ren</td>
</tr><tr>
<td>Armel Asselin</td>
<td>Jim Pattee</td>
<td>Friedrich Vedder</td>
<td>Sebastian Pipping</td>
</tr><tr>
<td>Andre Arpin</td>
<td>Stanislav Maslovski</td>
<td>Martin Stone</td>
<td>Fabien Proriol</td>
</tr><tr>
<td>mimir</td>
<td>Nicola Civran</td>
<td>Snow</td>
<td>Mitchell Foral</td>
</tr><tr>
<td>Pieter Holtzhausen</td>
<td>Waldemar Augustyn</td>
<td>Jason Haslam</td>
<td>Sebastian Steinlechner</td>
</tr><tr>
<td>Chris Rickard</td>
<td>Rob McMullen</td>
<td>Stefan Schwendeler</td>
<td>Cristian Adam</td>
</tr><tr>
<td>Nicolas Chachereau</td>
<td>Istvan Szollosi</td>
<td>Xie Renhui</td>
<td>Enrico Tröger</td>
</tr><tr>
<td>Todd Whiteman</td>
<td>Yuval Papish</td>
<td>instanton</td>
<td>Sergio Lucato</td>
</tr><tr>
<td>VladVRO</td>
<td>Dmitry Maslov</td>
<td>chupakabra</td>
<td>Juan Carlos Arevalo Baeza</td>
</tr><tr>
<td>Nick Treleaven</td>
<td>Stephen Stagg</td>
<td>Jean-Paul Iribarren</td>
<td>Tim Gerundt</td>
</tr><tr>
<td>Sam Harwell</td>
<td>Boris</td>
</tr>
</table>
<p>
Images used in GTK+ version
</p>
@ -241,6 +324,241 @@
Icons</a> Copyright(C) 1998 by Dean S. Jones<br />
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite175.zip?download">Release 1.75</a>
</h3>
<ul>
<li>
Released on 22 November 2007.
</li>
<li>
Some WordList and PropSet functionality moved from Scintilla to SciTE.
Projects that link to Scintilla's code for these classes may need to copy
code from SciTE.
</li>
<li>
Borland C++ can no longer build Scintilla.
</li>
<li>
Invalid bytes in UTF-8 mode are displayed as hex blobs. This also prevents crashes due to
passing invalid UTF-8 to platform calls.
</li>
<li>
Indentation guides enhanced to be visible on completely empty lines when possible.
</li>
<li>
The horizontal scroll bar may grow to match the widest line displayed.
</li>
<li>
Allow autocomplete popups to appear outside client rectangle in some cases.
</li>
<li>
When line state changed, SC_MOD_CHANGELINESTATE modification notification sent and
margin redrawn.
</li>
<li>
SciTE scripts can access the menu command values IDM_*.
</li>
<li>
SciTE's statement.end property has been implemented again.
</li>
<li>
SciTE shows paths and matches in different styles for Find In Files.
</li>
<li>
Incremental search in SciTE for Windows is modeless to make it easier to exit.
</li>
<li>
Folding performance improved.
</li>
<li>
SciTE for GTK+ now includes a Browse button in the Find In Files dialog.
</li>
<li>
On Windows versions that support Unicode well, Scintilla is a wide character window
which allows input for some less common languages like Armenian, Devanagari,
Tamil, and Georgian. To fully benefit, applications should use wide character calls.
</li>
<li>
Lua function names are exported from SciTE to allow some extension libraries to work.
</li>
<li>
Lexers added for Abaqus, Ansys APDL, Asymptote, and R.
</li>
<li>
SCI_DELWORDRIGHTEND added for closer compatibility with GTK+ entry widget.
</li>
<li>
The styling buffer may now use all 8 bits in each byte for lexical states with 0 bits for indicators.
</li>
<li>
Multiple characters may be set for SciTE's calltip.&lt;lexer&gt;.parameters.start property.
</li>
<li>
Bash lexer handles octal literals.
</li>
<li>
C++/JavaScript lexer recognises regex literals in more situations.
</li>
<li>
Haskell lexer fixed for quoted strings.
</li>
<li>
HTML/XML lexer does not notice XML indicator if there is
non-whitespace between the "&lt;?" and "XML".
ASP problem fixed where &lt;/ is used inside a comment.
</li>
<li>
Error messages from Lua 5.1 are recognised.
</li>
<li>
Folding implemented for Metapost.
</li>
<li>
Perl lexer enhanced for handling minus-prefixed barewords,
underscores in numeric literals and vector/version strings,
^D and ^Z similar to __END__,
subroutine prototypes as a new lexical class,
formats and format blocks as new lexical classes, and
'/' suffixed keywords and barewords.
</li>
<li>
Python lexer styles all of a decorator in the decorator style rather than just the name.
</li>
<li>
YAML lexer styles colons as operators.
</li>
<li>
Fixed SciTE bug where undo would group together multiple separate modifications.
</li>
<li>
Bug fixed where setting background colour of calltip failed.
</li>
<li>
SciTE allows wildcard suffixes for file pattern based properties.
</li>
<li>
SciTE on GTK+ bug fixed where user not prompted to save untitled buffer.
</li>
<li>
SciTE bug fixed where property values from one file were not seen by lower priority files.
</li>
<li>
Bug fixed when showing selection with a foreground colour change which highlighted
an incorrect range in some positions.
</li>
<li>
Cut now invokes SCN_MODIFYATTEMPTRO notification.
</li>
<li>
Bug fixed where caret not shown at beginning of wrapped lines.
Caret made visible in some cases after wrapping and scroll bar updated after wrapping.
</li>
<li>
Modern indicators now work on wrapped lines.
</li>
<li>
Some crashes fixed for 64-bit GTK+.
</li>
<li>
On GTK+ clipboard features improved for VMWare tools copy and paste.
SciTE exports the clipboard more consistently on shut down.
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite174.zip?download">Release 1.74</a>
</h3>
<ul>
<li>
Released on 18 June 2007.
</li>
<li>
OS X support.
</li>
<li>
Indicators changed to be a separate data structure allowing more indicators. Storing indicators in high bits
of styling bytes is deprecated and will be removed in the next version.
</li>
<li>
Unicode support extended to all Unicode characters not just the Basic Multilingual Plane.
</li>
<li>
Performance improved on wide lines by breaking long runs in a single style into shorter segments.
</li>
<li>
Performance improved by caching layout of short text segments.
</li>
<li>
SciTE includes Lua 5.1.
</li>
<li>
Caret may be displayed as a block.
</li>
<li>
Lexer added for GAP.
</li>
<li>
Lexer added for PL/M.
</li>
<li>
Lexer added for Progress.
</li>
<li>
SciTE session files have changed format to be like other SciTE .properties files
and now use the extension .session.
Bookmarks and folds may optionally be saved in session files.
Session files created with previous versions of SciTE will not load into this version.
</li>
<li>
SciTE's extension and scripting interfaces add OnKey, OnDwellStart, and OnClose methods.
</li>
<li>
On GTK+, copying to the clipboard does not include the text/urilist type since this caused problems when
pasting into Open Office.
</li>
<li>
On GTK+, Scintilla defaults caret blink rate to platform preference.
</li>
<li>
Dragging does not start until the mouse has been dragged a certain amount.
This stops spurious drags when just clicking inside the selection.
</li>
<li>
Bug fixed where brace highlight not shown when caret line background set.
</li>
<li>
Bug fixed in Ruby lexer where out of bounds access could occur.
</li>
<li>
Bug fixed in XML folding where tags were not being folded because they are singletons in HTML.
</li>
<li>
Bug fixed when many font names used.
</li>
<li>
Layout bug fixed on GTK+ where fonts have ligatures available.
</li>
<li>
Bug fixed with SCI_LINETRANSPOSE on a blank line.
</li>
<li>
SciTE hang fixed when using UNC path with directory properties feature.
</li>
<li>
Bug on Windows fixed by examining dropped text for Unicode even in non-Unicode mode so it
can work when source only provides Unicode or when using an encoding different from the
system default.
</li>
<li>
SciTE bug on GTK+ fixed where Stop Executing did not work when more than a single process started.
</li>
<li>
SciTE bug on GTK+ fixed where mouse wheel was not switching between buffers.
</li>
<li>
Minor line end fix to PostScript lexer.
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite173.zip?download">Release 1.73</a>
</h3>
@ -279,7 +597,7 @@
SciTE on GTK+ removed GTK+ 1.x compatible file dialog code.
</li>
<li>
SciTE on GTK+ recognizes key names KeypadMultiply and KeypadDivide.
SciTE on GTK+ recognises key names KeypadMultiply and KeypadDivide.
</li>
<li>
Background colour of line wrapping visual flag changed to STYLE_DEFAULT.
@ -383,6 +701,9 @@
Incremental search available on GTK+.
</li>
<li>
SciTE Indentation Settings dialog available on GTK+ and adds a "Convert" button.
</li>
<li>
Find in Files can optionally ignore binary files or directories that start with ".".
</li>
<li>
@ -981,7 +1302,7 @@
PHP allows spaces after &lt;&lt;&lt;.
</li>
<li>
TADS3 has a simpler set of states and recognizes identifiers.
TADS3 has a simpler set of states and recognises identifiers.
</li>
<li>
Avenue elseif folds better.
@ -1079,7 +1400,7 @@
</li>
<li>
Perl can fold POD and package sections. POD verbatim section style.
Globbing syntax recognized better.
Globbing syntax recognised better.
</li>
<li>
Context menu moved slightly on GTK+ so that it will be under the mouse and will
@ -1564,7 +1885,7 @@
AutoIt3 lexer updated.
</li>
<li>
Perl lexer recognizes regular expression use better.
Perl lexer recognises regular expression use better.
</li>
<li>
Errorlist lexer understands Lua tracebacks and copes with findstr
@ -5510,3 +5831,4 @@
</body>
</html>

View File

@ -43,7 +43,7 @@
Scintilla source code editing control from within Delphi and C++ Builder.
</p>
<p>
<a href="http://www.lehigh.edu/~jrl1/">wxStEdit</a>
<a href="http://wxcode.sourceforge.net/showcomp.php?name=wxStEdit">wxStEdit</a>
is a library and sample program that provides extra features over wxStyledTextControl.
</p>
<p>
@ -122,6 +122,42 @@
<h3>
Projects using Scintilla
</h3>
<p>
<a href="http://universalindent.sourceforge.net/">UniversalIndentGUI</a>
is a cross platform GUI for several code formatters, beautifiers and indenters
like GreatCode, AStyle (Artistic Styler), GNU Indent, BCPP and so on.
</p>
<p>
<a href="http://scitools.com/products/trackback/product.php">TrackBack</a>
watches and backs up every change made in your source code.
</p>
<p>
<a href="http://www.applepanic.com/">ReportBuilder Primary</a>
is designed to reduce the time to compose detailed and professional primary school reports.
</p>
<p>
<a href="http://stepaheadsoftware.com/products/vcw/vcw.htm">Visual Classworks</a>
Visual class modeling and coding in C++ via 'live'
UML style class diagrams.
</p>
<p>
<a href="http://stepaheadsoftware.com/products/javelin/javelin.htm">Javelin</a>
Visual Class modeling and coding in Java via 'live' UML style
class diagrams.
</p>
<p>
The <a href="http://www.adobe.com/devnet/bridge/">ExtendScript Toolkit</a>
is a development and debugging tool for JavaScript
scripts included with Adobe CS3 Suites.
</p>
<p>
<a href="http://tortoisesvn.net/">TortoiseSVN</a>
is a Windows GUI client for the Subversion source control software.
</p>
<p>
<a href="http://geany.uvena.de/Main/HomePage">Geany</a>
is a small and fast GTK2 based IDE, which has only a few dependencies from other packages.
</p>
<p>
<a href="http://www.elliecomputing.com/products/merge_overview.asp">ECMerge</a>
is a commercial graphical and batch diff / merge tool for Windows, Linux and Solaris
@ -189,7 +225,7 @@
PyCrash Viewer</a> can examine crash dumps of Python programs.
</p>
<p>
<a href="http://www.cabletest.com/mpt-discovery.shtml">
<a href="http://www.cabletest.com/mpt-wa-software-discovery.shtml">
MPT series Wire Analyzers</a> use Scintilla and SciTE.
</p>
<p>
@ -225,7 +261,7 @@
is a simple C/C++ IDE for the MinGW compiler on Windows.
</p>
<p>
<a href="http://www.die-offenbachs.de/detlev/eric3.html">Eric3</a>
<a href="http://www.die-offenbachs.de/detlev/eric.html">Eric3</a>
is a Python IDE written using PyQt and QScintilla.
</p>
<p>
@ -287,11 +323,6 @@
is a lexing package that can provide lexical analysis for over 20 programming
and markup languages.
</p>
<p>
<a href="http://www.akbkhome.com/Projects/phpmole-IDE/">Php mole</a>
is an integrated development enviroment for developing (primarily)
web based and phpgtk based applications.
</p>
<p>
<a href="http://hapdebugger.sourceforge.net/">HAP Python Remote Debugger</a>
is a Python debugger that can run on one Windows machine debugging a Python program running
@ -303,15 +334,6 @@
the pyscintilla wrapper. wxEditor is based on wxWindows, wxPython and
wxStyledTextControl.
</p>
<p>
<a href="http://www.pragmaticprogrammer.com/ruby/downloads/ruby-install.html">Ruby installation</a>
that includes SciTE set up for Ruby using an included copy of the "Programming Ruby" book for help.
</p>
<p>
<a href="http://www.lcc.ufrn.br/~milano/ild/index.html">Interactive LuaSpace Development</a>
is a graphical environment for LuaSpace which combines the CORBA platform
with the language Lua.
</p>
<p>
<a href="http://sourceforge.net/projects/pycrust/">PyCrust</a> is an interactive
Python shell based on wxPython.
@ -331,7 +353,7 @@
and an application.
</p>
<p>
<a href="http://llt.chez.tiscali.fr/">Filerx</a>
<a href="http://llt.chez-alice.fr/">Filerx</a>
is a project manager for SciTE on Windows.
Open source and includes an implementation of SciTE's Director interface so
will be of interest to others wanting to control SciTE.
@ -366,7 +388,7 @@
wxStyledTextCtrl used as its editor.
</p>
<p>
<a href="http://www.python.org/windows/">PythonWin</a>, a Win32 IDE for Python, uses
<a href="http://www.python.org/download/windows/">PythonWin</a>, a Win32 IDE for Python, uses
Scintilla for both its editing and interactive windows.
</p>
<h3>
@ -418,14 +440,9 @@
Documents
</h3>
<p>
<a href="http://www.finseth.com/~fin/craft/">The Craft of Text Editing</a>
<a href="http://www.finseth.com/craft/">The Craft of Text Editing</a>
describes how EMACS works, <i>Craig A. Finseth</i>
</p>
<p>
<a href="http://freespace.virgin.net/james.brown7/tuts/bigmem02.htm">Span Tables</a>
are another data structure that can be used to represent documents in memory in a way
that performs well when data is inserted and deleted, <i>James Brown</i>
</p>
<p>
<a href="http://www.cs.cmu.edu/~wjh/papers/byte.html">Data Structures in a Bit-Mapped Text
Editor</a>, <i>Wilfred J. Hanson</i>, Byte January 1987
@ -449,18 +466,18 @@
Java code. SciTE has an Indent command defined for .cxx files that uses AStyle.
</p>
<p>
<a href="http://winmerge.sourceforge.net/">WinMerge</a> is an interactive diff / merge
<a href="http://winmerge.org/">WinMerge</a> is an interactive diff / merge
for Windows. I prefer code submissions in the form of source files rather than diffs and then run
WinMerge over the files to work out how to merge.
</p>
<p>
<a href="http://www.python.org">Python</a> is my favourite programming language. Scintilla
was started after I tried to improve the editor built into <a
href="http://www.python.org/windows/">PythonWin</a>, but was frustrated by the limitations of
href="http://www.python.org/download/windows/">PythonWin</a>, but was frustrated by the limitations of
the Windows Richedit control which PythonWin used.
</p>
<p>
<a href="http://www.cs.yorku.ca/~oz/">regex</a> is a public domain
<a href="http://www.cse.yorku.ca/~oz/">regex</a> is a public domain
implementation of regular expression pattern matching used in Scintilla.
</p>
<!--
@ -483,3 +500,4 @@
</body>
</html>

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="20070331" />
<meta name="Date.Modified" content="20071122" />
<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.73<br />
Site last modified March 31 2007</font>
<font color="#FFCC99" size="3"> Release version 1.75<br />
Site last modified November 22 2007</font>
</td>
<td width="20%">
&nbsp;
@ -52,6 +52,19 @@
</tr>
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="6" border="0">
<tr>
<td width="100%">
<span class="versionlist">Version 1.75 displays invalid UTF-8 bytes as hexadecimal and
can show indentation guides on completely empty lines.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.74 runs natively on OS X.
Indicators are separated from the style buffer so there can be more indicators.
Wide lines are faster.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.73 allows style changes to be made during text modification events.</span>
@ -73,29 +86,6 @@
for pasting and uses internationalised input at all times.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.69 supports the Spice language and can draw
the selection and whole line markers translucently.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.68 can draw the caret line
and box indicators translucently and has an accurate TCL lexer.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.67 enhances some lexers and fixes bugs.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.66 has a new Ruby lexer and fixes bugs on GTK+
with Pango 1.8.</span>
</td>
</tr>
</table>
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
@ -178,14 +168,16 @@ if (IsRemote()) {
<a href="http://scintilla.sourceforge.net/Icons.html">Icons that can be used with Scintilla.</a>
</p>
<p>
The scintilla-interest mailing list has moved from lyra.org to Google Groups.
Questions and comments about Scintilla should be directed to the
<a href="http://mailman.lyra.org/mailman/listinfo/scintilla-interest">scintilla-interest</a>
<a href="http://groups.google.com/group/scintilla-interest">scintilla-interest</a>
mailing list,
which is for discussion of Scintilla and related projects, their bugs and future features.
This is a low traffic list, averaging less than 50 messages per week.
To avoid spam, only list members can write to the list.
Announcements of new versions of Scintilla go to both the scintilla-interest list and
<a href="http://mailman.lyra.org/mailman/listinfo/scintilla-announce">scintilla-announce</a>.
New versions of Scintilla are announced on scintilla-interest and may also be received by SourceForge
members by clicking on the Monitor column icon for "scintilla" on
<a href="https://sourceforge.net/project/showfiles.php?group_id=2439">the downloads page</a>.
Messages sent to my personal email address that could have been sent to the list
may receive no response.
<br />
@ -205,3 +197,4 @@ if (IsRemote()) {
</body>
</html>

View File

@ -31,10 +31,6 @@
with gdk_string_extents. */
#define FAST_WAY
#ifdef G_OS_WIN32
#define snprintf _snprintf
#endif
#if GTK_MAJOR_VERSION >= 2
#define USE_PANGO 1
#include "Converter.h"
@ -572,7 +568,7 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
faceName, sizeof(faceName),
charset, sizeof(charset));
snprintf(fontspec,
g_snprintf(fontspec,
sizeof(fontspec) - 1,
spec,
foundary, faceName,
@ -588,7 +584,7 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
strncat(fontset, fontspec, remaining - 1);
remaining -= strlen(fontset);
snprintf(fontspec,
g_snprintf(fontspec,
sizeof(fontspec) - 1,
",%s%s%s-o-*-*-*-%0d-*-*-*-*-%s",
foundary, faceName,
@ -623,7 +619,7 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
faceName, sizeof(faceName),
charset, sizeof(charset));
snprintf(fontspec,
g_snprintf(fontspec,
sizeof(fontspec) - 1,
"%s%s%s%s-*-*-*-%0d-*-*-*-*-%s",
foundary, faceName,
@ -634,7 +630,7 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
newid = LoadFontOrSet(fontspec, characterSet);
if (!newid) {
// some fonts have oblique, not italic
snprintf(fontspec,
g_snprintf(fontspec,
sizeof(fontspec) - 1,
"%s%s%s%s-*-*-*-%0d-*-*-*-*-%s",
foundary, faceName,
@ -645,7 +641,7 @@ FontID FontCached::CreateNewFont(const char *fontName, int characterSet,
newid = LoadFontOrSet(fontspec, characterSet);
}
if (!newid) {
snprintf(fontspec,
g_snprintf(fontspec,
sizeof(fontspec) - 1,
"-*-*-*-*-*-*-*-%0d-*-*-*-*-%s",
size * 10,
@ -1053,7 +1049,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int , ColourAllocated , int , Co
#else
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags) {
if (gc && drawable) {
if (gc && drawable && rc.Width() > 0) {
int width = rc.Width();
int height = rc.Height();
// Ensure not distorted too much by corners when small
@ -1293,7 +1289,7 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
len = maxLengthTextRun-1;
int wclen;
if (et == UTF8) {
wclen = UCS2FromUTF8(s, len,
wclen = UTF16FromUTF8(s, len,
static_cast<wchar_t *>(static_cast<void *>(wctext)), maxLengthTextRun - 1);
} else { // dbcs, so convert using current locale
char sMeasure[maxLengthTextRun];
@ -1383,8 +1379,15 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
int position = PANGO_PIXELS(pos.x);
int curIndex = pango_layout_iter_get_index(iter);
int places = curIndex - i;
int distance = position - positions[i-1];
while (i < curIndex) {
positions[i++] = position;
// Evenly distribute space among bytes of this cluster.
// Would be better to find number of characters and then
// divide evenly between characters with each byte of a character
// being at the same position.
positions[i] = position - (curIndex - 1 - i) * distance / places;
i++;
}
}
while (i < lenPositions)
@ -1436,12 +1439,25 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
utfForm = UTF8FromLatin1(s, len);
}
pango_layout_set_text(layout, utfForm, len);
int i = 0;
PangoLayoutIter *iter = pango_layout_get_iter(layout);
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
int i = 0;
int positionStart = 0;
int clusterStart = 0;
// Each Latin1 input character may take 1 or 2 bytes in UTF-8
// and groups of up to 3 may be represented as ligatures.
while (pango_layout_iter_next_cluster(iter)) {
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
positions[i++] = PANGO_PIXELS(pos.x);
int position = PANGO_PIXELS(pos.x);
int distance = position - positionStart;
int clusterEnd = pango_layout_iter_get_index(iter);
int ligatureLength = g_utf8_strlen(utfForm + clusterStart, clusterEnd - clusterStart);
PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3);
for (int charInLig=0; charInLig<ligatureLength; charInLig++) {
positions[i++] = position - (ligatureLength - 1 - charInLig) * distance / ligatureLength;
}
positionStart = position;
clusterStart = clusterEnd;
}
while (i < lenPositions)
positions[i++] = PANGO_PIXELS(pos.x + pos.width);
@ -1468,7 +1484,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
len = maxLengthTextRun-1;
int wclen;
if (et == UTF8) {
wclen = UCS2FromUTF8(s, len,
wclen = UTF16FromUTF8(s, len,
static_cast<wchar_t *>(static_cast<void *>(wctext)), maxLengthTextRun - 1);
} else { // dbcsMode, so convert using current locale
char sDraw[maxLengthTextRun];
@ -1554,7 +1570,7 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
#endif
if (et == UTF8) {
GdkWChar wctext[maxLengthTextRun];
size_t wclen = UCS2FromUTF8(s, len, static_cast<wchar_t *>(static_cast<void *>(wctext)),
size_t wclen = UTF16FromUTF8(s, len, static_cast<wchar_t *>(static_cast<void *>(wctext)),
sizeof(wctext) / sizeof(GdkWChar) - 1);
wctext[wclen] = L'\0';
return gdk_text_width_wc(PFont(font_)->pfont, wctext, wclen);
@ -1854,6 +1870,34 @@ void Window::SetTitle(const char *s) {
gtk_window_set_title(GTK_WINDOW(id), s);
}
/* Returns rectangle of monitor pt is on, both rect and pt are in Window's
gdk window coordinates */
PRectangle Window::GetMonitorRect(Point pt) {
gint x_offset, y_offset;
pt = pt;
gdk_window_get_origin(PWidget(id)->window, &x_offset, &y_offset);
// gtk 2.2+
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 2)
{
GdkScreen* screen;
gint monitor_num;
GdkRectangle rect;
screen = gtk_widget_get_screen(PWidget(id));
monitor_num = gdk_screen_get_monitor_at_point(screen, pt.x + x_offset, pt.y + y_offset);
gdk_screen_get_monitor_geometry(screen, monitor_num, &rect);
rect.x -= x_offset;
rect.y -= y_offset;
return PRectangle(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
}
#else
return PRectangle(-x_offset, -y_offset, (-x_offset) + gdk_screen_width(),
(-y_offset) + gdk_screen_height());
#endif
}
struct ListImage {
const char *xpm_data;
#if GTK_MAJOR_VERSION < 2
@ -2609,7 +2653,7 @@ bool Platform::MouseButtonBounce() {
}
void Platform::DebugDisplay(const char *s) {
printf("%s", s);
fprintf(stderr, "%s", s);
}
bool Platform::IsKeyDown(int) {

View File

@ -26,10 +26,11 @@
#include "Accessor.h"
#include "KeyWords.h"
#endif
#include "ContractionState.h"
#include "SVector.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
#include "CellBuffer.h"
#include "CallTip.h"
#include "KeyMap.h"
@ -39,8 +40,10 @@
#include "Style.h"
#include "AutoComplete.h"
#include "ViewStyle.h"
#include "Decoration.h"
#include "CharClassify.h"
#include "Document.h"
#include "PositionCache.h"
#include "Editor.h"
#include "SString.h"
#include "ScintillaBase.h"
@ -75,7 +78,7 @@
#pragma warning(disable: 4505)
#endif
#if GTK_CHECK_VERSION(2,2,0)
#if GTK_CHECK_VERSION(2,6,0)
#define USE_GTK_CLIPBOARD
#endif
@ -154,6 +157,7 @@ private:
virtual void Initialise();
virtual void Finalise();
virtual void DisplayCursor(Window::Cursor c);
virtual bool DragThreshold(Point ptStart, Point ptNow);
virtual void StartDrag();
int TargetAsUTF8(char *text);
int EncodedFromUTF8(char *utf8, char *encoded);
@ -194,6 +198,7 @@ private:
void ReceivedDrop(GtkSelectionData *selection_data);
static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *selected);
#ifdef USE_GTK_CLIPBOARD
void StoreOnClipboard(SelectionText *clipText);
static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data);
static void ClipboardClearSelection(GtkClipboard* clip, void *data);
#endif
@ -257,8 +262,9 @@ private:
static gint SelectionNotify(GtkWidget *widget, GdkEventSelection *selection_event);
#endif
static void DragBegin(GtkWidget *widget, GdkDragContext *context);
gboolean DragMotionThis(GdkDragContext *context, gint x, gint y, guint dragtime);
static gboolean DragMotion(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time);
gint x, gint y, guint dragtime);
static void DragLeave(GtkWidget *widget, GdkDragContext *context,
guint time);
static void DragEnd(GtkWidget *widget, GdkDragContext *context);
@ -307,12 +313,18 @@ GdkAtom ScintillaGTK::atomString = 0;
GdkAtom ScintillaGTK::atomUriList = 0;
GdkAtom ScintillaGTK::atomDROPFILES_DND = 0;
static const GtkTargetEntry clipboardTargets[] = {
static const GtkTargetEntry clipboardCopyTargets[] = {
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ "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 },
};
static const gint nClipboardTargets = sizeof(clipboardTargets) / sizeof(clipboardTargets[0]);
static const gint nClipboardPasteTargets = sizeof(clipboardPasteTargets) / sizeof(clipboardPasteTargets[0]);
static GtkWidget *PWidget(Window &w) {
return reinterpret_cast<GtkWidget *>(w.GetID());
@ -760,17 +772,37 @@ void ScintillaGTK::Initialise() {
gtk_widget_grab_focus(PWidget(wMain));
gtk_selection_add_targets(GTK_WIDGET(PWidget(wMain)), GDK_SELECTION_PRIMARY,
clipboardTargets, nClipboardTargets);
clipboardCopyTargets, nClipboardCopyTargets);
#ifndef USE_GTK_CLIPBOARD
gtk_selection_add_targets(GTK_WIDGET(PWidget(wMain)), atomClipboard,
clipboardTargets, nClipboardTargets);
clipboardPasteTargets, nClipboardPasteTargets);
#endif
gtk_drag_dest_set(GTK_WIDGET(PWidget(wMain)),
GTK_DEST_DEFAULT_ALL, clipboardTargets, nClipboardTargets,
GTK_DEST_DEFAULT_ALL, clipboardPasteTargets, nClipboardPasteTargets,
static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE));
#if GLIB_MAJOR_VERSION >= 2
// Set caret period based on GTK settings
gboolean blinkOn = false;
if (g_object_class_find_property(G_OBJECT_GET_CLASS(
G_OBJECT(gtk_settings_get_default())), "gtk-cursor-blink")) {
g_object_get(G_OBJECT(
gtk_settings_get_default()), "gtk-cursor-blink", &blinkOn, NULL);
}
if (blinkOn &&
g_object_class_find_property(G_OBJECT_GET_CLASS(
G_OBJECT(gtk_settings_get_default())), "gtk-cursor-blink-time")) {
gint value;
g_object_get(G_OBJECT(
gtk_settings_get_default()), "gtk-cursor-blink-time", &value, NULL);
caret.period = gint(value / 1.75);
} else {
caret.period = 0;
}
#endif
SetTicking(true);
}
@ -786,14 +818,19 @@ void ScintillaGTK::DisplayCursor(Window::Cursor c) {
wText.SetCursor(static_cast<Window::Cursor>(cursorMode));
}
bool ScintillaGTK::DragThreshold(Point ptStart, Point ptNow) {
#if GTK_MAJOR_VERSION < 2
return Editor::DragThreshold(ptStart, ptNow);
#else
return gtk_drag_check_threshold(GTK_WIDGET(PWidget(wMain)),
ptStart.x, ptStart.y, ptNow.x, ptNow.y);
#endif
}
void ScintillaGTK::StartDrag() {
dragWasDropped = false;
static const GtkTargetEntry targets[] = {
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ "STRING", 0, TARGET_STRING },
};
static const gint n_targets = sizeof(targets) / sizeof(targets[0]);
GtkTargetList *tl = gtk_target_list_new(targets, n_targets);
inDragDrop = ddDragging;
GtkTargetList *tl = gtk_target_list_new(clipboardCopyTargets, nClipboardCopyTargets);
gtk_drag_begin(GTK_WIDGET(PWidget(wMain)),
tl,
static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE),
@ -1255,17 +1292,9 @@ void ScintillaGTK::CopyToClipboard(const SelectionText &selectedText) {
atomClipboard,
GDK_CURRENT_TIME);
#else
GtkClipboard *clipBoard;
clipBoard = gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), atomClipboard);
if (clipBoard == NULL) // Occurs if widget isn't in a toplevel
return;
SelectionText *clipText = new SelectionText();
clipText->Copy(selectedText);
gtk_clipboard_set_with_data(clipBoard, clipboardTargets, nClipboardTargets,
ClipboardGetSelection, ClipboardClearSelection, clipText);
StoreOnClipboard(clipText);
#endif
}
@ -1277,17 +1306,9 @@ void ScintillaGTK::Copy() {
atomClipboard,
GDK_CURRENT_TIME);
#else
GtkClipboard *clipBoard;
clipBoard = gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), atomClipboard);
if (clipBoard == NULL) // Occurs if widget isn't in a toplevel
return;
SelectionText *clipText = new SelectionText();
CopySelectionRange(clipText);
gtk_clipboard_set_with_data(clipBoard, clipboardTargets, nClipboardTargets,
ClipboardGetSelection, ClipboardClearSelection, clipText);
StoreOnClipboard(clipText);
#endif
#if PLAT_GTK_WIN32
if (selType == selRectangle) {
@ -1391,7 +1412,7 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio
if ((selectionType != GDK_TARGET_STRING) && (selectionType != atomUTF8)) {
char *empty = new char[1];
empty[0] = '\0';
selText.Set(empty, 0, SC_CP_UTF8, 0, false);
selText.Set(empty, 0, SC_CP_UTF8, 0, false, false);
return;
}
@ -1410,16 +1431,16 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio
// Unknown encoding so assume in Latin1
char *destPrevious = dest;
dest = UTF8FromLatin1(dest, len);
selText.Set(dest, len, SC_CP_UTF8, 0, selText.rectangular);
selText.Set(dest, len, SC_CP_UTF8, 0, selText.rectangular, false);
delete []destPrevious;
} else {
// Assume buffer is in same encoding as selection
selText.Set(dest, len, pdoc->dbcsCodePage,
vs.styles[STYLE_DEFAULT].characterSet, isRectangular);
vs.styles[STYLE_DEFAULT].characterSet, isRectangular, false);
}
} else { // UTF-8
dest = Document::TransformLineEnds(&len, data, len, pdoc->eolMode);
selText.Set(dest, len, SC_CP_UTF8, 0, isRectangular);
selText.Set(dest, len, SC_CP_UTF8, 0, isRectangular, false);
#ifdef USE_CONVERTER
const char *charSetBuffer = CharacterSetID();
if (!IsUnicodeMode() && *charSetBuffer) {
@ -1427,7 +1448,7 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio
// Convert to locale
dest = ConvertText(&len, selText.s, selText.len, charSetBuffer, "UTF-8", true);
selText.Set(dest, len, pdoc->dbcsCodePage,
vs.styles[STYLE_DEFAULT].characterSet, selText.rectangular);
vs.styles[STYLE_DEFAULT].characterSet, selText.rectangular, false);
}
#endif
}
@ -1498,7 +1519,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
int tmpstr_len;
char *tmpstr = Document::TransformLineEnds(&tmpstr_len, text->s, text->len, SC_EOL_LF);
newline_normalized = new SelectionText();
newline_normalized->Set(tmpstr, tmpstr_len, SC_CP_UTF8, 0, text->rectangular);
newline_normalized->Set(tmpstr, tmpstr_len, SC_CP_UTF8, 0, text->rectangular, false);
text = newline_normalized;
}
#endif
@ -1512,7 +1533,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
int new_len;
char* tmputf = ConvertText(&new_len, text->s, text->len, "UTF-8", charSet, false);
converted = new SelectionText();
converted->Set(tmputf, new_len, SC_CP_UTF8, 0, text->rectangular);
converted->Set(tmputf, new_len, SC_CP_UTF8, 0, text->rectangular, false);
text = converted;
}
}
@ -1603,6 +1624,18 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
}
#ifdef USE_GTK_CLIPBOARD
void ScintillaGTK::StoreOnClipboard(SelectionText *clipText) {
GtkClipboard *clipBoard =
gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), atomClipboard);
if (clipBoard == NULL) // Occurs if widget isn't in a toplevel
return;
if (gtk_clipboard_set_with_data(clipBoard, clipboardCopyTargets, nClipboardCopyTargets,
ClipboardGetSelection, ClipboardClearSelection, clipText)) {
gtk_clipboard_set_can_store(clipBoard, clipboardCopyTargets, nClipboardCopyTargets);
}
}
void ScintillaGTK::ClipboardGetSelection(GtkClipboard *, GtkSelectionData *selection_data, guint info, void *data) {
GetSelection(selection_data, info, static_cast<SelectionText*>(data));
}
@ -2339,14 +2372,17 @@ void ScintillaGTK::DragBegin(GtkWidget *, GdkDragContext *) {
//Platform::DebugPrintf("DragBegin\n");
}
gboolean ScintillaGTK::DragMotion(GtkWidget *widget, GdkDragContext *context,
gboolean ScintillaGTK::DragMotionThis(GdkDragContext *context,
gint x, gint y, guint dragtime) {
ScintillaGTK *sciThis = ScintillaFromWidget(widget);
Point npt(x, y);
sciThis->inDragDrop = true;
sciThis->SetDragPosition(sciThis->PositionFromLocation(npt));
SetDragPosition(PositionFromLocation(npt));
GdkDragAction preferredAction = context->suggested_action;
if (context->actions == static_cast<GdkDragAction>
int pos = PositionFromLocation(npt);
if ((inDragDrop == ddDragging) && (0 == PositionInSelection(pos))) {
// Avoid dragging selection onto itself as that produces a move
// with no real effect but which creates undo actions.
preferredAction = static_cast<GdkDragAction>(0);
} else if (context->actions == static_cast<GdkDragAction>
(GDK_ACTION_COPY | GDK_ACTION_MOVE)) {
preferredAction = GDK_ACTION_MOVE;
}
@ -2354,6 +2390,12 @@ gboolean ScintillaGTK::DragMotion(GtkWidget *widget, GdkDragContext *context,
return FALSE;
}
gboolean ScintillaGTK::DragMotion(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint dragtime) {
ScintillaGTK *sciThis = ScintillaFromWidget(widget);
return sciThis->DragMotionThis(context, x, y, dragtime);
}
void ScintillaGTK::DragLeave(GtkWidget *widget, GdkDragContext * /*context*/, guint) {
ScintillaGTK *sciThis = ScintillaFromWidget(widget);
sciThis->SetDragPosition(invalidPosition);
@ -2367,6 +2409,7 @@ void ScintillaGTK::DragEnd(GtkWidget *widget, GdkDragContext * /*context*/) {
sciThis->SetEmptySelection(sciThis->posDrag);
sciThis->SetDragPosition(invalidPosition);
//Platform::DebugPrintf("DragEnd %x %d\n", sciThis, sciThis->dragWasDropped);
sciThis->inDragDrop = ddNone;
}
gboolean ScintillaGTK::Drop(GtkWidget *widget, GdkDragContext * /*context*/,

View File

@ -1,41 +1,53 @@
PlatGTK.o: PlatGTK.cxx Converter.h \
../include/Platform.h \
PlatGTK.o: PlatGTK.cxx \
../include/Scintilla.h ../include/ScintillaWidget.h \
../src/UniConversion.h ../src/XPM.h
ScintillaGTK.o: ScintillaGTK.cxx Converter.h \
../include/Platform.h \
../src/UniConversion.h ../src/XPM.h Converter.h
ScintillaGTK.o: ScintillaGTK.cxx \
../include/Scintilla.h ../include/ScintillaWidget.h \
../include/SciLexer.h ../include/PropSet.h ../include/SString.h \
../include/Accessor.h ../include/KeyWords.h ../src/ContractionState.h \
../src/SVector.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h ../src/Document.h \
../src/Editor.h ../src/ScintillaBase.h ../src/UniConversion.h \
../src/ExternalLexer.h
../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \
../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h \
../src/XPM.h ../src/LineMarker.h ../src/Style.h ../src/AutoComplete.h \
../src/ViewStyle.h ../src/RunStyles.h ../src/Decoration.h \
../src/CharClassify.h ../src/Document.h ../src/PositionCache.h \
../src/Editor.h ../include/SString.h ../src/ScintillaBase.h \
../src/UniConversion.h scintilla-marshal.h ../src/ExternalLexer.h \
Converter.h
AutoComplete.o: ../src/AutoComplete.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../src/AutoComplete.h
CallTip.o: ../src/CallTip.cxx ../include/Platform.h \
../include/Scintilla.h ../src/CallTip.h
CellBuffer.o: ../src/CellBuffer.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SVector.h ../src/CellBuffer.h
../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h
CharClassify.o: ../src/CharClassify.cxx ../src/CharClassify.h
ContractionState.o: ../src/ContractionState.cxx ../include/Platform.h \
../src/ContractionState.h
Decoration.o: ../src/Decoration.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/Decoration.h
DocumentAccessor.o: ../src/DocumentAccessor.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../src/SVector.h \
../include/Accessor.h ../src/DocumentAccessor.h ../src/CellBuffer.h \
../include/Scintilla.h ../src/CharClassify.h ../src/Document.h
../include/Accessor.h ../src/DocumentAccessor.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../include/Scintilla.h ../src/CharClassify.h ../src/Decoration.h \
../src/Document.h
Document.o: ../src/Document.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SVector.h ../src/CellBuffer.h \
../src/CharClassify.h ../src/Document.h ../src/RESearch.h
../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../src/CharClassify.h ../src/Decoration.h ../src/Document.h \
../src/RESearch.h
Editor.o: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \
../src/ContractionState.h ../src/SVector.h ../src/CellBuffer.h \
../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h ../src/Document.h ../src/Editor.h
../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Decoration.h ../src/Document.h ../src/PositionCache.h \
../src/Editor.h
ExternalLexer.o: ../src/ExternalLexer.cxx ../include/Platform.h \
../include/SciLexer.h ../include/PropSet.h ../include/SString.h \
../include/Accessor.h ../src/DocumentAccessor.h ../include/KeyWords.h \
../src/ExternalLexer.h
../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/DocumentAccessor.h \
../include/KeyWords.h ../src/ExternalLexer.h
Indicator.o: ../src/Indicator.cxx ../include/Platform.h \
../include/Scintilla.h ../src/Indicator.h
KeyMap.o: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \
@ -45,34 +57,64 @@ KeyWords.o: ../src/KeyWords.cxx ../include/Platform.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexAda.o: ../src/LexAda.cxx ../include/Platform.h ../include/Accessor.h \
../src/StyleContext.h ../include/PropSet.h ../include/SString.h \
../include/KeyWords.h ../include/SciLexer.h
../include/KeyWords.h ../include/SciLexer.h ../include/SString.h
LexAPDL.o: ../src/LexAPDL.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexAsm.o: ../src/LexAsm.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexAsn1.o: ../src/LexAsn1.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexAU3.o: ../src/LexAU3.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexAVE.o: ../src/LexAVE.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexBaan.o: ../src/LexBaan.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexBash.o: ../src/LexBash.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
LexBasic.o: ../src/LexBasic.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexBullant.o: ../src/LexBullant.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexCaml.o: ../src/LexCaml.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexCLW.o: ../src/LexCLW.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexCmake.o: ../src/LexCmake.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexConf.o: ../src/LexConf.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
LexCPP.o: ../src/LexCPP.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \
../src/CharacterSet.h
LexCrontab.o: ../src/LexCrontab.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexCsound.o: ../src/LexCsound.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexCSS.o: ../src/LexCSS.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexD.o: ../src/LexD.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexEiffel.o: ../src/LexEiffel.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
@ -85,6 +127,10 @@ LexEScript.o: ../src/LexEScript.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexFlagship.o: ../src/LexFlagship.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexForth.o: ../src/LexForth.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
@ -92,12 +138,30 @@ LexFortran.o: ../src/LexFortran.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexGAP.o: ../src/LexGAP.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexGui4Cli.o: ../src/LexGui4Cli.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexHaskell.o: ../src/LexHaskell.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexHTML.o: ../src/LexHTML.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \
../src/CharacterSet.h
LexInno.o: ../src/LexInno.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexKix.o: ../src/LexKix.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexLisp.o: ../src/LexLisp.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h
LexLout.o: ../src/LexLout.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
@ -118,10 +182,16 @@ LexMMIXAL.o: ../src/LexMMIXAL.cxx ../include/Platform.h \
../include/SciLexer.h
LexMPT.o: ../src/LexMPT.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
../include/Scintilla.h ../include/SciLexer.h ../include/SString.h
LexMSSQL.o: ../src/LexMSSQL.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexNsis.o: ../src/LexNsis.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
LexOpal.o: ../src/LexOpal.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h
LexOthers.o: ../src/LexOthers.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
@ -135,9 +205,16 @@ LexPB.o: ../src/LexPB.cxx ../include/Platform.h ../include/PropSet.h \
LexPerl.o: ../src/LexPerl.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
LexPLM.o: ../src/LexPLM.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h
LexPOV.o: ../src/LexPOV.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexProgress.o: ../src/LexProgress.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexPS.o: ../src/LexPS.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
@ -145,36 +222,78 @@ LexPython.o: ../src/LexPython.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexRebol.o: ../src/LexRebol.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \
../src/StyleContext.h
LexRuby.o: ../src/LexRuby.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
LexScriptol.o: ../src/LexScriptol.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexSmalltalk.o: ../src/LexSmalltalk.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexSpecman.o: ../src/LexSpecman.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexSpice.o: ../src/LexSpice.cxx ../include/Platform.h \
../include/Accessor.h ../src/StyleContext.h ../include/PropSet.h \
../include/SString.h ../include/KeyWords.h ../include/SciLexer.h \
../include/SString.h
LexSQL.o: ../src/LexSQL.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexTADS3.o: ../src/LexTADS3.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexTCL.o: ../src/LexTCL.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexTeX.o: ../src/LexTeX.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../include/KeyWords.h \
../include/Scintilla.h ../include/SciLexer.h ../src/StyleContext.h
LexVB.o: ../src/LexVB.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexVerilog.o: ../src/LexVerilog.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
../include/SciLexer.h
LexVHDL.o: ../src/LexVHDL.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexYAML.o: ../src/LexYAML.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LineMarker.o: ../src/LineMarker.cxx ../include/Platform.h \
../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h
PositionCache.o: ../src/PositionCache.cxx ../include/Platform.h \
../include/Scintilla.h ../src/ContractionState.h ../src/SVector.h \
../src/SplitVector.h ../src/Partitioning.h ../src/CellBuffer.h \
../src/KeyMap.h ../src/RunStyles.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/CharClassify.h ../src/Decoration.h ../src/Document.h \
../src/PositionCache.h
PropSet.o: ../src/PropSet.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h
RESearch.o: ../src/RESearch.cxx ../src/RESearch.h
RESearch.o: ../src/RESearch.cxx ../src/CharClassify.h ../src/RESearch.h
RunStyles.o: ../src/RunStyles.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h
ScintillaBase.o: ../src/ScintillaBase.cxx ../include/Platform.h \
../include/Scintilla.h ../include/PropSet.h ../include/SString.h \
../include/SciLexer.h ../include/Accessor.h ../src/DocumentAccessor.h \
../include/KeyWords.h ../src/ContractionState.h ../src/SVector.h \
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h \
../src/XPM.h ../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h ../src/Editor.h \
../src/AutoComplete.h ../src/CharClassify.h ../src/Decoration.h \
../src/Document.h ../src/PositionCache.h ../src/Editor.h \
../src/ScintillaBase.h
StyleContext.o: ../src/StyleContext.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
@ -183,8 +302,9 @@ Style.o: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \
../src/Style.h
UniConversion.o: ../src/UniConversion.cxx ../src/UniConversion.h
ViewStyle.o: ../src/ViewStyle.cxx ../include/Platform.h \
../include/Scintilla.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h
WindowAccessor.o: ../src/WindowAccessor.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/WindowAccessor.h ../include/Scintilla.h

View File

@ -40,38 +40,40 @@ endif
# If explicit setting of GTK1 or GTK2 then use that else look for
# pkg-config which is an OK indication that GTK2 is available
ifdef GTK2
CONFIGFLAGS=pkg-config --cflags gtk+-2.0
CONFIGFLAGS=$(shell pkg-config --cflags gtk+-2.0)
MARSHALLER=scintilla-marshal.o
else
ifdef GTK1
CONFIGFLAGS=gtk-config --cflags
CONFIGFLAGS=$(shell gtk-config --cflags)
else
ifneq (,$(findstring /,$(shell whereis pkg-config)))
CONFIGFLAGS=pkg-config --cflags gtk+-2.0
CONFIGFLAGS=$(shell pkg-config --cflags gtk+-2.0)
MARSHALLER=scintilla-marshal.o
else
CONFIGFLAGS=gtk-config --cflags
CONFIGFLAGS=$(shell gtk-config --cflags)
endif
endif
endif
.cxx.o:
$(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<
$(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $<
.c.o:
$(CCOMP) `$(CONFIGFLAGS)` $(CXXFLAGS) -w -c $<
$(CCOMP) $(CONFIGFLAGS) $(CXXFLAGS) -w -c $<
#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\*.o \)
LEXOBJS=\
LexAda.o LexAPDL.o LexAsm.o LexAsn1.o LexAU3.o LexAVE.o LexBaan.o LexBash.o \
LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexCmake.o LexConf.o LexCPP.o \
LexCrontab.o LexCsound.o LexCSS.o LexD.o LexEiffel.o LexErlang.o LexEScript.o \
LexFlagship.o LexForth.o LexFortran.o LexGui4Cli.o LexHaskell.o LexHTML.o \
LexInno.o LexKix.o LexLisp.o LexLout.o LexLua.o LexMatlab.o LexMetapost.o \
LexMMIXAL.o LexMPT.o LexMSSQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \
LexPB.o LexPerl.o LexPOV.o LexPS.o LexPython.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
LexAbaqus.o LexAda.o LexAPDL.o LexAsm.o LexAsn1.o LexASY.o LexAU3.o LexAVE.o \
LexBaan.o LexBash.o LexBasic.o LexBullant.o LexCaml.o LexCLW.o LexCmake.o \
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 \
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
#--Autogenerated -- end of automatically generated section
all: $(COMPLIB)
@ -80,13 +82,13 @@ clean:
rm -f *.o $(COMPLIB)
deps:
$(CC) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
$(CC) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \
CharClassify.o Document.o CallTip.o \
CharClassify.o Decoration.o Document.o CallTip.o \
ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
KeyMap.o LineMarker.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
RESearch.o RunStyles.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
$(MARSHALLER) $(LEXOBJS)
$(AR) rc $@ $^
$(RANLIB) $@

View File

@ -120,6 +120,7 @@ SOBJS=\
$(DIR_O)\CellBuffer.obj \
$(DIR_O)\ContractionState.obj \
$(DIR_O)\CharClassify.obj \
$(DIR_O)\Decoration.obj \
$(DIR_O)\Document.obj \
$(DIR_O)\Editor.obj \
$(DIR_O)\ExternalLexer.obj \
@ -127,8 +128,10 @@ SOBJS=\
$(DIR_O)\KeyMap.obj \
$(DIR_O)\LineMarker.obj \
$(DIR_O)\PlatGTK.obj \
$(DIR_O)\PositionCache.obj \
$(MARSHALLER) \
$(DIR_O)\RESearch.obj \
$(DIR_O)\RunStyles.obj \
$(DIR_O)\PropSet.obj \
$(DIR_O)\ScintillaBase.obj \
$(DIR_O)\ScintillaGTK.obj \
@ -140,10 +143,12 @@ SOBJS=\
#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\t$(DIR_O)\\\*.obj \\\n\)
LEXOBJS=\
$(DIR_O)\LexAbaqus.obj \
$(DIR_O)\LexAda.obj \
$(DIR_O)\LexAPDL.obj \
$(DIR_O)\LexAsm.obj \
$(DIR_O)\LexAsn1.obj \
$(DIR_O)\LexASY.obj \
$(DIR_O)\LexAU3.obj \
$(DIR_O)\LexAVE.obj \
$(DIR_O)\LexBaan.obj \
@ -165,6 +170,7 @@ LEXOBJS=\
$(DIR_O)\LexFlagship.obj \
$(DIR_O)\LexForth.obj \
$(DIR_O)\LexFortran.obj \
$(DIR_O)\LexGAP.obj \
$(DIR_O)\LexGui4Cli.obj \
$(DIR_O)\LexHaskell.obj \
$(DIR_O)\LexHTML.obj \
@ -173,23 +179,30 @@ LEXOBJS=\
$(DIR_O)\LexLisp.obj \
$(DIR_O)\LexLout.obj \
$(DIR_O)\LexLua.obj \
$(DIR_O)\LexMagik.obj \
$(DIR_O)\LexMatlab.obj \
$(DIR_O)\LexMetapost.obj \
$(DIR_O)\LexMMIXAL.obj \
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexObjC.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
$(DIR_O)\LexPascal.obj \
$(DIR_O)\LexPB.obj \
$(DIR_O)\LexPerl.obj \
$(DIR_O)\LexPLM.obj \
$(DIR_O)\LexPOV.obj \
$(DIR_O)\LexPowerShell.obj \
$(DIR_O)\LexProgress.obj \
$(DIR_O)\LexPS.obj \
$(DIR_O)\LexPython.obj \
$(DIR_O)\LexR.obj \
$(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 \
@ -197,6 +210,7 @@ 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 \
@ -210,6 +224,7 @@ LOBJS=\
$(DIR_O)\CellBuffer.obj \
$(DIR_O)\ContractionState.obj \
$(DIR_O)\CharClassify.obj \
$(DIR_O)\Decoration.obj \
$(DIR_O)\Document.obj \
$(DIR_O)\DocumentAccessor.obj \
$(DIR_O)\Editor.obj \
@ -218,8 +233,10 @@ LOBJS=\
$(DIR_O)\KeyWords.obj \
$(DIR_O)\LineMarker.obj \
$(DIR_O)\PlatGTK.obj \
$(DIR_O)\PositionCache.obj \
$(MARSHALLER) \
$(DIR_O)\RESearch.obj \
$(DIR_O)\RunStyles.obj \
$(DIR_O)\PropSet.obj \
$(DIR_O)\ScintillaBaseL.obj \
$(DIR_O)\ScintillaGTKL.obj \
@ -288,39 +305,60 @@ LEX_HEADERS=..\include\Platform.h ..\include\PropSet.h \
..\include\SString.h ..\include\Accessor.h ..\include\KeyWords.h \
..\include\Scintilla.h ..\include\SciLexer.h ..\src\StyleContext.h
$(DIR_O)\AutoComplete.obj: ..\src\AutoComplete.cxx ..\include\Platform.h ..\src\AutoComplete.h
$(DIR_O)\AutoComplete.obj: ../src/AutoComplete.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../src/AutoComplete.h
$(DIR_O)\CallTip.obj: ..\src\CallTip.cxx ..\include\Platform.h ..\src\CallTip.h
$(DIR_O)\CallTip.obj: ../src/CallTip.cxx ../include/Platform.h \
../include/Scintilla.h ../src/CallTip.h
$(DIR_O)\CellBuffer.obj: ..\src\CellBuffer.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\CellBuffer.h
$(DIR_O)\CellBuffer.obj: ../src/CellBuffer.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h
$(DIR_O)\CharClassify.obj: ..\src\CharClassify.cxx ..\src\CharClassify.h
$(DIR_O)\CharClassify.obj: ../src/CharClassify.cxx ../src/CharClassify.h
$(DIR_O)\ContractionState.obj: ..\src\ContractionState.cxx ..\include\Platform.h ..\src\ContractionState.h
$(DIR_O)\ContractionState.obj: ../src/ContractionState.cxx ../include/Platform.h \
../src/ContractionState.h
$(DIR_O)\Document.obj: ..\src\Document.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\RESearch.h \
..\src\CellBuffer.h ..\src\CharClassify.h ..\src\Document.h
$(DIR_O)\Document.obj: ../src/Document.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h ../src/CharClassify.h \
../src/Document.h ../src/RESearch.h
$(DIR_O)\DocumentAccessor.obj: ..\src\DocumentAccessor.cxx ..\include\Platform.h ..\include\PropSet.h \
..\include\Accessor.h ..\src\DocumentAccessor.h ..\src\CharClassify.h ..\include\Scintilla.h
$(DIR_O)\DocumentAccessor.obj: ../src/DocumentAccessor.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../src/SVector.h \
../include/Accessor.h ../src/DocumentAccessor.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h ../include/Scintilla.h \
../src/CharClassify.h ../src/Document.h
$(DIR_O)\Editor.obj: ..\src\Editor.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\ContractionState.h \
..\src\CellBuffer.h ..\src\KeyMap.h ..\src\Indicator.h ..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h \
..\src\CharClassify.h ..\src\Document.h ..\src\Editor.h
$(DIR_O)\Editor.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \
../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/PositionCache.h
$(DIR_O)\ExternalLexer.obj: ..\src\ExternalLexer.cxx ..\include\Platform.h ..\include\Scintilla.h ..\include\SciLexer.h \
..\include\PropSet.h ..\include\Accessor.h ..\src\DocumentAccessor.h ..\include\Keywords.h ..\src\ExternalLexer.h
$(DIR_O)\ExternalLexer.obj: ../src/ExternalLexer.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/DocumentAccessor.h \
../include/KeyWords.h ../src/ExternalLexer.h
$(DIR_O)\Indicator.obj: ..\src\Indicator.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\Indicator.h
$(DIR_O)\Indicator.obj: ../src/Indicator.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/Indicator.h
$(DIR_O)\KeyMap.obj: ..\src\KeyMap.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\KeyMap.h
$(DIR_O)\KeyMap.obj: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \
../src/KeyMap.h
$(DIR_O)\KeyWords.obj: ..\src\KeyWords.cxx ..\include\Platform.h ..\include\PropSet.h ..\include\Accessor.h ..\include\KeyWords.h \
..\include\Scintilla.h ..\include\SciLexer.h
$(DIR_O)\KeyWords.obj: ../src/KeyWords.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
#++Autogenerated -- run src/LexGen.py to regenerate
#**\n\($(DIR_O)\\\*.obj: ..\\src\\\*.cxx $(LEX_HEADERS)\n\n\)
$(DIR_O)\LexAbaqus.obj: ..\src\LexAbaqus.cxx $(LEX_HEADERS)
$(DIR_O)\LexAda.obj: ..\src\LexAda.cxx $(LEX_HEADERS)
$(DIR_O)\LexAPDL.obj: ..\src\LexAPDL.cxx $(LEX_HEADERS)
@ -329,6 +367,8 @@ $(DIR_O)\LexAsm.obj: ..\src\LexAsm.cxx $(LEX_HEADERS)
$(DIR_O)\LexAsn1.obj: ..\src\LexAsn1.cxx $(LEX_HEADERS)
$(DIR_O)\LexASY.obj: ..\src\LexASY.cxx $(LEX_HEADERS)
$(DIR_O)\LexAU3.obj: ..\src\LexAU3.cxx $(LEX_HEADERS)
$(DIR_O)\LexAVE.obj: ..\src\LexAVE.cxx $(LEX_HEADERS)
@ -371,6 +411,8 @@ $(DIR_O)\LexForth.obj: ..\src\LexForth.cxx $(LEX_HEADERS)
$(DIR_O)\LexFortran.obj: ..\src\LexFortran.cxx $(LEX_HEADERS)
$(DIR_O)\LexGAP.obj: ..\src\LexGAP.cxx $(LEX_HEADERS)
$(DIR_O)\LexGui4Cli.obj: ..\src\LexGui4Cli.cxx $(LEX_HEADERS)
$(DIR_O)\LexHaskell.obj: ..\src\LexHaskell.cxx $(LEX_HEADERS)
@ -387,6 +429,8 @@ $(DIR_O)\LexLout.obj: ..\src\LexLout.cxx $(LEX_HEADERS)
$(DIR_O)\LexLua.obj: ..\src\LexLua.cxx $(LEX_HEADERS)
$(DIR_O)\LexMagik.obj: ..\src\LexMagik.cxx $(LEX_HEADERS)
$(DIR_O)\LexMatlab.obj: ..\src\LexMatlab.cxx $(LEX_HEADERS)
$(DIR_O)\LexMetapost.obj: ..\src\LexMetapost.cxx $(LEX_HEADERS)
@ -399,6 +443,8 @@ $(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexObjC.obj: ..\src\LexObjC.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
$(DIR_O)\LexOthers.obj: ..\src\LexOthers.cxx $(LEX_HEADERS)
@ -409,18 +455,28 @@ $(DIR_O)\LexPB.obj: ..\src\LexPB.cxx $(LEX_HEADERS)
$(DIR_O)\LexPerl.obj: ..\src\LexPerl.cxx $(LEX_HEADERS)
$(DIR_O)\LexPLM.obj: ..\src\LexPLM.cxx $(LEX_HEADERS)
$(DIR_O)\LexPOV.obj: ..\src\LexPOV.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerShell.obj: ..\src\LexPowerShell.cxx $(LEX_HEADERS)
$(DIR_O)\LexProgress.obj: ..\src\LexProgress.cxx $(LEX_HEADERS)
$(DIR_O)\LexPS.obj: ..\src\LexPS.cxx $(LEX_HEADERS)
$(DIR_O)\LexPython.obj: ..\src\LexPython.cxx $(LEX_HEADERS)
$(DIR_O)\LexR.obj: ..\src\LexR.cxx $(LEX_HEADERS)
$(DIR_O)\LexRebol.obj: ..\src\LexRebol.cxx $(LEX_HEADERS)
$(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)
@ -435,6 +491,8 @@ $(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)
@ -446,52 +504,89 @@ $(DIR_O)\LexYAML.obj: ..\src\LexYAML.cxx $(LEX_HEADERS)
#--Autogenerated -- end of automatically generated section
$(DIR_O)\LineMarker.obj: ..\src\LineMarker.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\LineMarker.h
$(DIR_O)\LineMarker.obj: ../src/LineMarker.cxx ../include/Platform.h \
../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h
$(DIR_O)\PlatWin.obj: PlatWin.cxx ..\include\Platform.h PlatformRes.h ..\src\UniConversion.h
$(DIR_O)\PlatGTK.obj: PlatGTK.cxx ../include/Platform.h \
../src/UniConversion.h ../src/XPM.h
$(DIR_O)\PropSet.obj: ..\src\PropSet.cxx ..\include\Platform.h ..\include\PropSet.h \
..\include\SString.h
$(DIR_O)\PositionCache.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \
../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Decoration.h ../src/Document.h ../src/Editor.h ../src/PositionCache.h
$(DIR_O)\RESearch.obj: ..\src\RESearch.cxx ..\src\RESearch.h
$(DIR_O)\PropSet.obj: ../src/PropSet.cxx ../include/Platform.h ../include/PropSet.h \
../include/SString.h
$(DIR_O)\ScintillaBase.obj: ..\src\ScintillaBase.cxx ..\include\Platform.h ..\include\Scintilla.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h ..\src\AutoComplete.h ..\src\CharClassify.h \
..\src\Document.h ..\src\Editor.h ..\src\ScintillaBase.h
$(DIR_O)\RESearch.obj: ../src/RESearch.cxx ../src/CharClassify.h ../src/RESearch.h
$(DIR_O)\ScintillaBaseL.obj: ..\src\ScintillaBase.cxx ..\include\Platform.h ..\include\Scintilla.h ..\include\SciLexer.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\AutoComplete.h ..\src\ViewStyle.h ..\src\CharClassify.h \
..\src\Document.h ..\src\Editor.h \
..\src\ScintillaBase.h ..\include\PropSet.h ..\include\Accessor.h ..\src\DocumentAccessor.h ..\include\KeyWords.h
$(DIR_O)\RunStyles.obj: ../src/RunStyles.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h
$(DIR_O)\ScintillaWin.obj: ScintillaWin.cxx ..\include\Platform.h ..\include\Scintilla.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\AutoComplete.h ..\src\ViewStyle.h ..\src\CharClassify.h \
..\src\Document.h ..\src\Editor.h \
..\src\ScintillaBase.h ..\src\UniConversion.h
$(DIR_O)\ScintillaBase.obj: ../src/ScintillaBase.cxx ../include/Platform.h \
../include/Scintilla.h ../include/PropSet.h ../include/SString.h \
../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h \
../src/Editor.h ../src/ScintillaBase.h
$(DIR_O)\ScintillaWinL.obj: ScintillaWin.cxx ..\include\Platform.h ..\include\Scintilla.h ..\include\SciLexer.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\AutoComplete.h ..\src\ViewStyle.h ..\src\CharClassify.h \
..\src\Document.h ..\src\Editor.h \
..\src\ScintillaBase.h ..\include\PropSet.h ..\include\Accessor.h ..\include\KeyWords.h ..\src\UniConversion.h
$(DIR_O)\ScintillaBaseL.obj: ../src/ScintillaBase.cxx ../include/Platform.h \
../include/Scintilla.h ../include/PropSet.h ../include/SString.h \
../src/ContractionState.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/AutoComplete.h ../src/CharClassify.h ../src/Document.h \
../src/Editor.h ../src/ScintillaBase.h
$(DIR_O)\ScintillaWinS.obj: ScintillaWin.cxx ..\include\Platform.h ..\include\Scintilla.h \
..\src\ContractionState.h ..\src\CellBuffer.h ..\src\CallTip.h ..\src\KeyMap.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\AutoComplete.h ..\src\ViewStyle.h ..\src\CharClassify.h \
..\src\Document.h ..\src\Editor.h \
..\src\ScintillaBase.h ..\src\UniConversion.h
$(DIR_O)\ScintillaGTK.obj: ScintillaGTK.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \
../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \
../src/UniConversion.h
$(DIR_O)\Style.obj: ..\src\Style.cxx ..\include\Platform.h ..\src\Style.h
$(DIR_O)\ScintillaGTKL.obj: ScintillaGTK.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \
../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \
../src/UniConversion.h
$(DIR_O)\StyleContext.obj: ..\src\StyleContext.cxx ..\include\Platform.h ..\include\Accessor.h ..\include\PropSet.h ..\src\StyleContext.h
$(DIR_O)\ScintillaGTKS.obj: ScintillaGTK.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SString.h ../src/ContractionState.h \
../src/SVector.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/CellBuffer.h ../src/CallTip.h ../src/KeyMap.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/AutoComplete.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Document.h ../src/Editor.h ../src/ScintillaBase.h \
../src/UniConversion.h
$(DIR_O)\ViewStyle.obj: ..\src\ViewStyle.cxx ..\include\Platform.h ..\include\Scintilla.h ..\src\Indicator.h \
..\src\LineMarker.h ..\src\Style.h ..\src\ViewStyle.h
$(DIR_O)\Style.obj: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \
../src/Style.h
$(DIR_O)\UniConversion.obj: ..\src\UniConversion.cxx ..\src\UniConversion.h
$(DIR_O)\StyleContext.obj: ../src/StyleContext.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h
$(DIR_O)\WindowAccessor.obj: ..\src\WindowAccessor.cxx ..\include\Platform.h ..\include\PropSet.h \
..\include\Accessor.h ..\include\WindowAccessor.h ..\include\Scintilla.h
$(DIR_O)\UniConversion.obj: ../src/UniConversion.cxx ../src/UniConversion.h
$(DIR_O)\ViewStyle.obj: ../src/ViewStyle.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h
$(DIR_O)\WindowAccessor.obj: ../src/WindowAccessor.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/WindowAccessor.h ../include/Scintilla.h
$(DIR_O)\XPM.obj: ../src/XPM.cxx ../include/Platform.h ../src/XPM.h

View File

@ -75,4 +75,5 @@ public:
virtual void ColourTo(unsigned int pos, int chAttr)=0;
virtual void SetLevel(int line, int level)=0;
virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
virtual void IndicatorFill(int start, int end, int indicator, int value)=0;
};

View File

@ -71,6 +71,6 @@ try:
f.ReadFromFile("Scintilla.iface")
Regenerate("Scintilla.h", printHFile, f)
Regenerate("SciLexer.h", printLexHFile, f)
print "Maximum ID is", max(x for x in f.values if int(x) < 3000)
print "Maximum ID is", max([x for x in f.values if int(x) < 3000])
except:
raise

View File

@ -5,6 +5,10 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
@ -51,6 +55,10 @@ public:
static const LexerModule *Find(const char *languageName);
};
#ifdef SCI_NAMESPACE
}
#endif
/**
* Check if a character is a space.
* This is ASCII specific but is safe with chars >= 0x80.

View File

@ -25,6 +25,7 @@
#define PLAT_GTK 0
#define PLAT_GTK_WIN32 0
#define PLAT_MACOSX 0
#define PLAT_WIN 0
#define PLAT_WX 0
#define PLAT_FOX 0
@ -46,12 +47,19 @@
#define PLAT_GTK_WIN32 1
#endif
#elif defined(MACOSX)
#undef PLAT_MACOSX
#define PLAT_MACOSX 1
#else
#undef PLAT_WIN
#define PLAT_WIN 1
#endif
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
// Underlying the implementation of the platform classes are platform specific types.
// Sometimes these need to be passed around by client code so they are defined here
@ -123,6 +131,9 @@ public:
}
int Width() { return right - left; }
int Height() { return bottom - top; }
bool Empty() {
return (Height() <= 0) || (Width() <= 0);
}
};
/**
@ -369,9 +380,23 @@ typedef void (*CallBackAction)(void*);
class Window {
protected:
WindowID id;
#if PLAT_MACOSX
void *windowRef;
void *control;
#endif
public:
Window() : id(0), cursorLast(cursorInvalid) {}
Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) {}
Window() : id(0), cursorLast(cursorInvalid) {
#if PLAT_MACOSX
windowRef = 0;
control = 0;
#endif
}
Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) {
#if PLAT_MACOSX
windowRef = 0;
control = 0;
#endif
}
virtual ~Window();
Window &operator=(WindowID id_) {
id = id_;
@ -392,6 +417,11 @@ public:
enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand };
void SetCursor(Cursor curs);
void SetTitle(const char *s);
PRectangle GetMonitorRect(Point pt);
#if PLAT_MACOSX
void SetWindow(void *ref) { windowRef = ref; };
void SetControl(void *_control) { control = _control; };
#endif
private:
Cursor cursorLast;
};
@ -515,8 +545,16 @@ public:
#ifdef NDEBUG
#define PLATFORM_ASSERT(c) ((void)0)
#else
#ifdef SCI_NAMESPACE
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__))
#else
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
#endif
#endif
#ifdef SCI_NAMESPACE
}
#endif
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER

View File

@ -13,6 +13,10 @@ bool EqualCaseInsensitive(const char *a, const char *b);
bool isprefix(const char *target, const char *prefix);
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
struct Property {
unsigned int hash;
char *key;
@ -29,7 +33,6 @@ protected:
Property *props[hashRoots];
Property *enumnext;
int enumhash;
static bool caseSensitiveFilenames;
static unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
@ -39,7 +42,6 @@ protected:
}
return ret;
}
static bool IncludesVar(const char *value, const char *key);
public:
PropSet *superPS;
@ -49,19 +51,12 @@ public:
void Set(const char *keyVal);
void Unset(const char *key, int lenKey=-1);
void SetMultiple(const char *s);
SString Get(const char *key);
SString GetExpanded(const char *key);
SString Expand(const char *withVars, int maxExpands=100);
int GetInt(const char *key, int defaultValue=0);
SString GetWild(const char *keybase, const char *filename);
SString GetNewExpand(const char *keybase, const char *filename="");
SString Get(const char *key) const;
SString GetExpanded(const char *key) const;
SString Expand(const char *withVars, int maxExpands=100) const;
int GetInt(const char *key, int defaultValue=0) const;
void Clear();
char *ToString(); // Caller must delete[] the return value
bool GetFirst(char **key, char **val);
bool GetNext(char **key, char **val);
static void SetCaseSensitiveFilenames(bool caseSensitiveFilenames_) {
caseSensitiveFilenames = caseSensitiveFilenames_;
}
char *ToString() const; // Caller must delete[] the return value
private:
// copy-value semantics not implemented
@ -75,35 +70,30 @@ class WordList {
public:
// Each word contains at least one character - a empty word acts as sentinel at the end.
char **words;
char **wordsNoCase;
char *list;
int len;
bool onlyLineEnds; ///< Delimited by any white space or only line ends
bool sorted;
bool sortedNoCase;
int starts[256];
WordList(bool onlyLineEnds_ = false) :
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
sorted(false), sortedNoCase(false) {}
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
sorted(false)
{}
~WordList() { Clear(); }
operator bool() { return len ? true : false; }
char *operator[](int ind) { return words[ind]; }
void Clear();
void Set(const char *s);
char *Allocate(int size);
void SetFromAllocated();
bool InList(const char *s);
bool InListAbbreviated(const char *s, const char marker);
const char *GetNearestWord(const char *wordStart, int searchLen,
bool ignoreCase = false, SString wordCharacters="", int wordIndex = -1);
char *GetNearestWords(const char *wordStart, int searchLen,
bool ignoreCase=false, char otherSeparator='\0', bool exactLen=false);
};
inline bool IsAlphabetic(unsigned int ch) {
return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
}
#ifdef SCI_NAMESPACE
}
#endif
#ifdef _MSC_VER
// Visual C++ doesn't like the private copy idiom for disabling

View File

@ -8,11 +8,16 @@
#ifndef SSTRING_H
#define SSTRING_H
// These functions are implemented because each platform calls them something different.
int CompareCaseInsensitive(const char *a, const char *b);
int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
bool EqualCaseInsensitive(const char *a, const char *b);
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
// Define another string class.
// While it would be 'better' to use std::string, that doubles the executable size.
// An SString may contain embedded nul characters.
@ -277,4 +282,8 @@ inline char *StringDup(
return SContainer::StringAllocate(s, len);
}
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -93,6 +93,14 @@
#define SCLEX_SPICE 78
#define SCLEX_D 79
#define SCLEX_CMAKE 80
#define SCLEX_GAP 81
#define SCLEX_PLM 82
#define SCLEX_PROGRESS 83
#define SCLEX_ABAQUS 84
#define SCLEX_ASYMPTOTE 85
#define SCLEX_R 86
#define SCLEX_MAGIK 87
#define SCLEX_POWERSHELL 88
#define SCLEX_SEARCHRESULT 98
#define SCLEX_OBJC 99
#define SCLEX_USER 100
@ -348,6 +356,9 @@
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
#define SCE_PL_POD_VERB 31
#define SCE_PL_SUB_PROTOTYPE 40
#define SCE_PL_FORMAT_IDENT 41
#define SCE_PL_FORMAT 42
#define SCE_RB_DEFAULT 0
#define SCE_RB_ERROR 1
#define SCE_RB_COMMENTLINE 2
@ -453,6 +464,7 @@
#define SCE_ERR_ABSF 18
#define SCE_ERR_TIDY 19
#define SCE_ERR_JAVA_STACK 20
#define SCE_ERR_VALUE 21
#define SCE_BAT_DEFAULT 0
#define SCE_BAT_COMMENT 1
#define SCE_BAT_WORD 2
@ -1139,6 +1151,123 @@
#define SCE_CMAKE_MACRODEF 12
#define SCE_CMAKE_STRINGVAR 13
#define SCE_CMAKE_NUMBER 14
#define SCE_GAP_DEFAULT 0
#define SCE_GAP_IDENTIFIER 1
#define SCE_GAP_KEYWORD 2
#define SCE_GAP_KEYWORD2 3
#define SCE_GAP_KEYWORD3 4
#define SCE_GAP_KEYWORD4 5
#define SCE_GAP_STRING 6
#define SCE_GAP_CHAR 7
#define SCE_GAP_OPERATOR 8
#define SCE_GAP_COMMENT 9
#define SCE_GAP_NUMBER 10
#define SCE_GAP_STRINGEOL 11
#define SCE_PLM_DEFAULT 0
#define SCE_PLM_COMMENT 1
#define SCE_PLM_STRING 2
#define SCE_PLM_NUMBER 3
#define SCE_PLM_IDENTIFIER 4
#define SCE_PLM_OPERATOR 5
#define SCE_PLM_CONTROL 6
#define SCE_PLM_KEYWORD 7
#define SCE_4GL_DEFAULT 0
#define SCE_4GL_NUMBER 1
#define SCE_4GL_WORD 2
#define SCE_4GL_STRING 3
#define SCE_4GL_CHARACTER 4
#define SCE_4GL_PREPROCESSOR 5
#define SCE_4GL_OPERATOR 6
#define SCE_4GL_IDENTIFIER 7
#define SCE_4GL_BLOCK 8
#define SCE_4GL_END 9
#define SCE_4GL_COMMENT1 10
#define SCE_4GL_COMMENT2 11
#define SCE_4GL_COMMENT3 12
#define SCE_4GL_COMMENT4 13
#define SCE_4GL_COMMENT5 14
#define SCE_4GL_COMMENT6 15
#define SCE_4GL_DEFAULT_ 16
#define SCE_4GL_NUMBER_ 17
#define SCE_4GL_WORD_ 18
#define SCE_4GL_STRING_ 19
#define SCE_4GL_CHARACTER_ 20
#define SCE_4GL_PREPROCESSOR_ 21
#define SCE_4GL_OPERATOR_ 22
#define SCE_4GL_IDENTIFIER_ 23
#define SCE_4GL_BLOCK_ 24
#define SCE_4GL_END_ 25
#define SCE_4GL_COMMENT1_ 26
#define SCE_4GL_COMMENT2_ 27
#define SCE_4GL_COMMENT3_ 28
#define SCE_4GL_COMMENT4_ 29
#define SCE_4GL_COMMENT5_ 30
#define SCE_4GL_COMMENT6_ 31
#define SCE_ABAQUS_DEFAULT 0
#define SCE_ABAQUS_COMMENT 1
#define SCE_ABAQUS_COMMENTBLOCK 2
#define SCE_ABAQUS_NUMBER 3
#define SCE_ABAQUS_STRING 4
#define SCE_ABAQUS_OPERATOR 5
#define SCE_ABAQUS_WORD 6
#define SCE_ABAQUS_PROCESSOR 7
#define SCE_ABAQUS_COMMAND 8
#define SCE_ABAQUS_SLASHCOMMAND 9
#define SCE_ABAQUS_STARCOMMAND 10
#define SCE_ABAQUS_ARGUMENT 11
#define SCE_ABAQUS_FUNCTION 12
#define SCE_ASY_DEFAULT 0
#define SCE_ASY_COMMENT 1
#define SCE_ASY_COMMENTLINE 2
#define SCE_ASY_NUMBER 3
#define SCE_ASY_WORD 4
#define SCE_ASY_STRING 5
#define SCE_ASY_CHARACTER 6
#define SCE_ASY_OPERATOR 7
#define SCE_ASY_IDENTIFIER 8
#define SCE_ASY_STRINGEOL 9
#define SCE_ASY_COMMENTLINEDOC 10
#define SCE_ASY_WORD2 11
#define SCE_R_DEFAULT 0
#define SCE_R_COMMENT 1
#define SCE_R_KWORD 2
#define SCE_R_BASEKWORD 3
#define SCE_R_OTHERKWORD 4
#define SCE_R_NUMBER 5
#define SCE_R_STRING 6
#define SCE_R_STRING2 7
#define SCE_R_OPERATOR 8
#define SCE_R_IDENTIFIER 9
#define SCE_R_INFIX 10
#define SCE_R_INFIXEOL 11
#define SCE_MAGIK_DEFAULT 0
#define SCE_MAGIK_COMMENT 1
#define SCE_MAGIK_HYPER_COMMENT 16
#define SCE_MAGIK_STRING 2
#define SCE_MAGIK_CHARACTER 3
#define SCE_MAGIK_NUMBER 4
#define SCE_MAGIK_IDENTIFIER 5
#define SCE_MAGIK_OPERATOR 6
#define SCE_MAGIK_FLOW 7
#define SCE_MAGIK_CONTAINER 8
#define SCE_MAGIK_BRACKET_BLOCK 9
#define SCE_MAGIK_BRACE_BLOCK 10
#define SCE_MAGIK_SQBRACKET_BLOCK 11
#define SCE_MAGIK_UNKNOWN_KEYWORD 12
#define SCE_MAGIK_KEYWORD 13
#define SCE_MAGIK_PRAGMA 14
#define SCE_MAGIK_SYMBOL 15
#define SCE_POWERSHELL_DEFAULT 0
#define SCE_POWERSHELL_COMMENT 1
#define SCE_POWERSHELL_STRING 2
#define SCE_POWERSHELL_CHARACTER 3
#define SCE_POWERSHELL_NUMBER 4
#define SCE_POWERSHELL_VARIABLE 5
#define SCE_POWERSHELL_OPERATOR 6
#define SCE_POWERSHELL_IDENTIFIER 7
#define SCE_POWERSHELL_KEYWORD 8
#define SCE_POWERSHELL_CMDLET 9
#define SCE_POWERSHELL_ALIAS 10
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface

View File

@ -118,6 +118,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_ARROWS 24
#define SC_MARK_PIXMAP 25
#define SC_MARK_FULLRECT 26
#define SC_MARK_LEFTRECT 27
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@ -159,7 +160,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define STYLE_INDENTGUIDE 37
#define STYLE_CALLTIP 38
#define STYLE_LASTPREDEFINED 39
#define STYLE_MAX 127
#define STYLE_MAX 255
#define SC_CHARSET_ANSI 0
#define SC_CHARSET_DEFAULT 1
#define SC_CHARSET_BALTIC 186
@ -227,7 +228,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETWORDCHARS 2077
#define SCI_BEGINUNDOACTION 2078
#define SCI_ENDUNDOACTION 2079
#define INDIC_MAX 7
#define INDIC_PLAIN 0
#define INDIC_SQUIGGLE 1
#define INDIC_TT 2
@ -236,6 +236,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_HIDDEN 5
#define INDIC_BOX 6
#define INDIC_ROUNDBOX 7
#define INDIC_MAX 31
#define INDIC_CONTAINER 8
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
#define INDIC2_MASK 0x80
@ -244,6 +246,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICGETSTYLE 2081
#define SCI_INDICSETFORE 2082
#define SCI_INDICGETFORE 2083
#define SCI_INDICSETUNDER 2510
#define SCI_INDICGETUNDER 2511
#define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETSTYLEBITS 2090
@ -295,6 +299,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETCOLUMN 2129
#define SCI_SETHSCROLLBAR 2130
#define SCI_GETHSCROLLBAR 2131
#define SC_IV_NONE 0
#define SC_IV_REAL 1
#define SC_IV_LOOKFORWARD 2
#define SC_IV_LOOKBOTH 3
#define SCI_SETINDENTATIONGUIDES 2132
#define SCI_GETINDENTATIONGUIDES 2133
#define SCI_SETHIGHLIGHTGUIDE 2134
@ -445,6 +453,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETLAYOUTCACHE 2273
#define SCI_SETSCROLLWIDTH 2274
#define SCI_GETSCROLLWIDTH 2275
#define SCI_SETSCROLLWIDTHTRACKING 2516
#define SCI_GETSCROLLWIDTHTRACKING 2517
#define SCI_TEXTWIDTH 2276
#define SCI_SETENDATLASTLINE 2277
#define SCI_GETENDATLASTLINE 2278
@ -496,6 +506,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_ZOOMOUT 2334
#define SCI_DELWORDLEFT 2335
#define SCI_DELWORDRIGHT 2336
#define SCI_DELWORDRIGHTEND 2518
#define SCI_LINECUT 2337
#define SCI_LINEDELETE 2338
#define SCI_LINETRANSPOSE 2339
@ -639,6 +650,24 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_ALPHA_NOALPHA 256
#define SCI_SETCARETLINEBACKALPHA 2470
#define SCI_GETCARETLINEBACKALPHA 2471
#define CARETSTYLE_INVISIBLE 0
#define CARETSTYLE_LINE 1
#define CARETSTYLE_BLOCK 2
#define SCI_SETCARETSTYLE 2512
#define SCI_GETCARETSTYLE 2513
#define SCI_SETINDICATORCURRENT 2500
#define SCI_GETINDICATORCURRENT 2501
#define SCI_SETINDICATORVALUE 2502
#define SCI_GETINDICATORVALUE 2503
#define SCI_INDICATORFILLRANGE 2504
#define SCI_INDICATORCLEARRANGE 2505
#define SCI_INDICATORALLONFOR 2506
#define SCI_INDICATORVALUEAT 2507
#define SCI_INDICATORSTART 2508
#define SCI_INDICATOREND 2509
#define SCI_SETPOSITIONCACHE 2514
#define SCI_GETPOSITIONCACHE 2515
#define SCI_COPYALLOWLINE 2519
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@ -667,7 +696,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MOD_BEFOREDELETE 0x800
#define SC_MULTILINEUNDOREDO 0x1000
#define SC_STARTACTION 0x2000
#define SC_MODEVENTMASKALL 0x2FFF
#define SC_MOD_CHANGEINDICATOR 0x4000
#define SC_MOD_CHANGELINESTATE 0x8000
#define SC_MODEVENTMASKALL 0xFFFF
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
@ -717,12 +748,18 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_HOTSPOTDOUBLECLICK 2020
#define SCN_CALLTIPCLICK 2021
#define SCN_AUTOCSELECTION 2022
#define SCN_INDICATORCLICK 2023
#define SCN_INDICATORRELEASE 2024
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// These structures are defined to be exactly the same shape as the Win32
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
// So older code that treats Scintilla as a RichEdit will work.
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
struct CharacterRange {
long cpMin;
long cpMax;
@ -784,6 +821,10 @@ struct SCNotification {
int y; // SCN_DWELLSTART, SCN_DWELLEND
};
#ifdef SCI_NAMESPACE
}
#endif
// Deprecation section listing all API features that are deprecated and will
// will be removed completely in a future version.
// To enable these features define INCLUDE_DEPRECATED_FEATURES

View File

@ -268,6 +268,7 @@ val SC_MARK_DOTDOTDOT=23
val SC_MARK_ARROWS=24
val SC_MARK_PIXMAP=25
val SC_MARK_FULLRECT=26
val SC_MARK_LEFTRECT=27
val SC_MARK_CHARACTER=10000
@ -360,7 +361,7 @@ val STYLE_CONTROLCHAR=36
val STYLE_INDENTGUIDE=37
val STYLE_CALLTIP=38
val STYLE_LASTPREDEFINED=39
val STYLE_MAX=127
val STYLE_MAX=255
# Character set identifiers are used in StyleSetCharacterSet.
# The values are the same as the Windows *_CHARSET values.
@ -525,8 +526,8 @@ fun void BeginUndoAction=2078(,)
# End a sequence of actions that is undone and redone as a unit.
fun void EndUndoAction=2079(,)
# Indicator style enumeration and some constants
enu IndicatorStyle=INDIC_
val INDIC_MAX=7
val INDIC_PLAIN=0
val INDIC_SQUIGGLE=1
val INDIC_TT=2
@ -535,6 +536,8 @@ val INDIC_STRIKE=4
val INDIC_HIDDEN=5
val INDIC_BOX=6
val INDIC_ROUNDBOX=7
val INDIC_MAX=31
val INDIC_CONTAINER=8
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
val INDIC2_MASK=0x80
@ -552,6 +555,12 @@ set void IndicSetFore=2082(int indic, colour fore)
# Retrieve the foreground colour of an indicator.
get colour IndicGetFore=2083(int indic,)
# Set an indicator to draw under text or over(default).
set void IndicSetUnder=2510(int indic, bool under)
# Retrieve whether indicator drawn under or over text.
get bool IndicGetUnder=2511(int indic,)
# Set the foreground colour of all whitespace and whether to use this setting.
fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
@ -719,11 +728,17 @@ set void SetHScrollBar=2130(bool show,)
# Is the horizontal scroll bar visible?
get bool GetHScrollBar=2131(,)
enu IndentView=SC_IV_
val SC_IV_NONE=0
val SC_IV_REAL=1
val SC_IV_LOOKFORWARD=2
val SC_IV_LOOKBOTH=3
# Show or hide indentation guides.
set void SetIndentationGuides=2132(bool show,)
set void SetIndentationGuides=2132(int indentView,)
# Are the indentation guides visible?
get bool GetIndentationGuides=2133(,)
get int GetIndentationGuides=2133(,)
# Set the highlighted indentation guide column.
# 0 = no highlighted guide.
@ -1135,6 +1150,12 @@ set void SetScrollWidth=2274(int pixelWidth,)
# Retrieve the document width assumed for scrolling.
get int GetScrollWidth=2275(,)
# Sets whether the maximum width line displayed is used to set scroll width.
set void SetScrollWidthTracking=2516(bool tracking,)
# Retrieve whether the scroll width tracks wide lines.
get bool GetScrollWidthTracking=2517(,)
# Measure the pixel width of some text in a particular style.
# NUL terminated text argument.
# Does not handle tab or control characters.
@ -1298,6 +1319,9 @@ fun void DelWordLeft=2335(,)
# Delete the word to the right of the caret.
fun void DelWordRight=2336(,)
# Delete the word to the right of the caret, but not the trailing non-word characters.
fun void DelWordRightEnd=2518(,)
# Cut the line containing the caret.
fun void LineCut=2337(,)
@ -1726,6 +1750,56 @@ set void SetCaretLineBackAlpha=2470(int alpha,)
# Get the background alpha of the caret line.
get int GetCaretLineBackAlpha=2471(,)
enu CaretStyle=CARETSTYLE_
val CARETSTYLE_INVISIBLE=0
val CARETSTYLE_LINE=1
val CARETSTYLE_BLOCK=2
# Set the style of the caret to be drawn.
set void SetCaretStyle=2512(int caretStyle,)
# Returns the current style of the caret.
get int GetCaretStyle=2513(,)
# Set the indicator used for IndicatorFillRange and IndicatorClearRange
set void SetIndicatorCurrent=2500(int indicator,)
# Get the current indicator
get int GetIndicatorCurrent=2501(,)
# Set the value used for IndicatorFillRange
set void SetIndicatorValue=2502(int value,)
# Get the current indicator vaue
get int GetIndicatorValue=2503(,)
# Turn a indicator on over a range.
fun void IndicatorFillRange=2504(int position, int fillLength)
# Turn a indicator off over a range.
fun void IndicatorClearRange=2505(int position, int clearLength)
# Are any indicators present at position?
fun int IndicatorAllOnFor=2506(int position,)
# What value does a particular indicator have at at a position?
fun int IndicatorValueAt=2507(int indicator, int position)
# Where does a particular indicator start?
fun int IndicatorStart=2508(int indicator, int position)
# Where does a particular indicator end?
fun int IndicatorEnd=2509(int indicator, int position)
# Set number of entries in position cache
set void SetPositionCache=2514(int size,)
# How many entries are allocated to the position cache?
get int GetPositionCache=2515(,)
# Copy the selection, if selection empty copy the line with the caret
fun void CopyAllowLine=2519(,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -1789,7 +1863,9 @@ val SC_MOD_BEFOREINSERT=0x400
val SC_MOD_BEFOREDELETE=0x800
val SC_MULTILINEUNDOREDO=0x1000
val SC_STARTACTION=0x2000
val SC_MODEVENTMASKALL=0x2FFF
val SC_MOD_CHANGEINDICATOR=0x4000
val SC_MOD_CHANGELINESTATE=0x8000
val SC_MODEVENTMASKALL=0xFFFF
# For compatibility, these go through the COMMAND notification rather than NOTIFY
# and should have had exactly the same values as the EN_* constants.
@ -1913,6 +1989,14 @@ val SCLEX_OPAL=77
val SCLEX_SPICE=78
val SCLEX_D=79
val SCLEX_CMAKE=80
val SCLEX_GAP=81
val SCLEX_PLM=82
val SCLEX_PROGRESS=83
val SCLEX_ABAQUS=84
val SCLEX_ASYMPTOTE=85
val SCLEX_R=86
val SCLEX_MAGIK=87
val SCLEX_POWERSHELL=88
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2165,6 +2249,9 @@ val SCE_PL_STRING_QX=28
val SCE_PL_STRING_QR=29
val SCE_PL_STRING_QW=30
val SCE_PL_POD_VERB=31
val SCE_PL_SUB_PROTOTYPE=40
val SCE_PL_FORMAT_IDENT=41
val SCE_PL_FORMAT=42
# Lexical states for SCLEX_RUBY
lex Ruby=SCLEX_RUBY SCE_RB_
val SCE_RB_DEFAULT=0
@ -2284,6 +2371,7 @@ val SCE_ERR_IFORT=17
val SCE_ERR_ABSF=18
val SCE_ERR_TIDY=19
val SCE_ERR_JAVA_STACK=20
val SCE_ERR_VALUE=21
# Lexical states for SCLEX_BATCH
lex Batch=SCLEX_BATCH SCE_BAT_
val SCE_BAT_DEFAULT=0
@ -2649,6 +2737,7 @@ val SCE_YAML_REFERENCE=5
val SCE_YAML_DOCUMENT=6
val SCE_YAML_TEXT=7
val SCE_YAML_ERROR=8
val SCE_YAML_OPERATOR=9
# Lexical states for SCLEX_TEX
lex TeX=SCLEX_TEX SCE_TEX_
val SCE_TEX_DEFAULT=0
@ -3072,6 +3161,139 @@ val SCE_CMAKE_IFDEFINEDEF=11
val SCE_CMAKE_MACRODEF=12
val SCE_CMAKE_STRINGVAR=13
val SCE_CMAKE_NUMBER=14
# Lexical states for SCLEX_GAP
lex Gap=SCLEX_GAP SCE_GAP_
val SCE_GAP_DEFAULT=0
val SCE_GAP_IDENTIFIER=1
val SCE_GAP_KEYWORD=2
val SCE_GAP_KEYWORD2=3
val SCE_GAP_KEYWORD3=4
val SCE_GAP_KEYWORD4=5
val SCE_GAP_STRING=6
val SCE_GAP_CHAR=7
val SCE_GAP_OPERATOR=8
val SCE_GAP_COMMENT=9
val SCE_GAP_NUMBER=10
val SCE_GAP_STRINGEOL=11
# Lexical state for SCLEX_PLM
lex PLM=SCLEX_PLM SCE_PLM_
val SCE_PLM_DEFAULT=0
val SCE_PLM_COMMENT=1
val SCE_PLM_STRING=2
val SCE_PLM_NUMBER=3
val SCE_PLM_IDENTIFIER=4
val SCE_PLM_OPERATOR=5
val SCE_PLM_CONTROL=6
val SCE_PLM_KEYWORD=7
# Lexical state for SCLEX_PROGRESS
lex Progress=SCLEX_PROGRESS SCE_4GL_
val SCE_4GL_DEFAULT=0
val SCE_4GL_NUMBER=1
val SCE_4GL_WORD=2
val SCE_4GL_STRING=3
val SCE_4GL_CHARACTER=4
val SCE_4GL_PREPROCESSOR=5
val SCE_4GL_OPERATOR=6
val SCE_4GL_IDENTIFIER=7
val SCE_4GL_BLOCK=8
val SCE_4GL_END=9
val SCE_4GL_COMMENT1=10
val SCE_4GL_COMMENT2=11
val SCE_4GL_COMMENT3=12
val SCE_4GL_COMMENT4=13
val SCE_4GL_COMMENT5=14
val SCE_4GL_COMMENT6=15
val SCE_4GL_DEFAULT_=16
val SCE_4GL_NUMBER_=17
val SCE_4GL_WORD_=18
val SCE_4GL_STRING_=19
val SCE_4GL_CHARACTER_=20
val SCE_4GL_PREPROCESSOR_=21
val SCE_4GL_OPERATOR_=22
val SCE_4GL_IDENTIFIER_=23
val SCE_4GL_BLOCK_=24
val SCE_4GL_END_=25
val SCE_4GL_COMMENT1_=26
val SCE_4GL_COMMENT2_=27
val SCE_4GL_COMMENT3_=28
val SCE_4GL_COMMENT4_=29
val SCE_4GL_COMMENT5_=30
val SCE_4GL_COMMENT6_=31
# Lexical states for SCLEX_ABAQUS
lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_
val SCE_ABAQUS_DEFAULT=0
val SCE_ABAQUS_COMMENT=1
val SCE_ABAQUS_COMMENTBLOCK=2
val SCE_ABAQUS_NUMBER=3
val SCE_ABAQUS_STRING=4
val SCE_ABAQUS_OPERATOR=5
val SCE_ABAQUS_WORD=6
val SCE_ABAQUS_PROCESSOR=7
val SCE_ABAQUS_COMMAND=8
val SCE_ABAQUS_SLASHCOMMAND=9
val SCE_ABAQUS_STARCOMMAND=10
val SCE_ABAQUS_ARGUMENT=11
val SCE_ABAQUS_FUNCTION=12
# Lexical states for SCLEX_ASYMPTOTE
lex Asymptote=SCLEX_ASYMPTOTE SCE_ASY_
val SCE_ASY_DEFAULT=0
val SCE_ASY_COMMENT=1
val SCE_ASY_COMMENTLINE=2
val SCE_ASY_NUMBER=3
val SCE_ASY_WORD=4
val SCE_ASY_STRING=5
val SCE_ASY_CHARACTER=6
val SCE_ASY_OPERATOR=7
val SCE_ASY_IDENTIFIER=8
val SCE_ASY_STRINGEOL=9
val SCE_ASY_COMMENTLINEDOC=10
val SCE_ASY_WORD2=11
# Lexical states for SCLEX_R
lex R=SCLEX_R SCE_R_
val SCE_R_DEFAULT=0
val SCE_R_COMMENT=1
val SCE_R_KWORD=2
val SCE_R_BASEKWORD=3
val SCE_R_OTHERKWORD=4
val SCE_R_NUMBER=5
val SCE_R_STRING=6
val SCE_R_STRING2=7
val SCE_R_OPERATOR=8
val SCE_R_IDENTIFIER=9
val SCE_R_INFIX=10
val SCE_R_INFIXEOL=11
# Lexical state for SCLEX_MAGIKSF
lex MagikSF=SCLEX_MAGIKSF SCE_MAGIK_
val SCE_MAGIK_DEFAULT=0
val SCE_MAGIK_COMMENT=1
val SCE_MAGIK_HYPER_COMMENT=16
val SCE_MAGIK_STRING=2
val SCE_MAGIK_CHARACTER=3
val SCE_MAGIK_NUMBER=4
val SCE_MAGIK_IDENTIFIER=5
val SCE_MAGIK_OPERATOR=6
val SCE_MAGIK_FLOW=7
val SCE_MAGIK_CONTAINER=8
val SCE_MAGIK_BRACKET_BLOCK=9
val SCE_MAGIK_BRACE_BLOCK=10
val SCE_MAGIK_SQBRACKET_BLOCK=11
val SCE_MAGIK_UNKNOWN_KEYWORD=12
val SCE_MAGIK_KEYWORD=13
val SCE_MAGIK_PRAGMA=14
val SCE_MAGIK_SYMBOL=15
# Lexical state for SCLEX_POWERSHELL
lex PowerShell=SCLEX_POWERSHELL SCE_POWERSHELL_
val SCE_POWERSHELL_DEFAULT=0
val SCE_POWERSHELL_COMMENT=1
val SCE_POWERSHELL_STRING=2
val SCE_POWERSHELL_CHARACTER=3
val SCE_POWERSHELL_NUMBER=4
val SCE_POWERSHELL_VARIABLE=5
val SCE_POWERSHELL_OPERATOR=6
val SCE_POWERSHELL_IDENTIFIER=7
val SCE_POWERSHELL_KEYWORD=8
val SCE_POWERSHELL_CMDLET=9
val SCE_POWERSHELL_ALIAS=10
# Events
@ -3098,6 +3320,8 @@ evt void HotSpotClick=2019(int modifiers, int position)
evt void HotSpotDoubleClick=2020(int modifiers, int position)
evt void CallTipClick=2021(int position)
evt void AutoCSelection=2022(string text)
evt void IndicatorClick=2023(int modifiers, int position)
evt void IndicatorRelease=2024(int modifiers, int position)
cat Deprecated

View File

@ -6,6 +6,10 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class WindowAccessor : public Accessor {
@ -54,4 +58,9 @@ public:
void ColourTo(unsigned int pos, int chAttr);
void SetLevel(int line, int level);
int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
void IndicatorFill(int start, int end, int indicator, int value);
};
#ifdef SCI_NAMESPACE
}
#endif

View File

@ -14,6 +14,10 @@
#include "PropSet.h"
#include "AutoComplete.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
AutoComplete::AutoComplete() :
active(false),
separator(' '),
@ -172,3 +176,4 @@ void AutoComplete::Select(const char *word) {
lb->Select(location);
}

View File

@ -8,6 +8,10 @@
#ifndef AUTOCOMPLETE_H
#define AUTOCOMPLETE_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class AutoComplete {
@ -67,4 +71,8 @@ public:
void Select(const char *word);
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -12,6 +12,11 @@
#include "Scintilla.h"
#include "CallTip.h"
#include <stdio.h>
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static const int insetX = 5; // text inset in x from calltip border
static const int widthArrow = 14;
@ -29,8 +34,14 @@ CallTip::CallTip() {
tabSize = 0;
useStyleCallTip = false; // for backwards compatibility
#ifdef __APPLE__
// proper apple colours for the default
colourBG.desired = ColourDesired(0xff, 0xff, 0xc6);
colourUnSel.desired = ColourDesired(0, 0, 0);
#else
colourBG.desired = ColourDesired(0xff, 0xff, 0xff);
colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80);
#endif
colourSel.desired = ColourDesired(0, 0, 0x80);
colourShade.desired = ColourDesired(0, 0, 0);
colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0);
@ -170,6 +181,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
char *chunkVal = val;
bool moreChunks = true;
int maxWidth = 0;
while (moreChunks) {
char *chunkEnd = strchr(chunkVal, '\n');
if (chunkEnd == NULL) {
@ -217,6 +229,8 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
offsetMain = insetX; // initial alignment assuming no arrows
PaintContents(surfaceWindow, true);
#ifndef __APPLE__
// OSX doesn't put borders on "help tags"
// Draw a raised border around the edges of the window
surfaceWindow->MoveTo(0, rcClientSize.bottom - 1);
surfaceWindow->PenColour(colourShade.allocated);
@ -225,6 +239,7 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
surfaceWindow->PenColour(colourLight.allocated);
surfaceWindow->LineTo(0, 0);
surfaceWindow->LineTo(0, rcClientSize.bottom - 1);
#endif
}
void CallTip::MouseClick(Point pt) {

View File

@ -8,6 +8,10 @@
#ifndef CALLTIP_H
#define CALLTIP_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class CallTip {
@ -76,4 +80,8 @@ public:
void SetForeBack(const ColourPair &fore, const ColourPair &back);
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -13,11 +13,14 @@
#include "Platform.h"
#include "Scintilla.h"
#include "SVector.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "CellBuffer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
MarkerHandleSet::MarkerHandleSet() {
root = 0;
}
@ -468,6 +471,7 @@ void UndoHistory::BeginUndoAction() {
}
void UndoHistory::EndUndoAction() {
PLATFORM_ASSERT(undoSequenceDepth > 0);
EnsureUndoRoom();
undoSequenceDepth--;
if (0 == undoSequenceDepth) {
@ -559,7 +563,7 @@ CellBuffer::CellBuffer() {
CellBuffer::~CellBuffer() {
}
char CellBuffer::CharAt(int position) {
char CellBuffer::CharAt(int position) const {
return substance.ValueAt(position);
}
@ -649,7 +653,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startS
return data;
}
int CellBuffer::Length() {
int CellBuffer::Length() const {
return substance.Length();
}
@ -658,11 +662,11 @@ void CellBuffer::Allocate(int newSize) {
style.ReAllocate(newSize);
}
int CellBuffer::Lines() {
int CellBuffer::Lines() const {
return lv.Lines();
}
int CellBuffer::LineStart(int line) {
int CellBuffer::LineStart(int line) const {
if (line < 0)
return 0;
else if (line >= Lines())
@ -722,6 +726,21 @@ int CellBuffer::LineFromHandle(int markerHandle) {
// Without undo
void CellBuffer::InsertLine(int line, int position) {
lv.InsertLine(line, position);
if (lineStates.Length()) {
lineStates.EnsureLength(line);
lineStates.Insert(line, 0);
}
}
void CellBuffer::RemoveLine(int line) {
lv.RemoveLine(line);
if (lineStates.Length() > line) {
lineStates.Delete(line);
}
}
void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) {
if (insertLength == 0)
return;
@ -737,21 +756,21 @@ void CellBuffer::BasicInsertString(int position, const char *s, int insertLength
char chAfter = substance.ValueAt(position + insertLength);
if (chPrev == '\r' && chAfter == '\n') {
// Splitting up a crlf pair at position
lv.InsertLine(lineInsert, position);
InsertLine(lineInsert, position);
lineInsert++;
}
char ch = ' ';
for (int i = 0; i < insertLength; i++) {
ch = s[i];
if (ch == '\r') {
lv.InsertLine(lineInsert, (position + i) + 1);
InsertLine(lineInsert, (position + i) + 1);
lineInsert++;
} else if (ch == '\n') {
if (chPrev == '\r') {
// Patch up what was end of line
lv.SetLineStart(lineInsert - 1, (position + i) + 1);
} else {
lv.InsertLine(lineInsert, (position + i) + 1);
InsertLine(lineInsert, (position + i) + 1);
lineInsert++;
}
}
@ -761,7 +780,7 @@ void CellBuffer::BasicInsertString(int position, const char *s, int insertLength
if (chAfter == '\n') {
if (ch == '\r') {
// End of line already in buffer so drop the newly created one
lv.RemoveLine(lineInsert - 1);
RemoveLine(lineInsert - 1);
}
}
}
@ -796,13 +815,13 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
chNext = substance.ValueAt(position + i + 1);
if (ch == '\r') {
if (chNext != '\n') {
lv.RemoveLine(lineRemove);
RemoveLine(lineRemove);
}
} else if (ch == '\n') {
if (ignoreNL) {
ignoreNL = false; // Further \n are real deletions
} else {
lv.RemoveLine(lineRemove);
RemoveLine(lineRemove);
}
}
@ -813,7 +832,7 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
char chAfter = substance.ValueAt(position + deleteLength);
if (chBefore == '\r' && chAfter == '\n') {
// Using lineRemove-1 as cr ended line before start of deletion
lv.RemoveLine(lineRemove - 1);
RemoveLine(lineRemove - 1);
lv.SetLineStart(lineRemove - 1, position + 1);
}
}
@ -888,12 +907,14 @@ void CellBuffer::PerformRedoStep() {
}
int CellBuffer::SetLineState(int line, int state) {
lineStates.EnsureLength(line + 1);
int stateOld = lineStates[line];
lineStates[line] = state;
return stateOld;
}
int CellBuffer::GetLineState(int line) {
lineStates.EnsureLength(line + 1);
return lineStates[line];
}

View File

@ -8,6 +8,10 @@
#ifndef CELLBUFFER_H
#define CELLBUFFER_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
@ -63,11 +67,11 @@ public:
void InsertLine(int line, int position);
void SetLineStart(int line, int position);
void RemoveLine(int line);
int Lines() {
int Lines() const {
return starts.Partitions();
}
int LineFromPosition(int pos);
int LineStart(int line) {
int LineStart(int line) const {
return starts.PositionFromPartition(line);
}
@ -156,7 +160,7 @@ private:
LineVector lv;
SVector lineStates;
SplitVector<int> lineStates;
public:
@ -164,15 +168,17 @@ public:
~CellBuffer();
/// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(int position);
char CharAt(int position) const;
void GetCharRange(char *buffer, int position, int lengthRetrieve);
char StyleAt(int position);
int Length();
int Length() const;
void Allocate(int newSize);
int Lines();
int LineStart(int line);
int Lines() const;
int LineStart(int line) const;
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
void InsertLine(int line, int position);
void RemoveLine(int line);
const char *InsertString(int position, const char *s, int insertLength, bool &startSequence);
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
@ -228,4 +234,8 @@ public:
void ClearLevels();
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -0,0 +1,58 @@
// Scintilla source code edit control
/** @file CharacterSet.h
** Encapsulates a set of characters. Used to test if a character is within a set.
**/
// Copyright 2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
class CharacterSet {
int size;
bool valueAfter;
bool *bset;
public:
enum setBase {
setNone=0,
setLower=1,
setUpper=2,
setDigits=4,
setAlpha=setLower|setUpper,
setAlphaNum=setAlpha|setDigits
};
CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) {
size = size_;
valueAfter = valueAfter_;
bset = new bool[size];
for (int i=0; i < size; i++) {
bset[i] = false;
}
AddString(initialSet);
if (base & setLower)
AddString("abcdefghijklmnopqrstuvwxyz");
if (base & setUpper)
AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
if (base & setDigits)
AddString("0123456789");
}
~CharacterSet() {
delete []bset;
bset = 0;
size = 0;
}
void Add(int val) {
PLATFORM_ASSERT(val >= 0);
PLATFORM_ASSERT(val < size);
bset[val] = true;
}
void AddString(const char *CharacterSet) {
for (const char *cp=CharacterSet; *cp; cp++) {
int val = static_cast<unsigned char>(*cp);
PLATFORM_ASSERT(val >= 0);
PLATFORM_ASSERT(val < size);
bset[val] = true;
}
}
bool Contains(int val) const {
PLATFORM_ASSERT(val >= 0);
return (val < size) ? bset[val] : valueAfter;
}
};

View File

@ -1,289 +1,251 @@
// Scintilla source code edit control
/** @file ContractionState.cxx
** Manages visibility of lines for folding.
** Manages visibility of lines for folding and wrapping.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
#include "Platform.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
OneLine::OneLine() {
displayLine = 0;
//docLine = 0;
visible = true;
height = 1;
expanded = true;
}
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
ContractionState::ContractionState() {
lines = 0;
size = 0;
linesInDoc = 1;
linesInDisplay = 1;
valid = false;
docLines = 0;
sizeDocLines = 0;
ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) {
//InsertLine(0);
}
ContractionState::~ContractionState() {
Clear();
}
void ContractionState::MakeValid() const {
if (!valid) {
// Could be cleverer by keeping the index of the last still valid entry
// rather than invalidating all.
linesInDisplay = 0;
for (int lineInDoc=0; lineInDoc<linesInDoc; lineInDoc++) {
lines[lineInDoc].displayLine = linesInDisplay;
if (lines[lineInDoc].visible) {
linesInDisplay += lines[lineInDoc].height;
}
}
if (sizeDocLines < linesInDisplay) {
delete []docLines;
int *docLinesNew = new int[linesInDisplay + growSize];
if (!docLinesNew) {
docLines = 0;
sizeDocLines = 0;
return;
}
docLines = docLinesNew;
sizeDocLines = linesInDisplay + growSize;
}
int lineInDisplay=0;
for (int line=0; line<linesInDoc; line++) {
if (lines[line].visible) {
for (int linePiece=0; linePiece<lines[line].height; linePiece++) {
docLines[lineInDisplay] = line;
lineInDisplay++;
}
}
}
valid = true;
void ContractionState::EnsureData() {
if (OneToOne()) {
visible = new RunStyles();
expanded = new RunStyles();
heights = new RunStyles();
displayLines = new Partitioning(4);
InsertLines(0, linesInDocument);
}
}
void ContractionState::Clear() {
delete []lines;
lines = 0;
size = 0;
linesInDoc = 1;
linesInDisplay = 1;
delete []docLines;
docLines = 0;
sizeDocLines = 0;
delete visible;
visible = 0;
delete expanded;
expanded = 0;
delete heights;
heights = 0;
delete displayLines;
displayLines = 0;
linesInDocument = 1;
}
int ContractionState::LinesInDoc() const {
return linesInDoc;
if (OneToOne()) {
return linesInDocument;
} else {
return displayLines->Partitions() - 1;
}
}
int ContractionState::LinesDisplayed() const {
if (size != 0) {
MakeValid();
if (OneToOne()) {
return linesInDocument;
} else {
return displayLines->PositionFromPartition(LinesInDoc());
}
return linesInDisplay;
}
int ContractionState::DisplayFromDoc(int lineDoc) const {
if (size == 0) {
if (OneToOne()) {
return lineDoc;
} else {
if (lineDoc > displayLines->Partitions())
lineDoc = displayLines->Partitions();
return displayLines->PositionFromPartition(lineDoc);
}
MakeValid();
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].displayLine;
}
return -1;
}
int ContractionState::DocFromDisplay(int lineDisplay) const {
if (lineDisplay <= 0)
return 0;
if (lineDisplay >= linesInDisplay)
return linesInDoc;
if (size == 0)
if (OneToOne()) {
return lineDisplay;
MakeValid();
if (docLines) { // Valid allocation
return docLines[lineDisplay];
} else {
if (lineDisplay <= 0) {
return 0;
}
if (lineDisplay > LinesDisplayed()) {
return displayLines->PartitionFromPosition(LinesDisplayed());
}
int lineDoc = displayLines->PartitionFromPosition(lineDisplay);
PLATFORM_ASSERT(GetVisible(lineDoc));
return lineDoc;
}
}
void ContractionState::Grow(int sizeNew) {
OneLine *linesNew = new OneLine[sizeNew];
if (linesNew) {
int i = 0;
for (; i < size; i++) {
linesNew[i] = lines[i];
}
for (; i < sizeNew; i++) {
linesNew[i].displayLine = i;
}
delete []lines;
lines = linesNew;
size = sizeNew;
valid = false;
void ContractionState::InsertLine(int lineDoc) {
if (OneToOne()) {
linesInDocument++;
} else {
Platform::DebugPrintf("No memory available\n");
// TODO: Blow up
visible->InsertSpace(lineDoc, 1);
visible->SetValueAt(lineDoc, 1);
expanded->InsertSpace(lineDoc, 1);
expanded->SetValueAt(lineDoc, 1);
heights->InsertSpace(lineDoc, 1);
heights->SetValueAt(lineDoc, 1);
int lineDisplay = DisplayFromDoc(lineDoc);
displayLines->InsertPartition(lineDoc, lineDisplay);
displayLines->InsertText(lineDoc, 1);
}
}
void ContractionState::InsertLines(int lineDoc, int lineCount) {
if (size == 0) {
linesInDoc += lineCount;
linesInDisplay += lineCount;
return;
for (int l = 0; l < lineCount; l++) {
InsertLine(lineDoc + l);
}
//Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc);
if ((linesInDoc + lineCount + 2) >= size) {
Grow(linesInDoc + lineCount + growSize);
Check();
}
linesInDoc += lineCount;
for (int i = linesInDoc; i >= lineDoc + lineCount; i--) {
lines[i].visible = lines[i - lineCount].visible;
lines[i].height = lines[i - lineCount].height;
linesInDisplay += lines[i].height;
lines[i].expanded = lines[i - lineCount].expanded;
void ContractionState::DeleteLine(int lineDoc) {
if (OneToOne()) {
linesInDocument--;
} else {
if (GetVisible(lineDoc)) {
displayLines->InsertText(lineDoc, -heights->ValueAt(lineDoc));
}
for (int d=0;d<lineCount;d++) {
lines[lineDoc+d].visible = true; // Should inherit visibility from context ?
lines[lineDoc+d].height = 1;
lines[lineDoc+d].expanded = true;
displayLines->RemovePartition(lineDoc);
visible->DeleteRange(lineDoc, 1);
expanded->DeleteRange(lineDoc, 1);
heights->DeleteRange(lineDoc, 1);
}
valid = false;
}
void ContractionState::DeleteLines(int lineDoc, int lineCount) {
if (size == 0) {
linesInDoc -= lineCount;
linesInDisplay -= lineCount;
return;
for (int l = 0; l < lineCount; l++) {
DeleteLine(lineDoc);
}
int deltaDisplayed = 0;
for (int d=0;d<lineCount;d++) {
if (lines[lineDoc+d].visible)
deltaDisplayed -= lines[lineDoc+d].height;
}
for (int i = lineDoc; i < linesInDoc-lineCount; i++) {
if (i != 0) // Line zero is always visible
lines[i].visible = lines[i + lineCount].visible;
lines[i].expanded = lines[i + lineCount].expanded;
lines[i].height = lines[i + lineCount].height;
}
linesInDoc -= lineCount;
linesInDisplay += deltaDisplayed;
valid = false;
Check();
}
bool ContractionState::GetVisible(int lineDoc) const {
if (size == 0)
if (OneToOne()) {
return true;
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].visible;
} else {
return false;
if (lineDoc >= visible->Length())
return true;
return visible->ValueAt(lineDoc) == 1;
}
}
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) {
if (lineDocStart == 0)
lineDocStart++;
if (lineDocStart > lineDocEnd)
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) {
if (OneToOne() && visible_) {
return false;
if (size == 0) {
Grow(linesInDoc + growSize);
}
// TODO: modify docLine members to mirror displayLine
} else {
EnsureData();
int delta = 0;
// Change lineDocs
if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < linesInDoc)) {
Check();
if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) {
for (int line = lineDocStart; line <= lineDocEnd; line++) {
if (lines[line].visible != visible) {
delta += visible ? lines[line].height : -lines[line].height;
lines[line].visible = visible;
valid = false;
if (GetVisible(line) != visible_) {
int difference = visible_ ? heights->ValueAt(line) : -heights->ValueAt(line);
visible->SetValueAt(line, visible_ ? 1 : 0);
displayLines->InsertText(line, difference);
delta += difference;
}
}
} else {
return false;
}
linesInDisplay += delta;
Check();
return delta != 0;
}
}
bool ContractionState::GetExpanded(int lineDoc) const {
if (size == 0)
if (OneToOne()) {
return true;
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].expanded;
} else {
return false;
Check();
return expanded->ValueAt(lineDoc) == 1;
}
}
bool ContractionState::SetExpanded(int lineDoc, bool expanded) {
if (size == 0) {
if (expanded) {
// If in completely expanded state then setting
// one line to expanded has no effect.
bool ContractionState::SetExpanded(int lineDoc, bool expanded_) {
if (OneToOne() && expanded_) {
return false;
}
Grow(linesInDoc + growSize);
}
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
if (lines[lineDoc].expanded != expanded) {
lines[lineDoc].expanded = expanded;
} else {
EnsureData();
if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) {
expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0);
Check();
return true;
}
}
} else {
Check();
return false;
}
}
}
int ContractionState::GetHeight(int lineDoc) const {
if (size == 0)
if (OneToOne()) {
return 1;
if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
return lines[lineDoc].height;
} else {
return 1;
return heights->ValueAt(lineDoc);
}
}
// Set the number of display lines needed for this line.
// Return true if this is a change.
bool ContractionState::SetHeight(int lineDoc, int height) {
if (lineDoc > linesInDoc)
return false;
if (size == 0) {
if (height == 1) {
// If in completely expanded state then all lines
// assumed to have height of one so no effect here.
if (OneToOne() && (height == 1)) {
return false;
} else {
EnsureData();
if (GetHeight(lineDoc) != height) {
if (GetVisible(lineDoc)) {
displayLines->InsertText(lineDoc, height - GetHeight(lineDoc));
}
Grow(linesInDoc + growSize);
}
if (lines[lineDoc].height != height) {
lines[lineDoc].height = height;
valid = false;
heights->SetValueAt(lineDoc, height);
Check();
return true;
} else {
Check();
return false;
}
}
}
void ContractionState::ShowAll() {
delete []lines;
lines = 0;
size = 0;
delete []docLines;
docLines = 0;
sizeDocLines = 0;
linesInDisplay = linesInDoc;
int lines = LinesInDoc();
Clear();
linesInDocument = lines;
}
// Debugging checks
void ContractionState::Check() const {
#ifdef CHECK_CORRECTNESS
for (int vline = 0;vline < LinesDisplayed(); vline++) {
const int lineDoc = DocFromDisplay(vline);
PLATFORM_ASSERT(GetVisible(lineDoc));
}
for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) {
const int displayThis = DisplayFromDoc(lineDoc);
const int displayNext = DisplayFromDoc(lineDoc + 1);
const int height = displayNext - displayThis;
PLATFORM_ASSERT(height >= 0);
if (GetVisible(lineDoc)) {
PLATFORM_ASSERT(GetHeight(lineDoc) == height);
} else {
PLATFORM_ASSERT(0 == height);
}
}
#endif
}

View File

@ -1,40 +1,34 @@
// Scintilla source code edit control
/** @file ContractionState.h
** Manages visibility of lines for folding.
** Manages visibility of lines for folding and wrapping.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CONTRACTIONSTATE_H
#define CONTRACTIONSTATE_H
/**
*/
class OneLine {
public:
int displayLine; ///< Position within set of visible lines
//int docLine; ///< Inverse of @a displayLine
int height; ///< Number of display lines needed to show all of the line
bool visible;
bool expanded;
OneLine();
virtual ~OneLine() {}
};
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class ContractionState {
void Grow(int sizeNew);
enum { growSize = 4000 };
int linesInDoc;
mutable int linesInDisplay;
mutable OneLine *lines;
int size;
mutable int *docLines;
mutable int sizeDocLines;
mutable bool valid;
void MakeValid() const;
// These contain 1 element for every document line.
RunStyles *visible;
RunStyles *expanded;
RunStyles *heights;
Partitioning *displayLines;
int linesInDocument;
void EnsureData();
bool OneToOne() const {
// True when each document line is exactly one display line so need for
// complex data structures.
return visible == 0;
}
public:
ContractionState();
@ -47,7 +41,9 @@ public:
int DisplayFromDoc(int lineDoc) const;
int DocFromDisplay(int lineDisplay) const;
void InsertLine(int lineDoc);
void InsertLines(int lineDoc, int lineCount);
void DeleteLine(int lineDoc);
void DeleteLines(int lineDoc, int lineCount);
bool GetVisible(int lineDoc) const;
@ -60,6 +56,11 @@ public:
bool SetHeight(int lineDoc, int height);
void ShowAll();
void Check() const;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -0,0 +1,188 @@
/** @file Decoration.cxx
** Visual elements added over text.
**/
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "Platform.h"
#include "Scintilla.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "Decoration.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) {
}
Decoration::~Decoration() {
}
bool Decoration::Empty() {
return rs.starts->Partitions() == 1;
}
DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0),
lengthDocument(0), root(0), clickNotified(false) {
}
DecorationList::~DecorationList() {
Decoration *deco = root;
while (deco) {
Decoration *decoNext = deco->next;
delete deco;
deco = decoNext;
}
root = 0;
current = 0;
}
Decoration *DecorationList::DecorationFromIndicator(int indicator) {
for (Decoration *deco=root; deco; deco = deco->next) {
if (deco->indicator == indicator) {
return deco;
}
}
return 0;
}
Decoration *DecorationList::Create(int indicator, int length) {
currentIndicator = indicator;
Decoration *decoNew = new Decoration(indicator);
decoNew->rs.InsertSpace(0, length);
Decoration *decoPrev = 0;
Decoration *deco = root;
while (deco && (deco->indicator < indicator)) {
decoPrev = deco;
deco = deco->next;
}
if (decoPrev == 0) {
decoNew->next = root;
root = decoNew;
} else {
decoNew->next = deco;
decoPrev->next = decoNew;
}
return decoNew;
}
void DecorationList::Delete(int indicator) {
Decoration *decoToDelete = 0;
if (root) {
if (root->indicator == indicator) {
decoToDelete = root;
root = root->next;
} else {
Decoration *deco=root;
while (deco->next && !decoToDelete) {
if (deco->next && deco->next->indicator == indicator) {
decoToDelete = deco->next;
deco->next = decoToDelete->next;
} else {
deco = deco->next;
}
}
}
}
if (decoToDelete) {
delete decoToDelete;
current = 0;
}
}
void DecorationList::SetCurrentIndicator(int indicator) {
currentIndicator = indicator;
current = DecorationFromIndicator(indicator);
currentValue = 1;
}
void DecorationList::SetCurrentValue(int value) {
currentValue = value ? value : 1;
}
bool DecorationList::FillRange(int &position, int value, int &fillLength) {
if (!current) {
current = DecorationFromIndicator(currentIndicator);
if (!current) {
current = Create(currentIndicator, lengthDocument);
}
}
bool changed = current->rs.FillRange(position, value, fillLength);
if (current->Empty()) {
Delete(currentIndicator);
}
return changed;
}
void DecorationList::InsertSpace(int position, int insertLength) {
lengthDocument += insertLength;
for (Decoration *deco=root; deco; deco = deco->next) {
deco->rs.InsertSpace(position, insertLength);
}
}
void DecorationList::DeleteRange(int position, int deleteLength) {
lengthDocument -= deleteLength;
Decoration *deco;
for (deco=root; deco; deco = deco->next) {
deco->rs.DeleteRange(position, deleteLength);
}
DeleteAnyEmpty();
}
void DecorationList::DeleteAnyEmpty() {
Decoration *deco = root;
while (deco) {
if (deco->Empty()) {
Delete(deco->indicator);
deco = root;
} else {
deco = deco->next;
}
}
}
int DecorationList::AllOnFor(int position) {
int mask = 0;
for (Decoration *deco=root; deco; deco = deco->next) {
if (deco->rs.ValueAt(position)) {
mask |= 1 << deco->indicator;
}
}
return mask;
}
int DecorationList::ValueAt(int indicator, int position) {
Decoration *deco = DecorationFromIndicator(indicator);
if (deco) {
return deco->rs.ValueAt(position);
}
return 0;
}
int DecorationList::Start(int indicator, int position) {
Decoration *deco = DecorationFromIndicator(indicator);
if (deco) {
return deco->rs.StartRun(position);
}
return 0;
}
int DecorationList::End(int indicator, int position) {
Decoration *deco = DecorationFromIndicator(indicator);
if (deco) {
return deco->rs.EndRun(position);
}
return 0;
}

View File

@ -0,0 +1,64 @@
/** @file Decoration.h
** Visual elements added over text.
**/
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef DECORATION_H
#define DECORATION_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
class Decoration {
public:
Decoration *next;
RunStyles rs;
int indicator;
Decoration(int indicator_);
~Decoration();
bool Empty();
};
class DecorationList {
int currentIndicator;
int currentValue;
Decoration *current;
int lengthDocument;
Decoration *DecorationFromIndicator(int indicator);
Decoration *Create(int indicator, int length);
void Delete(int indicator);
void DeleteAnyEmpty();
public:
Decoration *root;
bool clickNotified;
DecorationList();
~DecorationList();
void SetCurrentIndicator(int indicator);
int GetCurrentIndicator() { return currentIndicator; }
void SetCurrentValue(int value);
int GetCurrentValue() { return currentValue; }
// Returns true if some values may have changed
bool FillRange(int &position, int value, int &fillLength);
void InsertSpace(int position, int insertLength);
void DeleteRange(int position, int deleteLength);
int AllOnFor(int position);
int ValueAt(int indicator, int position);
int Start(int indicator, int position);
int End(int indicator, int position);
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -13,14 +13,19 @@
#include "Platform.h"
#include "Scintilla.h"
#include "SVector.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "Document.h"
#include "RESearch.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
//Vitaliy
#include "UniConversion.h"
@ -178,7 +183,6 @@ void Document::SetSavePoint() {
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
return prev;
}
@ -189,14 +193,12 @@ void Document::AddMarkSet(int line, int valueSet) {
if (m & 1)
cb.AddMark(line, i);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
}
@ -214,11 +216,11 @@ void Document::DeleteAllMarks(int markerNum) {
NotifyModified(mh);
}
int Document::LineStart(int line) {
int Document::LineStart(int line) const {
return cb.LineStart(line);
}
int Document::LineEnd(int line) {
int Document::LineEnd(int line) const {
if (line == LinesTotal() - 1) {
return LineStart(line + 1);
} else {
@ -256,8 +258,7 @@ int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
LineStart(line), 0, 0, 0);
mh.line = line;
LineStart(line), 0, 0, 0, line);
mh.foldLevelNow = level;
mh.foldLevelPrev = prev;
NotifyModified(mh);
@ -335,7 +336,9 @@ int Document::LenChar(int pos) {
if (ch < 0x80)
return 1;
int len = 2;
if (ch >= (0x80 + 0x40 + 0x20))
if (ch >= (0x80 + 0x40 + 0x20 + 0x10))
len = 4;
else if (ch >= (0x80 + 0x40 + 0x20))
len = 3;
int lengthDoc = Length();
if ((pos + len) > lengthDoc)
@ -355,6 +358,55 @@ int Document::LenChar(int pos) {
}
}
static bool IsTrailByte(int ch) {
return (ch >= 0x80) && (ch < (0x80 + 0x40));
}
static int BytesFromLead(int leadByte) {
if (leadByte > 0xF4) {
// Characters longer than 4 bytes not possible in current UTF-8
return 0;
} else if (leadByte >= 0xF0) {
return 4;
} else if (leadByte >= 0xE0) {
return 3;
} else if (leadByte >= 0xC2) {
return 2;
}
return 0;
}
bool Document::InGoodUTF8(int pos, int &start, int &end) {
int lead = pos;
while ((lead>0) && (pos-lead < 4) && IsTrailByte(static_cast<unsigned char>(cb.CharAt(lead-1))))
lead--;
start = 0;
if (lead > 0) {
start = lead-1;
}
int leadByte = static_cast<unsigned char>(cb.CharAt(start));
int bytes = BytesFromLead(leadByte);
if (bytes == 0) {
return false;
} else {
int trailBytes = bytes - 1;
int len = pos - lead + 1;
if (len > trailBytes)
// pos too far from lead
return false;
// Check that there are enough trails for this lead
int trail = pos + 1;
while ((trail-lead<trailBytes) && (trail < Length())) {
if (!IsTrailByte(static_cast<unsigned char>(cb.CharAt(trail)))) {
return false;
}
trail++;
}
end = start + bytes;
return true;
}
}
// Normalise a position so that it is not halfway through a two byte character.
// This can occur in two situations -
// When lines are terminated with \r\n pairs which should be treated as one character.
@ -381,13 +433,14 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
if (dbcsCodePage) {
if (SC_CP_UTF8 == dbcsCodePage) {
unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos));
while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) {
// ch is a trail byte
int startUTF = pos;
int endUTF = pos;
if (IsTrailByte(ch) && InGoodUTF8(pos, startUTF, endUTF)) {
// ch is a trail byte within a UTF-8 character
if (moveDir > 0)
pos++;
pos = endUTF;
else
pos--;
ch = static_cast<unsigned char>(cb.CharAt(pos));
pos = startUTF;
}
} else {
// Anchor DBCS calculations at start of line because start of line can
@ -715,7 +768,7 @@ void Document::SetLineIndentation(int line, int indent) {
}
}
int Document::GetLineIndentPosition(int line) {
int Document::GetLineIndentPosition(int line) const {
if (line < 0)
return 0;
int pos = LineStart(line);
@ -856,7 +909,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
EndUndoAction();
}
bool Document::IsWhiteLine(int line) {
bool Document::IsWhiteLine(int line) const {
int currentChar = LineStart(line);
int endLine = LineEnd(line);
while (currentChar < endLine) {
@ -1190,12 +1243,12 @@ long Document::FindText(int minPos, int maxPos, const char *s,
int pos = forward ? startPos : (startPos - 1);
if (dbcsCodePage) {
if (!caseSensitive && dbcsCodePage == SC_CP_UTF8) {
ws_len = (int) UCS2Length(s, lengthFind);
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) {
UCS2FromUTF8(s, lengthFind, ws_upr, ws_size);
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
@ -1259,7 +1312,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
str[i] = CharAt(pos+i);
}
str[charLen] = 0;
UCS2FromUTF8(str, charLen, wstr, 2);
UTF16FromUTF8(str, charLen, wstr, 2);
wstr[1] = 0;
Platform_MakeUpperW(wstr, 1);
bMatch = (ws_upr[0] == wstr[0]);
@ -1309,7 +1362,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
str[i] = CharAt(i2+i);
}
str[charLen] = 0;
UCS2FromUTF8(str, charLen, wstr, 2);
UTF16FromUTF8(str, charLen, wstr, 2);
wstr[1] = 0;
Platform_MakeUpperW(wstr, 1);
found = (ws_upr[i1] == wstr[0]);
@ -1428,7 +1481,7 @@ const char *Document::SubstituteByPosition(const char *text, int *length) {
return substituted;
}
int Document::LinesTotal() {
int Document::LinesTotal() const {
return cb.Lines();
}
@ -1461,11 +1514,7 @@ void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCh
void Document::SetStylingBits(int bits) {
stylingBits = bits;
stylingBitsMask = 0;
for (int bit = 0; bit < stylingBits; bit++) {
stylingBitsMask <<= 1;
stylingBitsMask |= 1;
}
stylingBitsMask = (1 << stylingBits) - 1;
}
void Document::StartStyling(int position, char mask) {
@ -1529,10 +1578,24 @@ void Document::EnsureStyledTo(int pos) {
}
}
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);
NotifyModified(mh);
}
return statePrevious;
}
void Document::IncrementStyleClock() {
styleClock++;
if (styleClock > 0x100000) {
styleClock = 0;
styleClock = (styleClock + 1) % 0x100000;
}
void Document::DecorationFillRange(int position, int value, int fillLength) {
if (decorations.FillRange(position, value, fillLength)) {
DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER,
position, fillLength);
NotifyModified(mh);
}
}
@ -1593,6 +1656,11 @@ void Document::NotifySavePoint(bool atSavePoint) {
}
void Document::NotifyModified(DocModification mh) {
if (mh.modificationType & SC_MOD_INSERTTEXT) {
decorations.InsertSpace(mh.position, mh.length);
} else if (mh.modificationType & SC_MOD_DELETETEXT) {
decorations.DeleteRange(mh.position, mh.length);
}
for (int i = 0; i < lenWatchers; i++) {
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
}

View File

@ -8,6 +8,10 @@
#ifndef DOCUMENT_H
#define DOCUMENT_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
* A Position is a position within a document between two characters or at the beginning or end.
* Sometimes used as a character index where it identifies the character after the position.
@ -109,9 +113,6 @@ private:
char *substituted;
public:
//Vitaliy
inline bool MatchCaseInsensitive(const char* lpch1, const char* lpch2);
//yilatiV
int stylingBits;
int stylingBitsMask;
@ -125,6 +126,8 @@ public:
bool tabIndents;
bool backspaceUnindents;
DecorationList decorations;
Document();
virtual ~Document();
@ -135,10 +138,12 @@ public:
int ClampPositionIntoDocument(int pos);
bool IsCrLf(int pos);
int LenChar(int pos);
bool InGoodUTF8(int pos, int &start, int &end);
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
// Gateways to modifying document
void ModifiedAt(int pos);
void CheckReadOnly();
bool DeleteChars(int pos, int len);
bool InsertString(int position, const char *s, int insertLength);
int Undo();
@ -157,7 +162,7 @@ public:
int GetLineIndentation(int line);
void SetLineIndentation(int line, int indent);
int GetLineIndentPosition(int line);
int GetLineIndentPosition(int line) const;
int GetColumn(int position);
int FindColumn(int line, int column);
void Indent(bool forwards, int lineBottom, int lineTop);
@ -184,8 +189,8 @@ public:
void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); }
int LineStart(int line);
int LineEnd(int line);
int LineStart(int line) const;
int LineEnd(int line) const;
int LineEndPosition(int position);
int VCHomePosition(int position);
@ -199,13 +204,13 @@ public:
int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);
int NextWordStart(int pos, int delta);
int NextWordEnd(int pos, int delta);
int Length() { return cb.Length(); }
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);
long FindText(int iMessage, unsigned long wParam, long lParam);
const char *SubstituteByPosition(const char *text, int *length);
int LinesTotal();
int LinesTotal() const;
void ChangeCase(Range r, bool makeUpperCase);
@ -219,8 +224,9 @@ public:
void EnsureStyledTo(int pos);
int GetStyleClock() { return styleClock; }
void IncrementStyleClock();
void DecorationFillRange(int position, int value, int fillLength);
int SetLineState(int line, int state) { return cb.SetLineState(line, state); }
int SetLineState(int line, int state);
int GetLineState(int line) { return cb.GetLineState(line); }
int GetMaxLineState() { return cb.GetMaxLineState(); }
@ -233,15 +239,13 @@ public:
int WordPartLeft(int pos);
int WordPartRight(int pos);
int ExtendStyleRange(int pos, int delta, bool singleLine = false);
bool IsWhiteLine(int line);
bool IsWhiteLine(int line) const;
int ParaUp(int pos);
int ParaDown(int pos);
int IndentSize() { return actualIndentInChars; }
int BraceMatch(int position, int maxReStyle);
private:
void CheckReadOnly();
CharClassify::cc WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
@ -305,4 +309,8 @@ public:
virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -13,16 +13,21 @@
#include "Platform.h"
#include "PropSet.h"
#include "SVector.h"
#include "Accessor.h"
#include "DocumentAccessor.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "Scintilla.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "Document.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
DocumentAccessor::~DocumentAccessor() {
}
@ -188,3 +193,8 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
return indent;
}
void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) {
pdoc->decorations.SetCurrentIndicator(indicator);
pdoc->DecorationFillRange(start, value, end - start);
}

View File

@ -6,6 +6,10 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
class Document;
/**
@ -64,4 +68,9 @@ public:
void ColourTo(unsigned int pos, int chAttr);
void SetLevel(int line, int level);
int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
void IndicatorFill(int start, int end, int indicator, int value);
};
#ifdef SCI_NAMESPACE
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,10 @@
#ifndef EDITOR_H
#define EDITOR_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class Caret {
@ -41,92 +45,6 @@ public:
Idler();
};
/**
*/
class LineLayout {
private:
friend class LineLayoutCache;
int *lineStarts;
int lenLineStarts;
/// Drawing is only performed for @a maxLineLength characters on each line.
int lineNumber;
bool inCache;
public:
enum { wrapWidthInfinite = 0x7ffffff };
int maxLineLength;
int numCharsInLine;
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
int xHighlightGuide;
bool highlightColumn;
int selStart;
int selEnd;
bool containsCaret;
int edgeColumn;
char *chars;
unsigned char *styles;
int styleBitsSet;
char *indicators;
int *positions;
char bracePreviousStyles[2];
// Hotspot support
int hsStart;
int hsEnd;
// Wrapped line support
int widthLine;
int lines;
LineLayout(int maxLineLength_);
virtual ~LineLayout();
void Resize(int maxLineLength_);
void Free();
void Invalidate(validLevel validity_);
int LineStart(int line) {
if (line <= 0) {
return 0;
} else if ((line >= lines) || !lineStarts) {
return numCharsInLine;
} else {
return lineStarts[line];
}
}
void SetLineStart(int line, int start);
void SetBracesHighlight(Range rangeLine, Position braces[],
char bracesMatchStyle, int xHighlight);
void RestoreBracesHighlight(Range rangeLine, Position braces[]);
};
/**
*/
class LineLayoutCache {
int level;
int length;
int size;
LineLayout **cache;
bool allInvalidated;
int styleClock;
int useCount;
void Allocate(int length_);
void AllocateForLevel(int linesOnScreen, int linesInDoc);
public:
LineLayoutCache();
virtual ~LineLayoutCache();
void Deallocate();
enum {
llcNone=SC_CACHE_NONE,
llcCaret=SC_CACHE_CARET,
llcPage=SC_CACHE_PAGE,
llcDocument=SC_CACHE_DOCUMENT
};
void Invalidate(LineLayout::validLevel validity_);
void SetLevel(int level_);
int GetLevel() { return level; }
LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
int linesOnScreen, int linesInDoc);
void Dispose(LineLayout *ll);
};
/**
* Hold a piece of text selected for copying or dragging.
* The text is expected to hold a terminating '\0' and this is counted in len.
@ -136,16 +54,17 @@ public:
char *s;
int len;
bool rectangular;
bool lineCopy;
int codePage;
int characterSet;
SelectionText() : s(0), len(0), rectangular(false), codePage(0), characterSet(0) {}
SelectionText() : s(0), len(0), rectangular(false), lineCopy(false), codePage(0), characterSet(0) {}
~SelectionText() {
Free();
}
void Free() {
Set(0, 0, 0, 0, false);
Set(0, 0, 0, 0, false, false);
}
void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_) {
void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s;
s = s_;
if (s)
@ -155,8 +74,9 @@ public:
codePage = codePage_;
characterSet = characterSet_;
rectangular = rectangular_;
lineCopy = lineCopy_;
}
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_) {
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s;
s = new char[len_];
if (s) {
@ -170,9 +90,10 @@ public:
codePage = codePage_;
characterSet = characterSet_;
rectangular = rectangular_;
lineCopy = lineCopy_;
}
void Copy(const SelectionText &other) {
Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular);
Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy);
}
};
@ -218,6 +139,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
bool horizontalScrollBarVisible;
int scrollWidth;
bool trackLineWidth;
int lineWidthMaxSeen;
bool verticalScrollBarVisible;
bool endAtLastLine;
bool caretSticky;
@ -229,6 +152,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
Surface *pixmapIndentGuideHighlight;
LineLayoutCache llc;
PositionCache posCache;
KeyMap kmap;
@ -246,7 +170,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool dwelling;
enum { selChar, selWord, selLine } selectionType;
Point ptMouseLast;
bool inDragDrop;
enum { ddNone, ddInitial, ddDragging } inDragDrop;
bool dropWentOutside;
int posDrag;
int posDrop;
@ -355,7 +279,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int SelectionStart();
int SelectionEnd();
void SetRectangularRange();
void InvalidateSelection(int currentPos_, int anchor_);
void InvalidateSelection(int currentPos_, int anchor_, bool invalidateWholeSelection);
void SetSelection(int currentPos_, int anchor_);
void SetSelection(int currentPos_);
void SetEmptySelection(int currentPos_);
@ -378,6 +302,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void UpdateSystemCaret();
void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
bool WrapOneLine(Surface *surface, int lineToWrap);
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin();
void LinesSplit(int pixelWidth);
@ -395,8 +320,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
int line, int lineEnd, int xStart, int subLine, int subLineStart,
bool overrideBackground, ColourAllocated background,
bool drawWrapMark, ColourAllocated wrapColour);
void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine=0);
void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret);
void RefreshPixMaps(Surface *surfaceWindow);
void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, RangeToFormat *pfr);
@ -417,6 +345,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Cut();
void PasteRectangular(int pos, const char *ptr, int len);
virtual void Copy() = 0;
virtual void CopyAllowLine();
virtual bool CanPaste();
virtual void Paste() = 0;
void Clear();
@ -441,6 +370,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt);
void NotifyUpdateUI();
void NotifyPainted();
void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt);
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyNeedShown(int pos, int len);
void NotifyDwelling(Point pt, bool state);
@ -480,12 +410,13 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void CopyToClipboard(const SelectionText &selectedText) = 0;
char *CopyRange(int start, int end);
void CopySelectionFromRange(SelectionText *ss, int start, int end);
void CopySelectionRange(SelectionText *ss);
void CopySelectionFromRange(SelectionText *ss, bool allowLineCopy, int start, int end);
void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false);
void CopyRangeToClipboard(int start, int end);
void CopyText(int length, const char *text);
void SetDragPosition(int newPos);
virtual void DisplayCursor(Window::Cursor c);
virtual bool DragThreshold(Point ptStart, Point ptNow);
virtual void StartDrag();
void DropAt(int position, const char *value, bool moving, bool rectangular);
/** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
@ -530,6 +461,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
void AddStyledText(char *buffer, int appendLength);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
static const char *StringFromEOLMode(int eolMode);
public:
// Public so the COM thunks can access it.
@ -580,4 +515,8 @@ public:
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -21,6 +21,10 @@
#include "KeyWords.h"
#include "ExternalLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
LexerManager *LexerManager::theInstance = NULL;
//------------------------------------------

View File

@ -14,6 +14,10 @@
#define EXT_LEXER_DECL
#endif
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
// External Lexer function definitions...
typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle,
char *words[], WindowID window, char *props);
@ -92,4 +96,8 @@ public:
~LMMinder();
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -10,6 +10,10 @@
#include "Scintilla.h"
#include "Indicator.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
surface->PenColour(fore.allocated);
int ymid = (rc.bottom + rc.top) / 2;
@ -75,3 +79,4 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
}
}

View File

@ -8,15 +8,24 @@
#ifndef INDICATOR_H
#define INDICATOR_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class Indicator {
public:
int style;
bool under;
ColourPair fore;
Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)) {
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -11,6 +11,10 @@
#include "KeyMap.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
KeyMap::KeyMap() : kmap(0), len(0), alloc(0) {
for (int i = 0; MapDefault[i].key; i++) {
AssignCmdKey(MapDefault[i].key,
@ -146,3 +150,4 @@ const KeyToCommand KeyMap::MapDefault[] = {
{0,0,0},
};

View File

@ -8,6 +8,10 @@
#ifndef KEYTOCOMMAND_H
#define KEYTOCOMMAND_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
#define SCI_NORM 0
#define SCI_SHIFT SCMOD_SHIFT
#define SCI_CTRL SCMOD_CTRL
@ -40,4 +44,8 @@ public:
unsigned int Find(int key, int modifiers); // 0 returned on failure
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -19,6 +19,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
const LexerModule *LexerModule::base = 0;
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
@ -137,11 +141,13 @@ int Scintilla_LinkLexers() {
//++Autogenerated -- run src/LexGen.py to regenerate
//**\(\tLINK_LEXER(\*);\n\)
LINK_LEXER(lmAbaqus);
LINK_LEXER(lmAda);
LINK_LEXER(lmAns1);
LINK_LEXER(lmAPDL);
LINK_LEXER(lmAsm);
LINK_LEXER(lmASP);
LINK_LEXER(lmASY);
LINK_LEXER(lmAU3);
LINK_LEXER(lmAVE);
LINK_LEXER(lmBaan);
@ -170,6 +176,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmForth);
LINK_LEXER(lmFortran);
LINK_LEXER(lmFreeBasic);
LINK_LEXER(lmGAP);
LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
@ -180,6 +187,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmLot);
LINK_LEXER(lmLout);
LINK_LEXER(lmLua);
LINK_LEXER(lmMagikSF);
LINK_LEXER(lmMake);
LINK_LEXER(lmMatlab);
LINK_LEXER(lmMETAPOST);
@ -188,6 +196,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmNncrontab);
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
LINK_LEXER(lmObjC);
LINK_LEXER(lmOctave);
LINK_LEXER(lmOpal);
LINK_LEXER(lmPascal);
@ -195,14 +204,19 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmPerl);
LINK_LEXER(lmPHP);
LINK_LEXER(lmPHPSCRIPT);
LINK_LEXER(lmPLM);
LINK_LEXER(lmPOV);
LINK_LEXER(lmPowerShell);
LINK_LEXER(lmProgress);
LINK_LEXER(lmProps);
LINK_LEXER(lmPS);
LINK_LEXER(lmPureBasic);
LINK_LEXER(lmPython);
LINK_LEXER(lmR);
LINK_LEXER(lmREBOL);
LINK_LEXER(lmRuby);
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSearchResult);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSpecman);
LINK_LEXER(lmSpice);
@ -210,6 +224,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTCL);
LINK_LEXER(lmTeX);
LINK_LEXER(lmUserDefine);
LINK_LEXER(lmVB);
LINK_LEXER(lmVBScript);
LINK_LEXER(lmVerilog);

View File

@ -21,6 +21,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || ch == '_'));
@ -123,6 +126,123 @@ static void ColouriseAPDLDoc(unsigned int startPos, int length, int initStyle, W
sc.Complete();
}
//------------------------------------------------------------------------------
// 06-27-07 Sergio Lucato
// - Included code folding for Ansys APDL lexer
// - Copyied from LexBasic.cxx and modified for APDL
//------------------------------------------------------------------------------
/* Bits:
* 1 - whitespace
* 2 - operator
* 4 - identifier
* 8 - decimal digit
* 16 - hex digit
* 32 - bin digit
*/
static int character_classification[128] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6,
60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2,
2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4,
2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0
};
static bool IsSpace(int c) {
return c < 128 && (character_classification[c] & 1);
}
static bool IsIdentifier(int c) {
return c < 128 && (character_classification[c] & 4);
}
static int LowerCase(int c)
{
if (c >= 'A' && c <= 'Z')
return 'a' + c - 'A';
return c;
}
static int CheckAPDLFoldPoint(char const *token, int &level) {
if (!strcmp(token, "*if") ||
!strcmp(token, "*do") ||
!strcmp(token, "*dowhile") ) {
level |= SC_FOLDLEVELHEADERFLAG;
return 1;
}
if (!strcmp(token, "*endif") ||
!strcmp(token, "*enddo") ) {
return -1;
}
return 0;
}
static void FoldAPDLDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
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 = CheckAPDLFoldPoint(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;
}
}
}
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;
}
}
}
static const char * const apdlWordListDesc[] = {
"processors",
"commands",
@ -133,4 +253,4 @@ static const char * const apdlWordListDesc[] = {
0
};
LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", 0, apdlWordListDesc);
LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", FoldAPDLDoc, apdlWordListDesc);

270
scintilla/src/LexASY.cxx Normal file
View File

@ -0,0 +1,270 @@
// Scintilla source code edit control
//Author: instanton (email: soft_share<at>126<dot>com)
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#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
static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
int visibleChars = 0;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
if (sc.state == SCE_ASY_STRING) {
sc.SetState(SCE_ASY_STRING);
}
visibleChars = 0;
}
if (sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
// continuationLine = true;
continue;
}
}
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_ASY_OPERATOR:
sc.SetState(SCE_ASY_DEFAULT);
break;
case SCE_ASY_NUMBER:
if (!setWord.Contains(sc.ch)) {
sc.SetState(SCE_ASY_DEFAULT);
}
break;
case SCE_ASY_IDENTIFIER:
if (!setWord.Contains(sc.ch) || (sc.ch == '.')) {
char s[1000];
sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_ASY_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_ASY_WORD2);
}
sc.SetState(SCE_ASY_DEFAULT);
}
break;
case SCE_ASY_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_ASY_DEFAULT);
}
break;
case SCE_ASY_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_ASY_DEFAULT);
}
break;
case SCE_ASY_STRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_ASY_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_ASY_DEFAULT);
}
break;
case SCE_ASY_CHARACTER:
if (sc.atLineEnd) {
sc.ChangeState(SCE_ASY_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_ASY_DEFAULT);
}
break;
}
// Determine if a new state should be entered.
if (sc.state == SCE_ASY_DEFAULT) {
if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) {
sc.SetState(SCE_ASY_IDENTIFIER);
} else if (sc.Match('/', '*')) {
sc.SetState(SCE_ASY_COMMENT);
sc.Forward(); //
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_ASY_COMMENTLINE);
} else if (sc.ch == '\"') {
sc.SetState(SCE_ASY_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_ASY_CHARACTER);
} else if (sc.ch == '#' && visibleChars == 0) {
do {
sc.Forward();
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
if (sc.atLineEnd) {
sc.SetState(SCE_ASY_DEFAULT);
}
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_ASY_OPERATOR);
}
}
}
sc.Complete();
}
static bool IsAsyCommentStyle(int style) {
return style == SCE_ASY_COMMENT;
}
static inline bool isASYidentifier(int ch) {
return
((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ;
}
static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)
{
int length=0;
char ch=styler.SafeGetCharAt(pos);
*word=0;
while(isASYidentifier(ch) && length<100){
word[length]=ch;
length++;
ch=styler.SafeGetCharAt(pos+length);
}
word[length]=0;
return length;
}
static bool IsASYDrawingLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
int startpos = pos;
char buffer[100]="";
while (startpos<eol_pos){
char ch = styler[startpos];
ParseASYWord(startpos,styler,buffer);
bool drawcommands = strncmp(buffer,"draw",4)==0||
strncmp(buffer,"pair",4)==0||strncmp(buffer,"label",5)==0;
if (!drawcommands && ch!=' ') return false;
else if (drawcommands) return true;
startpos++;
}
return false;
}
static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
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);
int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && IsAsyCommentStyle(style)) {
if (!IsAsyCommentStyle(stylePrev) && (stylePrev != SCE_ASY_COMMENTLINEDOC)) {
levelNext++;
} else if (!IsAsyCommentStyle(styleNext) && (styleNext != SCE_ASY_COMMENTLINEDOC) && !atEOL) {
levelNext--;
}
}
if (style == SCE_ASY_OPERATOR) {
if (ch == '{') {
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}') {
levelNext--;
}
}
if (atEOL && IsASYDrawingLine(lineCurrent, styler)){
if (lineCurrent==0 && IsASYDrawingLine(lineCurrent + 1, styler))
levelNext++;
else if (lineCurrent!=0 && !IsASYDrawingLine(lineCurrent - 1, styler)
&& IsASYDrawingLine(lineCurrent + 1, styler)
)
levelNext++;
else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) &&
!IsASYDrawingLine(lineCurrent+1, styler))
levelNext--;
}
if (atEOL) {
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;
}
if (!IsASpace(ch))
visibleChars++;
}
}
static const char * const asyWordLists[] = {
"Primary keywords and identifiers",
"Secondary keywords and identifiers",
0,
};
LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists);

View File

@ -43,6 +43,8 @@
// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions.
// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF)
// Mar 9, 2007 - Fixed bug with + following a String getting the wrong Color.
// Jun 20, 2007 - Fixed Commentblock issue when LF's are used as EOL.
// Jul 26, 2007 - Fixed #endregion undetected bug.
//
// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -63,6 +65,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsTypeCharacter(const int ch)
{
return ch == '$';
@ -247,7 +253,12 @@ static void ColouriseAU3Doc(unsigned int startPos,
//Reset at line end
if (sc.atLineEnd) {
ci=0;
if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0))
if (sc.atLineEnd)
sc.SetState(SCE_AU3_DEFAULT);
else
sc.SetState(SCE_AU3_COMMENTBLOCK);
break;
}
//skip rest of line when a ; is encountered
if (sc.chPrev == ';') {
@ -305,6 +316,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
{
sc.ChangeState(SCE_AU3_COMMENTBLOCK);
sc.SetState(SCE_AU3_COMMENTBLOCK);
break;
}
else if (keywords.InList(s)) {
sc.ChangeState(SCE_AU3_KEYWORD);
@ -689,7 +701,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc
// vars for getting first word to check for keywords
bool FirstWordStart = false;
bool FirstWordEnd = false;
char szKeyword[10]="";
char szKeyword[11]="";
int szKeywordlen = 0;
char szThen[5]="";
int szThenlen = 0;

View File

@ -22,6 +22,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
@ -223,3 +226,4 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W
LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave", FoldAveDoc);

260
scintilla/src/LexAbaqus.cxx Normal file
View File

@ -0,0 +1,260 @@
// Scintilla source code edit control
/** @file LexABAQUS.cxx
** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz.
** By Sergio Lucato.
**/
// The License.txt file describes the conditions under which this software may be distributed.
// Code folding copyied and modified from LexBasic.cxx
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || ch == '_'));
}
static inline bool IsAnOperator(char ch) {
// '.' 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 == '%')
return true;
return false;
}
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];
// Do not leak onto next line
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);
}
}
// 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();
}
//------------------------------------------------------------------------------
// This copyied and modified from LexBasic.cxx
//------------------------------------------------------------------------------
/* Bits:
* 1 - whitespace
* 2 - operator
* 4 - identifier
* 8 - decimal digit
* 16 - hex digit
* 32 - bin digit
*/
static int character_classification[128] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6,
60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2,
2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4,
2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0
};
static bool IsSpace(int c) {
return c < 128 && (character_classification[c] & 1);
}
static bool IsIdentifier(int c) {
return c < 128 && (character_classification[c] & 4);
}
static int LowerCase(int c)
{
if (c >= 'A' && c <= 'Z')
return 'a' + c - 'A';
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 void FoldABAQUSDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
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;
}
}
}
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;
}
}
}
static const char * const abaqusWordListDesc[] = {
"processors",
"commands",
"slashommands",
"starcommands",
"arguments",
"functions",
0
};
LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc);

View File

@ -19,6 +19,10 @@
#include "SciLexer.h"
#include "SString.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/*
* Interface
*/

View File

@ -23,6 +23,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
@ -175,3 +178,4 @@ static const char * const asmWordListDesc[] = {
LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc);

View File

@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Some char test functions
static bool isAsn1Number(int ch)
{

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '$' || ch == ':');
}

View File

@ -2,7 +2,7 @@
/** @file LexBash.cxx
** Lexer for Bash.
**/
// Copyright 2004-2005 by Neil Hodgson <neilh@scintilla.org>
// Copyright 2004-2007 by Neil Hodgson <neilh@scintilla.org>
// Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004
// The License.txt file describes the conditions under which this software may be distributed.
@ -20,14 +20,24 @@
#include "Scintilla.h"
#include "SciLexer.h"
// define this if you want 'invalid octals' to be marked as errors
// usually, this is not a good idea, permissive lexing is better
#undef PEDANTIC_OCTAL
#define BASH_BASE_ERROR 65
#define BASH_BASE_DECIMAL 66
#define BASH_BASE_HEX 67
#ifdef PEDANTIC_OCTAL
#define BASH_BASE_OCTAL 68
#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) {
if (ch >= '0' && ch <= '9') {
return ch - '0';
@ -273,7 +283,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
ch = chNext;
chNext = chNext2;
} else if (isdigit(chNext)) {
#ifdef PEDANTIC_OCTAL
numBase = BASH_BASE_OCTAL;
#else
numBase = BASH_BASE_HEX;
#endif
}
}
} else if (iswordstart(ch)) {
@ -365,6 +379,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
// hex digit 0-9a-fA-F
} else
goto numAtEnd;
#ifdef PEDANTIC_OCTAL
} else if (numBase == BASH_BASE_OCTAL ||
numBase == BASH_BASE_OCTAL_ERROR) {
if (digit > 7) {
@ -373,6 +388,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
} else
goto numAtEnd;
}
#endif
} else if (numBase == BASH_BASE_ERROR) {
if (digit > 9)
goto numAtEnd;
@ -390,8 +406,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
}
} else {
numAtEnd:
if (numBase == BASH_BASE_ERROR ||
numBase == BASH_BASE_OCTAL_ERROR)
if (numBase == BASH_BASE_ERROR
#ifdef PEDANTIC_OCTAL
|| numBase == BASH_BASE_OCTAL_ERROR
#endif
)
state = SCE_SH_ERROR;
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;

View File

@ -31,6 +31,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/* Bits:
* 1 - whitespace
* 2 - operator
@ -367,3 +371,4 @@ LexerModule lmPureBasic(SCLEX_PUREBASIC, ColourisePureBasicDoc, "purebasic",
LexerModule lmFreeBasic(SCLEX_FREEBASIC, ColouriseFreeBasicDoc, "freebasic",
FoldFreeBasicDoc, freebasicWordListDesc);

View File

@ -15,6 +15,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Is an end of line character
inline bool IsEOL(const int ch) {

View File

@ -19,45 +19,11 @@
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "CharacterSet.h"
#define SET_LOWER "abcdefghijklmnopqrstuvwxyz"
#define SET_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define SET_DIGITS "0123456789"
class SetOfCharacters {
int size;
bool valueAfter;
bool *bset;
public:
SetOfCharacters(const char *setOfCharacters, int size_=0x80, bool valueAfter_=false) {
size = size_;
valueAfter = valueAfter_;
bset = new bool[size];
for (int i=0; i < size; i++) {
bset[i] = false;
}
for (const char *cp=setOfCharacters; *cp; cp++) {
int val = static_cast<unsigned char>(*cp);
PLATFORM_ASSERT(val >= 0);
PLATFORM_ASSERT(val < size);
bset[val] = true;
}
}
~SetOfCharacters() {
delete []bset;
bset = 0;
size = 0;
}
void Add(int val) {
PLATFORM_ASSERT(val >= 0);
PLATFORM_ASSERT(val < size);
bset[val] = true;
}
bool Contains(int val) {
PLATFORM_ASSERT(val >= 0);
return (val < size) ? bset[val] : valueAfter;
}
};
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool IsSpaceEquiv(int state) {
return (state <= SCE_C_COMMENTDOC) ||
@ -66,6 +32,24 @@ static bool IsSpaceEquiv(int state) {
(state == SCE_C_COMMENTDOCKEYWORDERROR);
}
// Preconditions: sc.currentPos points to a character after '+' or '-'.
// The test for pos reaching 0 should be redundant,
// and is in only for safety measures.
// Limitation: this code will give the incorrect answer for code like
// a = b+++/ptn/...
// Putting a space between the '++' post-inc operator and the '+' binary op
// fixes this, and is highly recommended for readability anyway.
static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
int pos = (int) sc.currentPos;
while (--pos > 0) {
char ch = styler[pos];
if (ch == '+' || ch == '-') {
return styler[pos - 1] == ch;
}
}
return false;
}
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler, bool caseSensitive) {
@ -76,12 +60,13 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
SetOfCharacters setOKBeforeRE("(=,");
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
SetOfCharacters setDoxygen("$@\\&<>#{}[]" SET_LOWER);
CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]");
SetOfCharacters setWordStart("_" SET_LOWER SET_UPPER, 0x80, true);
SetOfCharacters setWord("._" SET_LOWER SET_UPPER SET_DIGITS, 0x80, true);
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
setWordStart.Add('$');
setWord.Add('$');
@ -331,7 +316,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_C_COMMENTLINEDOC);
else
sc.SetState(SCE_C_COMMENTLINE);
} else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite)) {
} else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite) &&
(!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) {
sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') {
sc.SetState(SCE_C_STRING);
@ -438,7 +424,9 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
levelNext--;
}
}
if (atEOL) {
if (!IsASpace(ch))
visibleChars++;
if (atEOL || (i == endPos-1)) {
int levelUse = levelCurrent;
if (foldAtElse) {
levelUse = levelMinCurrent;
@ -456,8 +444,10 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
levelMinCurrent = levelCurrent;
visibleChars = 0;
}
if (!IsASpace(ch))
visibleChars++;
}
char lastChar = styler.SafeGetCharAt(endPos-1);
if ((unsigned)styler.Length() == endPos && (lastChar == '\n' || lastChar == '\r')) {
styler.SetLevel(lineCurrent, levelCurrent);
}
}

View File

@ -22,6 +22,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const unsigned int ch) {
return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character

View File

@ -42,6 +42,10 @@ static const int baseT[24] = {
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */
};
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#ifdef BUILD_AS_EXTERNAL_LEXER
/*
(actually seems to work!)

View File

@ -19,6 +19,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool isCmakeNumber(char ch)
{

View File

@ -23,6 +23,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_CONF_DEFAULT;

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
*keywordLists[], Accessor &styler)
{

View File

@ -20,6 +20,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/*/ Nested comments require keeping the value of the nesting level for every
position in the document. But since scintilla always styles line by line,
we only need to store one value per line. The non-negative number indicates

View File

@ -19,6 +19,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {

View File

@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool isEiffelOperator(unsigned int ch) {
// '.' left out as it is used to make up numbers
return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' ||

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/*
TODO:
o _Param should be a new lexical type
@ -520,3 +524,4 @@ LexerModule lmErlang(
FoldErlangDoc,
erlangWordListDesc);

View File

@ -22,6 +22,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool IsFlagShipComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='\'';
}
@ -224,3 +228,4 @@ LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFla

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
bool is_whitespace(int ch){
return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ';
}

View File

@ -19,6 +19,11 @@
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/***********************************************/
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%');

263
scintilla/src/LexGAP.cxx Normal file
View File

@ -0,0 +1,263 @@
// Scintilla source code edit control
/** @file LexGAP.cxx
** Lexer for the GAP language. (The GAP System for Computational Discrete Algebra)
** http://www.gap-system.org
**/
// Copyright 2007 by Istvan Szollosi ( szteven <at> gmail <dot> com )
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsGAPOperator(char ch) {
if (isalnum(ch)) return false;
if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
ch == '^' || ch == ',' || ch == '!' || ch == '.' ||
ch == '=' || ch == '<' || ch == '>' || ch == '(' ||
ch == ')' || ch == ';' || ch == '[' || ch == ']' ||
ch == '{' || ch == '}' || ch == ':' )
return true;
return false;
}
static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) {
unsigned int i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(styler[start + i]);
i++;
}
s[i] = '\0';
}
static void ColouriseGAPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords1 = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
// Do not leak onto next line
if (initStyle == SCE_GAP_STRINGEOL) initStyle = SCE_GAP_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
// Prevent SCE_GAP_STRINGEOL from leaking back to previous line
if ( sc.atLineStart ) {
if (sc.state == SCE_GAP_STRING) sc.SetState(SCE_GAP_STRING);
if (sc.state == SCE_GAP_CHAR) sc.SetState(SCE_GAP_CHAR);
}
// Handle line continuation generically
if (sc.ch == '\\' ) {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continue;
}
}
// Determine if the current state should terminate
switch (sc.state) {
case SCE_GAP_OPERATOR :
sc.SetState(SCE_GAP_DEFAULT);
break;
case SCE_GAP_NUMBER :
if (!IsADigit(sc.ch)) {
if (sc.ch == '\\') {
if (!sc.atLineEnd) {
if (!IsADigit(sc.chNext)) {
sc.Forward();
sc.ChangeState(SCE_GAP_IDENTIFIER);
}
}
} else if (isalpha(sc.ch) || sc.ch == '_') {
sc.ChangeState(SCE_GAP_IDENTIFIER);
}
else sc.SetState(SCE_GAP_DEFAULT);
}
break;
case SCE_GAP_IDENTIFIER :
if (!(iswordstart(static_cast<char>(sc.ch)) || sc.ch == '$')) {
if (sc.ch == '\\') sc.Forward();
else {
char s[1000];
sc.GetCurrent(s, sizeof(s));
if (keywords1.InList(s)) {
sc.ChangeState(SCE_GAP_KEYWORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_GAP_KEYWORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_GAP_KEYWORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_GAP_KEYWORD4);
}
sc.SetState(SCE_GAP_DEFAULT);
}
}
break;
case SCE_GAP_COMMENT :
if (sc.atLineEnd) {
sc.SetState(SCE_GAP_DEFAULT);
}
break;
case SCE_GAP_STRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_GAP_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_GAP_DEFAULT);
}
break;
case SCE_GAP_CHAR:
if (sc.atLineEnd) {
sc.ChangeState(SCE_GAP_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_GAP_DEFAULT);
}
break;
case SCE_GAP_STRINGEOL:
if (sc.atLineStart) {
sc.SetState(SCE_GAP_DEFAULT);
}
break;
}
// Determine if a new state should be entered
if (sc.state == SCE_GAP_DEFAULT) {
if (IsGAPOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_GAP_OPERATOR);
}
else if (IsADigit(sc.ch)) {
sc.SetState(SCE_GAP_NUMBER);
} else if (isalpha(sc.ch) || sc.ch == '_' || sc.ch == '\\' || sc.ch == '$' || sc.ch == '~') {
sc.SetState(SCE_GAP_IDENTIFIER);
if (sc.ch == '\\') sc.Forward();
} else if (sc.ch == '#') {
sc.SetState(SCE_GAP_COMMENT);
} else if (sc.ch == '\"') {
sc.SetState(SCE_GAP_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_GAP_CHAR);
}
}
}
sc.Complete();
}
static int ClassifyFoldPointGAP(const char* s) {
int level = 0;
if (strcmp(s, "function") == 0 ||
strcmp(s, "do") == 0 ||
strcmp(s, "if") == 0 ||
strcmp(s, "repeat") == 0 ) {
level = 1;
} else if (strcmp(s, "end") == 0 ||
strcmp(s, "od") == 0 ||
strcmp(s, "fi") == 0 ||
strcmp(s, "until") == 0 ) {
level = -1;
}
return level;
}
static void FoldGAPDoc( unsigned int startPos, int length, int initStyle, WordList** , Accessor &styler) {
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
int lastStart = 0;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (stylePrev != SCE_GAP_KEYWORD && style == SCE_GAP_KEYWORD) {
// Store last word start point.
lastStart = i;
}
if (stylePrev == SCE_GAP_KEYWORD) {
if(iswordchar(ch) && !iswordchar(chNext)) {
char s[100];
GetRange(lastStart, i, styler, s, sizeof(s));
levelCurrent += ClassifyFoldPointGAP(s);
}
}
if (atEOL) {
int lev = levelPrev;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char * const GAPWordListDesc[] = {
"Keywords 1",
"Keywords 2",
"Keywords 3 (unused)",
"Keywords 4 (unused)",
0
};
LexerModule lmGAP(
SCLEX_GAP,
ColouriseGAPDoc,
"gap",
FoldGAPDoc,
GAPWordListDesc);

View File

@ -211,18 +211,12 @@ def RegenerateAll():
# Find all the SciTE properties files
otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"]
if os.path.exists(root + "scite"):
propFilePaths = glob.glob(root + "scite/src/*.properties")
propFiles = [os.path.basename(f) for f in propFilePaths if os.path.basename(f) not in otherProps]
propFiles.sort(ciCompare)
print propFiles
# Find all the menu command IDs in the SciTE header
SciTEHeader = file(root + "scite/src/SciTE.h")
lines = SciTEHeader.read().split("\n")
SciTEHeader.close()
ids = [id for id in [l.split()[1] for l in lines if l.startswith("#define")] if id.startswith("IDM_")]
#print ids
Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules)
Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles)
Regenerate(root + "scintilla/win32/scintilla.mak", "#", NATIVE, lexFiles)
@ -232,9 +226,10 @@ def RegenerateAll():
# Windows).
Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles)
Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles)
Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles)
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, ids)
Generate(root + "scite/boundscheck/vcproj.gen",
root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles)

View File

@ -36,6 +36,10 @@ val SCE_GC_OPERATOR=9
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define debug Platform::DebugPrintf
static inline bool IsAWordChar(const int ch) {
@ -307,3 +311,4 @@ LexerModule lmGui4Cli(SCLEX_GUI4CLI, ColouriseGui4CliDoc, "gui4cli", FoldGui4Cli
#undef debug

View File

@ -19,6 +19,11 @@
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define SCE_HA_JS (SCE_HJA_START - SCE_HJ_START)
#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START)
@ -35,6 +40,20 @@ static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
inline bool IsOperator(int ch) {
if (isascii(ch) && 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 == '?' || ch == '!' || ch == '.' || ch == '~')
return true;
return false;
}
static inline int MakeLowerCase(int ch) {
if (ch < 'A' || ch > 'Z')
return ch;
@ -68,8 +87,15 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start,
return eScriptJS;
if (strstr(s, "php"))
return eScriptPHP;
if (strstr(s, "xml"))
if (strstr(s, "xml")) {
const char *xml = strstr(s, "xml");
for (const char *t=s; t<xml; t++) {
if (!IsASpace(*t)) {
return prevValue;
}
}
return eScriptXML;
}
return prevValue;
}
@ -104,16 +130,16 @@ static script_type ScriptOfState(int state) {
}
static int statePrintForState(int state, script_mode inScriptType) {
int StateToPrint;
int StateToPrint = state;
if (state >= SCE_HJ_START) {
if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) {
StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON);
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS);
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS);
} else {
StateToPrint = state;
}
}
return StateToPrint;
@ -225,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 caseSensitive, bool isXml) {
char s[30 + 2];
// Copy after the '<'
unsigned int i = 0;
@ -241,9 +267,10 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
s[i] = ' ';
s[i+1] = '\0';
// 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
// (There are many more. We will need a keywordlist in the property file for this)
tagDontFold = (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';
@ -403,21 +430,21 @@ static int StateForScript(script_type scriptLanguage) {
return Result;
}
static inline bool ishtmlwordchar(char ch) {
static inline bool ishtmlwordchar(int ch) {
return !isascii(ch) ||
(isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#');
}
static inline bool issgmlwordchar(char ch) {
static inline bool issgmlwordchar(int ch) {
return !isascii(ch) ||
(isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[');
}
static inline bool IsPhpWordStart(const unsigned char ch) {
static inline bool IsPhpWordStart(int ch) {
return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
}
static inline bool IsPhpWordChar(char ch) {
static inline bool IsPhpWordChar(int ch) {
return IsADigit(ch) || IsPhpWordStart(ch);
}
@ -438,11 +465,11 @@ static bool IsScriptCommentState(const int state) {
state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE;
}
static bool isLineEnd(char ch) {
static bool isLineEnd(int ch) {
return ch == '\r' || ch == '\n';
}
static bool isOKBeforeRE(char ch) {
static bool isOKBeforeRE(int ch) {
return (ch == '(') || (ch == '=') || (ch == ',');
}
@ -470,7 +497,7 @@ static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringD
}
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
Accessor &styler, bool isXml) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
@ -478,8 +505,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
styler.StartAt(startPos, STYLE_MAX);
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
char prevWord[200];
prevWord[0] = '\0';
char phpStringDelimiter[200]; // PHP is not limited in length, we are
@ -501,7 +528,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
length++;
state = styler.StyleAt(startPos);
}
styler.StartAt(startPos, STYLE_MAX);
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
int lineCurrent = styler.GetLine(startPos);
int lineState;
@ -531,13 +558,17 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true);
const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true);
const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int visibleChars = 0;
char chPrev = ' ';
char ch = ' ';
char chPrevNonWhite = ' ';
int chPrev = ' ';
int ch = ' ';
int chPrevNonWhite = ' ';
// look back to set chPrevNonWhite properly for better regex colouring
if (scriptLanguage == eScriptJS && startPos > 0) {
int back = startPos;
@ -549,30 +580,30 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
}
if (style == SCE_HJ_SYMBOLS) {
chPrevNonWhite = styler.SafeGetCharAt(back);
chPrevNonWhite = static_cast<unsigned char>(styler.SafeGetCharAt(back));
}
}
styler.StartSegment(startPos);
const int lengthDoc = startPos + length;
for (int i = startPos; i < lengthDoc; i++) {
const char chPrev2 = chPrev;
const int chPrev2 = chPrev;
chPrev = ch;
if (!isspacechar(ch) && state != SCE_HJ_COMMENT &&
if (!IsASpace(ch) && state != SCE_HJ_COMMENT &&
state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC)
chPrevNonWhite = ch;
ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
const char chNext2 = styler.SafeGetCharAt(i + 2);
ch = static_cast<unsigned char>(styler[i]);
int chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
const int chNext2 = static_cast<unsigned char>(styler.SafeGetCharAt(i + 2));
// Handle DBCS codepages
if (styler.IsLeadByte(ch)) {
if (styler.IsLeadByte(static_cast<char>(ch))) {
chPrev = ' ';
i += 1;
continue;
}
if ((!isspacechar(ch) || !foldCompact) && fold)
if ((!IsASpace(ch) || !foldCompact) && fold)
visibleChars++;
// decide what is the current state to print (depending of the script tag)
@ -660,22 +691,24 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HJ_COMMENTDOC:
//case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide
// the end of script marker from some JS interpreters.
case SCE_HB_COMMENTLINE:
case SCE_HBA_COMMENTLINE:
case SCE_HJ_DOUBLESTRING:
case SCE_HJ_SINGLESTRING:
case SCE_HJ_REGEX:
case SCE_HB_STRING:
case SCE_HBA_STRING:
case SCE_HP_STRING:
case SCE_HP_TRIPLE:
case SCE_HP_TRIPLEDOUBLE:
break;
default :
// check if the closing tag is a script tag
if (state == SCE_HJ_COMMENTLINE) {
if (state == SCE_HJ_COMMENTLINE || isXml) {
char tag[7]; // room for the <script> tag
char chr; // current char
int j = 0;
chr = styler.SafeGetCharAt(i+2);
while (j < 6 && !isspacechar(chr)) {
char chr = styler.SafeGetCharAt(i+2);
while (j < 6 && !IsASpace(chr)) {
tag[j++] = static_cast<char>(MakeLowerCase(chr));
chr = styler.SafeGetCharAt(i+2+j);
}
@ -724,7 +757,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
levelCurrent++;
}
// should be better
ch = styler.SafeGetCharAt(i);
ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
continue;
}
@ -763,7 +796,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (foldHTMLPreprocessor)
levelCurrent++;
// should be better
ch = styler.SafeGetCharAt(i);
ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
continue;
}
@ -942,12 +975,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
// find the length of the word
int size = 1;
while (ishtmlwordchar(styler.SafeGetCharAt(i + size)))
while (setHTMLWord.Contains(static_cast<unsigned char>(styler.SafeGetCharAt(i + size))))
size++;
styler.ColourTo(i + size - 1, StateToPrint);
i += size - 1;
visibleChars += size - 1;
ch = styler.SafeGetCharAt(i);
ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
if (scriptLanguage == eScriptSGMLblock) {
state = SCE_H_SGML_BLOCK_DEFAULT;
} else {
@ -1030,9 +1063,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_TAGUNKNOWN:
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) {
int eClass = classifyTagHTML(styler.GetStartSegment(),
i - 1, keywords, styler, tagDontFold, caseSensitive);
i - 1, keywords, styler, tagDontFold, caseSensitive, isXml);
if (eClass == SCE_H_SCRIPT) {
if (!tagClosing) {
inScriptType = eNonHtmlScript;
@ -1082,7 +1115,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_ATTRIBUTE:
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
if (!setAttributeContinue.Contains(ch)) {
if (inScriptType == eNonHtmlScript) {
int scriptLanguagePrev = scriptLanguage;
clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
@ -1155,7 +1188,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
i++;
ch = chNext;
state = SCE_H_DEFAULT;
} else if (ishtmlwordchar(ch)) {
} else if (setHTMLWord.Contains(ch)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_H_ATTRIBUTE;
}
@ -1179,7 +1212,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_VALUE:
if (!ishtmlwordchar(ch)) {
if (!setHTMLWord.Contains(ch)) {
if (ch == '\"' && chPrev == '=') {
// Should really test for being first character
state = SCE_H_DOUBLESTRING;
@ -1216,7 +1249,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HJ_DEFAULT:
case SCE_HJ_START:
case SCE_HJ_SYMBOLS:
if (iswordstart(ch)) {
if (IsAWordStart(ch)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_WORD;
} else if (ch == '/' && chNext == '*') {
@ -1245,7 +1278,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_COMMENTLINE;
i += 2;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i - 1, StateToPrint);
styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
state = SCE_HJ_DEFAULT;
@ -1257,7 +1290,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_HJ_WORD:
if (!iswordchar(ch)) {
if (!IsAWordChar(ch)) {
classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType);
//styler.ColourTo(i - 1, eHTJSKeyword);
state = SCE_HJ_DEFAULT;
@ -1276,7 +1309,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_COMMENTLINE;
i += 2;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
state = SCE_HJ_DEFAULT;
}
@ -1346,7 +1379,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
while (isascii(chNext) && islower(chNext)) { // gobble regex flags
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
}
}
styler.ColourTo(i, StateToPrint);
@ -1356,13 +1389,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (chNext == '\\' || chNext == '/') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
}
}
break;
case SCE_HB_DEFAULT:
case SCE_HB_START:
if (iswordstart(ch)) {
if (IsAWordStart(ch)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HB_WORD;
} else if (ch == '\'') {
@ -1375,7 +1408,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.SafeGetCharAt(i + 3) == '-') {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HB_COMMENTLINE;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i - 1, StateToPrint);
styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
state = SCE_HB_DEFAULT;
@ -1387,14 +1420,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_HB_WORD:
if (!iswordchar(ch)) {
if (!IsAWordChar(ch)) {
state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
if (state == SCE_HB_DEFAULT) {
if (ch == '\"') {
state = SCE_HB_STRING;
} else if (ch == '\'') {
state = SCE_HB_COMMENTLINE;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
state = SCE_HB_DEFAULT;
}
@ -1427,7 +1460,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
case SCE_HP_DEFAULT:
case SCE_HP_START:
if (iswordstart(ch)) {
if (IsAWordStart(ch)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HP_WORD;
} else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') &&
@ -1444,7 +1477,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HP_TRIPLEDOUBLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
} else {
// state = statePrintForState(SCE_HP_STRING,inScriptType);
state = SCE_HP_STRING;
@ -1456,11 +1489,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HP_TRIPLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
} else {
state = SCE_HP_CHARACTER;
}
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i - 1, StateToPrint);
styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType));
} else if ((ch == ' ') || (ch == '\t')) {
@ -1471,7 +1504,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_HP_WORD:
if (!iswordchar(ch)) {
if (!IsAWordChar(ch)) {
classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
state = SCE_HP_DEFAULT;
if (ch == '#') {
@ -1482,7 +1515,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HP_TRIPLEDOUBLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
} else {
state = SCE_HP_STRING;
}
@ -1492,11 +1525,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HP_TRIPLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
} else {
state = SCE_HP_CHARACTER;
}
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType));
}
}
@ -1512,7 +1545,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
}
} else if (ch == '\"') {
styler.ColourTo(i, StateToPrint);
@ -1524,7 +1557,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
}
} else if (ch == '\'') {
styler.ColourTo(i, StateToPrint);
@ -1545,7 +1578,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
///////////// start - PHP state handling
case SCE_HPHP_WORD:
if (!iswordchar(ch)) {
if (!IsAWordChar(ch)) {
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
if (ch == '/' && chNext == '*') {
i++;
@ -1565,7 +1598,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_SIMPLESTRING;
} else if (ch == '$' && IsPhpWordStart(chNext)) {
state = SCE_HPHP_VARIABLE;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
state = SCE_HPHP_OPERATOR;
} else {
state = SCE_HPHP_DEFAULT;
@ -1578,7 +1611,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
&& strchr(".xXabcdefABCDEF", ch) == NULL
&& ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) {
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
if (isoperator(ch))
if (IsOperator(ch))
state = SCE_HPHP_OPERATOR;
else
state = SCE_HPHP_DEFAULT;
@ -1587,7 +1620,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HPHP_VARIABLE:
if (!IsPhpWordChar(ch)) {
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
if (isoperator(ch))
if (IsOperator(ch))
state = SCE_HPHP_OPERATOR;
else
state = SCE_HPHP_DEFAULT;
@ -1651,7 +1684,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 1, StateToPrint);
if (IsADigit(ch) || (ch == '.' && IsADigit(chNext))) {
state = SCE_HPHP_NUMBER;
} else if (iswordstart(ch)) {
} else if (IsAWordStart(ch)) {
state = SCE_HPHP_WORD;
} else if (ch == '/' && chNext == '*') {
i++;
@ -1671,9 +1704,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_SIMPLESTRING;
} else if (ch == '$' && IsPhpWordStart(chNext)) {
state = SCE_HPHP_VARIABLE;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
state = SCE_HPHP_OPERATOR;
} else if ((state == SCE_HPHP_OPERATOR) && (isspacechar(ch))) {
} else if ((state == SCE_HPHP_OPERATOR) && (IsASpace(ch))) {
state = SCE_HPHP_DEFAULT;
}
break;
@ -1689,9 +1722,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HB_STRING;
} else if (ch == '\'') {
state = SCE_HB_COMMENTLINE;
} else if (iswordstart(ch)) {
} else if (IsAWordStart(ch)) {
state = SCE_HB_WORD;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i, SCE_HB_DEFAULT);
}
} else if (state == SCE_HBA_DEFAULT) { // One of the above succeeded
@ -1699,9 +1732,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HBA_STRING;
} else if (ch == '\'') {
state = SCE_HBA_COMMENTLINE;
} else if (iswordstart(ch)) {
} else if (IsAWordStart(ch)) {
state = SCE_HBA_WORD;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i, SCE_HBA_DEFAULT);
}
} else if (state == SCE_HJ_DEFAULT) { // One of the above succeeded
@ -1716,9 +1749,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HJ_DOUBLESTRING;
} else if ((ch == '\'') && (nonEmptySegment)) {
state = SCE_HJ_SINGLESTRING;
} else if (iswordstart(ch)) {
} else if (IsAWordStart(ch)) {
state = SCE_HJ_WORD;
} else if (isoperator(ch)) {
} else if (IsOperator(ch)) {
styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
}
}
@ -1734,6 +1767,18 @@ 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);
}
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);
}
static bool isASPScript(int state) {
return
(state >= SCE_HJA_START && state <= SCE_HJA_REGEX) ||
@ -1808,7 +1853,7 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
sc.SetState(SCE_H_DEFAULT);
}
} else if (sc.state == SCE_H_TAGUNKNOWN) {
if (!ishtmlwordchar(static_cast<char>(sc.ch)) && !((sc.ch == '/') && (sc.chPrev == '<')) && sc.ch != '[') {
if (!ishtmlwordchar(sc.ch) && !((sc.ch == '/') && (sc.chPrev == '<')) && sc.ch != '[') {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (s[1] == '/') {
@ -1831,7 +1876,7 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
}
}
} else if (sc.state == SCE_H_ATTRIBUTE) {
if (!ishtmlwordchar(static_cast<char>(sc.ch))) {
if (!ishtmlwordchar(sc.ch)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (!keywordsTags.InList(s)) {
@ -1883,7 +1928,7 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
} else if (sc.ch == '>') {
sc.SetState(SCE_H_TAG);
sc.ForwardSetState(SCE_H_DEFAULT);
} else if (ishtmlwordchar(static_cast<char>(sc.ch))) {
} else if (ishtmlwordchar(sc.ch)) {
sc.SetState(SCE_H_ATTRIBUTE);
}
}
@ -1927,8 +1972,8 @@ static void ColouriseASPPiece(StyleContext &sc, WordList *keywordlists[]) {
static void ColouriseASPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
StyleContext sc(startPos, length, initStyle, styler, 0x7f);
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(STYLE_MAX));
for (; sc.More(); sc.Forward()) {
ColouriseASPPiece(sc, keywordlists);
}
@ -2011,7 +2056,7 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
sc.SetState(SCE_HPHP_SIMPLESTRING);
} else if (sc.ch == '$' && IsPhpWordStart(static_cast<char>(sc.chNext))) {
sc.SetState(SCE_HPHP_VARIABLE);
} else if (isoperator(static_cast<char>(sc.ch))) {
} else if (IsOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_HPHP_OPERATOR);
}
}
@ -2019,8 +2064,8 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
// Lexer for HTML requires more lexical states (7 bits worth) than most lexers
StyleContext sc(startPos, length, initStyle, styler, 0x7f);
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(STYLE_MAX));
for (; sc.More(); sc.Forward()) {
ColourisePHPPiece(sc, keywordlists);
}
@ -2030,7 +2075,7 @@ 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;
ColouriseHyperTextDoc(startPos,length,initStyle,keywordlists,styler);
ColouriseHTMLDoc(startPos,length,initStyle,keywordlists,styler);
}
static const char * const htmlWordListDesc[] = {
@ -2053,9 +2098,9 @@ static const char * const phpscriptWordListDesc[] = {
0,
};
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc, 7);
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc, 7);
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8);
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8);
// SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead.
LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 7);
LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 7);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 7);
LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 8);
LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 8);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8);

View File

@ -31,6 +31,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#ifdef BUILD_AS_EXTERNAL_LEXER
#include "ExternalLexer.h"
@ -85,12 +89,16 @@ static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
else if (sc.state == SCE_HA_STRING) {
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_HA_DEFAULT);
} else if (sc.ch == '\\') {
sc.Forward();
}
}
// Char
else if (sc.state == SCE_HA_CHARACTER) {
if (sc.ch == '\'') {
sc.ForwardSetState(SCE_HA_DEFAULT);
} else if (sc.ch == '\\') {
sc.Forward();
}
}
// Number
@ -185,7 +193,7 @@ static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_HA_STRING);
}
// Character
else if (sc.Match('\'') && IsWhitespace(sc.GetRelative(-1)) ) {
else if (sc.Match('\'')) {
sc.SetState(SCE_HA_CHARACTER);
}
// Stringstart
@ -261,3 +269,4 @@ void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
LexerModule lmHaskell(SCLEX_HASKELL, ColorizeHaskellDoc, "haskell");

View File

@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
int state = SCE_INNO_DEFAULT;
char chPrev;

View File

@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.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 == '_';
@ -120,3 +124,4 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
LexerModule lmKix(SCLEX_KIX, ColouriseKixDoc, "kix");

View File

@ -21,6 +21,10 @@
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define SCE_LISP_CHARACTER 29
#define SCE_LISP_MACRO 30
#define SCE_LISP_MACRO_DISPATCH 31

View File

@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '@' || ch == '_');
}

View File

@ -22,6 +22,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||

View File

@ -22,6 +22,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
@ -181,3 +184,4 @@ static const char * const MMIXALWordListDesc[] = {
LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc);

View File

@ -20,6 +20,10 @@
#include "SciLexer.h"
#include "SString.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static int GetLotLineState(SString &line) {
if (line.length()) {
// Most of the time the first non-blank character in line determines that line's type

View File

@ -19,6 +19,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define KW_MSSQL_STATEMENTS 0
#define KW_MSSQL_DATA_TYPES 1
#define KW_MSSQL_SYSTEM_TABLES 2

445
scintilla/src/LexMagik.cxx Normal file
View File

@ -0,0 +1,445 @@
// Scintilla source code edit control
/**
* @file LexMagik.cxx
* Lexer for GE(r) Smallworld(tm) MagikSF
*/
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/**
* Is it a core character (C isalpha(), exclamation and question mark)
*
* \param ch The character
* \return True if ch is a character, False otherwise
*/
static inline bool IsAlphaCore(int ch) {
return (isalpha(ch) || ch == '!' || ch == '?');
}
/**
* Is it a character (IsAlphaCore() and underscore)
*
* \param ch The character
* \return True if ch is a character, False otherwise
*/
static inline bool IsAlpha(int ch) {
return (IsAlphaCore(ch) || ch == '_');
}
/**
* Is it a symbolic character (IsAlpha() and colon)
*
* \param ch The character
* \return True if ch is a character, False otherwise
*/
static inline bool IsAlphaSym(int ch) {
return (IsAlpha(ch) || ch == ':');
}
/**
* Is it a numerical character (IsAlpha() and 0 - 9)
*
* \param ch The character
* \return True if ch is a character, False otherwise
*/
static inline bool IsAlNum(int ch) {
return ((ch > '0' && ch < '9') || IsAlpha(ch));
}
/**
* Is it a symbolic numerical character (IsAlNum() and colon)
*
* \param ch The character
* \return True if ch is a character, False otherwise
*/
static inline bool IsAlNumSym(int ch) {
return (IsAlNum(ch) || ch == ':');
}
/**
* The lexer function
*
* \param startPos Where to start scanning
* \param length Where to scan to
* \param initStyle The style at the initial point, not used in this folder
* \param keywordslists The keywordslists, currently, number 5 is used
* \param styler The styler
*/
static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
styler.StartAt(startPos);
WordList &keywords = *keywordlists[0];
WordList &pragmatics = *keywordlists[1];
WordList &containers = *keywordlists[2];
WordList &flow = *keywordlists[3];
WordList &characters = *keywordlists[4];
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
repeat:
if(sc.ch == '#') {
if (sc.chNext == '#') sc.SetState(SCE_MAGIK_HYPER_COMMENT);
else sc.SetState(SCE_MAGIK_COMMENT);
for(; sc.More() && !(sc.atLineEnd); sc.Forward());
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
if(sc.ch == '"') {
sc.SetState(SCE_MAGIK_STRING);
if(sc.More())
{
sc.Forward();
for(; sc.More() && sc.ch != '"'; sc.Forward());
}
sc.ForwardSetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
// The default state
if(sc.state == SCE_MAGIK_DEFAULT) {
// A certain keyword has been detected
if (sc.ch == '_' && (
sc.currentPos == 0 || !IsAlNum(sc.chPrev))) {
char keyword[50];
memset(keyword, '\0', 50);
for(
int scanPosition = 0;
scanPosition < 50;
scanPosition++) {
char keywordChar = static_cast<char>(
tolower(styler.SafeGetCharAt(
scanPosition +
static_cast<int>(sc.currentPos+1), ' ')));
if(IsAlpha(keywordChar)) {
keyword[scanPosition] = keywordChar;
} else {
break;
}
}
// It is a pragma
if(pragmatics.InList(keyword)) {
sc.SetState(SCE_MAGIK_PRAGMA);
}
// it is a normal keyword like _local, _self, etc.
else if(keywords.InList(keyword)) {
sc.SetState(SCE_MAGIK_KEYWORD);
}
// It is a container keyword, such as _method, _proc, etc.
else if(containers.InList(keyword)) {
sc.SetState(SCE_MAGIK_CONTAINER);
}
// It is a flow keyword, such as _for, _if, _try, etc.
else if(flow.InList(keyword)) {
sc.SetState(SCE_MAGIK_FLOW);
}
// Interpret as unknown keyword
else {
sc.SetState(SCE_MAGIK_UNKNOWN_KEYWORD);
}
}
// Symbolic expression
else if(sc.ch == ':' && !IsAlNum(sc.chPrev)) {
sc.SetState(SCE_MAGIK_SYMBOL);
bool firstTrip = true;
for(sc.Forward(); sc.More(); sc.Forward()) {
if(firstTrip && IsAlphaSym(sc.ch));
else if(!firstTrip && IsAlNumSym(sc.ch));
else if(sc.ch == '|') {
for(sc.Forward();
sc.More() && sc.ch != '|';
sc.Forward());
}
else break;
firstTrip = false;
}
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
// Identifier (label) expression
else if(sc.ch == '@') {
sc.SetState(SCE_MAGIK_IDENTIFIER);
bool firstTrip = true;
for(sc.Forward(); sc.More(); sc.Forward()) {
if(firstTrip && IsAlphaCore(sc.ch)) {
firstTrip = false;
}
else if(!firstTrip && IsAlpha(sc.ch));
else break;
}
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
// Start of a character
else if(sc.ch == '%') {
sc.SetState(SCE_MAGIK_CHARACTER);
sc.Forward();
char keyword[50];
memset(keyword, '\0', 50);
for(
int scanPosition = 0;
scanPosition < 50;
scanPosition++) {
char keywordChar = static_cast<char>(
tolower(styler.SafeGetCharAt(
scanPosition +
static_cast<int>(sc.currentPos), ' ')));
if(IsAlpha(keywordChar)) {
keyword[scanPosition] = keywordChar;
} else {
break;
}
}
if(characters.InList(keyword)) {
sc.Forward(strlen(keyword));
} else {
sc.Forward();
}
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
// Operators
else if(
sc.ch == '>' ||
sc.ch == '<' ||
sc.ch == '.' ||
sc.ch == ',' ||
sc.ch == '+' ||
sc.ch == '-' ||
sc.ch == '/' ||
sc.ch == '*' ||
sc.ch == '~' ||
sc.ch == '$' ||
sc.ch == '=') {
sc.SetState(SCE_MAGIK_OPERATOR);
}
// Braces
else if(sc.ch == '(' || sc.ch == ')') {
sc.SetState(SCE_MAGIK_BRACE_BLOCK);
}
// Brackets
else if(sc.ch == '{' || sc.ch == '}') {
sc.SetState(SCE_MAGIK_BRACKET_BLOCK);
}
// Square Brackets
else if(sc.ch == '[' || sc.ch == ']') {
sc.SetState(SCE_MAGIK_SQBRACKET_BLOCK);
}
}
// It is an operator
else if(
sc.state == SCE_MAGIK_OPERATOR ||
sc.state == SCE_MAGIK_BRACE_BLOCK ||
sc.state == SCE_MAGIK_BRACKET_BLOCK ||
sc.state == SCE_MAGIK_SQBRACKET_BLOCK) {
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
// It is the pragma state
else if(sc.state == SCE_MAGIK_PRAGMA) {
if(!IsAlpha(sc.ch)) {
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
}
// It is the keyword state
else if(
sc.state == SCE_MAGIK_KEYWORD ||
sc.state == SCE_MAGIK_CONTAINER ||
sc.state == SCE_MAGIK_FLOW ||
sc.state == SCE_MAGIK_UNKNOWN_KEYWORD) {
if(!IsAlpha(sc.ch)) {
sc.SetState(SCE_MAGIK_DEFAULT);
goto repeat;
}
}
}
sc.Complete();
}
/**
* The word list description
*/
static const char * const magikWordListDesc[] = {
"Accessors (local, global, self, super, thisthread)",
"Pragmatic (pragma, private)",
"Containers (method, block, proc)",
"Flow (if, then, elif, else)",
"Characters (space, tab, newline, return)",
"Fold Containers (method, proc, block, if, loop)",
0};
/**
* This function detects keywords which are able to have a body. Note that it
* uses the Fold Containers word description, not the containers description. It
* only works when the style at that particular position is set on Containers
* or Flow (number 3 or 4).
*
* \param keywordslist The list of keywords that are scanned, they should only
* contain the start keywords, not the end keywords
* \param The actual keyword
* \return 1 if it is a folding start-keyword, -1 if it is a folding end-keyword
* 0 otherwise
*/
static inline int IsFoldingContainer(WordList &keywordslist, char * keyword) {
if(
strlen(keyword) > 3 &&
keyword[0] == 'e' && keyword[1] == 'n' && keyword[2] == 'd') {
if (keywordslist.InList(keyword + 3)) {
return -1;
}
} else {
if(keywordslist.InList(keyword)) {
return 1;
}
}
return 0;
}
/**
* The folding function
*
* \param startPos Where to start scanning
* \param length Where to scan to
* \param keywordslists The keywordslists, currently, number 5 is used
* \param styler The styler
*/
static void FoldMagikDoc(unsigned int startPos, int length, int,
WordList *keywordslists[], Accessor &styler) {
bool compact = styler.GetPropertyInt("fold.compact") != 0;
WordList &foldingElements = *keywordslists[5];
int endPos = startPos + length;
int line = styler.GetLine(startPos);
int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK;
int flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK;
for(
int currentPos = startPos;
currentPos < endPos;
currentPos++) {
char currentState = styler.StyleAt(currentPos);
char c = styler.SafeGetCharAt(currentPos, ' ');
int prevLine = styler.GetLine(currentPos - 1);
line = styler.GetLine(currentPos);
// Default situation
if(prevLine < line) {
styler.SetLevel(line, (level|flags) & ~SC_FOLDLEVELHEADERFLAG);
flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK;
}
if(
(
currentState == SCE_MAGIK_CONTAINER ||
currentState == SCE_MAGIK_FLOW
) &&
c == '_') {
char keyword[50];
memset(keyword, '\0', 50);
for(
int scanPosition = 0;
scanPosition < 50;
scanPosition++) {
char keywordChar = static_cast<char>(
tolower(styler.SafeGetCharAt(
scanPosition +
currentPos + 1, ' ')));
if(IsAlpha(keywordChar)) {
keyword[scanPosition] = keywordChar;
} else {
break;
}
}
if(IsFoldingContainer(foldingElements, keyword) > 0) {
styler.SetLevel(
line,
styler.LevelAt(line) | SC_FOLDLEVELHEADERFLAG);
level++;
} else if(IsFoldingContainer(foldingElements, keyword) < 0) {
styler.SetLevel(line, styler.LevelAt(line));
level--;
}
}
if(
compact && (
currentState == SCE_MAGIK_BRACE_BLOCK ||
currentState == SCE_MAGIK_BRACKET_BLOCK ||
currentState == SCE_MAGIK_SQBRACKET_BLOCK)) {
if(c == '{' || c == '[' || c == '(') {
styler.SetLevel(
line,
styler.LevelAt(line) | SC_FOLDLEVELHEADERFLAG);
level++;
} else if(c == '}' || c == ']' || c == ')') {
styler.SetLevel(line, styler.LevelAt(line));
level--;
}
}
}
}
/**
* Injecting the module
*/
LexerModule lmMagikSF(
SCLEX_MAGIK, ColouriseMagikDoc, "magiksf", FoldMagikDoc, magikWordListDesc);

View File

@ -25,6 +25,9 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool IsMatlabCommentChar(int c) {
return (c == '%') ;

View File

@ -3,6 +3,8 @@
// File: LexMetapost.cxx - general context conformant metapost coloring scheme
// Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com
// Version: September 28, 2003
// Modified by instanton: July 10, 2007
// Folding based on keywordlists[]
// Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -25,6 +27,10 @@
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// val SCE_METAPOST_DEFAULT = 0
// val SCE_METAPOST_SPECIAL = 1
// val SCE_METAPOST_GROUP = 2
@ -317,4 +323,77 @@ static const char * const metapostWordListDesc[] = {
0
} ;
LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", 0, metapostWordListDesc);
static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) {
WordList& keywordsStart=*keywordlists[3];
WordList& keywordsStop1=*keywordlists[4];
if (keywordsStart.InList(s)) {return 1;}
else if (keywordsStop1.InList(s)) {return -1;}
return 0;
}
static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)
{
int length=0;
char ch=styler.SafeGetCharAt(pos);
*word=0;
while(isMETAPOSTidentifier(ch) && isalpha(ch) && length<100){
word[length]=ch;
length++;
ch=styler.SafeGetCharAt(pos+length);
}
word[length]=0;
return length;
}
static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)
{
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos+length;
int visibleChars=0;
int lineCurrent=styler.GetLine(startPos);
int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent=levelPrev;
char chNext=styler[startPos];
char buffer[100]="";
for (unsigned int i=startPos; i < endPos; i++) {
char ch=chNext;
chNext=styler.SafeGetCharAt(i+1);
char chPrev=styler.SafeGetCharAt(i-1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if(i==0 || chPrev == '\r' || chPrev=='\n'|| chPrev==' '|| chPrev=='(' || chPrev=='$')
{
ParseMetapostWord(i, styler, buffer);
levelCurrent += classifyFoldPointMetapost(buffer,keywordlists);
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", FoldMetapostDoc, metapostWordListDesc);

View File

@ -19,6 +19,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/*
// located in SciLexer.h
#define SCLEX_NSIS 43
@ -648,3 +652,4 @@ static const char * const nsisWordLists[] = {
LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);

View File

@ -393,10 +393,10 @@ static bool matchKeyword(unsigned int start, WordList &keywords, Accessor &style
bool FoundKeyword = false;
for (unsigned int i = 0;
strlen(keywords[i]) > 0 && !FoundKeyword;
strlen(keywords.words[i]) > 0 && !FoundKeyword;
i++) {
if (atoi(keywords[i]) == keywordtype) {
FoundKeyword = styler.Match(start, ((char *)keywords[i]) + 2);
if (atoi(keywords.words[i]) == keywordtype) {
FoundKeyword = styler.Match(start, ((char *)keywords.words[i]) + 2);
}
}
return FoundKeyword;

View File

@ -19,6 +19,10 @@
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
{
unsigned int i = 0;

View File

@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool Is0To9(char ch) {
return (ch >= '0') && (ch <= '9');
}
@ -814,7 +818,7 @@ 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) {
static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) {
if (lineBuffer[0] == '>') {
// Command or return status
return SCE_ERR_CMD;
@ -897,7 +901,9 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
// Microsoft: <filename>(<line>,<column>)<message>
// CTags: \t<message>
// Lua 5 traceback: \t<filename>:<line>:<message>
// Lua 5.1: <exe>: <filename>:<line>:<message>
bool initialTab = (lineBuffer[0] == '\t');
bool initialColonPart = false;
enum { stInitial,
stGccStart, stGccDigit, stGcc,
stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
@ -912,10 +918,12 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
if (state == stInitial) {
if (ch == ':') {
// May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
if ((chNext != '\\') && (chNext != '/')) {
if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) {
// This check is not completely accurate as may be on
// GTK+ with a file name that includes ':'.
state = stGccStart;
} else if (chNext == ' ') { // indicates a Lua 5.1 error message
initialColonPart = true;
}
} else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
// May be Microsoft
@ -930,6 +938,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
} else if (state == stGccDigit) { // <filename>:<line>
if (ch == ':') {
state = stGcc; // :9.*: is GCC
startValue = i + 1;
break;
} else if (!Is0To9(ch)) {
state = stUnrecognized;
@ -990,7 +999,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
}
}
if (state == stGcc) {
return SCE_ERR_GCC;
return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC;
} else if ((state == stMsVc) || (state == stMsDotNet)) {
return SCE_ERR_MS;
} else if ((state == stCtagsStringDollar) || (state == stCtags)) {
@ -1005,8 +1014,16 @@ static void ColouriseErrorListLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int endPos,
Accessor &styler) {
styler.ColourTo(endPos, RecogniseErrorListLine(lineBuffer, lengthLine));
Accessor &styler,
bool valueSeparate) {
int startValue = -1;
int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
if (valueSeparate && (startValue >= 0)) {
styler.ColourTo(endPos - (lengthLine - startValue), style);
styler.ColourTo(endPos, SCE_ERR_VALUE);
} else {
styler.ColourTo(endPos, style);
}
}
static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
@ -1014,17 +1031,18 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
ColouriseErrorListLine(lineBuffer, linePos, i, styler);
ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate);
linePos = 0;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler);
ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate);
}
}

View File

@ -48,6 +48,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsTypeCharacter(const int ch)
{
return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$' || ch == '?';

198
scintilla/src/LexPLM.cxx Normal file
View File

@ -0,0 +1,198 @@
// Copyright (c) 1990-2007, Scientific Toolworks, Inc.
// Author: Jason Haslam
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void GetRange(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
}
s[i] = '\0';
}
static void ColourisePlmDoc(unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
unsigned int endPos = startPos + length;
int state = initStyle;
styler.StartAt(startPos);
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < endPos; i++) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
if (state == SCE_PLM_DEFAULT) {
if (ch == '/' && chNext == '*') {
styler.ColourTo(i - 1, state);
state = SCE_PLM_COMMENT;
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_PLM_STRING;
} else if (isdigit(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PLM_NUMBER;
} else if (isalpha(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PLM_IDENTIFIER;
} else if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
ch == '=' || ch == '<' || ch == '>' || ch == ':') {
styler.ColourTo(i - 1, state);
state = SCE_PLM_OPERATOR;
} else if (ch == '$') {
styler.ColourTo(i - 1, state);
state = SCE_PLM_CONTROL;
}
} else if (state == SCE_PLM_COMMENT) {
if (ch == '*' && chNext == '/') {
i++;
styler.ColourTo(i, state);
state = SCE_PLM_DEFAULT;
}
} else if (state == SCE_PLM_STRING) {
if (ch == '\'') {
if (chNext == '\'') {
i++;
} else {
styler.ColourTo(i, state);
state = SCE_PLM_DEFAULT;
}
}
} else if (state == SCE_PLM_NUMBER) {
if (!isdigit(ch) && !isalpha(ch) && ch != '$') {
i--;
styler.ColourTo(i, state);
state = SCE_PLM_DEFAULT;
}
} else if (state == SCE_PLM_IDENTIFIER) {
if (!isdigit(ch) && !isalpha(ch) && ch != '$') {
// Get the entire identifier.
char word[1024];
int segmentStart = styler.GetStartSegment();
GetRange(segmentStart, i - 1, styler, word, sizeof(word));
i--;
if (keywordlists[0]->InList(word))
styler.ColourTo(i, SCE_PLM_KEYWORD);
else
styler.ColourTo(i, state);
state = SCE_PLM_DEFAULT;
}
} else if (state == SCE_PLM_OPERATOR) {
if (ch != '=' && ch != '>') {
i--;
styler.ColourTo(i, state);
state = SCE_PLM_DEFAULT;
}
} else if (state == SCE_PLM_CONTROL) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_PLM_DEFAULT;
}
}
}
styler.ColourTo(endPos - 1, state);
}
static void FoldPlmDoc(unsigned int startPos,
int length,
int initStyle,
WordList *[],
Accessor &styler)
{
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
int startKeyword = 0;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (stylePrev != SCE_PLM_KEYWORD && style == SCE_PLM_KEYWORD)
startKeyword = i;
if (style == SCE_PLM_KEYWORD && styleNext != SCE_PLM_KEYWORD) {
char word[1024];
GetRange(startKeyword, i, styler, word, sizeof(word));
if (strcmp(word, "procedure") == 0 || strcmp(word, "do") == 0)
levelCurrent++;
else if (strcmp(word, "end") == 0)
levelCurrent--;
}
if (foldComment) {
if (stylePrev != SCE_PLM_COMMENT && style == SCE_PLM_COMMENT)
levelCurrent++;
else if (stylePrev == SCE_PLM_COMMENT && style != SCE_PLM_COMMENT)
levelCurrent--;
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char *const plmWordListDesc[] = {
"Keywords",
0
};
LexerModule lmPLM(SCLEX_PLM, ColourisePlmDoc, "PL/M", FoldPlmDoc, plmWordListDesc);

View File

@ -29,6 +29,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(int ch) {
return ch < 0x80 && (isalnum(ch) || ch == '_');
}

View File

@ -21,6 +21,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsASelfDelimitingChar(const int ch) {
return (ch == '[' || ch == ']' || ch == '{' || ch == '}' ||
ch == '/' || ch == '<' || ch == '>' ||
@ -103,7 +107,7 @@ static void ColourisePSDoc(
sc.SetState(SCE_C_DEFAULT);
} else if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT);
} else if (IsAWhitespaceChar(sc.ch)) {
} else if (IsAWhitespaceChar(sc.ch) && sc.ch != '\r') {
sc.ChangeState(SCE_PS_COMMENT);
}
} else if (sc.state == SCE_PS_NUMBER) {

View File

@ -21,6 +21,10 @@
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void getRange(unsigned int start,
unsigned int end,
Accessor &styler,
@ -289,7 +293,7 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (stylePrev == SCE_C_DEFAULT && style == SCE_C_WORD)
if (stylePrev != SCE_C_WORD && style == SCE_C_WORD)
{
// Store last word start point.
lastStart = i;

View File

@ -2,7 +2,7 @@
/** @file LexPerl.cxx
** Lexer for subset of Perl.
**/
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2008 by Neil Hodgson <neilh@scintilla.org>
// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my>
// The License.txt file describes the conditions under which this software may be distributed.
@ -20,6 +20,10 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define PERLNUM_BINARY 1 // order is significant: 1-4 cannot have a dot
#define PERLNUM_HEX 2
#define PERLNUM_OCTAL 3
@ -129,6 +133,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
WordList &keywords = *keywordlists[0];
// keywords that forces /PATTERN/ at all times
WordList reWords;
reWords.Set("elsif if split while");
class HereDocCls {
public:
int State; // 0: '<<' encountered
@ -183,6 +191,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
//char sooked[100];
//sooked[sookedpos] = '\0';
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
// If in a long distance lexical state, seek to the beginning to find quote characters
// Perl strings can be multi-line with embedded newlines, so backtrack.
// Perl numbers have additional state during lexing, so backtrack too.
@ -193,6 +202,14 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
startPos = styler.LineStart(styler.GetLine(startPos));
state = styler.StyleAt(startPos - 1);
}
// Backtrack for format body.
if (state == SCE_PL_FORMAT) {
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_PL_FORMAT_IDENT)) {
startPos--;
}
startPos = styler.LineStart(styler.GetLine(startPos));
state = styler.StyleAt(startPos - 1);
}
if ( state == SCE_PL_STRING_Q
|| state == SCE_PL_STRING_QQ
|| state == SCE_PL_STRING_QX
@ -206,6 +223,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|| state == SCE_PL_NUMBER
|| state == SCE_PL_IDENTIFIER
|| state == SCE_PL_ERROR
|| state == SCE_PL_SUB_PROTOTYPE
) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
startPos--;
@ -229,7 +247,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
backflag = BACK_KEYWORD;
}
styler.StartAt(startPos);
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
char chPrev = styler.SafeGetCharAt(startPos - 1);
if (startPos == 0)
chPrev = '\n';
@ -290,6 +308,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
}
}
}
if (HereDoc.State == 4 && isEOLChar(ch)) {
// Start of format body.
HereDoc.State = 0;
styler.ColourTo(i - 1, state);
state = SCE_PL_FORMAT;
}
if (state == SCE_PL_DEFAULT) {
if ((isascii(ch) && isdigit(ch)) || (isascii(chNext) && isdigit(chNext) &&
@ -427,8 +451,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else {
styler.ColourTo(i, SCE_PL_WORD);
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "format")) {
state = SCE_PL_FORMAT_IDENT;
HereDoc.State = 0;
} else {
state = SCE_PL_DEFAULT;
}
styler.ColourTo(i, SCE_PL_WORD);
backflag = BACK_KEYWORD;
backPos = i;
}
@ -436,8 +465,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
chNext = styler.SafeGetCharAt(i + 1);
// a repetition operator 'x'
} else if (state == SCE_PL_OPERATOR) {
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
goto handleOperator;
// quote-like delimiter, skip one char if double-char delimiter
} else {
i = kw - 1;
@ -498,6 +527,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
}
backflag = BACK_NONE;
} else if (ch == '%') {
backflag = BACK_NONE;
if (!isascii(chNext) || isalpha(chNext) || chNext == '#' || chNext == '$'
|| chNext == '_' || chNext == '!' || chNext == '^') {
state = SCE_PL_HASH;
@ -512,10 +542,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (chNext == '{') {
styler.ColourTo(i, SCE_PL_HASH);
} else {
styler.ColourTo(i, SCE_PL_OPERATOR);
goto handleOperator;
}
backflag = BACK_NONE;
} else if (ch == '*') {
backflag = BACK_NONE;
char strch[2];
strch[0] = chNext;
strch[1] = '\0';
@ -538,9 +568,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
ch = chNext;
chNext = chNext2;
}
styler.ColourTo(i, SCE_PL_OPERATOR);
goto handleOperator;
}
backflag = BACK_NONE;
} else if (ch == '/' || (ch == '<' && chNext == '<')) {
// Explicit backward peeking to set a consistent preferRE for
// any slash found, so no longer need to track preferRE state.
@ -552,6 +581,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
bool hereDocSpace = false; // these are for corner case:
bool hereDocScalar = false; // SCALAR [whitespace] '<<'
unsigned int bk = (i > 0)? i - 1: 0;
unsigned int bkend;
char bkch;
styler.Flush();
if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
@ -627,26 +657,22 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (bkstyle == SCE_PL_DEFAULT ||
bkstyle == SCE_PL_COMMENTLINE) {
} else if (bkstyle == SCE_PL_OPERATOR) {
// gcc 3.2.3 bloats if more compact form used
bkch = styler.SafeGetCharAt(bk);
if (bkch == '>') { // "->"
if (styler.SafeGetCharAt(bk - 1) == '-') {
// test for "->" and "::"
if ((bkch == '>' && styler.SafeGetCharAt(bk - 1) == '-')
|| (bkch == ':' && styler.SafeGetCharAt(bk - 1) == ':')) {
preferRE = false;
break;
}
} else if (bkch == ':') { // "::"
if (styler.SafeGetCharAt(bk - 1) == ':') {
} else {
// bare identifier, if '/', /PATTERN/ unless digit/space immediately after '/'
// if '//', always expect defined-or operator to follow identifier
if (!isHereDoc &&
(isspacechar(chNext) || isdigit(chNext) || chNext == '/'))
preferRE = false;
break;
}
}
} else {// bare identifier, usually a function call but Perl
// optimizes them as pseudo-constants, then the next
// '/' will be a divide; favour divide over regex
// if there is a whitespace after the '/'
if (isspacechar(chNext)) {
// HERE docs cannot have a space after the >>
if (isspacechar(chNext))
preferRE = false;
}
break;
}
bk--;
@ -655,8 +681,25 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
case SCE_PL_SCALAR: // for $var<< case
hereDocScalar = true;
break;
// other styles uses the default, preferRE=false
// for HERE docs, always true for preferRE
case SCE_PL_WORD:
preferRE = true;
if (isHereDoc)
break;
// adopt heuristics similar to vim-style rules:
// keywords always forced as /PATTERN/: split, if, elsif, while
// everything else /PATTERN/ unless digit/space immediately after '/'
// for '//', defined-or favoured unless special keywords
bkend = bk + 1;
while (bk > 0 && styler.StyleAt(bk-1) == SCE_PL_WORD) {
bk--;
}
if (isPerlKeyword(bk, bkend, reWords, styler))
break;
if (isspacechar(chNext) || isdigit(chNext) || chNext == '/')
preferRE = false;
break;
// other styles uses the default, preferRE=false
case SCE_PL_POD:
case SCE_PL_POD_VERB:
case SCE_PL_HERE_Q:
@ -666,6 +709,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
break;
}
}
backflag = BACK_NONE;
if (isHereDoc) { // handle HERE doc
// if SCALAR whitespace '<<', *always* a HERE doc
if (preferRE || (hereDocSpace && hereDocScalar)) {
@ -675,18 +719,22 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_PL_OPERATOR);
goto handleOperator;
}
} else { // handle regexp
if (preferRE) {
state = SCE_PL_REGEX;
Quote.New(1);
Quote.Open(ch);
} else { // / operator
styler.ColourTo(i, SCE_PL_OPERATOR);
} else { // / and // operators
if (chNext == '/') {
i++;
ch = chNext;
chNext = chNext2;
}
goto handleOperator;
}
}
backflag = BACK_NONE;
} else if (ch == '<') {
// looks forward for matching > on same line
unsigned int fw = i + 1;
@ -695,24 +743,23 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (fwch == ' ') {
if (styler.SafeGetCharAt(fw-1) != '\\' ||
styler.SafeGetCharAt(fw-2) != '\\')
break;
goto handleOperator;
} else if (isEOLChar(fwch) || isspacechar(fwch)) {
break;
goto handleOperator;
} else if (fwch == '>') {
if ((fw - i) == 2 && // '<=>' case
styler.SafeGetCharAt(fw-1) == '=') {
styler.ColourTo(fw, SCE_PL_OPERATOR);
} else {
styler.ColourTo(fw, SCE_PL_IDENTIFIER);
goto handleOperator;
}
styler.ColourTo(fw, SCE_PL_IDENTIFIER);
i = fw;
ch = fwch;
chNext = styler.SafeGetCharAt(i+1);
}
fw++;
}
styler.ColourTo(i, SCE_PL_OPERATOR);
backflag = BACK_NONE;
if (fw == lengthDoc)
goto handleOperator;
} else if (ch == '=' // POD
&& isalpha(chNext)
&& (isEOLChar(chPrev))) {
@ -729,6 +776,35 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
ch = chNext;
chNext = chNext2;
backflag = BACK_NONE;
} else if (ch == '-' // bareword promotion (-FOO cases)
&& ((isascii(chNext) && isalpha(chNext)) || chNext == '_')
&& backflag != BACK_NONE) {
state = SCE_PL_IDENTIFIER;
backflag = BACK_NONE;
} else if (ch == '(' && i > 0) {
// backtrack to identify if we're starting a sub prototype
// for generality, we need to ignore whitespace/comments
unsigned int bk = i - 1; // i > 0 tested above
styler.Flush();
while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_DEFAULT ||
styler.StyleAt(bk) == SCE_PL_COMMENTLINE)) {
bk--;
}
if (bk == 0 || styler.StyleAt(bk) != SCE_PL_IDENTIFIER) // check identifier
goto handleOperator;
while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_IDENTIFIER)) {
bk--;
}
while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_DEFAULT ||
styler.StyleAt(bk) == SCE_PL_COMMENTLINE)) {
bk--;
}
if (bk < 2 || styler.StyleAt(bk) != SCE_PL_WORD // check "sub" keyword
|| !styler.Match(bk - 2, "sub")) // assume suffix is unique!
goto handleOperator;
state = SCE_PL_SUB_PROTOTYPE;
backflag = BACK_NONE;
backPos = i; // needed for restart
} else if (isPerlOperator(ch)) {
if (ch == '.' && chNext == '.') { // .. and ...
i++;
@ -737,9 +813,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
}
handleOperator:
styler.ColourTo(i, SCE_PL_OPERATOR);
backflag = BACK_OPERATOR;
backPos = i;
} else if (ch == 4 || ch == 26) { // ^D and ^Z ends valid perl source
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else {
// keep colouring defaults to make restart easier
styler.ColourTo(i, SCE_PL_DEFAULT);
@ -752,8 +832,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (numState <= PERLNUM_FLOAT) {
// non-decimal number or float exponent, consume next dot
styler.ColourTo(i - 1, SCE_PL_NUMBER);
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
goto handleOperator;
} else { // decimal or vectors allows dots
dotCount++;
if (numState == PERLNUM_DECIMAL) {
@ -768,10 +848,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
goto numAtEnd;
}
}
} else if (ch == '_' && numState == PERLNUM_DECIMAL) {
if (!isdigit(chNext)) {
goto numAtEnd;
}
} else if (ch == '_') {
// permissive underscoring for number and vector literals
} else if (!isascii(ch) || isalnum(ch)) {
if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
if (!isascii(ch) || isalpha(ch)) {
@ -895,6 +973,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
i = oldi;
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
backflag = BACK_OPERATOR;
backPos = i;
HereDoc.State = 0;
goto restartLexer;
} else {
@ -1114,6 +1194,62 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == Quote.Up) {
Quote.Count++;
}
} else if (state == SCE_PL_SUB_PROTOTYPE) {
char strch[2];
strch[0] = ch;
strch[1] = '\0';
if (NULL != strstr("\\[$@%&*];", strch)) {
// keep going
} else if (ch == ')') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
} else {
// abandon prototype, restart from '('
i = backPos;
styler.ColourTo(i, SCE_PL_OPERATOR);
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_FORMAT_IDENT) {
// occupies different HereDoc states to avoid clashing with HERE docs
if (HereDoc.State == 0) {
if ((isascii(ch) && isalpha(ch)) || ch == '_' // probable identifier
|| ch == '=') { // no identifier
HereDoc.State = 3;
HereDoc.Quoted = false; // whitespace flag
} else if (ch == ' ' || ch == '\t') {
styler.ColourTo(i, SCE_PL_DEFAULT);
} else {
state = SCE_PL_DEFAULT;
HereDoc.State = 0;
goto restartLexer;
}
}
if (HereDoc.State == 3) { // with just a '=', state goes 0->3->4
if (ch == '=') {
styler.ColourTo(i, SCE_PL_FORMAT_IDENT);
state = SCE_PL_DEFAULT;
HereDoc.State = 4;
} else if (ch == ' ' || ch == '\t') {
HereDoc.Quoted = true;
} else if (isEOLChar(ch) || (HereDoc.Quoted && ch != '=')) {
// abandon format, restart from after 'format'
i = backPos + 1;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
state = SCE_PL_DEFAULT;
HereDoc.State = 0;
}
}
} else if (state == SCE_PL_FORMAT) {
if (isEOLChar(chPrev)) {
styler.ColourTo(i - 1, state);
if (ch == '.' && isEOLChar(chNext)) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
}
}
}
}
if (state == SCE_PL_ERROR) {
@ -1252,5 +1388,6 @@ static const char * const perlWordListDesc[] = {
0
};
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", FoldPerlDoc, perlWordListDesc);
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", FoldPerlDoc, perlWordListDesc, 8);

View File

@ -0,0 +1,111 @@
// Scintilla source code edit control
/** @file LexPowerShell.cxx
** Lexer for PowerShell scripts.
**/
// Copyright 2008 by Tim Gerundt <tim@gerundt.de>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.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 == '-';
}
static void ColourisePowerShellDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
styler.StartAt(startPos);
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_POWERSHELL_COMMENT) {
if (sc.atLineEnd) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_STRING) {
// This is a doubles quotes string
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_CHARACTER) {
// This is a single quote string
if (sc.ch == '\'') {
sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_NUMBER) {
if (!IsADigit(sc.ch)) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_VARIABLE) {
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_OPERATOR) {
if (!isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_IDENTIFIER) {
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_POWERSHELL_KEYWORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_POWERSHELL_CMDLET);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_POWERSHELL_ALIAS);
}
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
}
// Determine if a new state should be entered.
if (sc.state == SCE_POWERSHELL_DEFAULT) {
if (sc.ch == '#') {
sc.SetState(SCE_POWERSHELL_COMMENT);
} else if (sc.ch == '\"') {
sc.SetState(SCE_POWERSHELL_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_POWERSHELL_CHARACTER);
} else if (sc.ch == '$') {
sc.SetState(SCE_POWERSHELL_VARIABLE);
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_POWERSHELL_NUMBER);
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_POWERSHELL_OPERATOR);
} else if (IsAWordChar(sc.ch)) {
sc.SetState(SCE_POWERSHELL_IDENTIFIER);
}
}
}
sc.Complete();
}
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell");

View File

@ -0,0 +1,271 @@
// Scintilla source code edit control
/** @file LexProgress.cxx
** Lexer for Progress 4GL.
** Based on LexCPP.cxx of Neil Hodgson <neilh@scintilla.org>
**/
// Copyright 2006-2007 by Yuval Papish <Yuval@YuvCom.com>
// The License.txt file describes the conditions under which this software may be distributed.
/** TODO:
WebSpeed support in html lexer
Support "end triggers" expression of the triggers phrase
change lmPS to lmProgress
Support more than 6 comments levels
**/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '_');
}
enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords1 = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
//WordList &keywords4 = *keywordlists[3];
//WordList &keywords5 = *keywordlists[4];
int visibleChars = 0;
int mask;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
// Reset states to begining of colourise so no surprises
// if different sets of lines lexed.
visibleChars = 0;
}
// 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();
}
sc.Forward();
continue;
}
}
// Determine if a new state should be terminated.
mask = sc.state & 0x10;
switch (sc.state & 0xf) {
case SCE_4GL_OPERATOR:
sc.SetState(SCE_4GL_DEFAULT | mask);
break;
case SCE_4GL_NUMBER:
if (!(IsADigit(sc.ch))) {
sc.SetState(SCE_4GL_DEFAULT | mask);
}
break;
case SCE_4GL_IDENTIFIER:
if (!IsAWordChar(sc.ch) && sc.ch != '-') {
char s[1000];
sc.GetCurrentLowered(s, sizeof(s));
if (((sc.state & 0x10) == 0) && keywords2.InList(s) || keywords3.InList(s)) {
sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart);
}
else if (keywords1.InList(s)) {
if ((s[0] == 'e' && s[1] =='n' && s[2] == 'd' && !isalnum(s[3]) && s[3] != '-') ||
(s[0] == 'f' && s[1] =='o' && s[2] == 'r' && s[3] == 'w' && s[4] =='a' && s[5] == 'r' && s[6] == 'd'&& !isalnum(s[7]))) {
sc.ChangeState(SCE_4GL_END | ResetSentenceStart);
}
else if ((s[0] == 'e' && s[1] =='l' && s[2] == 's' && s[3] == 'e') ||
(s[0] == 't' && s[1] =='h' && s[2] == 'e' && s[3] == 'n')) {
sc.ChangeState(SCE_4GL_WORD & SetSentenceStart);
}
else {
sc.ChangeState(SCE_4GL_WORD | ResetSentenceStart);
}
}
sc.SetState(SCE_4GL_DEFAULT | (sc.state & 0x10));
}
break;
case SCE_4GL_PREPROCESSOR:
if (sc.atLineStart) {
sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart);
} else if (sc.ch == '*' && sc.chNext == '/') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
break;
case SCE_4GL_STRING:
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
break;
case SCE_4GL_CHARACTER:
if (sc.ch == '\'') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
break;
default:
if ((sc.state & 0xf) >= SCE_4GL_COMMENT1) {
if (sc.ch == '*' && sc.chNext == '/') {
sc.Forward();
if ((sc.state & 0xf) == SCE_4GL_COMMENT1) {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
else
sc.SetState((sc.state & 0x1f) - 1);
} else if (sc.ch == '/' && sc.chNext == '*') {
sc.Forward();
sc.SetState((sc.state & 0x1f) + 1);
}
}
}
// Determine if a new state should be entered.
mask = sc.state & 0x10;
if ((sc.state & 0xf) == SCE_4GL_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart);
} else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
sc.SetState(SCE_4GL_IDENTIFIER | mask);
} else if (sc.ch == '/' && sc.chNext == '*') {
sc.SetState(SCE_4GL_COMMENT1 | mask);
sc.Forward();
} else if (sc.ch == '\"') {
sc.SetState(SCE_4GL_STRING | ResetSentenceStart);
} else if (sc.ch == '\'') {
sc.SetState(SCE_4GL_CHARACTER | ResetSentenceStart);
} else if (sc.ch == '&' && visibleChars == 0 && ((sc.state & 0x10) == 0)) {
sc.SetState(SCE_4GL_PREPROCESSOR | ResetSentenceStart);
// Skip whitespace between & and preprocessor word
do {
sc.Forward();
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
// Handle syntactical line termination
} else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) {
sc.SetState(sc.state & SetSentenceStart);
} else if (isoperator(static_cast<char>(sc.ch))) {
if (sc.ch == ':')
sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);
else
sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart);
}
}
if (!IsASpace(sc.ch)) {
visibleChars++;
}
}
sc.Complete();
}
static bool IsStreamCommentStyle(int style) {
return (style & 0xf) >= SCE_4GL_COMMENT1 ;
}
// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle,
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
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 = static_cast<char>(tolower(styler[startPos]));
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelNext++;
} else if (!IsStreamCommentStyle(styleNext)) { // && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelNext--;
}
}
else if ((style & 0xf) == SCE_4GL_BLOCK && !isalnum(chNext)) {
levelNext++;
}
else if ((style & 0xf) == SCE_4GL_END && (ch == 'e' || ch == 'f')) {
levelNext--;
}
if (atEOL) {
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;
}
if (!isspacechar(ch))
visibleChars++;
}
}
static void Fold4glDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) {
FoldNoBox4glDoc(startPos, length, initStyle, styler);
}
static const char * const FglWordLists[] = {
"Primary keywords and identifiers",
"Secondary keywords and identifiers",
"Documentation comment keywords",
"Unused",
"Global classes and typedefs",
0,
};
LexerModule lmProgress(SCLEX_PS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists);

View File

@ -20,7 +20,12 @@
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
enum kwType { kwOther, kwClass, kwDef, kwImport };
static const int indicatorWhitespace = 1;
static bool IsPyComment(Accessor &styler, int pos, int len) {
return len > 0 && styler[pos] == '#';
@ -123,26 +128,29 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
bool hexadecimal = false;
// Python uses a different mask because bad indentation is marked by oring with 32
StyleContext sc(startPos, endPos - startPos, initStyle, styler, 0x7f);
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
bool indentGood = true;
int startIndicator = sc.currentPos;
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
const char chBad = static_cast<char>(64);
const char chGood = static_cast<char>(0);
char chFlags = chGood;
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
indentGood = true;
if (whingeLevel == 1) {
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
indentGood = (spaceFlags & wsInconsistent) == 0;
} else if (whingeLevel == 2) {
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
indentGood = (spaceFlags & wsSpaceTab) == 0;
} else if (whingeLevel == 3) {
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
indentGood = (spaceFlags & wsSpace) == 0;
} else if (whingeLevel == 4) {
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
indentGood = (spaceFlags & wsTab) == 0;
}
if (!indentGood) {
styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0);
startIndicator = sc.currentPos;
}
sc.SetState(sc.state);
styler.SetFlags(chFlags, static_cast<char>(sc.state));
}
if (sc.atLineEnd) {
@ -154,7 +162,6 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(sc.state);
}
lineCurrent++;
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
sc.ChangeState(SCE_P_STRINGEOL);
sc.ForwardSetState(SCE_P_DEFAULT);
@ -210,10 +217,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_P_DEFAULT);
}
} else if (sc.state == SCE_P_DECORATOR) {
if (sc.ch == '\r' || sc.ch == '\n') {
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_P_DEFAULT);
} else if (sc.ch == '#') {
sc.SetState((sc.chNext == '#') ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
}
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (sc.ch == '\\') {
@ -248,6 +253,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
}
if (!indentGood && !IsASpaceOrTab(sc.ch)) {
styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 1);
startIndicator = sc.currentPos;
indentGood = true;
}
// State exit code may have moved on to end of line
if (needEOLCheck && sc.atLineEnd) {
lineCurrent++;
@ -282,6 +293,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
}
}
styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0);
sc.Complete();
}

Some files were not shown because too many files have changed in this diff Show More