[NEW] Upgrade Scintilla from 1.77 to 1.78.

Signed-off-by: Don HO <don.h@free.fr>

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@499 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-06-24 19:09:31 +00:00
parent b96da24ec7
commit 8ee30eaef2
72 changed files with 6277 additions and 1448 deletions

View File

@ -14,10 +14,10 @@
<style type="text/css">
<!--
/*<![CDATA[*/
CODE { font-family: "Courier New", monospace; }
CODE { font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A:visited { color: blue; }
A:hover { text-decoration: underline ! important; }
A.message { text-decoration: none; font-family: "Courier New", monospace; }
A.message { text-decoration: none; font-weight: bold; font-family: Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A.toc { text-decoration: none; }
A.jump { text-decoration: none; }
/*]]>*/
@ -38,7 +38,7 @@
<h1>Scintilla Documentation</h1>
<p>Last edited 20/June/2007 NH</p>
<p>Last edited 28/April/2009 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@ -199,69 +199,71 @@
<tr>
<td>o <a class="toc" href="#Margins">Margins</a></td>
<td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
<td>o <a class="toc" href="#Annotations">Annotations</a></td>
<td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
<td>o <a class="toc" href="#OtherSettings">Other settings</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#BraceHighlighting">Brace highlighting</a></td>
<td>o <a class="toc" href="#TabsAndIndentationGuides">Tabs and Indentation
Guides</a></td>
<td>o <a class="toc" href="#Markers">Markers</a></td>
<td>o <a class="toc" href="#Indicators">Indicators</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#Indicators">Indicators</a></td>
<td>o <a class="toc" href="#Autocompletion">Autocompletion</a></td>
<td>o <a class="toc" href="#UserLists">User lists</a></td>
<td>o <a class="toc" href="#CallTips">Call tips</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#CallTips">Call tips</a></td>
<td>o <a class="toc" href="#KeyboardCommands">Keyboard commands</a></td>
<td>o <a class="toc" href="#KeyBindings">Key bindings</a></td>
<td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td>
<td>o <a class="toc" href="#MacroRecording">Macro recording</a></td>
<td>o <a class="toc" href="#Printing">Printing</a></td>
<td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#DirectAccess">Direct access</a></td>
<td>o <a class="toc" href="#MultipleViews">Multiple views</a></td>
<td>o <a class="toc" href="#Folding">Folding</a></td>
<td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td>
<td>o <a class="toc" href="#Zooming">Zooming</a></td>
<td>o <a class="toc" href="#LongLines">Long lines</a></td>
<td>o <a class="toc" href="#Lexer">Lexer</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#Lexer">Lexer</a></td>
<td>o <a class="toc" href="#Notifications">Notifications</a></td>
<td>o <a class="toc" href="#GTK">GTK+</a></td>
<td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
</tr>
<tr>
<td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td>
<td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never
supported by Scintilla</a></td>
@ -277,7 +279,7 @@
<h2 id="TextRetrievalAndModification">Text retrieval and modification</h2>
<p>Each character in a Scintilla document is followed by an associated byte of styling
<p>Each byte 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 an index into an array of styles.
Style bytes may be split into an index and a set of indicator bits
@ -292,6 +294,9 @@
href="#SCI_SETSTYLEBITS"><code>SCI_SETSTYLEBITS</code></a> up to a maximum of 7 bits.
The remaining bits can be used for indicators.</p>
<p>In this document, 'character' normally refers to a byte even when multi-byte characters are used.
Lengths measure the numbers of bytes, not the amount of characters in those bytes.</p>
<p>Positions within the Scintilla document refer to a character or the gap before that
character. The first character in a document is 0, the second 1 and so on. If a document
contains <code>nLen</code> characters, the last character is numbered <code>nLen</code>-1.
@ -518,7 +523,7 @@ struct TextRange {
is limited and should only be used for simple cases and initial development. A different regular expression
library can be <a class="jump" href="#AlternativeRegEx">integrated into Scintilla</a>
or can be called from the container using direct access to the buffer contents through
<a class="jump" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
<a class="message" href="#SCI_GETCHARACTERPOINTER">SCI_GETCHARACTERPOINTER</a>.
</p>
<code><a class="message" href="#SCI_FINDTEXT">SCI_FINDTEXT(int flags, TextToFind
*ttf)</a><br />
@ -896,6 +901,7 @@ struct TextToFind {
<a class="message" href="#SCI_GETUNDOCOLLECTION">SCI_GETUNDOCOLLECTION</a><br />
<a class="message" href="#SCI_BEGINUNDOACTION">SCI_BEGINUNDOACTION</a><br />
<a class="message" href="#SCI_ENDUNDOACTION">SCI_ENDUNDOACTION</a><br />
<a class="message" href="#SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</a><br />
</code>
<p><b id="SCI_UNDO">SCI_UNDO</b><br />
@ -943,6 +949,29 @@ struct TextToFind {
Alternatively, you can use these to mark a set of operations that you do not want to have
combined with the preceding or following operations if they are undone.</p>
<p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br />
The container can add its own actions into the undo stack by calling
<code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code>
notification will be sent to the container with the
<a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a>
flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or
redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is
returned in the <code>token</code> field of the notification.</p>
<p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then
it could call <code>SCI_ADDUNDOACTION(line, 0)</code> each time the command is performed.
Then when it receives a notification to undo or redo it toggles a bookmark on the line given by
the token field. If there are different types of commands or parameters that need to be stored into the undo
stack then the container should maintain a stack of its own for the document and use the current
position in that stack as the argument to <code>SCI_ADDUNDOACTION(line)</code>.
<code>SCI_ADDUNDOACTION</code> commands are not combined together
into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code>
and <code>SCI_ENDUNDOACTION</code>.</p>
<p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be
coalesced along with any insertion and deletion actions into a single compound action, otherwise 0.
Coalescing treats coalescible container actions as transparent so will still only group together insertions that
look like typing or deletions that look like multiple uses of the Backspace or Delete keys.
</p>
<h2 id="SelectionAndInformation">Selection and information</h2>
<p>Scintilla maintains a selection that stretches between two points, the anchor and the
@ -1004,7 +1033,7 @@ struct TextToFind {
<p><b id="SCI_GETTEXTLENGTH">SCI_GETTEXTLENGTH</b><br />
<b id="SCI_GETLENGTH">SCI_GETLENGTH</b><br />
Both these messages return the length of the document in characters.</p>
Both these messages return the length of the document in bytes.</p>
<p><b id="SCI_GETLINECOUNT">SCI_GETLINECOUNT</b><br />
This returns the number of lines in the document. An empty document contains 1 line. A
@ -1677,6 +1706,10 @@ struct TextToFind {
useWhitespaceForeColour, int colour)</a><br />
<a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
useWhitespaceBackColour, int colour)</a><br />
<a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
<a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
<a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
<a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
</code>
<p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
@ -1728,6 +1761,19 @@ struct TextToFind {
the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
<code>SCI_SETWHITESPACEBACK</code>.</p>
<p>
<b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
<b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
<b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
<b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br />
Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
baseline (its 'descent').
Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
This may done to make the text easier to read or to accomodate underlines or highlights.
<p>
<h2 id="Cursor">Cursor</h2>
<p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
@ -2330,6 +2376,10 @@ struct TextToFind {
is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so
it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it
is hidden. Of course, you can set the margins to be whatever you wish.</p>
<p>Styled text margins used to show revision and blame information:</p>
<p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p>
<code><a class="message" href="#SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int
type)</a><br />
<a class="message" href="#SCI_GETMARGINTYPEN">SCI_GETMARGINTYPEN(int margin)</a><br />
@ -2351,6 +2401,15 @@ struct TextToFind {
<a class="message" href="#SCI_GETMARGINRIGHT">SCI_GETMARGINRIGHT</a><br />
<a class="message" href="#SCI_SETFOLDMARGINCOLOUR">SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)</a><br />
<a class="message" href="#SCI_SETFOLDMARGINHICOLOUR">SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)</a><br />
<a class="message" href="#SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</a><br />
<a class="message" href="#SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</a><br />
<a class="message" href="#SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</a><br />
<a class="message" href="#SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</a><br />
<a class="message" href="#SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</a><br />
<a class="message" href="#SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</a><br />
<a class="message" href="#SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</a><br />
<a class="message" href="#SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</a><br />
<a class="message" href="#SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</a><br />
</code>
<p><b id="SCI_SETMARGINTYPEN">SCI_SETMARGINTYPEN(int margin, int iType)</b><br />
@ -2358,6 +2417,8 @@ struct TextToFind {
These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4.
You can use the predefined constants <code>SC_MARGIN_SYMBOL</code> (0) and
<code>SC_MARGIN_NUMBER</code> (1) to set a margin as either a line number or a symbol margin.
A margin with application defined text may use <code>SC_MARGIN_TEXT</code> (4) or
<code>SC_MARGIN_RTEXT</code> (5) to right justify the text.
By convention, margin 0 is used for line numbers and the next two are used for symbols. You can
also use the constants <code>SC_MARGIN_BACK</code> (2) and <code>SC_MARGIN_FORE</code> (3) for
symbol margins that set their background colour to match the STYLE_DEFAULT background and
@ -2421,6 +2482,128 @@ struct TextToFind {
On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight
colour to ::GetSysColor(COLOR_3DHIGHLIGHT).</p>
<p>
<b id="SCI_MARGINSETTEXT">SCI_MARGINSETTEXT(int line, char *text)</b><br />
<b id="SCI_MARGINGETTEXT">SCI_MARGINGETTEXT(int line, char *text)</b><br />
<b id="SCI_MARGINSETSTYLE">SCI_MARGINSETSTYLE(int line, int style)</b><br />
<b id="SCI_MARGINGETSTYLE">SCI_MARGINGETSTYLE(int line)</b><br />
<b id="SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</b><br />
<b id="SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</b><br />
<b id="SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</b><br />
Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT.
A different string may be set for each line with <code>SCI_MARGINSETTEXT</code>.
The whole of the text margin on a line may be displayed in a particular style with
<code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with
<code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style
of the corresponding text byte simlar to <code>SCI_SETSTYLINGEX</code>.
Setting a text margin will cause a
<a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a>
notification to be sent.
</p>
<p>
<b id="SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</b><br />
<b id="SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</b><br />
Margin styles may be completely separated from standard text styles by setting a style offset. For example,
<code>SCI_MARGINSETSTYLEOFFSET(256)</code> would allow the margin styles to be numbered from
256 upto 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code>
or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style.
</p>
<h2 id="Annotations">Annotations</h2>
<p>Annotations are read-only lines of text underneath each line of editable text.
An annotation may consist of multiple lines separated by '\n'.
Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to
line up different versions of text in a merge tool.</p>
<p>Annotations used for inline diagnostics:</p>
<p><img src="annotations.png" alt="Annotations used for inline diagnostics" /></p>
<code>
<a class="message" href="#SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</a><br />
<a class="message" href="#SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</a><br />
<a class="message" href="#SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</a><br />
<a class="message" href="#SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</a><br />
<a class="message" href="#SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</a><br />
<a class="message" href="#SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</a><br />
<a class="message" href="#SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</a><br />
<a class="message" href="#SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</a><br />
<a class="message" href="#SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</a><br />
<a class="message" href="#SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</a><br />
<a class="message" href="#SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</a><br />
<a class="message" href="#SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</a><br />
</code>
<p>
<b id="SCI_ANNOTATIONSETTEXT">SCI_ANNOTATIONSETTEXT(int line, char *text)</b><br />
<b id="SCI_ANNOTATIONGETTEXT">SCI_ANNOTATIONGETTEXT(int line, char *text)</b><br />
<b id="SCI_ANNOTATIONSETSTYLE">SCI_ANNOTATIONSETSTYLE(int line, int style)</b><br />
<b id="SCI_ANNOTATIONGETSTYLE">SCI_ANNOTATIONGETSTYLE(int line)</b><br />
<b id="SCI_ANNOTATIONSETSTYLES">SCI_ANNOTATIONSETSTYLES(int line, char *styles)</b><br />
<b id="SCI_ANNOTATIONGETSTYLES">SCI_ANNOTATIONGETSTYLES(int line, char *styles)</b><br />
<b id="SCI_ANNOTATIONGETLINES">SCI_ANNOTATIONGETLINES(int line)</b><br />
<b id="SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</b><br />
A different string may be set for each line with <code>SCI_ANNOTATIONSETTEXT</code>.
To clear annotations call <code>SCI_ANNOTATIONSETTEXT</code> with a NULL pointer.
The whole of the text ANNOTATION on a line may be displayed in a particular style with
<code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with
<code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style
of the corresponding text byte simlar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it
specifies how long the annotation is so how many bytes of styling to read.
Setting an annotation will cause a
<a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a>
notification to be sent.
</p>
<p>
The number of lines annotating a line can be retrieved with <code>SCI_ANNOTATIONGETLINES</code>.
All the lines can be cleared of annotations with <code>SCI_ANNOTATIONCLEARALL</code>
which is equivalent to clearing each line (setting to 0) and then deleting other memory used for this feature.
</p>
<p>
<b id="SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</b><br />
<b id="SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</b><br />
Annotations can be made visible in a view and there is a choice of display style when visible.
The two messages set and get the annotation display mode. The <code>visible</code>
argument can be one of:</p>
<table cellpadding="1" cellspacing="2" border="0" summary="Annotation visibility">
<tbody valign="top">
<tr>
<th align="left"><code>ANNOTATION_HIDDEN</code></th>
<td>0</td>
<td>Annotations are not displayed.</td>
</tr>
<tr>
<th align="left"><code>ANNOTATION_STANDARD</code></th>
<td>1</td>
<td>Annotations are drawn left justified with no adornment.</td>
</tr>
<tr>
<th align="left"><code>ANNOTATION_BOXED</code></th>
<td>2</td>
<td>Annotations are indented 40 pixels and are surrounded by a box.</td>
</tr>
</tbody>
</table>
</p>
<p>
<b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br />
<b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br />
Annotation styles may be completely separated from standard text styles by setting a style offset. For example,
<code>SCI_ANNOTATIONSETSTYLEOFFSET(512)</code> would allow the annotation styles to be numbered from
512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256).
Each style number set with <code>SCI_ANNOTATIONSETSTYLE</code>
or <code>SCI_ANNOTATIONSETSTYLES</code> has the offset added before looking up the style.
</p>
<h2 id="OtherSettings">Other settings</h2>
<code><a class="message" href="#SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool
allowPaletteUse)</a><br />
@ -2752,6 +2935,8 @@ struct TextToFind {
markerSymbols)</a><br />
<a class="message" href="#SCI_MARKERDEFINEPIXMAP">SCI_MARKERDEFINEPIXMAP(int markerNumber,
const char *xpm)</a><br />
<a class="message" href="#SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)
</a><br />
<a class="message" href="#SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int
colour)</a><br />
<a class="message" href="#SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int
@ -2789,6 +2974,10 @@ struct TextToFind {
of lines. You would also use it if you changed the folding style and wanted one or more of the
<code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p>
<p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that
plugins may allocate that marker number.
</p>
<p>There are also marker symbols designed for use in the folding margin in a flattened tree
style.<br />
<code>SC_MARK_BOXMINUS</code>, <code>SC_MARK_BOXMINUSCONNECTED</code>,
@ -2929,6 +3118,10 @@ struct TextToFind {
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>
<p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br />
Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code>
or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>.</p>
<p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int <a class="jump"
href="#colour">colour</a>)</b><br />
<b id="SCI_MARKERSETBACK">SCI_MARKERSETBACK(int markerNumber, int <a class="jump"
@ -3019,6 +3212,10 @@ struct TextToFind {
<a class="message" href="#SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int
colour)</a><br />
<a class="message" href="#SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</a><br />
<a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</a><br />
<a class="message" href="#SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</a><br />
<a class="message" href="#SCI_INDICSETUNDER">SCI_INDICSETUNDER(int indicatorNumber, bool under)</a><br />
<a class="message" href="#SCI_INDICGETUNDER">SCI_INDICGETUNDER(int indicatorNumber)</a><br />
</code>
<p><b id="SCI_INDICSETSTYLE">SCI_INDICSETSTYLE(int indicatorNumber, int
@ -3101,7 +3298,9 @@ struct TextToFind {
<td align="center">7</td>
<td>A rectangle with rounded corners around the text using translucent drawing with the
interior more transparent than the border.</td>
interior more transparent than the border. You can use
<a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a>
to control the alpha transparency value. The default alpha value is 30.
</tr>
</tbody>
</table>
@ -3120,6 +3319,13 @@ struct TextToFind {
<code>SCI_INDICSETFORE(1, 0xff0000);</code> (light blue)<br />
<code>SCI_INDICSETFORE(2, 0x0000ff);</code> (light red)</p>
<p><b id="SCI_INDICSETALPHA">SCI_INDICSETALPHA(int indicatorNumber, int alpha)</b><br />
<b id="SCI_INDICGETALPHA">SCI_INDICGETALPHA(int indicatorNumber)</b><br />
These two messages set and get the alpha transparency used for drawing the
fill color of the INDIC_ROUNDBOX rectangle. The alpha value can range from
0 (completely transparent) to 100 (no transparency).
</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).
@ -4824,6 +5030,7 @@ struct SCNotification {
<a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
<a class="message" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a><br />
<a class="message" href="#SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</a><br />
<a class="message" href="#SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</a><br />
</code>
<p>The following <code>SCI_*</code> messages are associated with these notifications:</p>
@ -5139,6 +5346,26 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
<td><code>line</code></td>
</tr>
<tr>
<td align="left"><code id="SC_MOD_CHANGEMARGIN">SC_MOD_CHANGEMARGIN</code></td>
<td align="center">0x10000</td>
<td>A text margin has changed.</td>
<td><code>line</code></td>
</tr>
<tr>
<td align="left"><code id="SC_MOD_CHANGEANNOTATION">SC_MOD_CHANGEANNOTATION</code></td>
<td align="center">0x20000</td>
<td>An annotation has changed.</td>
<td><code>line</code></td>
</tr>
<tr>
<td align="left"><code>SC_MULTILINEUNDOREDO</code></td>
@ -5164,10 +5391,22 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
<td>None</td>
</tr>
<tr>
<td align="left"><code id="SC_MOD_CONTAINER">SC_MOD_CONTAINER</code></td>
<td align="center">0x40000</td>
<td>This is set on for actions that the container stored into the undo stack with
<a class="message" href="#SCI_ADDUNDOACTION"><code>SCI_ADDUNDOACTION</code></a>.
</td>
<td>token</td>
</tr>
<tr>
<td align="left"><code>SC_MODEVENTMASKALL</code></td>
<td align="center">0x1fff</td>
<td align="center">0x7FFFF</td>
<td>This is a mask for all valid flags. This is the default mask state set by <a
class="message" href="#SCI_SETMODEVENTMASK"><code>SCI_SETMODEVENTMASK</code></a>.</td>
@ -5461,7 +5700,11 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
<p><b id="SCN_AUTOCCANCELLED">SCN_AUTOCCANCELLED</b><br />
The user has cancelled an <a class="jump" href="#Autocompletion">autocompletion list</a>.
There is no other information in SCNotification.
There is no other information in SCNotification.</p>
<p><b id="SCN_AUTOCCHARDELETED">SCN_AUTOCCHARDELETED</b><br />
The user deleted a character while autocompletion list was active.
There is no other information in SCNotification.</p>
<h2 id="GTK">GTK+</h2>
<p>On GTK+, the following functions create a Scintilla widget, communicate with it and allow

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/scintilla177.zip?download">
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla178.zip?download">
Windows</a>&nbsp;&nbsp;
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla177.tgz?download">
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla178.tgz?download">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -41,7 +41,7 @@
containing very few restrictions.
</p>
<h3>
Release 1.77
Release 1.78
</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/scintilla177.zip?download">zip format</a> (910K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla177.tgz?download">tgz format</a> (770K) commonly used on Linux and compatible operating systems</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla178.zip?download">zip format</a> (960K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla178.tgz?download">tgz format</a> (800K) 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

@ -319,6 +319,19 @@
<td>alexbodn</td>
<td>Sergiu Dotenco</td>
<td>Anders Karlsson</td>
<td>ozlooper</td>
</tr><tr>
<td>Marko Njezic</td>
<td>Eugen Bitter</td>
<td>Christoph Baumann</td>
<td>Christopher Bean</td>
</tr><tr>
<td>Sergey Kishchenko</td>
<td>Kai Liu</td>
<td>Andreas Rumpf</td>
<td>James Moffatt</td>
</tr><tr>
<td>Yuzhou Xin</td>
</tr>
</table>
<p>
@ -330,6 +343,128 @@
Icons</a> Copyright(C) 1998 by Dean S. Jones<br />
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite178.zip?download">Release 1.78</a>
</h3>
<ul>
<li>
Released on 28 April 2009.
</li>
<li>
Annotation lines may be added to each line.
</li>
<li>
A text margin may be defined with different text on each line.
</li>
<li>
Application actions may be added to the undo history.
</li>
<li>
Can query the symbol defined for a marker.
An available symbol added for applications to indicate that plugins may allocate a marker.
</li>
<li>
Can increase the amount of font ascent and descent.
</li>
<li>
COBOL lexer added. Feature #2127406.
</li>
<li>
Nimrod lexer added. Feature #2642620.
</li>
<li>
PowerPro lexer added. Feature #2195308.
</li>
<li>
SML lexer added. Feature #2710950.
</li>
<li>
SORCUS Installation file lexer added. Feature #2343375.
</li>
<li>
TACL lexer added. Feature #2127406.
</li>
<li>
TAL lexer added. Feature #2127406.
</li>
<li>
Rewritten Pascal lexer with improved folding and other fixes. Feature #2190650.
</li>
<li>
INDIC_ROUNDBOX translucency level can be modified. Feature #2586290.
</li>
<li>
C++ lexer treats angle brackets in #include directives as quotes when styling.within.preprocessor. Bug #2551033.
</li>
<li>
Inno Setup lexer is sensitive to whether within the [Code] section and handles comments better. Bug #2552973.
</li>
<li>
HTML lexer does not go into script mode when script tag is self-closing.
</li>
<li>
HTML folder fixed where confused by comments when fold.html.preprocessor off. Bug #2532774.
</li>
<li>
Perl lexer fixes problem with string matching caused by line endings. Bug #2648342.
</li>
<li>
Progress lexer fixes problem with "last-event:function" phrase. Bug #2483619.
</li>
<li>
Properties file lexer extended to handle RFC2822 text when lexer.props.allow.initial.spaces on.
</li>
<li>
Python lexer adds options for Python 3 and Cython.
</li>
<li>
Shell lexer fixes heredoc problem caused by line endings. Bug #2635257.
</li>
<li>
TeX lexer handles comment at end of line correctly. Bug #2698766.
</li>
<li>
SciTE retains selection range when performing a replace selection command. Feature #2339160.
</li>
<li>
SciTE definition of word characters fixed to match documentaiton. Bug #2464531.
</li>
<li>
SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground.
Bug #2634224.
</li>
<li>
Fixed encoding bug with calltips on GTK+.
</li>
<li>
Block caret drawn in correct place on wrapped lines. Bug #2126144.
</li>
<li>
Compilation for 64 bit Windows works using MinGW. Bug #2515578.
</li>
<li>
Incorrect memory freeing fixed on OS X. Bug #2354098, #2671749.
</li>
<li>
SciTE on GTK+ crash fixed on startup when child process exits before initialisation complete.
Bug #2716987.
</li>
<li>
Crash fixed when AutoCompleteGetCurrent called with no active autocompletion.
</li>
<li>
Flickering diminished when pressing Tab. Bug #2723006.
</li>
<li>
Namespace compilation issues with GTK+ on OS X fixed.
</li>
<li>
Increased maximum length of SciTE's Language menu on GTK+ to 100 items. Bug #2528241.
</li>
<li>
Fixed incorrect Python lexing for multi-line continued strings. Bug #2450963.
</li>
</ul>
<h3>
<a href="http://prdownloads.sourceforge.net/scintilla/scite177.zip?download">Release 1.77</a>
</h3>

View File

@ -55,7 +55,7 @@
</a> is an encapsulation of Scintilla for use within the .NET framework.
</p>
<p>
<a href="http://www.riverbankcomputing.co.uk/qscintilla/index.php">QScintilla
<a href="http://www.riverbankcomputing.co.uk/software/qscintilla/intro">QScintilla
</a> is a port of Scintilla to the Qt platform. It has a similar license to Qt: GPL for use in
free software and commercial for use in close-source applications.
</p>
@ -65,11 +65,7 @@
includes a binding of Scintilla.
</p>
<p>
<a href="http://www.templatetamer.org/index.php?DolphinScintilla">
DolphinScintilla</a> is a DolphinSmalltalk wrapper for Scintilla.
</p>
<p>
<a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/scintilla/ScintillaVB/">ScintillaVB</a>
<a href="http://scintilla.cvs.sourceforge.net/viewvc/scintilla/ScintillaVB/">ScintillaVB</a>
is an ActiveX control written in VB that encapsulates Scintilla.
</p>
<p>
@ -83,7 +79,7 @@
</p>
<p>
The wxStyledTextCtrl editor component in the
<a href="http://wxwindows.org/">wxWindows</a> cross platform toolkit is based on Scintilla.<br />
<a href="http://www.wxwidgets.org/">wxWidgets</a> cross platform toolkit is based on Scintilla.<br />
A Python binding for wxStyledTextCtrl is part of <a href="http://wxpython.org/">wxPython</a>.
</p>
<p>
@ -98,13 +94,6 @@
is an alternative GTK class implementation for scintilla
similar to the above, but for GTK 2.x.
</p>
<p>
<a href="http://www.wingide.com/opensource/pyscintilla.html">pyscintilla</a>
is the original Python binding for Scintilla's default GTK
1.x class. Includes some additional support, such as native printing on
Windows. The binding is hand-written rather than auto-generated from the
Scintilla.iface file.
</p>
<p>
<a href="http://sourceforge.net/projects/moleskine/">pygtkscintilla</a>
is a Python binding for gtk1.x scintilla that uses
@ -116,12 +105,20 @@
gtkscintilla2.
</p>
<p>
<a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/scintilla/scintillactrl/">ScintillaCtrl</a>
<a href="http://scintilla.cvs.sourceforge.net/viewvc/scintilla/scintillactrl/">ScintillaCtrl</a>
is an unmaintained ActiveX control wrapper for Scintilla.
</p>
<h3>
Projects using Scintilla
</h3>
<p>
<a href="http://www.jabaco.org/">Jabaco</a>
is a simple programming language with a Visual Basic like syntax.
</p>
<p>
<a href="http://www.daansystems.com/lispide">LispIDE</a>
is a basic Lisp editor for Windows 2000, XP and Vista.
</p>
<p>
<a href="http://www.flexedit.org/">FlexEdit</a>
is Free Text/Hex Editor for Windows.
@ -224,10 +221,6 @@
GLIntercept</a> is an OpenGL function call interceptor that uses SciTE as a
run-time shader editor.
</p>
<p>
<a href="http://xined.sourceforge.net/">
Xin</a> is an open-source XML editor for Windows.
</p>
<p>
<a href="http://wxguide.sourceforge.net/indexedit.html">
wyoEditor</a> is "A nice editor with a well designed and consistent look and feel".
@ -252,10 +245,6 @@
<a href="http://cssed.sourceforge.net">CSSED</a>
is a tiny GTK2 CSS editor.
</p>
<p>
<a href="http://www.atari-soldiers.com/dide.html">DIDE</a>
is a free IDE for the D language on Windows.
</p>
<p>
<a href="http://wxghostscript.sourceforge.net/">
IdePS</a>
@ -271,19 +260,10 @@
Venis IX</a>,
the Visual Environment for NSIS (Nullsoft Scriptable Install System).
</p>
<p>
<a href="http://www.parinya.ca/">
MinGW Developer Studio</a>
is a simple C/C++ IDE for the MinGW compiler on Windows.
</p>
<p>
<a href="http://www.die-offenbachs.de/detlev/eric.html">Eric3</a>
is a Python IDE written using PyQt and QScintilla.
</p>
<p>
<a href="http://www.templatetamer.com/">TemplateTamer</a>
is a tool for development of template based PHP web pages.
</p>
<p>
<a href="http://www.bomberstudios.com/sciteflash/">SciTE|Flash</a>
is a free Scintilla-based ActionScript editor for Windows.
@ -302,7 +282,7 @@
</p>
<p>
<a href="http://wxbasic.sourceforge.net/">wxBasic</a> is an open source
Basic interpreter that uses the wxWindows toolkit. A small IDE is under construction.
Basic interpreter that uses the wxWidgets toolkit. A small IDE is under construction.
</p>
<p>
<a href="http://freeride.rubyforge.org/wiki/wiki.pl">FreeRIDE</a> will be a
@ -347,7 +327,7 @@
<p>
<a href="http://www.rexx.com/~dkuhlman/">pyeditor and wxEditor</a>
are scriptable editors implemented in Python. pyeditor is based on GTK+ and
the pyscintilla wrapper. wxEditor is based on wxWindows, wxPython and
the pyscintilla wrapper. wxEditor is based on wxWidgets, wxPython and
wxStyledTextControl.
</p>
<p>
@ -363,11 +343,6 @@
is a cross-platform multi-language development environment built
as an application of Mozilla.
</p>
<p>
<a href="http://www.xtgsystems.com/lua/">titmouse</a>
is a Lua editor/debugger for Windows. It is available as both a component
and an application.
</p>
<p>
<a href="http://llt.chez-alice.fr/">Filerx</a>
is a project manager for SciTE on Windows.
@ -388,11 +363,6 @@
Suneido</a> is an integrated application platform currently available for Win32 that includes an
object-oriented language, client-server database, and user interface and reporting frameworks.
</p>
<p>
<a href="http://www.BitBuilder.com">
BitLeaf</a> is a new GNOME based development environment.
Currently at an early stage of development.
</p>
<p>
<a href="http://www.allitis.com/agast/home.html">
Agast</a> is an authoring system for adventure games which includes
@ -400,7 +370,7 @@
</p>
<p>
<a href="http://boa-constructor.sourceforge.net/">Boa Constructor</a> is a RAD GUI
Building IDE for the wxWindows cross platform platform. Written using wxPython with the
Building IDE for the wxWidgets cross platform platform. Written using wxPython with the
wxStyledTextCtrl used as its editor.
</p>
<p>
@ -411,7 +381,7 @@
Editing Components
</h3>
<p>
<a href="http://gtksourceview.sourceforge.net/index.html">GtkSourceView</a>
<a href="http://projects.gnome.org/gtksourceview/">GtkSourceView</a>
is a text widget that extends the standard GTK+ 2.x text widget and improves it
by implementing syntax highlighting and other features typical of a source editor.
</p>
@ -496,23 +466,9 @@
<a href="http://www.cse.yorku.ca/~oz/">regex</a> is a public domain
implementation of regular expression pattern matching used in Scintilla.
</p>
<!--
<p>
<a href="http://www.petes-place.com/">CodeMagic</a> is a free generic IDE for Win32.
Strongly Perl focused but customisable for other languages. Has more user interface features
than SciTE.
</p>
-->
<p>
<!--
Debugging dance soundtrack from <a href="http://www.insurge.com.au">iNsuRge</a>
and -->
Inspirational coding soundscapes by <a href="http://www.davidbridie.com.au">David Bridie</a>.
</p>
<p>
Get away from hacking without any of that tedious standing up bother: <a
href="http://www.zip.com.au/~sneal/index.html">Virtually There</a> ;).
</p>
</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="20081018" />
<meta name="Date.Modified" content="20090428" />
<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.77<br />
Site last modified October 18 2008</font>
<font color="#FFCC99" size="3"> Release version 1.78<br />
Site last modified April 28 2009</font>
</td>
<td width="20%">
&nbsp;
@ -46,12 +46,18 @@
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100%" alt="Sci Break" style="background: url(http://scintilla.sourceforge.net/SciBreak.jpg) no-repeat;height:150px;">
<td width="100%" alt="Sci Break" style="background: url(http://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
&nbsp;
</td>
</tr>
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="6" border="0">
<tr>
<td width="100%">
<span class="versionlist">Version 1.78 allows annotation lines to be displayed beneath each document line
and to display a margin with different text for each document line.</span>
</td>
</tr>
<tr>
<td width="100%">
<span class="versionlist">Version 1.77 allows direct temporary access to the text buffer.</span>
@ -103,25 +109,25 @@
<font size="4">
<script type="text/javascript" language="JavaScript"><!--
if (IsRemote()) {
document.write('<a href="http://scintilla.sourceforge.net/SciTEImage.html">Screenshot</a>&nbsp;&nbsp;');
document.write('<a href="http://scintilla.sourceforge.net/ScintillaDownload.html">Download</a>&nbsp;&nbsp;');
document.write('<a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a>&nbsp;&nbsp;');
document.write('<a href="http://www.scintilla.org/ScintillaDownload.html">Download</a>&nbsp;&nbsp;');
}
//--></script>
<a href="http://scintilla.sourceforge.net/ScintillaDoc.html">Documentation</a>&nbsp;&nbsp;
<a href="http://scintilla.sourceforge.net/ScintillaToDo.html">Bugs</a>&nbsp;&nbsp;
<a href="http://www.scintilla.org/ScintillaDoc.html">Documentation</a>&nbsp;&nbsp;
<a href="http://www.scintilla.org/ScintillaToDo.html">Bugs</a>&nbsp;&nbsp;
<script type="text/javascript" language="JavaScript"><!--
if (IsRemote()) {
document.write('<a href="http://scintilla.sourceforge.net/SciTE.html">SciTE</a>&nbsp;&nbsp; ');
document.write('<a href="http://www.scintilla.org/SciTE.html">SciTE</a>&nbsp;&nbsp; ');
}
//--></script>
<a href="http://scintilla.sourceforge.net/ScintillaHistory.html">
History</a>&nbsp;&nbsp; <a href="http://scintilla.sourceforge.net/ScintillaRelated.html">Related</a>&nbsp;&nbsp;</font>
<a href="http://www.scintilla.org/ScintillaHistory.html">
History</a>&nbsp;&nbsp; <a href="http://www.scintilla.org/ScintillaRelated.html">Related</a>&nbsp;&nbsp;</font>
</td>
</tr>
</table>
<p>
<a href="http://scintilla.sourceforge.net/ScintillaDoc.html">Scintilla</a> is a free source code editing component.
It comes with complete source code and a <a href="http://scintilla.sourceforge.net/License.txt">license</a> that
<a href="http://www.scintilla.org/ScintillaDoc.html">Scintilla</a> is a free source code editing component.
It comes with complete source code and a <a href="http://www.scintilla.org/License.txt">license</a> that
permits use in any free project or commercial product.
</p>
<p>
@ -134,12 +140,12 @@ if (IsRemote()) {
colours and multiple fonts.
</p>
<p>
The <a href="http://scintilla.sourceforge.net/SinkWorld.html">SinkWorld project</a>
The <a href="http://www.scintilla.org/SinkWorld.html">SinkWorld project</a>
investigates possible future directions for Scintilla to make it more flexible, robust, perform
better and run on the .NET and Java virtual machines.
</p>
<p>
<a href="http://scintilla.sourceforge.net/SciTE.html">SciTE</a> is a SCIntilla based Text Editor. Originally built to
<a href="http://www.scintilla.org/SciTE.html">SciTE</a> is a SCIntilla based Text Editor. Originally built to
demonstrate Scintilla, it has grown to be a generally useful editor with facilities for
building and running programs. It is best used for jobs with simple configurations - I use it
for building test and demonstration programs as well as SciTE and Scintilla, themselves.
@ -155,27 +161,27 @@ if (IsRemote()) {
<p>
Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating
systems with GTK+. They have been run on Windows 95, NT 4.0, Windows 2000, and on Fedora 8
with GTK+ 2.12. <a href="http://scintilla.sourceforge.net/SciTEImage.html">Here is a screenshot of
with GTK+ 2.12. <a href="http://www.scintilla.org/SciTEImage.html">Here is a screenshot of
SciTE.</a><br />
</p>
<p>
You can <a href="http://scintilla.sourceforge.net/ScintillaDownload.html">download Scintilla.</a>
You can <a href="http://www.scintilla.org/ScintillaDownload.html">download Scintilla.</a>
</p>
<p>
The source code can be downloaded via CVS at the Source Forge
<a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page</a>.
</p>
<p>
<a href="http://scintilla.sourceforge.net/ScintillaRelated.html">Related sites.</a>
<a href="http://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
</p>
<p>
<a href="http://scintilla.sourceforge.net/ScintillaToDo.html">Bugs and To Do list.</a>
<a href="http://www.scintilla.org/ScintillaToDo.html">Bugs and To Do list.</a>
</p>
<p>
<a href="http://scintilla.sourceforge.net/ScintillaHistory.html">History and contribution credits.</a>
<a href="http://www.scintilla.org/ScintillaHistory.html">History and contribution credits.</a>
</p>
<p>
<a href="http://scintilla.sourceforge.net/Icons.html">Icons that can be used with Scintilla.</a>
<a href="http://www.scintilla.org/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.
@ -197,10 +203,10 @@ if (IsRemote()) {
document.write('There is a <a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page<\/a>');
document.write(' hosted on ');
if (IsRemote()) {
document.write('<a href="http://sourceforge.net">');
document.write('<img src="http://sourceforge.net/sflogo.php?group_id=2439&type=1" width="88" height="31" border="0" /><\/a> ');
document.write('<a href="http://sourceforge.net/projects/scintilla">');
document.write('<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> ');
} else {
document.write('<a href="http://sourceforge.net">SourceForge<\/a>');
document.write('<a href="http://sourceforge.net/projects/scintilla">SourceForge<\/a>');
}
//-->
</script>

View File

@ -41,6 +41,10 @@
#pragma warning(disable: 4505)
#endif
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
enum encodingType { singleByte, UTF8, dbcs};
struct LOGFONT {
@ -673,7 +677,13 @@ void Font::Release() {
id = 0;
}
class SurfaceImpl : public Surface {
// Required on OS X
#ifdef SCI_NAMESPACE
class Scintilla::SurfaceImpl : public Surface
#else
class SurfaceImpl : public Surface
#endif
{
encodingType et;
GdkDrawable *drawable;
GdkGC *gc;
@ -1750,7 +1760,6 @@ PRectangle Window::GetPosition() {
void Window::SetPosition(PRectangle rc) {
#if 1
//gtk_widget_set_uposition(id, rc.left, rc.top);
GtkAllocation alloc;
alloc.x = rc.left;
alloc.y = rc.top;
@ -1787,7 +1796,12 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
if (oy + sizey > screenHeight)
oy = screenHeight - sizey;
#if GTK_MAJOR_VERSION >= 2
gtk_window_move(GTK_WINDOW(PWidget(id)), ox, oy);
#else
gtk_widget_set_uposition(PWidget(id), ox, oy);
#endif
#if 0
GtkAllocation alloc;

View File

@ -88,6 +88,10 @@
#define OBJECT_CLASS GObjectClass
#endif
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
extern char *UTF8FromLatin1(const char *s, int &len);
class ScintillaGTK : public ScintillaBase {
@ -2494,6 +2498,8 @@ gint ScintillaGTK::ExposeCT(GtkWidget *widget, GdkEventExpose * /*ose*/, CallTip
Surface *surfaceWindow = Surface::Allocate();
if (surfaceWindow) {
surfaceWindow->Init(widget->window, widget);
surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
surfaceWindow->SetDBCSMode(ctip->codePage);
ctip->PaintCT(surfaceWindow);
surfaceWindow->Release();
delete surfaceWindow;

View File

@ -4,46 +4,45 @@ PlatGTK.o: PlatGTK.cxx \
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/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
../include/Accessor.h ../include/KeyWords.h ../src/SVector.h \
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/ContractionState.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/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/SplitVector.h \
../src/Partitioning.h ../src/CellBuffer.h
../include/Scintilla.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/SplitVector.h ../src/Partitioning.h ../src/RunStyles.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/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../include/Scintilla.h ../src/CharClassify.h ../src/Decoration.h \
../src/Document.h
../include/PropSet.h ../include/SString.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/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/CellBuffer.h ../src/PerLine.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/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
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/ContractionState.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/Decoration.h \
../src/Document.h ../src/PositionCache.h ../src/Editor.h
ExternalLexer.o: ../src/ExternalLexer.cxx ../include/Platform.h \
../include/Scintilla.h ../include/SciLexer.h ../include/PropSet.h \
../include/SString.h ../include/Accessor.h ../src/DocumentAccessor.h \
@ -55,6 +54,10 @@ KeyMap.o: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \
KeyWords.o: ../src/KeyWords.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexAbaqus.o: ../src/LexAbaqus.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
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/SString.h
@ -67,6 +70,10 @@ LexAsm.o: ../src/LexAsm.cxx ../include/Platform.h ../include/PropSet.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
LexASY.o: ../src/LexASY.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
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
@ -77,8 +84,9 @@ 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
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \
../src/CharacterSet.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 \
@ -95,6 +103,10 @@ LexCLW.o: ../src/LexCLW.cxx ../include/Platform.h ../include/PropSet.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
LexCOBOL.o: ../src/LexCOBOL.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
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
@ -167,7 +179,12 @@ LexLout.o: ../src/LexLout.cxx ../include/Platform.h ../include/PropSet.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h
LexLua.o: ../src/LexLua.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
LexMagik.o: ../src/LexMagik.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
LexMatlab.o: ../src/LexMatlab.cxx ../include/Platform.h \
../include/PropSet.h ../include/SString.h ../include/Accessor.h \
../src/StyleContext.h ../include/KeyWords.h ../include/Scintilla.h \
@ -186,6 +203,14 @@ LexMPT.o: ../src/LexMPT.cxx ../include/Platform.h ../include/PropSet.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
LexMySQL.o: ../src/LexMySQL.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
LexNimrod.o: ../src/LexNimrod.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
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
@ -198,19 +223,28 @@ LexOthers.o: ../src/LexOthers.cxx ../include/Platform.h \
LexPascal.o: ../src/LexPascal.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
../src/StyleContext.h ../src/CharacterSet.h
LexPB.o: ../src/LexPB.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
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
../include/SString.h ../include/Accessor.h ../src/StyleContext.h \
../include/KeyWords.h ../include/Scintilla.h ../include/SciLexer.h \
../src/CharacterSet.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
LexPowerPro.o: ../src/LexPowerPro.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
LexPowerShell.o: ../src/LexPowerShell.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 \
@ -222,6 +256,9 @@ 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
LexR.o: ../src/LexR.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 \
@ -236,6 +273,13 @@ 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
LexSML.o: ../src/LexSML.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
LexSorcus.o: ../src/LexSorcus.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 \
@ -247,10 +291,16 @@ LexSpice.o: ../src/LexSpice.cxx ../include/Platform.h \
LexSQL.o: ../src/LexSQL.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
LexTACL.o: ../src/LexTACL.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
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
LexTAL.o: ../src/LexTAL.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
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
@ -272,13 +322,15 @@ LexYAML.o: ../src/LexYAML.cxx ../include/Platform.h ../include/PropSet.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
PerLine.o: ../src/PerLine.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/CellBuffer.h ../src/PerLine.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
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/ContractionState.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/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/CharClassify.h ../src/RESearch.h
@ -288,10 +340,10 @@ RunStyles.o: ../src/RunStyles.cxx ../include/Platform.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 \
../include/KeyWords.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/ContractionState.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/Decoration.h \
../src/Document.h ../src/PositionCache.h ../src/Editor.h \
../src/ScintillaBase.h

View File

@ -65,14 +65,15 @@ endif
LEXOBJS=\
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 \
LexMySQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
LexPLM.o LexPOV.o LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o \
LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o \
LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
LexCOBOL.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 LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \
LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o LexPowerShell.o \
LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o LexScriptol.o \
LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.o LexSQL.o LexTACL.o \
LexTADS3.o LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
all: $(COMPLIB)
@ -84,7 +85,7 @@ deps:
$(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 Decoration.o Document.o CallTip.o \
CharClassify.o Decoration.o Document.o PerLine.o CallTip.o \
ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.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 \

View File

@ -158,6 +158,7 @@ LEXOBJS=\
$(DIR_O)\LexCaml.obj \
$(DIR_O)\LexCLW.obj \
$(DIR_O)\LexCmake.obj \
$(DIR_O)\LexCOBOL.obj \
$(DIR_O)\LexConf.obj \
$(DIR_O)\LexCPP.obj \
$(DIR_O)\LexCrontab.obj \
@ -186,6 +187,7 @@ LEXOBJS=\
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNimrod.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
@ -194,6 +196,7 @@ LEXOBJS=\
$(DIR_O)\LexPerl.obj \
$(DIR_O)\LexPLM.obj \
$(DIR_O)\LexPOV.obj \
$(DIR_O)\LexPowerPro.obj \
$(DIR_O)\LexPowerShell.obj \
$(DIR_O)\LexProgress.obj \
$(DIR_O)\LexPS.obj \
@ -203,10 +206,14 @@ LEXOBJS=\
$(DIR_O)\LexRuby.obj \
$(DIR_O)\LexScriptol.obj \
$(DIR_O)\LexSmalltalk.obj \
$(DIR_O)\LexSML.obj \
$(DIR_O)\LexSorcus.obj \
$(DIR_O)\LexSpecman.obj \
$(DIR_O)\LexSpice.obj \
$(DIR_O)\LexSQL.obj \
$(DIR_O)\LexTACL.obj \
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTAL.obj \
$(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexVB.obj \
@ -385,6 +392,8 @@ $(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS)
$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS)
$(DIR_O)\LexCOBOL.obj: ..\src\LexCOBOL.cxx $(LEX_HEADERS)
$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS)
$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS)
@ -441,6 +450,8 @@ $(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNimrod.obj: ..\src\LexNimrod.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
@ -457,6 +468,8 @@ $(DIR_O)\LexPLM.obj: ..\src\LexPLM.cxx $(LEX_HEADERS)
$(DIR_O)\LexPOV.obj: ..\src\LexPOV.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerPro.obj: ..\src\LexPowerPro.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerShell.obj: ..\src\LexPowerShell.cxx $(LEX_HEADERS)
$(DIR_O)\LexProgress.obj: ..\src\LexProgress.cxx $(LEX_HEADERS)
@ -475,14 +488,22 @@ $(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS)
$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS)
$(DIR_O)\LexSML.obj: ..\src\LexSML.cxx $(LEX_HEADERS)
$(DIR_O)\LexSorcus.obj: ..\src\LexSorcus.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpice.obj: ..\src\LexSpice.cxx $(LEX_HEADERS)
$(DIR_O)\LexSQL.obj: ..\src\LexSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTACL.obj: ..\src\LexTACL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTADS3.obj: ..\src\LexTADS3.cxx $(LEX_HEADERS)
$(DIR_O)\LexTAL.obj: ..\src\LexTAL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS)

View File

@ -1,36 +1,35 @@
# Module for reading and parsing Scintilla.iface file
import string
def sanitiseLine(line):
if line[-1:] == '\n': line = line[:-1]
if string.find(line, "##") != -1:
line = line[:string.find(line, "##")]
line = string.strip(line)
if line.find("##") != -1:
line = line[:line.find("##")]
line = line.strip()
return line
def decodeFunction(featureVal):
retType, rest = string.split(featureVal, " ", 1)
nameIdent, params = string.split(rest, "(")
name, value = string.split(nameIdent, "=")
params, rest = string.split(params, ")")
param1, param2 = string.split(params, ",")[0:2]
retType, rest = featureVal.split(" ", 1)
nameIdent, params = rest.split("(")
name, value = nameIdent.split("=")
params, rest = params.split(")")
param1, param2 = params.split(",")[0:2]
return retType, name, value, param1, param2
def decodeEvent(featureVal):
retType, rest = string.split(featureVal, " ", 1)
nameIdent, params = string.split(rest, "(")
name, value = string.split(nameIdent, "=")
retType, rest = featureVal.split(" ", 1)
nameIdent, params = rest.split("(")
name, value = nameIdent.split("=")
return retType, name, value
def decodeParam(p):
param = string.strip(p)
param = p.strip()
type = ""
name = ""
value = ""
if " " in param:
type, nv = string.split(param, " ")
type, nv = param.split(" ")
if "=" in nv:
name, value = string.split(nv, "=")
name, value = nv.split("=")
else:
name = nv
return type, name, value
@ -59,7 +58,7 @@ class Face:
currentComment.append(line[2:])
else:
currentCommentFinished = 1
featureType, featureVal = string.split(line, " ", 1)
featureType, featureVal = line.split(" ", 1)
if featureType in ["fun", "get", "set"]:
retType, name, value, param1, param2 = decodeFunction(featureVal)
p1 = decodeParam(param1)
@ -72,7 +71,7 @@ class Face:
"Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2],
"Category": currentCategory, "Comment": currentComment
}
if self.values.has_key(value):
if value in self.values:
raise "Duplicate value " + value + " " + name
self.values[value] = 1
self.order.append(name)
@ -84,21 +83,21 @@ class Face:
"Value": value,
"Category": currentCategory, "Comment": currentComment
}
if self.events.has_key(value):
if value in self.events:
raise "Duplicate event " + value + " " + name
self.events[value] = 1
self.order.append(name)
elif featureType == "cat":
currentCategory = featureVal
elif featureType == "val":
name, value = string.split(featureVal, "=", 1)
name, value = featureVal.split("=", 1)
self.features[name] = {
"FeatureType": featureType,
"Category": currentCategory,
"Value": value }
self.order.append(name)
elif featureType == "enu" or featureType == "lex":
name, value = string.split(featureVal, "=", 1)
name, value = featureVal.split("=", 1)
self.features[name] = {
"FeatureType": featureType,
"Category": currentCategory,

View File

@ -1,16 +1,15 @@
# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface
# definition file.
# The header files are copied to a temporary file apart from the section between a //++Autogenerated
# comment and a //--Autogenerated comment which is generated by the printHFile and printLexHFile
# The header files are copied to a temporary file apart from the section between a /* ++Autogenerated*/
# comment and a /* --Autogenerated*/ comment which is generated by the printHFile and printLexHFile
# functions. After the temporary file is created, it is copied back to the original file name.
import string
import sys
import os
import Face
def Contains(s,sub):
return string.find(s, sub) != -1
return s.find(sub) != -1
def printLexHFile(f,out):
for name in f.order:
@ -24,10 +23,10 @@ def printHFile(f,out):
v = f.features[name]
if v["Category"] != "Deprecated":
if v["FeatureType"] in ["fun", "get", "set"]:
featureDefineName = "SCI_" + string.upper(name)
featureDefineName = "SCI_" + name.upper()
out.write("#define " + featureDefineName + " " + v["Value"] + "\n")
elif v["FeatureType"] in ["evt"]:
featureDefineName = "SCN_" + string.upper(name)
featureDefineName = "SCN_" + name.upper()
out.write("#define " + featureDefineName + " " + v["Value"] + "\n")
elif v["FeatureType"] in ["val"]:
if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")):
@ -38,15 +37,15 @@ def CopyWithInsertion(input, output, genfn, definition):
for line in input.readlines():
if copying:
output.write(line)
if Contains(line, "//++Autogenerated"):
if Contains(line, "/* ++Autogenerated"):
copying = 0
genfn(definition, output)
if Contains(line, "//--Autogenerated"):
if Contains(line, "/* --Autogenerated"):
copying = 1
output.write(line)
def contents(filename):
f = file(filename)
f = open(filename)
t = f.read()
f.close()
return t
@ -71,6 +70,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 %s" % max([x for x in f.values if int(x) < 3000]))
except:
raise

View File

@ -23,6 +23,7 @@
//*******************************************************//
#define PLAT_GTK 0
#define PLAT_GTK_WIN32 0
#define PLAT_MACOSX 0

View File

@ -1,19 +1,19 @@
// Scintilla source code edit control
/* Scintilla source code edit control */
/** @file SciLexer.h
** Interface to the added lexer functions in the SciLexer version of the edit control.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
/* Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
* The License.txt file describes the conditions under which this software may be distributed. */
// Most of this file is automatically generated from the Scintilla.iface interface definition
// file which contains any comments about the definitions. HFacer.py does the generation.
/* Most of this file is automatically generated from the Scintilla.iface interface definition
* file which contains any comments about the definitions. HFacer.py does the generation. */
#ifndef SCILEXER_H
#define SCILEXER_H
// SciLexer features - not in standard Scintilla
/* SciLexer features - not in standard Scintilla */
//++Autogenerated -- start of section automatically generated from Scintilla.iface
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define SCLEX_CONTAINER 0
#define SCLEX_NULL 1
#define SCLEX_PYTHON 2
@ -103,9 +103,18 @@
#define SCLEX_POWERSHELL 88
#define SCLEX_MYSQL 89
#define SCLEX_PO 90
#define SCLEX_TAL 91
#define SCLEX_COBOL 92
#define SCLEX_TACL 93
#define SCLEX_SORCUS 94
#define SCLEX_POWERPRO 95
#define SCLEX_NIMROD 96
#define SCLEX_SML 97
#define SCLEX_SEARCHRESULT 98
#define SCLEX_OBJC 99
#define SCLEX_USER 100
#define SCLEX_AUTOMATIC 1000
//For All lexer
@ -1129,6 +1138,7 @@
#define SCE_INNO_SECTION 4
#define SCE_INNO_PREPROC 5
#define SCE_INNO_PREPROC_INLINE 6
#define SCE_INNO_INLINE_EXPANSION 6
#define SCE_INNO_COMMENT_PASCAL 7
#define SCE_INNO_KEYWORD_PASCAL 8
#define SCE_INNO_KEYWORD_USER 9
@ -1316,8 +1326,65 @@
#define SCE_PO_MSGCTXT 6
#define SCE_PO_MSGCTXT_TEXT 7
#define SCE_PO_FUZZY 8
#define SCE_PAS_DEFAULT 0
#define SCE_PAS_IDENTIFIER 1
#define SCE_PAS_COMMENT 2
#define SCE_PAS_COMMENT2 3
#define SCE_PAS_COMMENTLINE 4
#define SCE_PAS_PREPROCESSOR 5
#define SCE_PAS_PREPROCESSOR2 6
#define SCE_PAS_NUMBER 7
#define SCE_PAS_HEXNUMBER 8
#define SCE_PAS_WORD 9
#define SCE_PAS_STRING 10
#define SCE_PAS_STRINGEOL 11
#define SCE_PAS_CHARACTER 12
#define SCE_PAS_OPERATOR 13
#define SCE_PAS_ASM 14
#define SCE_SORCUS_DEFAULT 0
#define SCE_SORCUS_COMMAND 1
#define SCE_SORCUS_PARAMETER 2
#define SCE_SORCUS_COMMENTLINE 3
#define SCE_SORCUS_STRING 4
#define SCE_SORCUS_STRINGEOL 5
#define SCE_SORCUS_IDENTIFIER 6
#define SCE_SORCUS_OPERATOR 7
#define SCE_SORCUS_NUMBER 8
#define SCE_SORCUS_CONSTANT 9
#define SCE_POWERPRO_DEFAULT 0
#define SCE_POWERPRO_COMMENTBLOCK 1
#define SCE_POWERPRO_COMMENTLINE 2
#define SCE_POWERPRO_NUMBER 3
#define SCE_POWERPRO_WORD 4
#define SCE_POWERPRO_WORD2 5
#define SCE_POWERPRO_WORD3 6
#define SCE_POWERPRO_WORD4 7
#define SCE_POWERPRO_DOUBLEQUOTEDSTRING 8
#define SCE_POWERPRO_SINGLEQUOTEDSTRING 9
#define SCE_POWERPRO_LINECONTINUE 10
#define SCE_POWERPRO_OPERATOR 11
#define SCE_POWERPRO_IDENTIFIER 12
#define SCE_POWERPRO_STRINGEOL 13
#define SCE_POWERPRO_VERBATIM 14
#define SCE_POWERPRO_ALTQUOTE 15
#define SCE_POWERPRO_FUNCTION 16
#define SCE_SML_DEFAULT 0
#define SCE_SML_IDENTIFIER 1
#define SCE_SML_TAGNAME 2
#define SCE_SML_KEYWORD 3
#define SCE_SML_KEYWORD2 4
#define SCE_SML_KEYWORD3 5
#define SCE_SML_LINENUM 6
#define SCE_SML_OPERATOR 7
#define SCE_SML_NUMBER 8
#define SCE_SML_CHAR 9
#define SCE_SML_STRING 11
#define SCE_SML_COMMENT 12
#define SCE_SML_COMMENT1 13
#define SCE_SML_COMMENT2 14
#define SCE_SML_COMMENT3 15
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif

View File

@ -1,12 +1,12 @@
// Scintilla source code edit control
/* Scintilla source code edit control */
/** @file Scintilla.h
** Interface to the edit control.
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
/* Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
* The License.txt file describes the conditions under which this software may be distributed. */
// Most of this file is automatically generated from the Scintilla.iface interface definition
// file which contains any comments about the definitions. HFacer.py does the generation.
/* Most of this file is automatically generated from the Scintilla.iface interface definition
* file which contains any comments about the definitions. HFacer.py does the generation. */
#ifndef SCINTILLA_H
#define SCINTILLA_H
@ -16,16 +16,16 @@ typedef BOOL bool;
#endif
#if PLAT_WIN
// Return false on failure:
/* Return false on failure: */
bool Scintilla_RegisterClasses(void *hInstance);
bool Scintilla_ReleaseResources();
#endif
int Scintilla_LinkLexers();
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
#if _MSC_VER >= 1300
/* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
* hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
* May need to be changed for 64 bit platforms. */
#if defined(_WIN32)
#include <BaseTsd.h>
#endif
#ifdef MAXULONG_PTR
@ -38,7 +38,7 @@ typedef long sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
//++Autogenerated -- start of section automatically generated from Scintilla.iface
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define INVALID_POSITION -1
#define SCI_START 2000
#define SCI_OPTIONAL_START 3000
@ -119,6 +119,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_PIXMAP 25
#define SC_MARK_FULLRECT 26
#define SC_MARK_LEFTRECT 27
#define SC_MARK_AVAILABLE 28
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@ -144,6 +145,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARGIN_NUMBER 1
#define SC_MARGIN_BACK 2
#define SC_MARGIN_FORE 3
#define SC_MARGIN_TEXT 4
#define SC_MARGIN_RTEXT 5
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
@ -250,8 +253,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICGETUNDER 2511
#define SCI_GETCARETLINEVISIBLEALWAYS 3095
#define SCI_SETCARETLINEVISIBLEALWAYS 3096
#define SCI_INDICSETALPHA 3097
#define SCI_INDICGETALPHA 3098
#define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETSTYLEBITS 2090
@ -399,10 +400,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_FOLDLEVELBASE 0x400
#define SC_FOLDLEVELWHITEFLAG 0x1000
#define SC_FOLDLEVELHEADERFLAG 0x2000
#define SC_FOLDLEVELBOXHEADERFLAG 0x4000
#define SC_FOLDLEVELBOXFOOTERFLAG 0x8000
#define SC_FOLDLEVELCONTRACTED 0x10000
#define SC_FOLDLEVELUNINDENT 0x20000
#define SC_FOLDLEVELNUMBERMASK 0x0FFF
#define SCI_SETFOLDLEVEL 2222
#define SCI_GETFOLDLEVEL 2223
@ -420,7 +417,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040
#define SC_FOLDFLAG_BOX 0x0001
#define SCI_SETFOLDFLAGS 2233
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
#define SCI_SETTABINDENTS 2260
@ -675,6 +671,39 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETCHARACTERPOINTER 2520
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_INDICSETALPHA 2523
#define SCI_INDICGETALPHA 2524
#define SCI_SETEXTRAASCENT 2525
#define SCI_GETEXTRAASCENT 2526
#define SCI_SETEXTRADESCENT 2527
#define SCI_GETEXTRADESCENT 2528
#define SCI_MARKERSYMBOLDEFINED 2529
#define SCI_MARGINSETTEXT 2530
#define SCI_MARGINGETTEXT 2531
#define SCI_MARGINSETSTYLE 2532
#define SCI_MARGINGETSTYLE 2533
#define SCI_MARGINSETSTYLES 2534
#define SCI_MARGINGETSTYLES 2535
#define SCI_MARGINTEXTCLEARALL 2536
#define SCI_MARGINSETSTYLEOFFSET 2537
#define SCI_MARGINGETSTYLEOFFSET 2538
#define SCI_ANNOTATIONSETTEXT 2540
#define SCI_ANNOTATIONGETTEXT 2541
#define SCI_ANNOTATIONSETSTYLE 2542
#define SCI_ANNOTATIONGETSTYLE 2543
#define SCI_ANNOTATIONSETSTYLES 2544
#define SCI_ANNOTATIONGETSTYLES 2545
#define SCI_ANNOTATIONGETLINES 2546
#define SCI_ANNOTATIONCLEARALL 2547
#define ANNOTATION_HIDDEN 0
#define ANNOTATION_STANDARD 1
#define ANNOTATION_BOXED 2
#define SCI_ANNOTATIONSETVISIBLE 2548
#define SCI_ANNOTATIONGETVISIBLE 2549
#define SCI_ANNOTATIONSETSTYLEOFFSET 2550
#define SCI_ANNOTATIONGETSTYLEOFFSET 2551
#define UNDO_MAY_COALESCE 1
#define SCI_ADDUNDOACTION 2560
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@ -705,7 +734,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_STARTACTION 0x2000
#define SC_MOD_CHANGEINDICATOR 0x4000
#define SC_MOD_CHANGELINESTATE 0x8000
#define SC_MODEVENTMASKALL 0xFFFF
#define SC_MOD_CHANGEMARGIN 0x10000
#define SC_MOD_CHANGEANNOTATION 0x20000
#define SC_MOD_CONTAINER 0x40000
#define SC_MODEVENTMASKALL 0x7FFFF
#define SC_SEARCHRESULT_LINEBUFFERMAXLENGTH 1024
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
@ -759,13 +791,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_INDICATORCLICK 2023
#define SCN_INDICATORRELEASE 2024
#define SCN_AUTOCCANCELLED 2025
#define SCN_AUTOCCHARDELETED 2026
#define SCN_SCROLLED 2080
//--Autogenerated -- end of section automatically generated from Scintilla.iface
/* --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.
/* 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 {
@ -789,8 +822,8 @@ struct TextToFind {
#ifdef PLATFORM_H
// This structure is used in printing and requires some of the graphics types
// from Platform.h. Not needed by most client code.
/* This structure is used in printing and requires some of the graphics types
* from Platform.h. Not needed by most client code. */
struct RangeToFormat {
SurfaceID hdc;
@ -803,9 +836,9 @@ struct RangeToFormat {
#endif
struct NotifyHeader {
// Compatible with Windows NMHDR.
// hwndFrom is really an environment specific window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
/* Compatible with Windows NMHDR.
* hwndFrom is really an environment specific window handle or pointer
* but most clients of Scintilla.h do not have this type visible. */
void *hwndFrom;
uptr_t idFrom;
unsigned int code;
@ -813,23 +846,25 @@ struct NotifyHeader {
struct SCNotification {
struct NotifyHeader nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
int message; // SCN_MACRORECORD
uptr_t wParam; // SCN_MACRORECORD
sptr_t lParam; // SCN_MACRORECORD
int line; // SCN_MODIFIED
int foldLevelNow; // SCN_MODIFIED
int foldLevelPrev; // SCN_MODIFIED
int margin; // SCN_MARGINCLICK
int listType; // SCN_USERLISTSELECTION
int x; // SCN_DWELLSTART, SCN_DWELLEND
int y; // SCN_DWELLSTART, SCN_DWELLEND
int position; /* SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND */
int ch; /* SCN_CHARADDED, SCN_KEY */
int modifiers; /* SCN_KEY */
int modificationType; /* SCN_MODIFIED */
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
int length; /* SCN_MODIFIED */
int linesAdded; /* SCN_MODIFIED */
int message; /* SCN_MACRORECORD */
uptr_t wParam; /* SCN_MACRORECORD */
sptr_t lParam; /* SCN_MACRORECORD */
int line; /* SCN_MODIFIED */
int foldLevelNow; /* SCN_MODIFIED */
int foldLevelPrev; /* SCN_MODIFIED */
int margin; /* SCN_MARGINCLICK */
int listType; /* SCN_USERLISTSELECTION */
int x; /* SCN_DWELLSTART, SCN_DWELLEND */
int y; /* SCN_DWELLSTART, SCN_DWELLEND */
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
int annotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */
};
struct SearchResultMarking {
@ -842,14 +877,13 @@ struct SearchResultMarkings {
SearchResultMarking *_markings;
};
#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
/* Deprecation section listing all API features that are deprecated and
* will be removed completely in a future version.
* To enable these features define INCLUDE_DEPRECATED_FEATURES */
#ifdef INCLUDE_DEPRECATED_FEATURES
@ -858,6 +892,12 @@ struct SearchResultMarkings {
#define CARET_XEVEN 0x08
#define CARET_XJUMPS 0x10
#define SC_FOLDFLAG_BOX 0x0001
#define SC_FOLDLEVELBOXHEADERFLAG 0x4000
#define SC_FOLDLEVELBOXFOOTERFLAG 0x8000
#define SC_FOLDLEVELCONTRACTED 0x10000
#define SC_FOLDLEVELUNINDENT 0x20000
#define SCN_POSCHANGED 2012
#define SCN_CHECKBRACE 2007

View File

@ -269,6 +269,7 @@ val SC_MARK_ARROWS=24
val SC_MARK_PIXMAP=25
val SC_MARK_FULLRECT=26
val SC_MARK_LEFTRECT=27
val SC_MARK_AVAILABLE=28
val SC_MARK_CHARACTER=10000
@ -325,6 +326,8 @@ val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
val SC_MARGIN_BACK=2
val SC_MARGIN_FORE=3
val SC_MARGIN_TEXT=4
val SC_MARGIN_RTEXT=5
# Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType)
@ -1011,10 +1014,6 @@ enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400
val SC_FOLDLEVELWHITEFLAG=0x1000
val SC_FOLDLEVELHEADERFLAG=0x2000
val SC_FOLDLEVELBOXHEADERFLAG=0x4000
val SC_FOLDLEVELBOXFOOTERFLAG=0x8000
val SC_FOLDLEVELCONTRACTED=0x10000
val SC_FOLDLEVELUNINDENT=0x20000
val SC_FOLDLEVELNUMBERMASK=0x0FFF
# Set the fold level of a line.
@ -1058,7 +1057,6 @@ val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004
val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008
val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010
val SC_FOLDFLAG_LEVELNUMBERS=0x0040
val SC_FOLDFLAG_BOX=0x0001
# Set some style options for folding.
fun void SetFoldFlags=2233(int flags,)
@ -1810,6 +1808,100 @@ set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)
# Set the alpha fill colour of the given indicator.
set void IndicSetAlpha=2523(int indicator, int alpha)
# Get the alpha fill colour of the given indicator.
get int IndicGetAlpha=2524(int indicator,)
# Set extra ascent for each line
set void SetExtraAscent=2525(int extraAscent,)
# Get extra ascent for each line
get int GetExtraAscent=2526(,)
# Set extra descent for each line
set void SetExtraDescent=2527(int extraDescent,)
# Get extra descent for each line
get int GetExtraDescent=2528(,)
# Which symbol was defined for markerNumber with MarkerDefine
fun int MarkerSymbolDefined=2529(int markerNumber,)
# Set the text in the text margin for a line
set void MarginSetText=2530(int line, string text)
# Get the text in the text margin for a line
get int MarginGetText=2531(int line, stringresult text)
# Set the style number for the text margin for a line
set void MarginSetStyle=2532(int line, int style)
# Get the style number for the text margin for a line
get int MarginGetStyle=2533(int line,)
# Set the style in the text margin for a line
set void MarginSetStyles=2534(int line, string styles)
# Get the styles in the text margin for a line
get int MarginGetStyles=2535(int line, stringresult styles)
# Clear the margin text on all lines
fun void MarginTextClearAll=2536(,)
# Get the start of the range of style numbers used for margin text
set void MarginSetStyleOffset=2537(int style,)
# Get the start of the range of style numbers used for margin text
get int MarginGetStyleOffset=2538(,)
# Set the annotation text for a line
set void AnnotationSetText=2540(int line, string text)
# Get the annotation text for a line
get int AnnotationGetText=2541(int line, stringresult text)
# Set the style number for the annotations for a line
set void AnnotationSetStyle=2542(int line, int style)
# Get the style number for the annotations for a line
get int AnnotationGetStyle=2543(int line,)
# Set the annotation styles for a line
set void AnnotationSetStyles=2544(int line, string styles)
# Get the annotation styles for a line
get int AnnotationGetStyles=2545(int line, stringresult styles)
# Get the number of annotation lines for a line
get int AnnotationGetLines=2546(int line,)
# Clear the annotations from all lines
fun void AnnotationClearAll=2547(,)
enu AnnotationVisible=ANNOTATION_
val ANNOTATION_HIDDEN=0
val ANNOTATION_STANDARD=1
val ANNOTATION_BOXED=2
# Set the visibility for the annotations for a view
set void AnnotationSetVisible=2548(int visible,)
# Get the visibility for the annotations for a view
get int AnnotationGetVisible=2549(,)
# Get the start of the range of style numbers used for annotations
set void AnnotationSetStyleOffset=2550(int style,)
# Get the start of the range of style numbers used for annotations
get int AnnotationGetStyleOffset=2551(,)
val UNDO_MAY_COALESCE=1
# Add a container action to the undo stack
fun void AddUndoAction=2560(int token, int flags)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -1875,7 +1967,10 @@ val SC_MULTILINEUNDOREDO=0x1000
val SC_STARTACTION=0x2000
val SC_MOD_CHANGEINDICATOR=0x4000
val SC_MOD_CHANGELINESTATE=0x8000
val SC_MODEVENTMASKALL=0xFFFF
val SC_MOD_CHANGEMARGIN=0x10000
val SC_MOD_CHANGEANNOTATION=0x20000
val SC_MOD_CONTAINER=0x40000
val SC_MODEVENTMASKALL=0x7FFFF
# For compatibility, these go through the COMMAND notification rather than NOTIFY
# and should have had exactly the same values as the EN_* constants.
@ -2009,12 +2104,20 @@ val SCLEX_MAGIK=87
val SCLEX_POWERSHELL=88
val SCLEX_MYSQL=89
val SCLEX_PO=90
val SCLEX_TAL=91
val SCLEX_COBOL=92
val SCLEX_TACL=93
val SCLEX_SORCUS=94
val SCLEX_POWERPRO=95
val SCLEX_NIMROD=96
val SCLEX_SML=97
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
lex Python=SCLEX_PYTHON SCE_P_
lex Nimrod=SCLEX_NIMROD SCE_P_
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2
@ -2033,7 +2136,6 @@ val SCE_P_WORD2=14
val SCE_P_DECORATOR=15
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
@ -3133,6 +3235,7 @@ val SCE_INNO_PARAMETER=3
val SCE_INNO_SECTION=4
val SCE_INNO_PREPROC=5
val SCE_INNO_PREPROC_INLINE=6
val SCE_INNO_INLINE_EXPANSION=6
val SCE_INNO_COMMENT_PASCAL=7
val SCE_INNO_KEYWORD_PASCAL=8
val SCE_INNO_KEYWORD_USER=9
@ -3346,6 +3449,71 @@ val SCE_PO_MSGSTR_TEXT=5
val SCE_PO_MSGCTXT=6
val SCE_PO_MSGCTXT_TEXT=7
val SCE_PO_FUZZY=8
# Lexical states for SCLEX_PASCAL
lex Pascal=SCLEX_PASCAL SCE_PAS_
val SCE_PAS_DEFAULT=0
val SCE_PAS_IDENTIFIER=1
val SCE_PAS_COMMENT=2
val SCE_PAS_COMMENT2=3
val SCE_PAS_COMMENTLINE=4
val SCE_PAS_PREPROCESSOR=5
val SCE_PAS_PREPROCESSOR2=6
val SCE_PAS_NUMBER=7
val SCE_PAS_HEXNUMBER=8
val SCE_PAS_WORD=9
val SCE_PAS_STRING=10
val SCE_PAS_STRINGEOL=11
val SCE_PAS_CHARACTER=12
val SCE_PAS_OPERATOR=13
val SCE_PAS_ASM=14
# Lexical state for SCLEX_SORCUS
lex SORCUS=SCLEX_SORCUS SCE_SORCUS_
val SCE_SORCUS_DEFAULT=0
val SCE_SORCUS_COMMAND=1
val SCE_SORCUS_PARAMETER=2
val SCE_SORCUS_COMMENTLINE=3
val SCE_SORCUS_STRING=4
val SCE_SORCUS_STRINGEOL=5
val SCE_SORCUS_IDENTIFIER=6
val SCE_SORCUS_OPERATOR=7
val SCE_SORCUS_NUMBER=8
val SCE_SORCUS_CONSTANT=9
# Lexical state for SCLEX_POWERPRO
lex PowerPro=SCLEX_POWERPRO SCE_POWERPRO_
val SCE_POWERPRO_DEFAULT=0
val SCE_POWERPRO_COMMENTBLOCK=1
val SCE_POWERPRO_COMMENTLINE=2
val SCE_POWERPRO_NUMBER=3
val SCE_POWERPRO_WORD=4
val SCE_POWERPRO_WORD2=5
val SCE_POWERPRO_WORD3=6
val SCE_POWERPRO_WORD4=7
val SCE_POWERPRO_DOUBLEQUOTEDSTRING=8
val SCE_POWERPRO_SINGLEQUOTEDSTRING=9
val SCE_POWERPRO_LINECONTINUE=10
val SCE_POWERPRO_OPERATOR=11
val SCE_POWERPRO_IDENTIFIER=12
val SCE_POWERPRO_STRINGEOL=13
val SCE_POWERPRO_VERBATIM=14
val SCE_POWERPRO_ALTQUOTE=15
val SCE_POWERPRO_FUNCTION=16
# Lexical states for SCLEX_SML
lex SML=SCLEX_SML SCE_SML_
val SCE_SML_DEFAULT=0
val SCE_SML_IDENTIFIER=1
val SCE_SML_TAGNAME=2
val SCE_SML_KEYWORD=3
val SCE_SML_KEYWORD2=4
val SCE_SML_KEYWORD3=5
val SCE_SML_LINENUM=6
val SCE_SML_OPERATOR=7
val SCE_SML_NUMBER=8
val SCE_SML_CHAR=9
val SCE_SML_STRING=11
val SCE_SML_COMMENT=12
val SCE_SML_COMMENT1=13
val SCE_SML_COMMENT2=14
val SCE_SML_COMMENT3=15
# Events
@ -3375,6 +3543,7 @@ evt void AutoCSelection=2022(string text)
evt void IndicatorClick=2023(int modifiers, int position)
evt void IndicatorRelease=2024(int modifiers, int position)
evt void AutoCCancelled=2025(void)
evt void AutoCCharDeleted=2026(void)
cat Deprecated
@ -3388,6 +3557,13 @@ val CARET_XJUMPS=0x10
val SCN_CHECKBRACE=2007
evt void PosChanged=2012(int position)
# Box folding support
val SC_FOLDFLAG_BOX=0x0001
val SC_FOLDLEVELBOXHEADERFLAG=0x4000
val SC_FOLDLEVELBOXFOOTERFLAG=0x8000
val SC_FOLDLEVELCONTRACTED=0x10000
val SC_FOLDLEVELUNINDENT=0x20000
# SCLEX_HTML should be used in preference to these.
val SCLEX_ASP=29
val SCLEX_PHP=30

View File

@ -1,10 +1,10 @@
// Scintilla source code edit control
/* Scintilla source code edit control */
/** @file ScintillaWidget.h
** Definition of Scintilla widget for GTK+.
** Only needed by GTK+ code but is harmless on other platforms.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
/* Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
* The License.txt file describes the conditions under which this software may be distributed. */
#ifndef SCINTILLAWIDGET_H
#define SCINTILLAWIDGET_H

View File

@ -21,165 +21,20 @@
using namespace Scintilla;
#endif
MarkerHandleSet::MarkerHandleSet() {
root = 0;
}
MarkerHandleSet::~MarkerHandleSet() {
MarkerHandleNumber *mhn = root;
while (mhn) {
MarkerHandleNumber *mhnToFree = mhn;
mhn = mhn->next;
delete mhnToFree;
}
root = 0;
}
int MarkerHandleSet::Length() const {
int c = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
c++;
mhn = mhn->next;
}
return c;
}
int MarkerHandleSet::NumberFromHandle(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return mhn->number;
}
mhn = mhn->next;
}
return - 1;
}
int MarkerHandleSet::MarkValue() const {
unsigned int m = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
m |= (1 << mhn->number);
mhn = mhn->next;
}
return m;
}
bool MarkerHandleSet::Contains(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return true;
}
mhn = mhn->next;
}
return false;
}
bool MarkerHandleSet::InsertHandle(int handle, int markerNum) {
MarkerHandleNumber *mhn = new MarkerHandleNumber;
if (!mhn)
return false;
mhn->handle = handle;
mhn->number = markerNum;
mhn->next = root;
root = mhn;
return true;
}
void MarkerHandleSet::RemoveHandle(int handle) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->handle == handle) {
*pmhn = mhn->next;
delete mhn;
return;
}
pmhn = &((*pmhn)->next);
}
}
bool MarkerHandleSet::RemoveNumber(int markerNum) {
bool performedDeletion = false;
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->number == markerNum) {
*pmhn = mhn->next;
delete mhn;
performedDeletion = true;
} else {
pmhn = &((*pmhn)->next);
}
}
return performedDeletion;
}
void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
pmhn = &((*pmhn)->next);
}
*pmhn = other->root;
other->root = 0;
}
LineVector::LineVector() : starts(256) {
handleCurrent = 1;
Init();
}
LineVector::~LineVector() {
starts.DeleteAll();
for (int line = 0; line < markers.Length(); line++) {
delete markers[line];
markers[line] = 0;
}
markers.DeleteAll();
levels.DeleteAll();
}
void LineVector::Init() {
starts.DeleteAll();
for (int line = 0; line < markers.Length(); line++) {
delete markers[line];
markers[line] = 0;
}
markers.DeleteAll();
levels.DeleteAll();
}
void LineVector::ExpandLevels(int sizeNew) {
levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE);
}
void LineVector::ClearLevels() {
levels.DeleteAll();
}
int LineVector::SetLevel(int line, int level) {
int prev = 0;
if ((line >= 0) && (line < Lines())) {
if (!levels.Length()) {
ExpandLevels(Lines() + 1);
}
prev = levels[line];
if (prev != level) {
levels[line] = level;
}
}
return prev;
}
int LineVector::GetLevel(int line) {
if (levels.Length() && (line >= 0) && (line < Lines())) {
return levels[line];
} else {
return SC_FOLDLEVELBASE;
}
void LineVector::SetPerLine(PerLine *pl) {
perLine = pl;
}
void LineVector::InsertText(int line, int delta) {
@ -188,15 +43,8 @@ void LineVector::InsertText(int line, int delta) {
void LineVector::InsertLine(int line, int position) {
starts.InsertPartition(line, position);
if (markers.Length()) {
markers.Insert(line, 0);
}
if (levels.Length()) {
int level = SC_FOLDLEVELBASE;
if ((line > 0) && (line < Lines())) {
level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG;
}
levels.InsertValue(line, 1, level);
if (perLine) {
perLine->InsertLine(line);
}
}
@ -206,20 +54,8 @@ void LineVector::SetLineStart(int line, int position) {
void LineVector::RemoveLine(int line) {
starts.RemovePartition(line);
// Retain the markers from the deleted line by oring them into the previous line
if (markers.Length()) {
if (line > 0) {
MergeMarkers(line - 1);
}
markers.Delete(line);
}
if (levels.Length()) {
// Move up following lines but merge header flag from this line
// to line before to avoid a temporary disappearence causing expansion.
int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG;
levels.Delete(line);
if (line > 0)
levels[line-1] |= firstHeader;
if (perLine) {
perLine->RemoveLine(line);
}
}
@ -227,82 +63,6 @@ int LineVector::LineFromPosition(int pos) {
return starts.PartitionFromPosition(pos);
}
int LineVector::MarkValue(int line) {
if (markers.Length() && markers[line])
return markers[line]->MarkValue();
else
return 0;
}
int LineVector::AddMark(int line, int markerNum) {
handleCurrent++;
if (!markers.Length()) {
// No existing markers so allocate one element per line
markers.InsertValue(0, Lines(), 0);
}
if (!markers[line]) {
// Need new structure to hold marker handle
markers[line] = new MarkerHandleSet();
if (!markers[line])
return - 1;
}
markers[line]->InsertHandle(handleCurrent, markerNum);
return handleCurrent;
}
void LineVector::MergeMarkers(int pos) {
if (markers[pos + 1] != NULL) {
if (markers[pos] == NULL)
markers[pos] = new MarkerHandleSet;
markers[pos]->CombineWith(markers[pos + 1]);
delete markers[pos + 1];
markers[pos + 1] = NULL;
}
}
void LineVector::DeleteMark(int line, int markerNum, bool all) {
if (markers.Length() && markers[line]) {
if (markerNum == -1) {
delete markers[line];
markers[line] = NULL;
} else {
bool performedDeletion = markers[line]->RemoveNumber(markerNum);
while (all && performedDeletion) {
performedDeletion = markers[line]->RemoveNumber(markerNum);
}
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
}
void LineVector::DeleteMarkFromHandle(int markerHandle) {
int line = LineFromHandle(markerHandle);
if (line >= 0) {
markers[line]->RemoveHandle(markerHandle);
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
int LineVector::LineFromHandle(int markerHandle) {
if (markers.Length()) {
for (int line = 0; line < Lines(); line++) {
if (markers[line]) {
if (markers[line]->Contains(markerHandle)) {
return line;
}
}
}
}
return -1;
}
Action::Action() {
at = startAction;
position = 0;
@ -398,7 +158,7 @@ void UndoHistory::EnsureUndoRoom() {
}
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData,
bool &startSequence) {
bool &startSequence, bool mayCoalesce) {
EnsureUndoRoom();
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
@ -410,25 +170,35 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
if (currentAction >= 1) {
if (0 == undoSequenceDepth) {
// Top level actions may not always be coalesced
Action &actPrevious = actions[currentAction - 1];
int targetAct = -1;
const Action *actPrevious = &(actions[currentAction + targetAct]);
// Container actions may forward the coalesce state of Scintilla Actions.
while ((actPrevious->at == containerAction) && actPrevious->mayCoalesce) {
targetAct--;
actPrevious = &(actions[currentAction + targetAct]);
}
// See if current action can be coalesced into previous action
// Will work if both are inserts or deletes and position is same
if (at != actPrevious.at) {
currentAction++;
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData))) {
// Insertions must be immediately after to coalesce
if (currentAction == savePoint) {
currentAction++;
} else if (!actions[currentAction].mayCoalesce) {
// Not allowed to coalesce if this set
currentAction++;
} else if (!mayCoalesce || !actPrevious->mayCoalesce) {
currentAction++;
} else if (at == containerAction || actions[currentAction].at == containerAction) {
; // A coalescible containerAction
} else if ((at != actPrevious->at) && (actPrevious->at != startAction)) {
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious->position + actPrevious->lenData))) {
// Insertions must be immediately after to coalesce
currentAction++;
} else if (at == removeAction) {
if ((lengthData == 1) || (lengthData == 2)){
if ((position + lengthData) == actPrevious.position) {
if ((position + lengthData) == actPrevious->position) {
; // Backspace -> OK
} else if (position == actPrevious.position) {
} else if (position == actPrevious->position) {
; // Delete -> OK
} else {
// Removals must be at same position to coalesce
@ -451,7 +221,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++;
}
startSequence = oldCurrentAction != currentAction;
actions[currentAction].Create(at, position, data, lengthData);
actions[currentAction].Create(at, position, data, lengthData, mayCoalesce);
currentAction++;
actions[currentAction].Create(startAction);
maxAction = currentAction;
@ -666,6 +436,10 @@ void CellBuffer::Allocate(int newSize) {
style.ReAllocate(newSize);
}
void CellBuffer::SetPerLine(PerLine *pl) {
lv.SetPerLine(pl);
}
int CellBuffer::Lines() const {
return lv.Lines();
}
@ -695,54 +469,14 @@ bool CellBuffer::IsSavePoint() {
return uh.IsSavePoint();
}
int CellBuffer::AddMark(int line, int markerNum) {
if ((line >= 0) && (line < Lines())) {
return lv.AddMark(line, markerNum);
}
return - 1;
}
void CellBuffer::DeleteMark(int line, int markerNum) {
if ((line >= 0) && (line < Lines())) {
lv.DeleteMark(line, markerNum, false);
}
}
void CellBuffer::DeleteMarkFromHandle(int markerHandle) {
lv.DeleteMarkFromHandle(markerHandle);
}
int CellBuffer::GetMark(int line) {
if ((line >= 0) && (line < Lines()))
return lv.MarkValue(line);
return 0;
}
void CellBuffer::DeleteAllMarks(int markerNum) {
for (int line = 0; line < Lines(); line++) {
lv.DeleteMark(line, markerNum, true);
}
}
int CellBuffer::LineFromHandle(int markerHandle) {
return lv.LineFromHandle(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) {
@ -862,6 +596,11 @@ void CellBuffer::EndUndoAction() {
uh.EndUndoAction();
}
void CellBuffer::AddUndoAction(int token, bool mayCoalesce) {
bool startSequence;
uh.AppendAction(containerAction, token, 0, 0, startSequence, mayCoalesce);
}
void CellBuffer::DeleteUndoHistory() {
uh.DeleteUndoHistory();
}
@ -910,30 +649,3 @@ void CellBuffer::PerformRedoStep() {
uh.CompletedRedoStep();
}
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];
}
int CellBuffer::GetMaxLineState() {
return lineStates.Length();
}
int CellBuffer::SetLevel(int line, int level) {
return lv.SetLevel(line, level);
}
int CellBuffer::GetLevel(int line) {
return lv.GetLevel(line);
}
void CellBuffer::ClearLevels() {
lv.ClearLevels();
}

View File

@ -12,33 +12,12 @@
namespace Scintilla {
#endif
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
*/
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
/**
* A marker handle set contains any number of MarkerHandleNumbers.
*/
class MarkerHandleSet {
MarkerHandleNumber *root;
// Interface to per-line data that wants to see each line insertion and deletion
class PerLine {
public:
MarkerHandleSet();
~MarkerHandleSet();
int Length() const;
int NumberFromHandle(int handle) const;
int MarkValue() const; ///< Bit set of marker numbers.
bool Contains(int handle) const;
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
bool RemoveNumber(int markerNum);
void CombineWith(MarkerHandleSet *other);
virtual ~PerLine() {}
virtual void InsertLine(int)=0;
virtual void RemoveLine(int)=0;
};
/**
@ -47,21 +26,14 @@ public:
class LineVector {
Partitioning starts;
SplitVector<MarkerHandleSet *> markers;
SplitVector<int> levels;
/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
PerLine *perLine;
public:
LineVector();
~LineVector();
void Init();
void ExpandLevels(int sizeNew=-1);
void ClearLevels();
int SetLevel(int line, int level);
int GetLevel(int line);
void SetPerLine(PerLine *pl);
void InsertText(int line, int delta);
void InsertLine(int line, int position);
@ -81,9 +53,18 @@ public:
void DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
void ClearLevels();
int SetLevel(int line, int level);
int GetLevel(int line);
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
};
enum actionType { insertAction, removeAction, startAction };
enum actionType { insertAction, removeAction, startAction, containerAction };
/**
* Actions are used to store all the information required to perform one undo/redo step.
@ -120,7 +101,7 @@ public:
UndoHistory();
~UndoHistory();
void AppendAction(actionType at, int position, char *data, int length, bool &startSequence);
void AppendAction(actionType at, int position, char *data, int length, bool &startSequence, bool mayCoalesce=true);
void BeginUndoAction();
void EndUndoAction();
@ -160,8 +141,6 @@ private:
LineVector lv;
SplitVector<int> lineStates;
public:
CellBuffer();
@ -175,6 +154,7 @@ public:
int Length() const;
void Allocate(int newSize);
void SetPerLine(PerLine *pl);
int Lines() const;
int LineStart(int line) const;
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
@ -197,14 +177,6 @@ public:
void SetSavePoint();
bool IsSavePoint();
/// Line marker functions
int AddMark(int line, int markerNum);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
int GetMark(int line);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
/// Actions without undo
void BasicInsertString(int position, const char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength);
@ -213,6 +185,7 @@ public:
bool IsCollectingUndo();
void BeginUndoAction();
void EndUndoAction();
void AddUndoAction(int token, bool mayCoalesce);
void DeleteUndoHistory();
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
@ -225,14 +198,6 @@ public:
int StartRedo();
const Action &GetRedoStep() const;
void PerformRedoStep();
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
int SetLevel(int line, int level);
int GetLevel(int line);
void ClearLevels();
};
#ifdef SCI_NAMESPACE

View File

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

View File

@ -17,6 +17,7 @@
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "PerLine.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "Document.h"
@ -26,77 +27,6 @@
using namespace Scintilla;
#endif
//Vitaliy
#include "UniConversion.h"
// Win32 only !!!
static bool IsMustDie9x(void)
{
OSVERSIONINFO osver;
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( GetVersionEx( &osver ) )
{
if ( (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
(osver.dwMajorVersion == 4) )
{
//MessageBox(NULL, "MustDie9x == true", "Test", MB_OK);
return true;
}
}
//MessageBox(NULL, "MustDie9x == false", "Test", MB_OK);
return false;
}
static inline void Platform_MakeUpperW(wchar_t* wstr, unsigned int len) {
// TODO: Add platform-specific function here
// Win32 example:
static bool bIsMustDie9x = IsMustDie9x();
if ( !bIsMustDie9x )
{
::CharUpperW(wstr);
}
else
{
char* str = new char[len + 1];
if ( str )
{
::WideCharToMultiByte(CP_ACP, 0, wstr, len, str, len, NULL, NULL);
str[len] = 0;
::CharUpperA(str);
::MultiByteToWideChar(CP_ACP, 0, str, len, wstr, len);
wstr[len] = 0;
delete [] str;
}
}
}
static inline char Platform_MakeUpperChar(char ch) {
// TODO: Add platform-specific function here
// Win32 example:
char str[2] = {ch, 0};
::CharUpperA(str);
ch = str[0];
// default: no conversion
return ch;
}
static inline char Platform_MakeLowerChar(char ch) {
// TODO: Add platform-specific function here
// Win32 example:
char str[2] = {ch, 0};
::CharLowerA(str);
ch = str[0];
// default: no conversion
return ch;
}
// yilatiV
// This is ASCII specific but is safe with chars >= 0x80
static inline bool isspacechar(unsigned char ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
@ -145,6 +75,14 @@ Document::Document() {
matchesValid = false;
regex = 0;
perLineData[ldMarkers] = new LineMarkers();
perLineData[ldLevels] = new LineLevels();
perLineData[ldState] = new LineState();
perLineData[ldMargin] = new LineAnnotation();
perLineData[ldAnnotation] = new LineAnnotation();
cb.SetPerLine(this);
}
Document::~Document() {
@ -152,12 +90,30 @@ Document::~Document() {
watchers[i].watcher->NotifyDeleted(this, watchers[i].userData);
}
delete []watchers;
for (int j=0; j<ldSize; j++) {
delete perLineData[j];
perLineData[j] = 0;
}
watchers = 0;
lenWatchers = 0;
delete regex;
regex = 0;
}
void Document::InsertLine(int line) {
for (int j=0; j<ldSize; j++) {
if (perLineData[j])
perLineData[j]->InsertLine(line);
}
}
void Document::RemoveLine(int line) {
for (int j=0; j<ldSize; j++) {
if (perLineData[j])
perLineData[j]->RemoveLine(line);
}
}
// Increase reference count and return its previous value.
int Document::AddRef() {
return refCount++;
@ -177,42 +133,58 @@ void Document::SetSavePoint() {
NotifySavePoint(true);
}
int Document::GetMark(int line) {
return static_cast<LineMarkers*>(perLineData[ldMarkers])->MarkValue(line);
}
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
if (line <= LinesTotal()) {
int prev = static_cast<LineMarkers*>(perLineData[ldMarkers])->
AddMark(line, markerNum, LinesTotal());
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
return prev;
} else {
return 0;
}
}
void Document::AddMarkSet(int line, int valueSet) {
unsigned int m = valueSet;
for (int i = 0; m; i++, m >>= 1)
if (m & 1)
cb.AddMark(line, i);
static_cast<LineMarkers*>(perLineData[ldMarkers])->
AddMark(line, i, LinesTotal());
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1;
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
for (int line = 0; line < LinesTotal(); line++) {
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true);
}
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1;
NotifyModified(mh);
}
int Document::LineFromHandle(int markerHandle) {
return static_cast<LineMarkers*>(perLineData[ldMarkers])->LineFromHandle(markerHandle);
}
int Document::LineStart(int line) const {
return cb.LineStart(line);
}
@ -252,7 +224,7 @@ int Document::VCHomePosition(int position) {
}
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
int prev = static_cast<LineLevels*>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal());
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
LineStart(line), 0, 0, 0, line);
@ -263,6 +235,14 @@ int Document::SetLevel(int line, int level) {
return prev;
}
int Document::GetLevel(int line) {
return static_cast<LineLevels*>(perLineData[ldLevels])->GetLevel(line);
}
void Document::ClearLevels() {
static_cast<LineLevels*>(perLineData[ldLevels])->ClearLevels();
}
static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true;
@ -574,21 +554,27 @@ int Document::Undo() {
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else if (action.at == containerAction) {
DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO);
dm.token = action.position;
NotifyModified(dm);
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
int cellPosition = action.position;
if (action.at != containerAction) {
ModifiedAt(cellPosition);
newPos = cellPosition;
}
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
} else if (action.at == insertAction) {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
@ -629,19 +615,25 @@ int Document::Redo() {
if (action.at == insertAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else if (action.at == containerAction) {
DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_REDO);
dm.token = action.position;
NotifyModified(dm);
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
cb.PerformRedoStep();
if (action.at != containerAction) {
ModifiedAt(action.position);
newPos = action.position;
}
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
} else if (action.at == removeAction) {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
@ -1069,31 +1061,19 @@ bool Document::IsWordAt(int start, int end) {
// The comparison and case changing functions here assume ASCII
// or extended ASCII such as the normal Windows code page.
//Vitaliy
// NOTE: this function is called for non-Unicode characters only!
// ( i.e. when (!dbcsCodePage || isascii(ch)) )
static inline char MakeUpperCase(char ch) {
if (ch >= 'A' && ch <= 'Z')
if (ch < 'a' || ch > 'z')
return ch;
else if (ch >= 'a' && ch <= 'z')
else
return static_cast<char>(ch - 'a' + 'A');
else
return Platform_MakeUpperChar(ch);
}
// NOTE: this function is called for non-Unicode characters only!
// ( i.e. when (!dbcsCodePage || isascii(ch)) )
static inline char MakeLowerCase(char ch) {
if (ch >= 'a' && ch <= 'z')
if (ch < 'A' || ch > 'Z')
return ch;
else if (ch >= 'A' && ch <= 'Z')
return static_cast<char>(ch - 'A' + 'a');
else
return Platform_MakeLowerChar(ch);
return static_cast<char>(ch - 'A' + 'a');
}
//yilatiV
/**
* Find text in document, supporting both forward and backward
@ -1142,8 +1122,8 @@ long Document::FindText(int minPos, int maxPos, const char *s,
}
if (found) {
if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
(word && IsWordAt(pos, pos + lengthFind)) ||
(wordStart && IsWordStartAt(pos)))
return pos;
}
}
@ -1158,8 +1138,8 @@ long Document::FindText(int minPos, int maxPos, const char *s,
}
if (found) {
if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
(word && IsWordAt(pos, pos + lengthFind)) ||
(wordStart && IsWordStartAt(pos)))
return pos;
}
}
@ -1238,7 +1218,7 @@ bool Document::SetStyleFor(int length, char style) {
}
}
bool Document::SetStyles(int length, char *styles) {
bool Document::SetStyles(int length, const char *styles) {
if (enteredStyling != 0) {
return false;
} else {
@ -1277,7 +1257,7 @@ void Document::EnsureStyledTo(int pos) {
}
int Document::SetLineState(int line, int state) {
int statePrevious = cb.SetLineState(line, state);
int statePrevious = static_cast<LineState*>(perLineData[ldState])->SetLineState(line, state);
if (state != statePrevious) {
DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line);
NotifyModified(mh);
@ -1285,6 +1265,89 @@ int Document::SetLineState(int line, int state) {
return statePrevious;
}
int Document::GetLineState(int line) {
return static_cast<LineState*>(perLineData[ldState])->GetLineState(line);
}
int Document::GetMaxLineState() {
return static_cast<LineState*>(perLineData[ldState])->GetMaxLineState();
}
StyledText Document::MarginStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldMargin]);
return StyledText(pla->Length(line), pla->Text(line),
pla->MultipleStyles(line), pla->Style(line), pla->Styles(line));
}
void Document::MarginSetText(int line, const char *text) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetText(line, text);
DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
}
void Document::MarginSetStyle(int line, int style) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyle(line, style);
}
void Document::MarginSetStyles(int line, const unsigned char *styles) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyles(line, styles);
}
int Document::MarginLength(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldMargin])->Length(line);
}
void Document::MarginClearAll() {
int maxEditorLine = LinesTotal();
for (int l=0;l<maxEditorLine;l++)
MarginSetText(l, 0);
// Free remaining data
static_cast<LineAnnotation*>(perLineData[ldMargin])->ClearAll();
}
bool Document::AnnotationAny() const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->AnySet();
}
StyledText Document::AnnotationStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldAnnotation]);
return StyledText(pla->Length(line), pla->Text(line),
pla->MultipleStyles(line), pla->Style(line), pla->Styles(line));
}
void Document::AnnotationSetText(int line, const char *text) {
const int linesBefore = AnnotationLines(line);
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetText(line, text);
const int linesAfter = AnnotationLines(line);
DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line);
mh.annotationLinesAdded = linesAfter - linesBefore;
NotifyModified(mh);
}
void Document::AnnotationSetStyle(int line, int style) {
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyle(line, style);
}
void Document::AnnotationSetStyles(int line, const unsigned char *styles) {
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyles(line, styles);
}
int Document::AnnotationLength(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Length(line);
}
int Document::AnnotationLines(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Lines(line);
}
void Document::AnnotationClearAll() {
int maxEditorLine = LinesTotal();
for (int l=0;l<maxEditorLine;l++)
AnnotationSetText(l, 0);
// Free remaining data
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->ClearAll();
}
void Document::IncrementStyleClock() {
styleClock = (styleClock + 1) % 0x100000;
}
@ -1740,8 +1803,18 @@ const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text,
#ifndef SCI_OWNREGEX
#ifdef SCI_NAMESPACE
RegexSearchBase *Scintilla::CreateRegexSearch(CharClassify *charClassTable) {
return new BuiltinRegex(charClassTable);
}
#else
RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable) {
return new BuiltinRegex(charClassTable);
}
#endif
#endif

View File

@ -93,9 +93,31 @@ public:
/// Factory function for RegexSearchBase
extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable);
struct StyledText {
size_t length;
const char *text;
bool multipleStyles;
size_t style;
const unsigned char *styles;
StyledText( size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) :
length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) {
}
// Return number of bytes from start to before '\n' or end of text.
// Return 1 when start is outside text
size_t LineLength(size_t start) const {
size_t cur = start;
while ((cur < length) && (text[cur] != '\n'))
cur++;
return cur-start;
}
size_t StyleAt(size_t i) const {
return multipleStyles ? styles[i] : style;
}
};
/**
*/
class Document {
class Document : PerLine {
public:
/** Used to pair watcher pointer with user data. */
@ -110,7 +132,6 @@ public:
};
enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation };
private:
int refCount;
CellBuffer cb;
@ -125,6 +146,10 @@ private:
WatcherWithUserData *watchers;
int lenWatchers;
// ldSize is not real data - it is for dimensions and loops
enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize };
PerLine *perLineData[ldSize];
bool matchesValid;
RegexSearchBase* regex;
@ -150,6 +175,9 @@ public:
int AddRef();
int Release();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int LineFromPosition(int pos);
int ClampPositionIntoDocument(int pos);
bool IsCrLf(int pos);
@ -173,6 +201,7 @@ public:
bool IsCollectingUndo() { return cb.IsCollectingUndo(); }
void BeginUndoAction() { cb.BeginUndoAction(); }
void EndUndoAction() { cb.EndUndoAction(); }
void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
void SetSavePoint();
bool IsSavePoint() { return cb.IsSavePoint(); }
const char *BufferPointer() { return cb.BufferPointer(); }
@ -199,21 +228,21 @@ public:
cb.GetCharRange(buffer, position, lengthRetrieve);
}
char StyleAt(int position) { return cb.StyleAt(position); }
int GetMark(int line) { return cb.GetMark(line); }
int GetMark(int line);
int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); }
int LineFromHandle(int markerHandle);
int LineStart(int line) const;
int LineEnd(int line) const;
int LineEndPosition(int position);
int VCHomePosition(int position);
int SetLevel(int line, int level);
int GetLevel(int line) { return cb.GetLevel(line); }
void ClearLevels() { cb.ClearLevels(); }
int GetLevel(int line);
void ClearLevels();
int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line);
@ -236,7 +265,7 @@ public:
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
bool SetStyleFor(int length, char style);
bool SetStyles(int length, char *styles);
bool SetStyles(int length, const char *styles);
int GetEndStyled() { return endStyled; }
void EnsureStyledTo(int pos);
int GetStyleClock() { return styleClock; }
@ -244,8 +273,24 @@ public:
void DecorationFillRange(int position, int value, int fillLength);
int SetLineState(int line, int state);
int GetLineState(int line) { return cb.GetLineState(line); }
int GetMaxLineState() { return cb.GetMaxLineState(); }
int GetLineState(int line);
int GetMaxLineState();
StyledText MarginStyledText(int line);
void MarginSetStyle(int line, int style);
void MarginSetStyles(int line, const unsigned char *styles);
void MarginSetText(int line, const char *text);
int MarginLength(int line) const;
void MarginClearAll();
bool AnnotationAny() const;
StyledText AnnotationStyledText(int line);
void AnnotationSetText(int line, const char *text);
void AnnotationSetStyle(int line, int style);
void AnnotationSetStyles(int line, const unsigned char *styles);
int AnnotationLength(int line) const;
int AnnotationLines(int line) const;
void AnnotationClearAll();
bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData);
@ -288,6 +333,8 @@ public:
int line;
int foldLevelNow;
int foldLevelPrev;
int annotationLinesAdded;
int token;
DocModification(int modificationType_, int position_=0, int length_=0,
int linesAdded_=0, const char *text_=0, int line_=0) :
@ -298,7 +345,9 @@ public:
text(text_),
line(line_),
foldLevelNow(0),
foldLevelPrev(0) {}
foldLevelPrev(0),
annotationLinesAdded(0),
token(0) {}
DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
modificationType(modificationType_),
@ -308,7 +357,9 @@ public:
text(act.data),
line(0),
foldLevelNow(0),
foldLevelPrev(0) {}
foldLevelPrev(0),
annotationLinesAdded(0),
token(0) {}
};
/**

View File

@ -1279,7 +1279,8 @@ bool Editor::WrapOneLine(Surface *surface, int lineToWrap) {
LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
linesWrapped = ll->lines;
}
return cs.SetHeight(lineToWrap, linesWrapped);
return cs.SetHeight(lineToWrap, linesWrapped +
(vs.annotationVisible ? pdoc->AnnotationLines(lineToWrap) : 0));
}
// Check if wrapping needed and perform any needed wrapping.
@ -1317,7 +1318,8 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
if (wrapWidth != LineLayout::wrapWidthInfinite) {
wrapWidth = LineLayout::wrapWidthInfinite;
for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) {
cs.SetHeight(lineDoc, 1);
cs.SetHeight(lineDoc, 1 +
(vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0));
}
wrapOccurred = true;
}
@ -1459,6 +1461,84 @@ static int istrlen(const char *s) {
return static_cast<int>(strlen(s));
}
bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) {
if (st.multipleStyles) {
for (size_t iStyle=0;iStyle<st.length; iStyle++) {
if (!vs.ValidStyle(styleOffset + st.styles[iStyle]))
return false;
}
} else {
if (!vs.ValidStyle(styleOffset + st.style))
return false;
}
return true;
}
static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset,
const char *text, const unsigned char *styles, size_t len) {
int width = 0;
size_t start = 0;
while (start < len) {
size_t style = styles[start];
size_t endSegment = start;
while ((endSegment+1 < len) && (static_cast<size_t>(styles[endSegment+1]) == style))
endSegment++;
width += surface->WidthText(vs.styles[style+styleOffset].font, text + start, endSegment - start + 1);
start = endSegment + 1;
}
return width;
}
static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, const StyledText &st) {
int widthMax = 0;
size_t start = 0;
while (start < st.length) {
size_t lenLine = st.LineLength(start);
int widthSubLine;
if (st.multipleStyles) {
widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine);
} else {
widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font, st.text + start, lenLine);
}
if (widthSubLine > widthMax)
widthMax = widthSubLine;
start += lenLine + 1;
}
return widthMax;
}
void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle rcText, int ascent,
const StyledText &st, size_t start, size_t length) {
if (st.multipleStyles) {
int x = rcText.left;
size_t i = 0;
while (i < length) {
size_t end = i;
int style = st.styles[i + start];
while (end < length-1 && st.styles[start+end+1] == style)
end++;
style += styleOffset;
int width = surface->WidthText(vs.styles[style].font, st.text + start + i, end - i + 1);
PRectangle rcSegment = rcText;
rcSegment.left = x;
rcSegment.right = x + width + 1;
surface->DrawTextNoClip(rcSegment, vs.styles[style].font,
ascent, st.text + start + i, end - i + 1,
vs.styles[style].fore.allocated,
vs.styles[style].back.allocated);
x += width;
i = end + 1;
}
} else {
int style = st.style + styleOffset;
surface->DrawTextNoClip(rcText, vs.styles[style].font,
rcText.top + vs.maxAscent, st.text, st.length,
vs.styles[style].fore.allocated,
vs.styles[style].back.allocated);
}
}
void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
if (vs.fixedColumnWidth == 0)
return;
@ -1640,6 +1720,20 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
rcNumber.top + vs.maxAscent, number, istrlen(number),
vs.styles[STYLE_LINENUMBER].fore.allocated,
vs.styles[STYLE_LINENUMBER].back.allocated);
} else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) {
if (firstSubLine) {
const StyledText stMargin = pdoc->MarginStyledText(lineDoc);
if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) {
surface->FillRectangle(rcMarker,
vs.styles[stMargin.StyleAt(0)+vs.marginStyleOffset].back.allocated);
if (vs.ms[margin].style == SC_MARGIN_RTEXT) {
int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin);
rcMarker.left = rcMarker.right - width - 3;
}
DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, rcMarker.top + vs.maxAscent,
stMargin, 0, stMargin.length);
}
}
}
if (marks) {
@ -2224,6 +2318,58 @@ void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment,
textBack, textFore);
}
void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
int indent = pdoc->GetLineIndentation(line) * vsDraw.spaceWidth;
PRectangle rcSegment = rcLine;
int annotationLine = subLine - ll->lines;
const StyledText stAnnotation = pdoc->AnnotationStyledText(line);
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
surface->FillRectangle(rcSegment, vsDraw.styles[0].back.allocated);
if (vs.annotationVisible == ANNOTATION_BOXED) {
// Only care about calculating width if need to draw box
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
widthAnnotation += vsDraw.spaceWidth * 2; // Margins
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore.allocated);
} else {
rcSegment.left = xStart;
}
const int annotationLines = pdoc->AnnotationLines(line);
size_t start = 0;
size_t lengthAnnotation = stAnnotation.LineLength(start);
int lineInAnnotation = 0;
while ((lineInAnnotation < annotationLine) && (start < stAnnotation.length)) {
start += lengthAnnotation + 1;
lengthAnnotation = stAnnotation.LineLength(start);
lineInAnnotation++;
}
PRectangle rcText = rcSegment;
if (vs.annotationVisible == ANNOTATION_BOXED) {
surface->FillRectangle(rcText,
vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back.allocated);
rcText.left += vsDraw.spaceWidth;
}
DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, rcText.top + vsDraw.maxAscent,
stAnnotation, start, lengthAnnotation);
if (vs.annotationVisible == ANNOTATION_BOXED) {
surface->MoveTo(rcSegment.left, rcSegment.top);
surface->LineTo(rcSegment.left, rcSegment.bottom);
surface->MoveTo(rcSegment.right, rcSegment.top);
surface->LineTo(rcSegment.right, rcSegment.bottom);
if (subLine == ll->lines){
surface->MoveTo(rcSegment.left, rcSegment.top);
surface->LineTo(rcSegment.right, rcSegment.top);
}
if (subLine == ll->lines+annotationLines-1) {
surface->MoveTo(rcSegment.left, rcSegment.bottom - 1);
surface->LineTo(rcSegment.right, rcSegment.bottom - 1);
}
}
}
}
void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
@ -2283,6 +2429,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
int startseg = ll->LineStart(subLine);
int subLineStart = ll->positions[startseg];
if (subLine >= ll->lines) {
DrawAnnotation(surface, vsDraw, line, xStart, rcLine, ll, subLine);
return; // No further drawing
}
int lineStart = 0;
int lineEnd = 0;
if (subLine < ll->lines) {
@ -2696,8 +2846,15 @@ void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll,
}
// We now know what to draw, update the caret drawing rectangle
rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[ll->LineStart(subLine)] + xStart;
rcCaret.right = ll->positions[offsetFirstChar+numCharsToDraw] - ll->positions[ll->LineStart(subLine)] + xStart;
rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[lineStart] + xStart;
rcCaret.right = ll->positions[offsetFirstChar+numCharsToDraw] - ll->positions[lineStart] + xStart;
// Adjust caret position to take into account any word wrapping symbols.
if ((actualWrapVisualStartIndent != 0) && (lineStart != 0)) {
int wordWrapCharWidth = actualWrapVisualStartIndent * vs.aveCharWidth;
rcCaret.left += wordWrapCharWidth;
rcCaret.right += wordWrapCharWidth;
}
// This character is where the caret block is, we override the colours
// (inversed) for drawing the caret here.
@ -2796,7 +2953,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
//Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast);
int endPosPaint = pdoc->Length();
if (lineStyleLast < cs.LinesDisplayed())
endPosPaint = pdoc->LineStart(cs.DocFromDisplay(lineStyleLast + 1));
endPosPaint = pdoc->LineStart(cs.DocFromDisplay(lineStyleLast) + 1);
int xStart = vs.fixedColumnWidth - xOffset;
int ypos = 0;
@ -2948,7 +3105,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
ll->RestoreBracesHighlight(rangeLine, braces);
bool expanded = cs.GetExpanded(lineDoc);
#ifdef INCLUDE_DEPRECATED_FEATURES
if ((foldFlags & SC_FOLDFLAG_BOX) == 0) {
#endif
// Paint the line above the fold
if ((expanded && (foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED))
||
@ -2969,6 +3128,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated);
}
}
#ifdef INCLUDE_DEPRECATED_FEATURES
} else {
int FoldLevelCurr = (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE;
int FoldLevelPrev = (pdoc->GetLevel(lineDoc - 1) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE;
@ -3004,6 +3164,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
surface->FillRectangle(rcBoxLine, vs.styles[STYLE_DEFAULT].fore.allocated);
}
}
#endif
// Draw the Caret
if (lineDoc == lineCaret) {
@ -3487,6 +3648,8 @@ void Editor::ClearAll() {
}
if (!pdoc->IsReadOnly()) {
cs.Clear();
pdoc->AnnotationClearAll();
pdoc->MarginClearAll();
}
pdoc->EndUndoAction();
anchor = 0;
@ -3813,6 +3976,10 @@ void Editor::CheckModificationForWrap(DocModification mh) {
int lines = Platform::Maximum(0, mh.linesAdded);
NeedWrapping(lineDoc, lineDoc + lines + 1);
}
// Fix up annotation heights
int lineDoc = pdoc->LineFromPosition(mh.position);
int lines = Platform::Maximum(0, mh.linesAdded);
SetAnnotationHeights(lineDoc, lineDoc + lines + 2);
}
}
@ -3900,6 +4067,12 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
cs.DeleteLines(lineOfPos, -mh.linesAdded);
}
}
if (mh.modificationType & SC_MOD_CHANGEANNOTATION) {
int lineDoc = pdoc->LineFromPosition(mh.position);
if (vs.annotationVisible) {
cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded);
}
}
CheckModificationForWrap(mh);
if (mh.linesAdded != 0) {
// Avoid scrolling of display if change before current display
@ -3930,7 +4103,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
SetScrollBars();
}
if (mh.modificationType & SC_MOD_CHANGEMARKER) {
if ((mh.modificationType & SC_MOD_CHANGEMARKER) || (mh.modificationType & SC_MOD_CHANGEMARGIN)) {
if ((paintState == notPainting) || !PaintContainsMargin()) {
if (mh.modificationType & SC_MOD_CHANGEFOLD) {
// Fold changes can affect the drawing of following lines so redraw whole margin
@ -3964,6 +4137,8 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
scn.line = mh.line;
scn.foldLevelNow = mh.foldLevelNow;
scn.foldLevelPrev = mh.foldLevelPrev;
scn.token = mh.token;
scn.annotationLinesAdded = mh.annotationLinesAdded;
NotifyParent(scn);
}
}
@ -4233,8 +4408,16 @@ void Editor::NewLine() {
void Editor::CursorUpOrDown(int direction, selTypes sel) {
Point pt = LocationFromPosition(currentPos);
int lineDoc = pdoc->LineFromPosition(currentPos);
Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc));
int subLine = (pt.y - ptStartLine.y) / vs.lineHeight;
int commentLines = vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0;
int posNew = PositionFromLocation(
Point(lastXChosen, pt.y + direction * vs.lineHeight));
if ((direction > 0) && (subLine >= (cs.GetHeight(lineDoc) - 1 - commentLines))) {
posNew = PositionFromLocation(
Point(lastXChosen, pt.y + (commentLines + 1) * vs.lineHeight));
}
if (direction < 0) {
// Line wrapping may lead to a location on the same line, so
// seek back if that is the case.
@ -4539,6 +4722,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
SetLastXChosen();
}
EnsureCaretVisible();
ShowCaretAtCurrentPosition(); // Avoid blinking
break;
case SCI_BACKTAB:
Indent(false);
@ -4546,6 +4730,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
SetLastXChosen();
}
EnsureCaretVisible();
ShowCaretAtCurrentPosition(); // Avoid blinking
break;
case SCI_NEWLINE:
NewLine();
@ -5668,6 +5853,14 @@ void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) {
}
}
void Editor::SetAnnotationHeights(int start, int end) {
if (vs.annotationVisible) {
for (int line=start; line<end; line++) {
cs.SetHeight(line, pdoc->AnnotationLines(line) + 1);
}
}
}
void Editor::SetDocPointer(Document *document) {
//Platform::DebugPrintf("** %x setdoc to %x\n", pdoc, document);
pdoc->RemoveWatcher(this, 0);
@ -5692,6 +5885,7 @@ void Editor::SetDocPointer(Document *document) {
// Reset the contraction state to fully shown.
cs.Clear();
cs.InsertLines(0, pdoc->LinesTotal() - 1);
SetAnnotationHeights(0, pdoc->LinesTotal());
llc.Deallocate();
NeedWrapping();
@ -5700,6 +5894,22 @@ void Editor::SetDocPointer(Document *document) {
Redraw();
}
void Editor::SetAnnotationVisible(int visible) {
if (vs.annotationVisible != visible) {
bool changedFromOrToHidden = ((vs.annotationVisible != 0) != (visible != 0));
vs.annotationVisible = visible;
if (changedFromOrToHidden) {
int dir = vs.annotationVisible ? 1 : -1;
for (int line=0; line<pdoc->LinesTotal(); line++) {
int annotationLines = pdoc->AnnotationLines(line);
if (annotationLines > 0) {
cs.SetHeight(line, cs.GetHeight(line) + annotationLines * dir);
}
}
}
}
}
/**
* Recursively expand a fold, making lines visible except where they have an unexpanded parent.
*/
@ -6820,6 +7030,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSYMBOLDEFINED:
if (wParam <= MARKER_MAX)
return vs.markers[wParam].markType;
else
return 0;
case SCI_MARKERSETFORE:
if (wParam <= MARKER_MAX)
vs.markers[wParam].fore.desired = ColourDesired(lParam);
@ -7237,15 +7454,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_INDICGETUNDER:
return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0;
case SCI_INDICSETALPHA:
if (wParam <= INDIC_MAX && lParam <= SC_ALPHA_OPAQUE && lParam > 0) {
vs.indicators[wParam].alpha = lParam;
if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 100) {
vs.indicators[wParam].fillAlpha = lParam;
InvalidateStyleRedraw();
}
break;
case SCI_INDICGETALPHA:
return (wParam <= INDIC_MAX) ? vs.indicators[wParam].alpha : 0;
return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0;
case SCI_SETINDICATORCURRENT:
pdoc->decorations.SetCurrentIndicator(wParam);
@ -7618,6 +7836,138 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETCHARACTERPOINTER:
return reinterpret_cast<sptr_t>(pdoc->BufferPointer());
case SCI_SETEXTRAASCENT:
vs.extraAscent = wParam;
InvalidateStyleRedraw();
break;
case SCI_GETEXTRAASCENT:
return vs.extraAscent;
case SCI_SETEXTRADESCENT:
vs.extraDescent = wParam;
InvalidateStyleRedraw();
break;
case SCI_GETEXTRADESCENT:
return vs.extraDescent;
case SCI_MARGINSETSTYLEOFFSET:
vs.marginStyleOffset = wParam;
InvalidateStyleRedraw();
break;
case SCI_MARGINGETSTYLEOFFSET:
return vs.marginStyleOffset;
case SCI_MARGINSETTEXT:
pdoc->MarginSetText(wParam, CharPtrFromSPtr(lParam));
break;
case SCI_MARGINGETTEXT: {
const StyledText st = pdoc->MarginStyledText(wParam);
if (lParam) {
if (st.text)
memcpy(CharPtrFromSPtr(lParam), st.text, st.length);
else
strcpy(CharPtrFromSPtr(lParam), "");
}
return st.length;
}
case SCI_MARGINSETSTYLE:
pdoc->MarginSetStyle(wParam, lParam);
break;
case SCI_MARGINGETSTYLE: {
const StyledText st = pdoc->MarginStyledText(wParam);
return st.style;
}
case SCI_MARGINSETSTYLES:
pdoc->MarginSetStyles(wParam, reinterpret_cast<const unsigned char *>(lParam));
break;
case SCI_MARGINGETSTYLES: {
const StyledText st = pdoc->MarginStyledText(wParam);
if (lParam) {
if (st.styles)
memcpy(CharPtrFromSPtr(lParam), st.styles, st.length);
else
strcpy(CharPtrFromSPtr(lParam), "");
}
return st.styles ? st.length : 0;
}
case SCI_MARGINTEXTCLEARALL:
pdoc->MarginClearAll();
break;
case SCI_ANNOTATIONSETTEXT:
pdoc->AnnotationSetText(wParam, CharPtrFromSPtr(lParam));
break;
case SCI_ANNOTATIONGETTEXT: {
const StyledText st = pdoc->AnnotationStyledText(wParam);
if (lParam) {
if (st.text)
memcpy(CharPtrFromSPtr(lParam), st.text, st.length);
else
strcpy(CharPtrFromSPtr(lParam), "");
}
return st.length;
}
case SCI_ANNOTATIONGETSTYLE: {
const StyledText st = pdoc->AnnotationStyledText(wParam);
return st.style;
}
case SCI_ANNOTATIONSETSTYLE:
pdoc->AnnotationSetStyle(wParam, lParam);
break;
case SCI_ANNOTATIONSETSTYLES:
pdoc->AnnotationSetStyles(wParam, reinterpret_cast<const unsigned char *>(lParam));
break;
case SCI_ANNOTATIONGETSTYLES: {
const StyledText st = pdoc->AnnotationStyledText(wParam);
if (lParam) {
if (st.styles)
memcpy(CharPtrFromSPtr(lParam), st.styles, st.length);
else
strcpy(CharPtrFromSPtr(lParam), "");
}
return st.styles ? st.length : 0;
}
case SCI_ANNOTATIONGETLINES:
return pdoc->AnnotationLines(wParam);
case SCI_ANNOTATIONCLEARALL:
pdoc->AnnotationClearAll();
break;
case SCI_ANNOTATIONSETVISIBLE:
SetAnnotationVisible(wParam);
break;
case SCI_ANNOTATIONGETVISIBLE:
return vs.annotationVisible;
case SCI_ANNOTATIONSETSTYLEOFFSET:
vs.annotationStyleOffset = wParam;
InvalidateStyleRedraw();
break;
case SCI_ANNOTATIONGETSTYLEOFFSET:
return vs.annotationStyleOffset;
case SCI_ADDUNDOACTION:
pdoc->AddUndoAction(wParam, lParam & UNDO_MAY_COALESCE);
break;
default:
return DefWndProc(iMessage, wParam, lParam);
}

View File

@ -322,6 +322,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
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 DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
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);
@ -444,8 +446,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
void CheckForChangeOutsidePaint(Range r);
void SetBraceHighlight(Position pos0, Position pos1, int matchStyle);
void SetAnnotationHeights(int start, int end);
void SetDocPointer(Document *document);
void SetAnnotationVisible(int visible);
void Expand(int &line, bool doExpand);
void ToggleContraction(int line);
void EnsureLineVisible(int lineDoc, bool enforcePolicy);

View File

@ -72,7 +72,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.top = rcLine.top + 1;
rcBox.left = rc.left;
rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, 1, fore.allocated, alpha, fore.allocated, ((alpha>SC_ALPHA_OPAQUE-20)?SC_ALPHA_OPAQUE:(alpha+20)), 0);
surface->AlphaRectangle(rcBox, 1, fore.allocated, fillAlpha, fore.allocated, (fillAlpha > SC_ALPHA_OPAQUE-30)?SC_ALPHA_OPAQUE:(fillAlpha+30), 0);
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);

View File

@ -17,10 +17,10 @@ namespace Scintilla {
class Indicator {
public:
int style;
int alpha;
bool under;
ColourPair fore;
Indicator() : style(INDIC_PLAIN), alpha(30), under(false), fore(ColourDesired(0,0,0)) {
int fillAlpha;
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
};

View File

@ -159,6 +159,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmClw);
LINK_LEXER(lmClwNoCase);
LINK_LEXER(lmCmake);
LINK_LEXER(lmCOBOL);
LINK_LEXER(lmConf);
LINK_LEXER(lmCPP);
LINK_LEXER(lmCPPNoCase);
@ -194,6 +195,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmMMIXAL);
LINK_LEXER(lmMSSQL);
LINK_LEXER(lmMySQL);
LINK_LEXER(lmNimrod);
LINK_LEXER(lmNncrontab);
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
@ -208,6 +210,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmPLM);
LINK_LEXER(lmPo);
LINK_LEXER(lmPOV);
LINK_LEXER(lmPowerPro);
LINK_LEXER(lmPowerShell);
LINK_LEXER(lmProgress);
LINK_LEXER(lmProps);
@ -220,10 +223,14 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSearchResult);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSML);
LINK_LEXER(lmSorc);
LINK_LEXER(lmSpecman);
LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL);
LINK_LEXER(lmTACL);
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTAL);
LINK_LEXER(lmTCL);
LINK_LEXER(lmTeX);
LINK_LEXER(lmUserDefine);

View File

@ -253,11 +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 (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

View File

@ -334,6 +334,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
}
char s[HERE_DELIM_MAX];
sc.GetCurrent(s, sizeof(s));
if (sc.LengthCurrent() == 0)
break;
if (s[strlen(s) - 1] == '\r')
s[strlen(s) - 1] = '\0';
if (strcmp(HereDoc.Delimiter, s) == 0) {
if ((prefixws > 0 && HereDoc.Indent) || // indentation rule
(prefixws == 0 && !HereDoc.Indent)) {

368
scintilla/src/LexCOBOL.cxx Normal file
View File

@ -0,0 +1,368 @@
// Scintilla source code edit control
/** @file LexCOBOL.cxx
** Lexer for COBOL
** Based on LexPascal.cxx
** Written by Laurent le Tynevez
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments)
** Updated by Rod Falck, Aug 2006 Converted to COBOL
**/
#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
#define IN_DIVISION 0x01
#define IN_DECLARATIVES 0x02
#define IN_SECTION 0x04
#define IN_PARAGRAPH 0x08
#define IN_FLAGS 0xF
#define NOT_HEADER 0x10
inline bool isCOBOLoperator(char ch)
{
return isoperator(ch);
}
inline bool isCOBOLwordchar(char ch)
{
return isascii(ch) && (isalnum(ch) || ch == '-');
}
inline bool isCOBOLwordstart(char ch)
{
return isascii(ch) && isalnum(ch);
}
static int CountBits(int nBits)
{
int count = 0;
for (int i = 0; i < 32; ++i)
{
count += nBits & 1;
nBits >>= 1;
}
return count;
}
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 ColourTo(Accessor &styler, unsigned int end, unsigned int attr) {
styler.ColourTo(end, attr);
}
static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
int ret = 0;
WordList& a_keywords = *keywordlists[0];
WordList& b_keywords = *keywordlists[1];
WordList& c_keywords = *keywordlists[2];
char s[100];
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.')) {
chAttr = SCE_C_NUMBER;
char *p = s + 1;
while (*p) {
if (!isdigit(*p) && isCOBOLwordchar(*p)) {
chAttr = SCE_C_IDENTIFIER;
break;
}
++p;
}
}
else {
if (a_keywords.InList(s)) {
chAttr = SCE_C_WORD;
}
else if (b_keywords.InList(s)) {
chAttr = SCE_C_WORD2;
}
else if (c_keywords.InList(s)) {
chAttr = SCE_C_UUID;
}
}
if (*bAarea) {
if (strcmp(s, "division") == 0) {
ret = IN_DIVISION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "declaratives") == 0) {
ret = IN_DIVISION | IN_DECLARATIVES;
if (nContainment & IN_DECLARATIVES)
ret |= NOT_HEADER | IN_SECTION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "section") == 0) {
ret = (nContainment &~ IN_PARAGRAPH) | IN_SECTION;
// we've determined the containment, anything else is just ignored for those purposes
*bAarea = false;
} else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) {
ret = IN_DIVISION | IN_DECLARATIVES | IN_SECTION | NOT_HEADER;
} else {
ret = nContainment | IN_PARAGRAPH;
}
}
ColourTo(styler, end, chAttr);
return ret;
}
static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
int state = initStyle;
if (state == SCE_C_CHARACTER) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int nContainment;
int currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
nContainment = styler.GetLineState(currentLine);
nContainment &= ~NOT_HEADER;
} else {
styler.SetLineState(currentLine, 0);
nContainment = 0;
}
styler.StartSegment(startPos);
bool bNewLine = true;
bool bAarea = !isspacechar(chNext);
int column = 0;
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
++column;
if (bNewLine) {
column = 0;
}
if (column <= 1 && !bAarea) {
bAarea = !isspacechar(ch);
}
bool bSetNewLine = false;
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
// Avoid triggering two times on Dos/Win
// End of line
if (state == SCE_C_CHARACTER) {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
styler.SetLineState(currentLine, nContainment);
currentLine++;
bSetNewLine = true;
if (nContainment & NOT_HEADER)
nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION);
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (isCOBOLwordstart(ch) || (ch == '$' && isalpha(chNext))) {
ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER;
} else if (column == 0 && ch == '*' && chNext != '*') {
ColourTo(styler, i-1, state);
state = SCE_C_COMMENTLINE;
} else if (column == 0 && ch == '/' && chNext != '*') {
ColourTo(styler, i-1, state);
state = SCE_C_COMMENTLINE;
} else if (column == 0 && ch == '*' && chNext == '*') {
ColourTo(styler, i-1, state);
state = SCE_C_COMMENTDOC;
} else if (column == 0 && ch == '/' && chNext == '*') {
ColourTo(styler, i-1, state);
state = SCE_C_COMMENTDOC;
} else if (ch == '"') {
ColourTo(styler, i-1, state);
state = SCE_C_STRING;
} else if (ch == '\'') {
ColourTo(styler, i-1, state);
state = SCE_C_CHARACTER;
} else if (ch == '?' && column == 0) {
ColourTo(styler, i-1, state);
state = SCE_C_PREPROCESSOR;
} else if (isCOBOLoperator(ch)) {
ColourTo(styler, i-1, state);
ColourTo(styler, i, SCE_C_OPERATOR);
}
} else if (state == SCE_C_IDENTIFIER) {
if (!isCOBOLwordchar(ch)) {
int lStateChange = classifyWordCOBOL(styler.GetStartSegment(), i - 1, keywordlists, styler, nContainment, &bAarea);
if(lStateChange != 0) {
styler.SetLineState(currentLine, lStateChange);
nContainment = lStateChange;
}
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '"') {
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isCOBOLoperator(ch)) {
ColourTo(styler, i, SCE_C_OPERATOR);
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
ColourTo(styler, i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENT) {
if (ch == '\r' || ch == '\n') {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == '\r' || ch == '\n') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
ColourTo(styler, i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if (ch == '"') {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_CHARACTER) {
if (ch == '\'') {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
}
}
chPrev = ch;
bNewLine = bSetNewLine;
if (bNewLine)
{
bAarea = false;
}
}
ColourTo(styler, lengthDoc - 1, state);
}
static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF;
char chNext = styler[startPos];
bool bNewLine = true;
bool bAarea = !isspacechar(chNext);
int column = 0;
bool bComment = false;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
++column;
if (bNewLine) {
column = 0;
bComment = (ch == '*' || ch == '/' || ch == '?');
}
if (column <= 1 && !bAarea) {
bAarea = !isspacechar(ch);
}
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (atEOL) {
int nContainment = styler.GetLineState(lineCurrent);
int lev = CountBits(nContainment & IN_FLAGS) | SC_FOLDLEVELBASE;
if (bAarea && !bComment)
--lev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((bAarea) && (visibleChars > 0) && !(nContainment & NOT_HEADER) && !bComment)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) {
// this level is at the same level or less than the previous line
// therefore these is nothing for the previous header to collapse, so remove the header
styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG);
}
levelPrev = lev;
visibleChars = 0;
bAarea = false;
bNewLine = true;
lineCurrent++;
} else {
bNewLine = false;
}
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);
}
static const char * const COBOLWordListDesc[] = {
"A Keywords",
"B Keywords",
"Extended Keywords",
0
};
LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc);

View File

@ -58,6 +58,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
// property styling.within.preprocessor
// For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
// or only from the initial # to the end of the command word(1).
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
@ -67,6 +70,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
// property lexer.cpp.allow.dollars
// Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
setWordStart.Add('$');
setWord.Add('$');
@ -77,6 +83,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool continuationLine = false;
bool isIncludePreprocessor = false;
if (initStyle == SCE_C_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\'
@ -118,6 +125,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
// if different sets of lines lexed.
visibleChars = 0;
lastWordWasUUID = false;
isIncludePreprocessor = false;
}
// Handle line continuation generically.
@ -230,6 +238,11 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
case SCE_C_STRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL);
} else if (isIncludePreprocessor) {
if (sc.ch == '>') {
sc.ForwardSetState(SCE_C_DEFAULT);
isIncludePreprocessor = false;
}
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
@ -321,6 +334,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') {
sc.SetState(SCE_C_STRING);
isIncludePreprocessor = false; // ensure that '>' won't end the string
} else if (isIncludePreprocessor && sc.ch == '<') {
sc.SetState(SCE_C_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_C_CHARACTER);
} else if (sc.ch == '#' && visibleChars == 0) {
@ -332,6 +348,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT);
} else if (sc.Match("include")) {
isIncludePreprocessor = true;
}
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_C_OPERATOR);
@ -359,10 +377,24 @@ static bool IsStreamCommentStyle(int style) {
// and to make it possible to fiddle the current level for "} else {".
static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
// property fold.comment
// This option enables folding multi-line comments and explicit fold points when using the C++ lexer.
// Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //}
// at the end of a section that should fold.
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// property fold.preprocessor
// This option enables folding preprocessor directives when using the C++ lexer.
// Includes C#'s explicit #region and #endregion folding directives.
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// property fold.at.else
// This option enables C++ folding on a "} else {" line of an if statement.
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);

View File

@ -268,6 +268,9 @@ static bool IsStreamCommentStyle(int style) {
static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// property lexer.d.fold.at.else
// This option enables D folding on a "} else {" line of an if statement.
bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else",
styler.GetPropertyInt("fold.at.else", 0)) != 0;
unsigned int endPos = startPos + length;

View File

@ -83,7 +83,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// Handle the fix format generically
int toLineStart = sc.currentPos - posLineStart;
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') {
if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") ||
@ -252,7 +252,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
lev = 0;
else
lev = 1;
} else if (strcmp(s, "end") == 0 && chNextNonBlank != '='
} else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=')
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0

View File

@ -58,6 +58,8 @@ def CopyWithInsertion(input, commentPrefix, retainDefs, eolType, *lists):
if retainDefs:
output.append(line)
definition = line[len(commentPrefix + "**"):]
if (commentPrefix == "<!--") and (" -->" in definition):
definition = definition.replace(" -->", "")
listid = 0
if definition[0] in string.digits:
listid = int(definition[:1])
@ -107,18 +109,19 @@ def UpdateFile(filename, updated):
infile = open(filename, "rb")
except IOError: # File is not there yet
out = open(filename, "wb")
out.write(updated)
out.write(updated.encode('utf-8'))
out.close()
print "New", filename
print("New %s" % filename)
return
original = infile.read()
infile.close()
original = original.decode('utf-8')
if updated != original:
os.unlink(filename)
out = open(filename, "wb")
out.write(updated)
out.write(updated.encode('utf-8'))
out.close()
print "Changed", filename
print("Changed %s " % filename)
#~ else:
#~ print "Unchanged", filename
@ -132,12 +135,13 @@ def Generate(inpath, outpath, commentPrefix, eolType, *lists):
#print "generate '%s' -> '%s' (comment prefix: %r, eols: %r)"\
# % (inpath, outpath, commentPrefix, eolType)
try:
infile = open(inpath, "r")
infile = open(inpath, "rb")
except IOError:
print "Can not open", inpath
print("Can not open %s" % inpath)
return
original = infile.read()
infile.close()
original = original.decode('utf-8')
updated = CopyWithInsertion(original, commentPrefix,
inpath == outpath, eolType, *lists)
UpdateFile(outpath, updated)
@ -174,7 +178,7 @@ knownIrregularProperties = [
]
def FindProperties(lexFile):
properties = set()
properties = {}
f = open(lexFile)
for l in f.readlines():
if "GetProperty" in l:
@ -186,36 +190,80 @@ def FindProperties(lexFile):
if propertyName in knownIrregularProperties or \
propertyName.startswith("fold.") or \
propertyName.startswith("lexer."):
properties.add(propertyName)
properties[propertyName] = 1
return properties
def FindPropertyDocumentation(lexFile):
documents = {}
f = open(lexFile)
name = ""
for l in f.readlines():
l = l.strip()
if "// property " in l:
propertyName = l.split()[2]
if propertyName.lower() == propertyName:
# Only allow lower case property names
name = propertyName
documents[name] = ""
elif name:
if l.startswith("//"):
if documents[name]:
documents[name] += " "
documents[name] += l[2:].strip()
else:
name = ""
return documents
def ciCompare(a,b):
return cmp(a.lower(), b.lower())
def ciKey(a):
return a.lower()
def sortListInsensitive(l):
try: # Try key function
l.sort(key=ciKey)
except TypeError: # Earlier version of Python, so use comparison function
l.sort(ciCompare)
def RegenerateAll():
root="../../"
# Find all the lexer source code files
lexFilePaths = glob.glob(root + "scintilla/src/Lex*.cxx")
lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths]
print lexFiles
print(lexFiles)
lexerModules = []
lexerProperties = set()
lexerProperties = {}
propertyDocuments = {}
for lexFile in lexFilePaths:
lexerModules.extend(FindModules(lexFile))
lexerProperties.update(FindProperties(lexFile))
lexerModules.sort(ciCompare)
lexerProperties.remove("fold.comment.python")
lexerProperties = list(lexerProperties)
lexerProperties.sort(ciCompare)
for k in FindProperties(lexFile).keys():
lexerProperties[k] = 1
documents = FindPropertyDocumentation(lexFile)
for k in documents.keys():
propertyDocuments[k] = documents[k]
sortListInsensitive(lexerModules)
del lexerProperties["fold.comment.python"]
lexerProperties = list(lexerProperties.keys())
sortListInsensitive(lexerProperties)
# Generate HTML to document each property
# This is done because tags can not be safely put inside comments in HTML
documentProperties = list(propertyDocuments.keys())
sortListInsensitive(documentProperties)
propertiesHTML = []
for k in documentProperties:
propertiesHTML.append("\t<tr>\n\t<td>%s</td>\n\t<td>%s</td>\n\t</tr>" %
(k, propertyDocuments[k]))
# 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
sortListInsensitive(propFiles)
print(propFiles)
Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules)
Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles)
@ -231,6 +279,7 @@ def RegenerateAll():
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)
Regenerate(root + "scite/doc/SciTEDoc.html", "<!--", NATIVE, propertiesHTML)
Generate(root + "scite/boundscheck/vcproj.gen",
root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles)

View File

@ -276,16 +276,29 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
s[i] = '\0';
// No keywords -> all are known
// Name of a closing tag starts at s + 1
char chAttr = SCE_H_TAGUNKNOWN;
if (s[0] == '!') {
chAttr = SCE_H_SGML_DEFAULT;
} else if (!keywords || keywords.InList(s[0] == '/' ? s + 1 : s)) {
} else if (!keywords || keywords.InList(s)) {
chAttr = SCE_H_TAG;
}
styler.ColourTo(end, chAttr);
if (chAttr == SCE_H_TAG) {
if (allowScripts && 0 == strcmp(s, "script")) {
// check to see if this is a self-closing tag by sniffing ahead
bool isSelfClose = false;
for (unsigned int cPos = end; cPos <= end + 100; cPos++) {
char ch = styler.SafeGetCharAt(cPos, '\0');
if (ch == '\0' || ch == '>')
break;
else if (ch == '/' && styler.SafeGetCharAt(cPos + 1, '\0') == '>') {
isSelfClose = true;
break;
}
}
// do not enter a script state if the tag self-closed
if (!isSelfClose)
chAttr = SCE_H_SCRIPT;
} else if (!isXml && 0 == strcmp(s, "comment")) {
chAttr = SCE_H_COMMENT;
@ -573,6 +586,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else {
// Default client and ASP scripting language is JavaScript
lineState = eScriptJS << 8;
// property asp.default.language
// Script in ASP code is initially assumed to be in JavaScript.
// To change this to VBScript set asp.default.language to 2. Python is 3.
// Don
//lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4;
lineState |= styler.GetPropertyInt("asp.default.language", eScriptVBS) << 4;
@ -592,13 +609,37 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
scriptLanguage = eScriptComment;
}
// property fold.html
// Folding is turned on or off for HTML and XML files with this option.
// The fold option must also be on for folding to occur.
const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0;
const bool fold = foldHTML && styler.GetPropertyInt("fold", 0);
// property fold.html.preprocessor
// Folding is turned on or off for scripts embedded in HTML files with this option.
// The default is on.
const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1);
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// property fold.hypertext.comment
// Allow folding for comments in scripts embedded in HTML.
// The default is off.
const bool foldComment = fold && styler.GetPropertyInt("fold.hypertext.comment", 0) != 0;
// property fold.hypertext.heredoc
// Allow folding for heredocs in scripts embedded in HTML.
// The default is off.
const bool foldHeredoc = fold && styler.GetPropertyInt("fold.hypertext.heredoc", 0) != 0;
// property html.tags.case.sensitive
// For XML and HTML, setting this property to 1 will make tags match in a case
// sensitive way which is the expected behaviour for XML and XHTML.
const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0;
// property lexer.xml.allow.scripts
// Set to 0 to disable scripts in XML.
const bool allowScripts = styler.GetPropertyInt("lexer.xml.allow.scripts", 1) != 0;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true);
@ -870,7 +911,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_H_SGML_COMMAND; // wait for a pending command
}
// fold whole tag (-- when closing the tag)
if (foldHTMLPreprocessor)
if (foldHTMLPreprocessor || (state == SCE_H_COMMENT))
levelCurrent++;
continue;
}

View File

@ -33,6 +33,8 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
char *buffer = new char[length];
int bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0;
bool isCode = false;
bool isCStyleComment = false;
WordList &sectionKeywords = *keywordLists[0];
WordList &standardKeywords = *keywordLists[1];
@ -63,7 +65,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
switch(state) {
case SCE_INNO_DEFAULT:
if (ch == ';' && isBOLWS) {
if (!isCode && ch == ';' && isBOLWS) {
// Start of a comment
state = SCE_INNO_COMMENT;
} else if (ch == '[' && isBOLWS) {
@ -73,13 +75,17 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
} else if (ch == '#' && isBOLWS) {
// Start of a preprocessor directive
state = SCE_INNO_PREPROC;
} else if (ch == '{' && chNext == '#') {
// Start of a preprocessor inline directive
state = SCE_INNO_PREPROC_INLINE;
} else if ((ch == '{' && (chNext == ' ' || chNext == '\t'))
|| (ch == '(' && chNext == '*')) {
} else if (!isCode && ch == '{' && chNext != '{' && chPrev != '{') {
// Start of an inline expansion
state = SCE_INNO_INLINE_EXPANSION;
} else if (isCode && (ch == '{' || (ch == '(' && chNext == '*'))) {
// Start of a Pascal comment
state = SCE_INNO_COMMENT_PASCAL;
isCStyleComment = false;
} else if (isCode && ch == '/' && chNext == '/') {
// Apparently, C-style comments are legal, too
state = SCE_INNO_COMMENT_PASCAL;
isCStyleComment = true;
} else if (ch == '"') {
// Start of a double-quote string
state = SCE_INNO_STRING_DOUBLE;
@ -112,13 +118,13 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
buffer[bufferCount] = '\0';
// Check if the buffer contains a keyword
if (standardKeywords.InList(buffer)) {
if (!isCode && standardKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD);
} else if (parameterKeywords.InList(buffer)) {
} else if (!isCode && parameterKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_PARAMETER);
} else if (pascalKeywords.InList(buffer)) {
} else if (isCode && pascalKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL);
} else if (userKeywords.InList(buffer)) {
} else if (!isCode && userKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);
} else {
styler.ColourTo(i-1,SCE_INNO_DEFAULT);
@ -138,6 +144,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
// Check if the buffer contains a section name
if (sectionKeywords.InList(buffer)) {
styler.ColourTo(i,SCE_INNO_SECTION);
isCode = !CompareCaseInsensitive(buffer, "code");
} else {
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
@ -187,10 +194,10 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
}
break;
case SCE_INNO_PREPROC_INLINE:
case SCE_INNO_INLINE_EXPANSION:
if (ch == '}') {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_PREPROC_INLINE);
styler.ColourTo(i,SCE_INNO_INLINE_EXPANSION);
} else if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
@ -198,6 +205,12 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
break;
case SCE_INNO_COMMENT_PASCAL:
if (isCStyleComment) {
if (isEOL) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
}
} else {
if (ch == '}' || (ch == ')' && chPrev == '*')) {
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
@ -205,6 +218,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
}
break;
}

430
scintilla/src/LexNimrod.cxx Normal file
View File

@ -0,0 +1,430 @@
// Scintilla source code edit control
// Nimrod lexer
// (c) 2009 Andreas Rumpf
/** @file LexNimrod.cxx
** Lexer for Nimrod.
**/
// Copyright 1998-2002 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
static inline bool IsAWordChar(int ch) {
return (ch >= 0x80) || isalnum(ch) || ch == '_';
}
static int tillEndOfTripleQuote(Accessor &styler, int pos, int max) {
/* search for """ */
for (;;) {
if (styler.SafeGetCharAt(pos, '\0') == '\0') return pos;
if (pos >= max) return pos;
if (styler.Match(pos, "\"\"\"")) {
return pos + 2;
}
pos++;
}
}
#define CR 13 /* use both because Scite allows changing the line ending */
#define LF 10
static bool inline isNewLine(int ch) {
return ch == CR || ch == LF;
}
static int scanString(Accessor &styler, int pos, int max, bool rawMode) {
for (;;) {
if (pos >= max) return pos;
char ch = styler.SafeGetCharAt(pos, '\0');
if (ch == CR || ch == LF || ch == '\0') return pos;
if (ch == '"') return pos;
if (ch == '\\' && !rawMode) {
pos += 2;
} else {
pos++;
}
}
}
static int scanChar(Accessor &styler, int pos, int max) {
for (;;) {
if (pos >= max) return pos;
char ch = styler.SafeGetCharAt(pos, '\0');
if (ch == CR || ch == LF || ch == '\0') return pos;
if (ch == '\'' && !isalnum(styler.SafeGetCharAt(pos+1, '\0')) )
return pos;
if (ch == '\\') {
pos += 2;
} else {
pos++;
}
}
}
static int scanIdent(Accessor &styler, int pos, WordList &keywords) {
char buf[100]; /* copy to lowercase and ignore underscores */
int i = 0;
for (;;) {
char ch = styler.SafeGetCharAt(pos, '\0');
if (!IsAWordChar(ch)) break;
if (ch != '_' && i < ((int)sizeof(buf))-1) {
buf[i] = static_cast<char>(tolower(ch));
i++;
}
pos++;
}
buf[i] = '\0';
/* look for keyword */
if (keywords.InList(buf)) {
styler.ColourTo(pos-1, SCE_P_WORD);
} else {
styler.ColourTo(pos-1, SCE_P_IDENTIFIER);
}
return pos;
}
static int scanNumber(Accessor &styler, int pos) {
char ch, ch2;
ch = styler.SafeGetCharAt(pos, '\0');
ch2 = styler.SafeGetCharAt(pos+1, '\0');
if (ch == '0' && (ch2 == 'b' || ch2 == 'B')) {
/* binary number: */
pos += 2;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '1')) ++pos;
else break;
}
} else if (ch == '0' &&
(ch2 == 'o' || ch2 == 'O' || ch2 == 'c' || ch2 == 'C')) {
/* octal number: */
pos += 2;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '7')) ++pos;
else break;
}
} else if (ch == '0' && (ch2 == 'x' || ch2 == 'X')) {
/* hexadecimal number: */
pos += 2;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')
|| (ch >= 'a' && ch <= 'f')
|| (ch >= 'A' && ch <= 'F')) ++pos;
else break;
}
} else {
// skip decimal part:
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos;
else break;
}
ch2 = styler.SafeGetCharAt(pos+1, '\0');
if (ch == '.' && ch2 >= '0' && ch2 <= '9') {
++pos; // skip '.'
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos;
else break;
}
}
if (ch == 'e' || ch == 'E') {
++pos;
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '-' || ch == '+') ++pos;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos;
else break;
}
}
}
if (ch == '\'') {
/* a type suffix: */
pos++;
for (;;) {
ch = styler.SafeGetCharAt(pos);
if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z')
|| (ch >= 'a' && ch <= 'z') || ch == '_') ++pos;
else break;
}
}
styler.ColourTo(pos-1, SCE_P_NUMBER);
return pos;
}
/* rewritten from scratch, because I couldn't get rid of the bugs...
(A character based approach sucks!)
*/
static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int pos = startPos;
int max = startPos + length;
char ch;
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
switch (initStyle) {
/* check where we are: */
case SCE_P_TRIPLEDOUBLE:
pos = tillEndOfTripleQuote(styler, pos, max);
styler.ColourTo(pos, SCE_P_TRIPLEDOUBLE);
pos++;
break;
default: /* nothing to do: */
break;
}
while (pos < max) {
ch = styler.SafeGetCharAt(pos, '\0');
switch (ch) {
case '\0': return;
case '#': {
bool doccomment = (styler.SafeGetCharAt(pos+1) == '#');
while (pos < max && !isNewLine(styler.SafeGetCharAt(pos, LF))) pos++;
if (doccomment)
styler.ColourTo(pos, SCE_C_COMMENTLINEDOC);
else
styler.ColourTo(pos, SCE_P_COMMENTLINE);
} break;
case 'r': case 'R': {
if (styler.SafeGetCharAt(pos+1) == '"') {
pos = scanString(styler, pos+2, max, true);
styler.ColourTo(pos, SCE_P_STRING);
pos++;
} else {
pos = scanIdent(styler, pos, keywords);
}
} break;
case '"':
if (styler.Match(pos+1, "\"\"")) {
pos = tillEndOfTripleQuote(styler, pos+3, max);
styler.ColourTo(pos, SCE_P_TRIPLEDOUBLE);
} else {
pos = scanString(styler, pos+1, max, false);
styler.ColourTo(pos, SCE_P_STRING);
}
pos++;
break;
case '\'':
pos = scanChar(styler, pos+1, max);
styler.ColourTo(pos, SCE_P_CHARACTER);
pos++;
break;
default: // identifers, numbers, operators, whitespace
if (ch >= '0' && ch <= '9') {
pos = scanNumber(styler, pos);
} else if (IsAWordChar(ch)) {
pos = scanIdent(styler, pos, keywords);
} else if (ch == '`') {
pos++;
while (pos < max) {
ch = styler.SafeGetCharAt(pos, LF);
if (ch == '`') {
++pos;
break;
}
if (ch == CR || ch == LF) break;
++pos;
}
styler.ColourTo(pos, SCE_P_IDENTIFIER);
} else if (strchr("()[]{}:=;-\\/&%$!+<>|^?,.*~@", ch)) {
styler.ColourTo(pos, SCE_P_OPERATOR);
pos++;
} else {
styler.ColourTo(pos, SCE_P_DEFAULT);
pos++;
}
break;
}
}
}
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
static bool IsQuoteLine(int line, Accessor &styler) {
int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
static void FoldNimrodDoc(unsigned int startPos, int length,
int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
const int maxPos = startPos + length;
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
const bool foldComment = styler.GetPropertyInt("fold.comment.nimrod") != 0;
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.nimrod") != 0;
// Backtrack to previous non-blank line so we can determine indent level
// for any white space lines (needed esp. within triple quoted strings)
// and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
int lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) &&
(!IsCommentLine(lineCurrent, styler)) &&
(!IsQuoteLine(lineCurrent, styler)))
break;
}
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
// Set up initial loop state
startPos = styler.LineStart(lineCurrent);
int prev_state = SCE_P_DEFAULT & 31;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) ||
(prev_state == SCE_P_TRIPLEDOUBLE));
int prevComment = 0;
if (lineCurrent >= 1)
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
// Process all characters to end of requested range or end of any triple quote
// or comment that hangs over the end of the range. Cap processing in all cases
// to end of document (in case of unclosed quote or comment at end).
while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) ||
prevQuote || prevComment)) {
// Gather info
int lev = indentCurrent;
int lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
int quote = false;
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
const int quote_start = (quote && !prevQuote);
const int quote_continue = (quote && prevQuote);
const int comment = foldComment && IsCommentLine(lineCurrent, styler);
const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
IsCommentLine(lineNext, styler) &&
(lev > SC_FOLDLEVELBASE));
const int comment_continue = (comment && prevComment);
if ((!quote || !prevQuote) && !comment)
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
if (quote)
indentNext = indentCurrentLevel;
if (indentNext & SC_FOLDLEVELWHITEFLAG)
indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
if (quote_start) {
// Place fold point at start of triple quoted string
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (quote_continue || prevQuote) {
// Add level to rest of lines in the string
lev = lev + 1;
} else if (comment_start) {
// Place fold point at start of a block of comments
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (comment_continue) {
// Add level to rest of lines in the block
lev = lev + 1;
}
// Skip past any blank lines for next indent level info; we skip also
// comments (all comments, not just those starting in column 0)
// which effectively folds them into surrounding code rather
// than screwing up folding.
while (!quote &&
(lineNext < docLines) &&
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
(lineNext <= docLines && IsCommentLine(lineNext, styler)))) {
lineNext++;
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
}
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
const int levelBeforeComments =
Platform::Maximum(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
// which is indented more than the line after the end of
// the comment-block, use the level of the block before
int skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
skipLevel = levelBeforeComments;
int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(skipLine, skipLevel | whiteFlag);
}
// Set fold header on non-quote/non-comment line
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) <
(indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG;
}
// Keep track of triple quote and block comment state of previous line
prevQuote = quote;
prevComment = comment_start || comment_continue;
// Set fold level for this line and move to next line
styler.SetLevel(lineCurrent, lev);
indentCurrent = indentNext;
lineCurrent = lineNext;
}
// NOTE: Cannot set level of last line here because indentCurrent doesn't have
// header flag set; the loop above is crafted to take care of this case!
//styler.SetLevel(lineCurrent, indentCurrent);
}
static const char * const nimrodWordListDesc[] = {
"Keywords",
0
};
LexerModule lmNimrod(SCLEX_NIMROD, ColouriseNimrodDoc, "nimrod", FoldNimrodDoc,
nimrodWordListDesc);

View File

@ -18,6 +18,8 @@
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#define INCLUDE_DEPRECATED_FEATURES
#include "Scintilla.h"
#include "SciLexer.h"

View File

@ -640,17 +640,27 @@ static void ColourisePoDoc(unsigned int startPos, int length, int, WordList *[],
}
}
static inline bool isassignchar(unsigned char ch) {
return (ch == '=') || (ch == ':');
}
static void ColourisePropsLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
Accessor &styler) {
Accessor &styler,
bool allowInitialSpaces) {
unsigned int i = 0;
if (allowInitialSpaces) {
while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces
i++;
} else {
if (isspacechar(lineBuffer[i])) // don't allow initial spaces
i = lengthLine;
}
if (i < lengthLine) {
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
styler.ColourTo(endPos, SCE_PROPS_COMMENT);
@ -658,14 +668,14 @@ static void ColourisePropsLine(
styler.ColourTo(endPos, SCE_PROPS_SECTION);
} else if (lineBuffer[i] == '@') {
styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
if (lineBuffer[++i] == '=')
if (isassignchar(lineBuffer[i++]))
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
// Search for the '=' character
while ((i < lengthLine) && (lineBuffer[i] != '='))
while ((i < lengthLine) && !isassignchar(lineBuffer[i]))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
if ((i < lengthLine) && isassignchar(lineBuffer[i])) {
styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
@ -684,18 +694,25 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
styler.StartSegment(startPos);
unsigned int linePos = 0;
unsigned int startLine = startPos;
// property lexer.props.allow.initial.spaces
// For properties files, set to 0 to style all lines that start with whitespace in the default style.
// This is not suitable for SciTE .properties files which use indentation for flow control but
// can be used for RFC2822 text where indentation is used for continuation lines.
bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0;
for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler);
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler);
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces);
}
}
@ -770,7 +787,7 @@ static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], A
lev = SC_FOLDLEVELBASE;
}
int flagsNext = styler.LevelAt(lineCurrent);
styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK);
styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
}
static void ColouriseMakeLine(
@ -1085,6 +1102,12 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
// property lexer.errorlist.value.separate
// For lines in the output pane that are matches from Find in Files or GCC-style
// diagnostics, style the path and line number separately from the rest of the
// line with style 21 used for the rest of the line.
// This allows matched text to be more easily distinguished from its location.
bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];

View File

@ -4,8 +4,109 @@
** Written by Laurent le Tynevez
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments)
** Completely rewritten by Marko Njezic <sf@maxempire.com> October 2008
**/
/*
A few words about features of the new completely rewritten LexPascal...
Generally speaking LexPascal tries to support all available Delphi features (up
to Delphi 2009 at this time), including .NET specific features.
~ HIGHLIGHTING:
If you enable "lexer.pascal.smart.highlighting" property, some keywords will
only be highlighted in appropriate context. As implemented those are keywords
related to property and DLL exports declarations (similar to how Delphi IDE
works).
For example, keywords "read" and "write" will only be highlighted if they are in
property declaration:
property MyProperty: boolean read FMyProperty write FMyProperty;
~ FOLDING:
Folding is supported in the following cases:
- Folding of stream-like comments
- Folding of groups of consecutive line comments
- Folding of preprocessor blocks (the following preprocessor blocks are
supported: IF / IFEND; IFDEF, IFNDEF, IFOPT / ENDIF and REGION / ENDREGION
blocks), including nesting of preprocessor blocks up to 255 levels
- Folding of code blocks on appropriate keywords (the following code blocks are
supported: "begin, asm, record, try, case / end" blocks, class & object
declarations and interface declarations)
Remarks:
- Folding of code blocks tries to handle all special cases in which folding
should not occur. As implemented those are:
1. Structure "record case / end" (there's only one "end" statement and "case" is
ignored as fold point)
2. Forward class declarations ("type TMyClass = class;") and object method
declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") are
ignored as fold points
3. Simplified complete class declarations ("type TMyClass = class(TObject);")
are ignored as fold points
4. Every other situation when class keyword doesn't actually start class
declaration ("class procedure", "class function", "class of", "class var",
"class property" and "class operator")
- Folding of code blocks inside preprocessor blocks is disabled (any comments
inside them will be folded fine) because there is no guarantee that complete
code block will be contained inside folded preprocessor block in which case
folded code block could end prematurely at the end of preprocessor block if
there is no closing statement inside. This was done in order to properly process
document that may contain something like this:
type
{$IFDEF UNICODE}
TMyClass = class(UnicodeAncestor)
{$ELSE}
TMyClass = class(AnsiAncestor)
{$ENDIF}
private
...
public
...
published
...
end;
If class declarations were folded, then the second class declaration would end
at "$ENDIF" statement, first class statement would end at "end;" statement and
preprocessor "$IFDEF" block would go all the way to the end of document.
However, having in mind all this, if you want to enable folding of code blocks
inside preprocessor blocks, you can disable folding of preprocessor blocks by
changing "fold.preprocessor" property, in which case everything inside them
would be folded.
~ KEYWORDS:
The list of keywords that can be used in pascal.properties file (up to Delphi
2009):
- Keywords: absolute abstract and array as asm assembler automated begin case
cdecl class const constructor deprecated destructor dispid dispinterface div do
downto dynamic else end except export exports external far file final
finalization finally for forward function goto if implementation in inherited
initialization inline interface is label library message mod near nil not object
of on or out overload override packed pascal platform private procedure program
property protected public published raise record register reintroduce repeat
resourcestring safecall sealed set shl shr static stdcall strict string then
threadvar to try type unit unsafe until uses var varargs virtual while with xor
- Keywords related to the "smart highlithing" feature: add default implements
index name nodefault read readonly remove stored write writeonly
- Keywords related to Delphi packages (in addition to all above): package
contains requires
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@ -20,12 +121,13 @@
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void getRange(unsigned int start,
static void GetRangeLowered(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
@ -38,235 +140,357 @@ static void getRange(unsigned int start,
s[i] = '\0';
}
static bool IsStreamCommentStyle(int style) {
return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR;
static void GetForwardRangeLowered(unsigned int start,
CharacterSet &charSet,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
while ((i < len-1) && charSet.Contains(styler.SafeGetCharAt(start + i))) {
s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i)));
i++;
}
s[i] = '\0';
}
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
styler.ColourTo(end, SCE_C_REGEX);
} else
styler.ColourTo(end, attr);
}
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass, bool bInAsm) {
int ret = 0;
enum {
stateInAsm = 0x1000,
stateInProperty = 0x2000,
stateInExport = 0x4000,
stateFoldInPreprocessor = 0x0100,
stateFoldInRecord = 0x0200,
stateFoldInPreprocessorLevelMask = 0x00FF,
stateFoldMaskAll = 0x0FFF
};
static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &curLineState, bool bSmartHighlighting) {
WordList& keywords = *keywordlists[0];
WordList& classwords = *keywordlists[1];
char s[100];
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.') ||(s[0] == '$')) {
chAttr = SCE_C_NUMBER;
}
else {
if (s[0] == '#') {
chAttr = SCE_C_CHARACTER;
}
else {
sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if(strcmp(s, "class") == 0) {
ret = 1;
if (curLineState & stateInAsm) {
if (strcmp(s, "end") == 0 && sc.GetRelative(-4) != '@') {
curLineState &= ~stateInAsm;
sc.ChangeState(SCE_PAS_WORD);
} else {
sc.ChangeState(SCE_PAS_ASM);
}
else if (strcmp(s, "asm") == 0) {
ret = 2;
}
else if (strcmp(s, "end") == 0) {
ret = -1;
}
} else if (bInClass) {
if (classwords.InList(s)) {
chAttr = SCE_C_WORD;
} else {
bool ignoreKeyword = false;
if (strcmp(s, "asm") == 0) {
curLineState |= stateInAsm;
} else if (bSmartHighlighting) {
if (strcmp(s, "property") == 0) {
curLineState |= stateInProperty;
} else if (strcmp(s, "exports") == 0) {
curLineState |= stateInExport;
} else if (!(curLineState & (stateInProperty | stateInExport)) && strcmp(s, "index") == 0) {
ignoreKeyword = true;
} else if (!(curLineState & stateInExport) && strcmp(s, "name") == 0) {
ignoreKeyword = true;
} else if (!(curLineState & stateInProperty) &&
(strcmp(s, "read") == 0 || strcmp(s, "write") == 0 ||
strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 ||
strcmp(s, "stored") == 0 || strcmp(s, "implements") == 0 ||
strcmp(s, "readonly") == 0 || strcmp(s, "writeonly") == 0 ||
strcmp(s, "add") == 0 || strcmp(s, "remove") == 0)) {
ignoreKeyword = true;
}
}
if (!ignoreKeyword) {
sc.ChangeState(SCE_PAS_WORD);
}
}
ColourTo(styler, end, chAttr, (bInAsm && ret != -1));
return ret;
} else if (curLineState & stateInAsm) {
sc.ChangeState(SCE_PAS_ASM);
}
static int classifyFoldPointPascal(const char* s) {
int lev = 0;
if (!(isdigit(s[0]) || (s[0] == '.'))) {
if (strcmp(s, "begin") == 0 ||
strcmp(s, "object") == 0 ||
strcmp(s, "case") == 0 ||
strcmp(s, "class") == 0 ||
strcmp(s, "record") == 0 ||
strcmp(s, "try") == 0) {
lev=1;
} else if (strcmp(s, "end") == 0) {
lev=-1;
}
}
return lev;
sc.SetState(SCE_PAS_DEFAULT);
}
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
bool bSmartHighlighting = styler.GetPropertyInt("lexer.pascal.smart.highlighting", 1) != 0;
styler.StartAt(startPos);
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
CharacterSet setNumber(CharacterSet::setDigits, ".-+eE");
CharacterSet setHexNumber(CharacterSet::setDigits, "abcdefABCDEF");
CharacterSet setOperator(CharacterSet::setNone, "#$&'()*+,-./:;<=>@[]^{}");
int state = initStyle;
if (state == SCE_C_CHARACTER) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int curLine = styler.GetLine(startPos);
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
bool bInClassDefinition;
StyleContext sc(startPos, length, initStyle, styler);
int currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
bInClassDefinition = (styler.GetLineState(currentLine) == 1);
} else {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
for (; sc.More(); sc.Forward()) {
if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line
curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, curLineState);
}
bool bInAsm = (state == SCE_C_REGEX);
if (bInAsm)
state = SCE_C_DEFAULT;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
// Avoid triggering two times on Dos/Win
// End of line
if (state == SCE_C_CHARACTER) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_PAS_NUMBER:
if (!setNumber.Contains(sc.ch) || (sc.ch == '.' && sc.chNext == '.')) {
sc.SetState(SCE_PAS_DEFAULT);
} else if (sc.ch == '-' || sc.ch == '+') {
if (sc.chPrev != 'E' && sc.chPrev != 'e') {
sc.SetState(SCE_PAS_DEFAULT);
}
currentLine++;
styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
}
break;
case SCE_PAS_IDENTIFIER:
if (!setWord.Contains(sc.ch)) {
ClassifyPascalWord(keywordlists, sc, curLineState, bSmartHighlighting);
}
break;
case SCE_PAS_HEXNUMBER:
if (!setHexNumber.Contains(sc.ch)) {
sc.SetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_COMMENT:
case SCE_PAS_PREPROCESSOR:
if (sc.ch == '}') {
sc.ForwardSetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_COMMENT2:
case SCE_PAS_PREPROCESSOR2:
if (sc.Match('*', ')')) {
sc.Forward();
sc.ForwardSetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_STRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_PAS_STRINGEOL);
} else if (sc.ch == '\'' && sc.chNext == '\'') {
sc.Forward();
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_STRINGEOL:
if (sc.atLineStart) {
sc.SetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_CHARACTER:
if (!setHexNumber.Contains(sc.ch) && sc.ch != '$') {
sc.SetState(SCE_PAS_DEFAULT);
}
break;
case SCE_PAS_OPERATOR:
if (bSmartHighlighting && sc.chPrev == ';') {
curLineState &= ~(stateInProperty | stateInExport);
}
sc.SetState(SCE_PAS_DEFAULT);
break;
case SCE_PAS_ASM:
sc.SetState(SCE_PAS_DEFAULT);
break;
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
// Determine if a new state should be entered.
if (sc.state == SCE_PAS_DEFAULT) {
if (IsADigit(sc.ch) && !(curLineState & stateInAsm)) {
sc.SetState(SCE_PAS_NUMBER);
} else if (setWordStart.Contains(sc.ch)) {
sc.SetState(SCE_PAS_IDENTIFIER);
} else if (sc.ch == '$' && !(curLineState & stateInAsm)) {
sc.SetState(SCE_PAS_HEXNUMBER);
} else if (sc.Match('{', '$')) {
sc.SetState(SCE_PAS_PREPROCESSOR);
} else if (sc.ch == '{') {
sc.SetState(SCE_PAS_COMMENT);
} else if (sc.Match("(*$")) {
sc.SetState(SCE_PAS_PREPROCESSOR2);
} else if (sc.Match('(', '*')) {
sc.SetState(SCE_PAS_COMMENT2);
sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_PAS_COMMENTLINE);
} else if (sc.ch == '\'') {
sc.SetState(SCE_PAS_STRING);
} else if (sc.ch == '#') {
sc.SetState(SCE_PAS_CHARACTER);
} else if (setOperator.Contains(sc.ch) && !(curLineState & stateInAsm)) {
sc.SetState(SCE_PAS_OPERATOR);
} else if (curLineState & stateInAsm) {
sc.SetState(SCE_PAS_ASM);
}
}
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch) || ch == '#' || ch == '$' || (ch == '@' && bInAsm)) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_IDENTIFIER;
} else if (ch == '{' && chNext != '$' && chNext != '&') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_CHARACTER;
} else if (ch == '{' && (chNext == '$' || chNext=='&')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_PREPROCESSOR;
} else if (isoperator(ch)) {
ColourTo(styler, i-1, state, bInAsm);
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
} else if (state == SCE_C_IDENTIFIER) {
bool bDoublePoint = ((ch == '.') && (chPrev == '.'));
if ((!iswordchar(ch) && ch != '$' && ch != '#' && (ch != '@' || !bInAsm)) || bDoublePoint) {
if (bDoublePoint) i--;
int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition, bInAsm);
if(lStateChange == 1) {
styler.SetLineState(currentLine, 1);
bInClassDefinition = true;
} else if(lStateChange == 2) {
bInAsm = true;
} else if(lStateChange == -1) {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
bInAsm = false;
}
if (bDoublePoint) {
i++;
ColourTo(styler, i-1, SCE_C_DEFAULT, bInAsm);
if (sc.state == SCE_PAS_IDENTIFIER && setWord.Contains(sc.chPrev)) {
ClassifyPascalWord(keywordlists, sc, curLineState, bSmartHighlighting);
}
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{' && chNext != '$' && chNext != '&') {
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
sc.Complete();
}
static bool IsStreamCommentStyle(int style) {
return style == SCE_PAS_COMMENT || style == SCE_PAS_COMMENT2;
}
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eolPos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eolPos; i++) {
char ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
if (ch == '/' && chNext == '/' && style == SCE_PAS_COMMENTLINE) {
return true;
} else if (!IsASpaceOrTab(ch)) {
return false;
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if (ch=='}'){
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
} else {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
return false;
}
static unsigned int GetFoldInPreprocessorLevelFlag(int lineFoldStateCurrent) {
return lineFoldStateCurrent & stateFoldInPreprocessorLevelMask;
}
} else if (state == SCE_C_COMMENT) {
if (ch == '}' ) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned int nestLevel) {
lineFoldStateCurrent &= ~stateFoldInPreprocessorLevelMask;
lineFoldStateCurrent |= nestLevel & stateFoldInPreprocessorLevelMask;
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == ')' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
unsigned int startPos, Accessor &styler) {
CharacterSet setWord(CharacterSet::setAlpha);
char s[11]; // Size of the longest possible keyword + one additional character + null
GetForwardRangeLowered(startPos, setWord, styler, s, sizeof(s));
unsigned int nestLevel = GetFoldInPreprocessorLevelFlag(lineFoldStateCurrent);
if (strcmp(s, "if") == 0 ||
strcmp(s, "ifdef") == 0 ||
strcmp(s, "ifndef") == 0 ||
strcmp(s, "ifopt") == 0 ||
strcmp(s, "region") == 0) {
nestLevel++;
SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);
lineFoldStateCurrent |= stateFoldInPreprocessor;
levelCurrent++;
} else if (strcmp(s, "endif") == 0 ||
strcmp(s, "ifend") == 0 ||
strcmp(s, "endregion") == 0) {
nestLevel--;
SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);
if (nestLevel == 0) {
lineFoldStateCurrent &= ~stateFoldInPreprocessor;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_CHARACTER) {
if (ch == '\'') {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
levelCurrent--;
if (levelCurrent < SC_FOLDLEVELBASE) {
levelCurrent = SC_FOLDLEVELBASE;
}
}
}
chPrev = ch;
static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
Accessor &styler, bool includeChars = false) {
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
unsigned int j = currentPos + 1;
char ch = styler.SafeGetCharAt(j);
while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) {
j++;
ch = styler.SafeGetCharAt(j);
}
return j;
}
static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
unsigned int startPos, unsigned int endPos,
unsigned int lastStart, unsigned int currentPos, Accessor &styler) {
char s[100];
GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s));
if (strcmp(s, "record") == 0) {
lineFoldStateCurrent |= stateFoldInRecord;
levelCurrent++;
} else if (strcmp(s, "begin") == 0 ||
strcmp(s, "asm") == 0 ||
strcmp(s, "try") == 0 ||
(strcmp(s, "case") == 0 && !(lineFoldStateCurrent & stateFoldInRecord))) {
levelCurrent++;
} else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) {
// "class" & "object" keywords require special handling...
bool ignoreKeyword = false;
unsigned int j = SkipWhiteSpace(currentPos, endPos, styler);
if (j < endPos) {
CharacterSet setWordStart(CharacterSet::setAlpha, "_");
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
if (styler.SafeGetCharAt(j) == ';') {
// Handle forward class declarations ("type TMyClass = class;")
// and object method declarations ("TNotifyEvent = procedure(Sender: TObject) of object;")
ignoreKeyword = true;
} else if (strcmp(s, "class") == 0) {
// "class" keyword has a few more special cases...
if (styler.SafeGetCharAt(j) == '(') {
// Handle simplified complete class declarations ("type TMyClass = class(TObject);")
j = SkipWhiteSpace(j, endPos, styler, true);
if (j < endPos && styler.SafeGetCharAt(j) == ')') {
j = SkipWhiteSpace(j, endPos, styler);
if (j < endPos && styler.SafeGetCharAt(j) == ';') {
ignoreKeyword = true;
}
}
} else if (setWordStart.Contains(styler.SafeGetCharAt(j))) {
char s2[11]; // Size of the longest possible keyword + one additional character + null
GetForwardRangeLowered(j, setWord, styler, s2, sizeof(s2));
if (strcmp(s2, "procedure") == 0 ||
strcmp(s2, "function") == 0 ||
strcmp(s2, "of") == 0 ||
strcmp(s2, "var") == 0 ||
strcmp(s2, "property") == 0 ||
strcmp(s2, "operator") == 0) {
ignoreKeyword = true;
}
}
}
}
if (!ignoreKeyword) {
levelCurrent++;
}
} else if (strcmp(s, "interface") == 0) {
// "interface" keyword requires special handling...
bool ignoreKeyword = true;
unsigned int j = lastStart - 1;
char ch = styler.SafeGetCharAt(j);
while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
IsStreamCommentStyle(styler.StyleAt(j)))) {
j--;
ch = styler.SafeGetCharAt(j);
}
if (j >= startPos && styler.SafeGetCharAt(j) == '=') {
ignoreKeyword = false;
}
if (!ignoreKeyword) {
levelCurrent++;
}
} else if (strcmp(s, "end") == 0) {
lineFoldStateCurrent &= ~stateFoldInRecord;
levelCurrent--;
if (levelCurrent < SC_FOLDLEVELBASE) {
levelCurrent = SC_FOLDLEVELBASE;
}
}
ColourTo(styler, lengthDoc - 1, state, bInAsm);
}
static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
@ -279,11 +503,13 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int lineFoldStateCurrent = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) & stateFoldMaskAll : 0;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
int lastStart = 0;
CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
@ -293,45 +519,6 @@ 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_WORD && style == SCE_C_WORD)
{
// Store last word start point.
lastStart = i;
}
if (stylePrev == SCE_C_WORD) {
if(iswordchar(ch) && !iswordchar(chNext)) {
char s[100];
getRange(lastStart, i, styler, s, sizeof(s));
levelCurrent += classifyFoldPointPascal(s);
}
}
if (foldComment && (style == SCE_C_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelCurrent++;
} else if (chNext2 == '}') {
levelCurrent--;
}
}
}
if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
if (ch == '{' && chNext == '$') {
unsigned int j=i+2; // skip {$
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
if (styler.Match(j, "region") || styler.Match(j, "if")) {
levelCurrent++;
} else if (styler.Match(j, "end")) {
levelCurrent--;
}
}
}
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;
@ -340,6 +527,37 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
levelCurrent--;
}
}
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
if (foldPreprocessor) {
if (style == SCE_PAS_PREPROCESSOR && ch == '{' && chNext == '$') {
ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 2, styler);
} else if (style == SCE_PAS_PREPROCESSOR2 && ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) == '$') {
ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 3, styler);
}
}
if (stylePrev != SCE_PAS_WORD && style == SCE_PAS_WORD)
{
// Store last word start point.
lastStart = i;
}
if (stylePrev == SCE_PAS_WORD && !(lineFoldStateCurrent & stateFoldInPreprocessor)) {
if(setWord.Contains(ch) && !setWord.Contains(chNext)) {
ClassifyPascalWordFoldPoint(levelCurrent, lineFoldStateCurrent, startPos, endPos, lastStart, i, styler);
}
}
if (!IsASpace(ch))
visibleChars++;
if (atEOL) {
int lev = levelPrev;
@ -350,23 +568,24 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
int newLineState = (styler.GetLineState(lineCurrent) & ~stateFoldMaskAll) | lineFoldStateCurrent;
styler.SetLineState(lineCurrent, newLineState);
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);
// If we didn't reach the EOL in previous loop, store line level and whitespace information.
// The rest will be filled in later...
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(lineCurrent, lev);
}
static const char * const pascalWordListDesc[] = {
"Keywords",
"Classwords",
0
};

View File

@ -247,8 +247,9 @@ static bool styleCheckSubPrototype(Accessor &styler, unsigned int bk)
static bool isMatch(const char *sref, char *s)
{
// match per-line delimiter - must kill trailing CR if CRLF
if (s[strlen(s) - 1] == '\r')
s[strlen(s) - 1] = '\0';
int i = strlen(s);
if (i != 0 && s[i - 1] == '\r')
s[i - 1] = '\0';
return (strcmp(sref, s) == 0);
}
@ -569,7 +570,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
sc.Forward(ws_skip + 1);
HereDoc.Quote = delim_ch;
HereDoc.Quoted = true;
} else if (ws_skip == 0 && setNonHereDoc.Contains(sc.chNext)
} else if ((ws_skip == 0 && setNonHereDoc.Contains(sc.chNext))
|| ws_skip > 0) {
// left shift << or <<= operator cases
// restore position if operator
@ -1183,8 +1184,15 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// Custom folding of POD and packages
// property fold.perl.pod
// Enable folding Pod blocks when using the Perl lexer.
bool foldPOD = styler.GetPropertyInt("fold.perl.pod", 1) != 0;
// property fold.perl.package
// Enable folding packages when using the Perl lexer.
bool foldPackage = styler.GetPropertyInt("fold.perl.package", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);

View File

@ -0,0 +1,600 @@
// Scintilla source code edit control
// @file LexPowerPro.cxx
// PowerPro utility, written by Bruce Switzer, is available from http://powerpro.webeddie.com
// PowerPro lexer is written by Christopher Bean (cbean@cb-software.net)
//
// Lexer code heavily borrowed from:
// LexAU3.cxx by Jos van der Zande
// LexCPP.cxx by Neil Hodgson
// LexVB.cxx by Neil Hodgson
//
// Changes:
// 2008-10-25 - Initial release
// 2008-10-26 - Changed how <name> is hilighted in 'function <name>' so that
// local isFunction = "" and local functions = "" don't get falsely highlighted
// 2008-12-14 - Added bounds checking for szKeyword and szDo
// - Replaced SetOfCharacters with CharacterSet
// - Made sure that CharacterSet::Contains is passed only positive values
// - Made sure that the return value of Accessor::SafeGetCharAt is positive before
// passsing to functions that require positive values like isspacechar()
// - Removed unused visibleChars processing from ColourisePowerProDoc()
// - Fixed bug with folding logic where line continuations didn't end where
// they were supposed to
// - Moved all helper functions to the top of the file
//
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.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 inline bool IsStreamCommentStyle(int style) {
return style == SCE_POWERPRO_COMMENTBLOCK;
}
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine + 1) - 2;
while (nsPos < nePos)
{
int stylech = styler.StyleAt(nsPos);
if (!(stylech == SCE_POWERPRO_COMMENTBLOCK)) {
char ch = styler.SafeGetCharAt(nePos);
char chPrev = styler.SafeGetCharAt(nePos-1);
char chPrevPrev = styler.SafeGetCharAt(nePos-2);
if (ch > 0 && chPrev > 0 && chPrevPrev > 0 && !isspacechar(ch) && !isspacechar(chPrev) && !isspacechar(chPrevPrev) ) {
if (chPrevPrev == ';' && chPrev == ';' && ch == '+')
return true;
else
return false;
}
}
nePos--; // skip to next char
}
return false;
}
// Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine+1) - 1;
char ch = styler.SafeGetCharAt(nsPos);
while (ch > 0 && isspacechar(ch) && nsPos < nePos)
{
nsPos++; // skip to next char
ch = styler.SafeGetCharAt(nsPos);
}
return styler.StyleAt(nsPos);
}
//returns true if there is a function to highlight
//used to highlight <name> in 'function <name>'
static bool HasFunction(Accessor &styler, unsigned int currentPos) {
//check for presence of 'function '
return (styler.SafeGetCharAt(currentPos) == ' '
&& tolower(styler.SafeGetCharAt(currentPos-1)) == 'n'
&& tolower(styler.SafeGetCharAt(currentPos-2)) == 'o'
&& tolower(styler.SafeGetCharAt(currentPos-3)) == 'i'
&& tolower(styler.SafeGetCharAt(currentPos-4)) == 't'
&& tolower(styler.SafeGetCharAt(currentPos-5)) == 'c'
&& tolower(styler.SafeGetCharAt(currentPos-6)) == 'n'
&& tolower(styler.SafeGetCharAt(currentPos-7)) == 'u'
&& tolower(styler.SafeGetCharAt(currentPos-8)) == 'f'
//only allow 'function ' to appear at the beginning of a line
&& (styler.SafeGetCharAt(currentPos-9) == '\n'
|| styler.SafeGetCharAt(currentPos-9) == '\r'
|| (styler.SafeGetCharAt(currentPos -9, '\0')) == '\0') //is the first line
);
}
static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler, bool caseSensitive) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
//define the character sets
CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
StyleContext sc(startPos, length, initStyle, styler);
char s_save[100]; //for last line highlighting
for (; sc.More(); sc.Forward()) {
// **********************************************
// save the total current word for eof processing
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if ((sc.ch > 0) && setWord.Contains(sc.ch))
{
strcpy(s_save,s);
int tp = strlen(s_save);
if (tp < 99) {
s_save[tp] = static_cast<char>(tolower(sc.ch));
s_save[tp+1] = '\0';
}
}
// **********************************************
//
if (sc.atLineStart) {
if (sc.state == SCE_POWERPRO_DOUBLEQUOTEDSTRING) {
// Prevent SCE_POWERPRO_STRINGEOL from leaking back to previous line which
// ends with a line continuation by locking in the state upto this position.
sc.SetState(SCE_POWERPRO_DOUBLEQUOTEDSTRING);
}
}
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_POWERPRO_OPERATOR:
sc.SetState(SCE_POWERPRO_DEFAULT);
break;
case SCE_POWERPRO_NUMBER:
if (!IsADigit(sc.ch))
sc.SetState(SCE_POWERPRO_DEFAULT);
break;
case SCE_POWERPRO_IDENTIFIER:
//if ((sc.ch > 0) && !setWord.Contains(sc.ch) || (sc.ch == '.')) { // use this line if don't want to match keywords with . in them. ie: win.debug will match both win and debug so win debug will also be colorized
if ((sc.ch > 0) && !setWord.Contains(sc.ch)){ // || (sc.ch == '.')) { // use this line if you want to match keywords with a . ie: win.debug will only match win.debug neither win nor debug will be colorized separately
char s[1000];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (keywords.InList(s)) {
sc.ChangeState(SCE_POWERPRO_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_POWERPRO_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_POWERPRO_WORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_POWERPRO_WORD4);
}
sc.SetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_LINECONTINUE:
if (sc.atLineStart) {
sc.SetState(SCE_POWERPRO_DEFAULT);
} else if (sc.Match('/', '*') || sc.Match('/', '/')) {
sc.SetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_COMMENTBLOCK:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_DOUBLEQUOTEDSTRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_POWERPRO_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_SINGLEQUOTEDSTRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_POWERPRO_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_STRINGEOL:
if (sc.atLineStart) {
sc.SetState(SCE_POWERPRO_DEFAULT);
}
break;
case SCE_POWERPRO_VERBATIM:
if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_POWERPRO_DEFAULT);
}
}
break;
case SCE_POWERPRO_ALTQUOTE:
if (sc.ch == '#') {
if (sc.chNext == '#') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_POWERPRO_DEFAULT);
}
}
break;
case SCE_POWERPRO_FUNCTION:
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ' ' || sc.ch == '(') {
sc.SetState(SCE_POWERPRO_DEFAULT);
}
break;
}
// Determine if a new state should be entered.
if (sc.state == SCE_POWERPRO_DEFAULT) {
if (sc.Match('?', '\"')) {
sc.SetState(SCE_POWERPRO_VERBATIM);
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_POWERPRO_NUMBER);
}else if (sc.Match('?','#')) {
if (sc.ch == '?' && sc.chNext == '#') {
sc.SetState(SCE_POWERPRO_ALTQUOTE);
sc.Forward();
}
} else if (HasFunction(styler, sc.currentPos)) { //highlight <name> in 'function <name>'
sc.SetState(SCE_POWERPRO_FUNCTION);
} else if (sc.ch == '@' && sc.atLineStart) { //alternate function definition [label]
sc.SetState(SCE_POWERPRO_FUNCTION);
} else if ((sc.ch > 0) && (setWordStart.Contains(sc.ch) || (sc.ch == '?'))) {
sc.SetState(SCE_POWERPRO_IDENTIFIER);
} else if (sc.Match(";;+")) {
sc.SetState(SCE_POWERPRO_LINECONTINUE);
} else if (sc.Match('/', '*')) {
sc.SetState(SCE_POWERPRO_COMMENTBLOCK);
sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_POWERPRO_COMMENTLINE);
} else if (sc.atLineStart && sc.ch == ';') { //legacy comment that can only appear at the beginning of a line
sc.SetState(SCE_POWERPRO_COMMENTLINE);
} else if (sc.Match(";;")) {
sc.SetState(SCE_POWERPRO_COMMENTLINE);
} else if (sc.ch == '\"') {
sc.SetState(SCE_POWERPRO_DOUBLEQUOTEDSTRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_POWERPRO_SINGLEQUOTEDSTRING);
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_POWERPRO_OPERATOR);
}
}
}
//*************************************
// Colourize the last word correctly
//*************************************
if (sc.state == SCE_POWERPRO_IDENTIFIER)
{
if (keywords.InList(s_save)) {
sc.ChangeState(SCE_POWERPRO_WORD);
sc.SetState(SCE_POWERPRO_DEFAULT);
}
else if (keywords2.InList(s_save)) {
sc.ChangeState(SCE_POWERPRO_WORD2);
sc.SetState(SCE_POWERPRO_DEFAULT);
}
else if (keywords3.InList(s_save)) {
sc.ChangeState(SCE_POWERPRO_WORD3);
sc.SetState(SCE_POWERPRO_DEFAULT);
}
else if (keywords4.InList(s_save)) {
sc.ChangeState(SCE_POWERPRO_WORD4);
sc.SetState(SCE_POWERPRO_DEFAULT);
}
else {
sc.SetState(SCE_POWERPRO_DEFAULT);
}
}
sc.Complete();
}
static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
{
//define the character sets
CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
bool isFoldingAll = true; //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function)
int endPos = startPos + length;
int lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly
// get settings from the config files for folding comments and preprocessor lines
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;
bool foldCompact = true;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
isFoldingAll = false;
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
}
}
// vars for style of previous/current/next lines
int style = GetStyleFirstWord(lineCurrent,styler);
int stylePrev = 0;
// find the first previous line without continuation character at the end
while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
(lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
}
if (lineCurrent > 0) {
stylePrev = GetStyleFirstWord(lineCurrent-1,styler);
}
// vars for getting first word to check for keywords
bool FirstWordStart = false;
bool FirstWordEnd = false;
const unsigned int KEYWORD_MAX = 10;
char szKeyword[KEYWORD_MAX]="";
unsigned int szKeywordlen = 0;
char szDo[3]="";
int szDolen = 0;
bool DoFoundLast = false;
// var for indentlevel
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
}
int levelNext = levelCurrent;
int visibleChars = 0;
int functionCount = 0;
char chNext = styler.SafeGetCharAt(startPos);
char chPrev = '\0';
char chPrevPrev = '\0';
char chPrevPrevPrev = '\0';
for (int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch > 0) && setWord.Contains(ch)) {
visibleChars++;
}
// get the syle for the current character neede to check in comment
int stylech = styler.StyleAt(i);
// get first word for the line for indent check max 9 characters
if (FirstWordStart && (!(FirstWordEnd))) {
if ((ch > 0) && !setWord.Contains(ch)) {
FirstWordEnd = true;
}
else if (szKeywordlen < KEYWORD_MAX - 1) {
szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
szKeyword[szKeywordlen] = '\0';
}
}
// start the capture of the first word
if (!(FirstWordStart)) {
if ((ch > 0) && (setWord.Contains(ch) || setWordStart.Contains(ch) || ch == ';' || ch == '/')) {
FirstWordStart = true;
if (szKeywordlen < KEYWORD_MAX - 1) {
szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
szKeyword[szKeywordlen] = '\0';
}
}
}
// only process this logic when not in comment section
if (stylech != SCE_POWERPRO_COMMENTLINE) {
if (DoFoundLast) {
if (DoFoundLast && (ch > 0) && setWord.Contains(ch)) {
DoFoundLast = false;
}
}
// find out if the word "do" is the last on a "if" line
if (FirstWordEnd && strcmp(szKeyword,"if") == 0) {
if (szDolen == 2) {
szDo[0] = szDo[1];
szDo[1] = static_cast<char>(tolower(ch));
szDo[2] = '\0';
if (strcmp(szDo,"do") == 0 ) {
DoFoundLast = true;
}
}
else if (szDolen < 2) {
szDo[szDolen++] = static_cast<char>(tolower(ch));
szDo[szDolen] = '\0';
}
}
}
// End of Line found so process the information
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
// **************************
// Folding logic for Keywords
// **************************
// if a keyword is found on the current line and the line doesn't end with ;;+ (continuation)
// and we are not inside a commentblock.
if (szKeywordlen > 0 &&
(!(chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev ==';')) &&
((!(IsStreamCommentStyle(style)) || foldInComment)) ) {
// only fold "if" last keyword is "then" (else its a one line if)
if (strcmp(szKeyword,"if") == 0 && DoFoundLast) {
levelNext++;
}
// create new fold for these words
if (strcmp(szKeyword,"for") == 0) {
levelNext++;
}
//handle folding for functions/labels
//Note: Functions and labels don't have an explicit end like [end function]
// 1. functions/labels end at the start of another function
// 2. functions/labels end at the end of the file
if ((strcmp(szKeyword,"function") == 0) || (szKeywordlen > 0 && szKeyword[0] == '@')) {
if (isFoldingAll) { //if we're folding the whole document (recursivly by lua script)
if (functionCount > 0) {
levelCurrent--;
} else {
levelNext++;
}
functionCount++;
} else { //if just folding a small piece (by clicking on the minus sign next to the word)
levelCurrent--;
}
}
// end the fold for these words before the current line
if (strcmp(szKeyword,"endif") == 0 || strcmp(szKeyword,"endfor") == 0) {
levelNext--;
levelCurrent--;
}
// end the fold for these words before the current line and Start new fold
if (strcmp(szKeyword,"else") == 0 || strcmp(szKeyword,"elseif") == 0 ) {
levelCurrent--;
}
}
// Preprocessor and Comment folding
int styleNext = GetStyleFirstWord(lineCurrent + 1,styler);
// *********************************
// Folding logic for Comment blocks
// *********************************
if (foldComment && IsStreamCommentStyle(style)) {
// Start of a comment block
if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) {
levelNext++;
}
// fold till the last line for normal comment lines
else if (IsStreamCommentStyle(stylePrev)
&& !(styleNext == SCE_POWERPRO_COMMENTLINE)
&& stylePrev == SCE_POWERPRO_COMMENTLINE
&& style == SCE_POWERPRO_COMMENTLINE) {
levelNext--;
}
// fold till the one but last line for Blockcomment lines
else if (IsStreamCommentStyle(stylePrev)
&& !(styleNext == SCE_POWERPRO_COMMENTBLOCK)
&& style == SCE_POWERPRO_COMMENTBLOCK) {
levelNext--;
levelCurrent--;
}
}
int levelUse = levelCurrent;
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);
}
// reset values for the next line
lineCurrent++;
stylePrev = style;
style = styleNext;
levelCurrent = levelNext;
visibleChars = 0;
// if the last characters are ;;+ then don't reset since the line continues on the next line.
if (chPrev == '+' && chPrevPrev == ';' && chPrevPrevPrev == ';') {
//do nothing
} else {
szKeywordlen = 0;
szDolen = 0;
FirstWordStart = false;
FirstWordEnd = false;
DoFoundLast = false;
//blank out keyword
for (unsigned int i = 0; i < KEYWORD_MAX; i++) {
szKeyword[i] = '\0';
}
}
}
// save the last processed characters
if ((ch > 0) && !isspacechar(ch)) {
chPrevPrevPrev = chPrevPrev;
chPrevPrev = chPrev;
chPrev = ch;
visibleChars++;
}
}
//close folds on the last line - without this a 'phantom'
//fold can appear when an open fold is on the last line
//this can occur because functions and labels don't have an explicit end
if (lineCurrent >= lastLine) {
int lev = 0;
lev |= SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(lineCurrent, lev);
}
}
static const char * const powerProWordLists[] = {
"Keyword list 1",
"Keyword list 2",
"Keyword list 3",
"Keyword list 4",
0,
};
static void ColourisePowerProDocWrapper(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false);
}
LexerModule lmPowerPro(SCLEX_POWERPRO, ColourisePowerProDocWrapper, "powerpro", FoldPowerProDoc, powerProWordLists);

View File

@ -39,19 +39,19 @@ static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '_');
}
enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit5 = 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];
WordList &keywords1 = *keywordlists[0]; // regular keywords
WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart
WordList &keywords3 = *keywordlists[2]; // block opening keywords
//WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented
int visibleChars = 0;
int mask;
int sentenceStartState; // true -> bit5 = 0
StyleContext sc(startPos, length, initStyle, styler);
@ -86,21 +86,21 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
}
}
// Determine if a new state should be terminated.
mask = sc.state & 0x10;
sentenceStartState = sc.state & 0x10;
switch (sc.state & 0xf) {
case SCE_4GL_OPERATOR:
sc.SetState(SCE_4GL_DEFAULT | mask);
sc.SetState(SCE_4GL_DEFAULT | sentenceStartState);
break;
case SCE_4GL_NUMBER:
if (!(IsADigit(sc.ch))) {
sc.SetState(SCE_4GL_DEFAULT | mask);
sc.SetState(SCE_4GL_DEFAULT | sentenceStartState);
}
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)) {
if (((sentenceStartState == 0) && keywords2.InList(s)) || keywords3.InList(s)) {
sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart);
}
else if (keywords1.InList(s)) {
@ -123,17 +123,17 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.atLineStart) {
sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart);
} else if (sc.ch == '*' && sc.chNext == '/') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState);
}
break;
case SCE_4GL_STRING:
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState);
}
break;
case SCE_4GL_CHARACTER:
if (sc.ch == '\'') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState);
}
break;
default:
@ -141,7 +141,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.ch == '*' && sc.chNext == '/') {
sc.Forward();
if ((sc.state & 0xf) == SCE_4GL_COMMENT1) {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState);
}
else
sc.SetState((sc.state & 0x1f) - 1);
@ -153,14 +153,14 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
}
// Determine if a new state should be entered.
mask = sc.state & 0x10;
sentenceStartState = 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 (IsAWordStart(sc.ch) || sc.ch == '@') {
sc.SetState(SCE_4GL_IDENTIFIER | sentenceStartState);
} else if (sc.ch == '/' && sc.chNext == '*') {
sc.SetState(SCE_4GL_COMMENT1 | mask);
sc.SetState(SCE_4GL_COMMENT1 | sentenceStartState);
sc.Forward();
} else if (sc.ch == '\"') {
sc.SetState(SCE_4GL_STRING | ResetSentenceStart);
@ -176,9 +176,12 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} 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))) {
/* This code allows highlight of handles. Alas, it would cause the frase "last-event:function"
to be recognized as a BlockBegin
if (sc.ch == ':')
sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);
else
else */
sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart);
}
}
@ -271,6 +274,4 @@ static const char * const FglWordLists[] = {
0,
};
LexerModule lmProgress(SCLEX_PS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists);
LexerModule lmProgress(SCLEX_PROGRESS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists);

View File

@ -24,17 +24,27 @@
using namespace Scintilla;
#endif
enum kwType { kwOther, kwClass, kwDef, kwImport };
/* kwCDef, kwCTypeName only used for Cython */
enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName };
static const int indicatorWhitespace = 1;
static bool IsPyComment(Accessor &styler, int pos, int len) {
return len > 0 && styler[pos] == '#';
}
static bool IsPyStringStart(int ch, int chNext, int chNext2) {
enum literalsAllowed { litNone=0, litU=1, litB=2};
static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
return
((allowed & litB) && (ch == 'b' || ch == 'B')) ||
((allowed & litU) && (ch == 'u' || ch == 'U'));
}
static bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) {
if (ch == '\'' || ch == '"')
return true;
if (ch == 'u' || ch == 'U') {
if (IsPyStringTypeChar(ch, allowed)) {
if (chNext == '"' || chNext == '\'')
return true;
if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
@ -47,16 +57,16 @@ static bool IsPyStringStart(int ch, int chNext, int chNext2) {
}
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex) {
static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, literalsAllowed allowed) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
// Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
// Advance beyond r, u, or ur prefix (or r, b, or br in Python 3.0), but bail if there are any unexpected chars
if (ch == 'r' || ch == 'R') {
i++;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == 'u' || ch == 'U') {
} else if (IsPyStringTypeChar(ch, allowed)) {
if (chNext == 'r' || chNext == 'R')
i += 2;
else
@ -105,19 +115,49 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
initStyle = styler.StyleAt(startPos - 1);
// Look for backslash-continued lines
while (lineCurrent > 0) {
int eolPos = styler.LineStart(lineCurrent) - 1;
int eolStyle = styler.StyleAt(eolPos);
if (eolStyle == SCE_P_STRING
|| eolStyle == SCE_P_CHARACTER
|| eolStyle == SCE_P_STRINGEOL) {
lineCurrent -= 1;
} else {
break;
}
}
startPos = styler.LineStart(lineCurrent);
}
initStyle = startPos == 0 ? SCE_P_DEFAULT : styler.StyleAt(startPos - 1);
}
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
// property tab.timmy.whinge.level
// For Python code, checks whether indenting is consistent.
// The default, 0 turns off indentation checking,
// 1 checks whether each line is potentially inconsistent with the previous line,
// 2 checks whether any space characters occur before a tab character in the indentation,
// 3 checks whether any spaces are in the indentation, and
// 4 checks for any tab characters in the indentation.
// 1 is a good level to use.
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
// property lexer.python.literals.binary
// Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712.
bool base2or8Literals = styler.GetPropertyInt("lexer.python.literals.binary", 1) != 0;
// property lexer.python.strings.u
// Set to 0 to not recognise Python Unicode literals u"x" as used before Python 3.
literalsAllowed allowedLiterals = (styler.GetPropertyInt("lexer.python.strings.u", 1)) ? litU : litNone;
// property lexer.python.strings.b
// Set to 0 to not recognise Python 3 bytes literals b"x".
if (styler.GetPropertyInt("lexer.python.strings.b", 1))
allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
initStyle = initStyle & 31;
if (initStyle == SCE_P_STRINGEOL) {
initStyle = SCE_P_DEFAULT;
@ -126,12 +166,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwType kwLast = kwOther;
int spaceFlags = 0;
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
bool hexadecimal = false;
bool base_n_number = false;
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
bool indentGood = true;
int startIndicator = sc.currentPos;
bool inContinuedString = false;
for (; sc.More(); sc.Forward()) {
@ -163,9 +204,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
lineCurrent++;
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (inContinuedString) {
inContinuedString = false;
} else {
sc.ChangeState(SCE_P_STRINGEOL);
sc.ForwardSetState(SCE_P_DEFAULT);
}
}
if (!sc.More())
break;
}
@ -178,7 +223,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_P_DEFAULT);
} else if (sc.state == SCE_P_NUMBER) {
if (!IsAWordChar(sc.ch) &&
!(!hexadecimal && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
!(!base_n_number && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
sc.SetState(SCE_P_DEFAULT);
}
} else if (sc.state == SCE_P_IDENTIFIER) {
@ -194,6 +239,23 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
style = SCE_P_CLASSNAME;
} else if (kwLast == kwDef) {
style = SCE_P_DEFNAME;
} else if (kwLast == kwCDef) {
int pos = sc.currentPos;
unsigned char ch = styler.SafeGetCharAt(pos, '\0');
while (ch != '\0') {
if (ch == '(') {
style = SCE_P_DEFNAME;
break;
} else if (ch == ':') {
style = SCE_P_CLASSNAME;
break;
} else if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
pos++;
ch = styler.SafeGetCharAt(pos, '\0');
} else {
break;
}
}
} else if (keywords2.InList(s)) {
style = SCE_P_WORD2;
}
@ -206,9 +268,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwLast = kwDef;
else if (0 == strcmp(s, "import"))
kwLast = kwImport;
else
else if (0 == strcmp(s, "cdef"))
kwLast = kwCDef;
else if (0 == strcmp(s, "cimport"))
kwLast = kwImport;
else if (kwLast != kwCDef)
kwLast = kwOther;
} else {
} else if (kwLast != kwCDef) {
kwLast = kwOther;
}
}
@ -225,7 +291,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) {
sc.Forward();
}
if (sc.chNext == '\n' || sc.chNext == '\r') {
inContinuedString = true;
} else {
// Don't roll over the newline.
sc.Forward();
}
} else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) {
sc.ForwardSetState(SCE_P_DEFAULT);
needEOLCheck = true;
@ -259,6 +330,11 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
indentGood = true;
}
// One cdef line, clear kwLast only at end of line
if (kwLast == kwCDef && sc.atLineEnd) {
kwLast = kwOther;
}
// State exit code may have moved on to end of line
if (needEOLCheck && sc.atLineEnd) {
lineCurrent++;
@ -271,20 +347,30 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if (sc.state == SCE_P_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) {
hexadecimal = true;
} else {
hexadecimal = false;
}
base_n_number = true;
sc.SetState(SCE_P_NUMBER);
} else if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch)) || sc.ch == '`') {
} else if (sc.ch == '0' &&
(sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) {
if (base2or8Literals) {
base_n_number = true;
sc.SetState(SCE_P_NUMBER);
} else {
sc.SetState(SCE_P_NUMBER);
sc.ForwardSetState(SCE_P_IDENTIFIER);
}
} else {
base_n_number = false;
sc.SetState(SCE_P_NUMBER);
}
} else if ((isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) || sc.ch == '`') {
sc.SetState(SCE_P_OPERATOR);
} else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
} else if (sc.ch == '@') {
sc.SetState(SCE_P_DECORATOR);
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) {
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) {
unsigned int nextIndex = 0;
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex));
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals));
while (nextIndex > (sc.currentPos + 1) && sc.More()) {
sc.Forward();
}
@ -321,7 +407,13 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
const int maxPos = startPos + length;
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
// property fold.comment.python
// This option enables folding multi-line comments when using the Python lexer.
const bool foldComment = styler.GetPropertyInt("fold.comment.python") != 0;
// property fold.quotes.python
// This option enables folding multi-line quoted strings when using the Python lexer.
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python") != 0;
// Backtrack to previous non-blank line so we can determine indent level
@ -459,3 +551,4 @@ static const char * const pythonWordListDesc[] = {
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,
pythonWordListDesc);

View File

@ -784,13 +784,13 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
state = SCE_RB_COMMENTLINE;
} else if (ch == '=') {
// =begin indicates the start of a comment (doc) block
if (i == 0 || isEOLChar(chPrev)
if (i == 0 || (isEOLChar(chPrev)
&& chNext == 'b'
&& styler.SafeGetCharAt(i + 2) == 'e'
&& styler.SafeGetCharAt(i + 3) == 'g'
&& styler.SafeGetCharAt(i + 4) == 'i'
&& styler.SafeGetCharAt(i + 5) == 'n'
&& !isSafeWordcharOrHigh(styler.SafeGetCharAt(i + 6))) {
&& !isSafeWordcharOrHigh(styler.SafeGetCharAt(i + 6)))) {
styler.ColourTo(i - 1, state);
state = SCE_RB_POD;
} else {

222
scintilla/src/LexSML.cxx Normal file
View File

@ -0,0 +1,222 @@
// Scintilla source code edit control
/** @file LexSML.cxx
** Lexer for SML.
**/
// Copyright 2009 by James Moffatt and Yuzhou Xin
// 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"
inline int issml(int c) {return isalnum(c) || c == '_';}
inline int issmlf(int c) {return isalpha(c) || c == '_';}
inline int issmld(int c) {return isdigit(c) || c == '_';}
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
void ColouriseSMLDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
StyleContext sc(startPos, length, initStyle, styler);
int nesting = 0;
if (sc.state < SCE_SML_STRING)
sc.state = SCE_SML_DEFAULT;
if (sc.state >= SCE_SML_COMMENT)
nesting = (sc.state & 0x0f) - SCE_SML_COMMENT;
int chBase = 0, chToken = 0, chLit = 0;
WordList& keywords = *keywordlists[0];
WordList& keywords2 = *keywordlists[1];
WordList& keywords3 = *keywordlists[2];
const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0);
while (sc.More()) {
int state2 = -1;
int chColor = sc.currentPos - 1;
bool advance = true;
switch (sc.state & 0x0f) {
case SCE_SML_DEFAULT:
chToken = sc.currentPos;
if (issmlf(sc.ch))
state2 = SCE_SML_IDENTIFIER;
else if (sc.Match('`') && issmlf(sc.chNext))
state2 = SCE_SML_TAGNAME;
else if (sc.Match('#')&&isdigit(sc.chNext))
state2 = SCE_SML_LINENUM;
else if (sc.Match('#','\"')){
state2 = SCE_SML_CHAR,chLit = 0;
sc.Forward();
}
else if (isdigit(sc.ch)) {
state2 = SCE_SML_NUMBER, chBase = 10;
if (sc.Match('0') && strchr("xX", sc.chNext))
chBase = 16, sc.Forward();}
else if (sc.Match('\"')&&sc.chPrev!='#')
state2 = SCE_SML_STRING;
else if (sc.Match('(', '*')){
state2 = SCE_SML_COMMENT,
sc.ch = ' ',
sc.Forward();}
else if (strchr("!~"
"=<>@^+-*/"
"()[];,:.#", sc.ch))
state2 = SCE_SML_OPERATOR;
break;
case SCE_SML_IDENTIFIER:
if (!(issml(sc.ch) || sc.Match('\''))) {
const int n = sc.currentPos - chToken;
if (n < 24) {
char t[24];
for (int i = -n; i < 0; i++)
t[n + i] = static_cast<char>(sc.GetRelative(i));
t[n] = '\0';
if ((n == 1 && sc.chPrev == '_') || keywords.InList(t))
sc.ChangeState(SCE_SML_KEYWORD);
else if (keywords2.InList(t))
sc.ChangeState(SCE_SML_KEYWORD2);
else if (keywords3.InList(t))
sc.ChangeState(SCE_SML_KEYWORD3);
}
state2 = SCE_SML_DEFAULT, advance = false;
}
break;
case SCE_SML_TAGNAME:
if (!(issml(sc.ch) || sc.Match('\'')))
state2 = SCE_SML_DEFAULT, advance = false;
break;
case SCE_SML_LINENUM:
if (!isdigit(sc.ch))
state2 = SCE_SML_DEFAULT, advance = false;
break;
case SCE_SML_OPERATOR: {
const char* o = 0;
if (issml(sc.ch) || isspace(sc.ch)
|| (o = strchr(")]};,\'\"`#", sc.ch),o)
|| !strchr("!$%&*+-./:<=>?@^|~", sc.ch)) {
if (o && strchr(")]};,", sc.ch)) {
if ((sc.Match(')') && sc.chPrev == '(')
|| (sc.Match(']') && sc.chPrev == '['))
sc.ChangeState(SCE_SML_KEYWORD);
chColor++;
} else
advance = false;
state2 = SCE_SML_DEFAULT;
}
break;
}
case SCE_SML_NUMBER:
if (issmld(sc.ch) || IsADigit(sc.ch, chBase))
break;
if ((sc.Match('l') || sc.Match('L') || sc.Match('n'))
&& (issmld(sc.chPrev) || IsADigit(sc.chPrev, chBase)))
break;
if (chBase == 10) {
if (sc.Match('.') && issmld(sc.chPrev))
break;
if ((sc.Match('e') || sc.Match('E'))
&& (issmld(sc.chPrev) || sc.chPrev == '.'))
break;
if ((sc.Match('+') || sc.Match('-'))
&& (sc.chPrev == 'e' || sc.chPrev == 'E'))
break;
}
state2 = SCE_SML_DEFAULT, advance = false;
break;
case SCE_SML_CHAR:
if (sc.Match('\\')) {
chLit = 1;
if (sc.chPrev == '\\')
sc.ch = ' ';
} else if ((sc.Match('\"') && sc.chPrev != '\\') || sc.atLineEnd) {
state2 = SCE_SML_DEFAULT;
chLit = 1;
if (sc.Match('\"'))
chColor++;
else
sc.ChangeState(SCE_SML_IDENTIFIER);
} else if (chLit < 1 && sc.currentPos - chToken >= 3)
sc.ChangeState(SCE_SML_IDENTIFIER), advance = false;
break;
case SCE_SML_STRING:
if (sc.Match('\\') && sc.chPrev == '\\')
sc.ch = ' ';
else if (sc.Match('\"') && sc.chPrev != '\\')
state2 = SCE_SML_DEFAULT, chColor++;
break;
case SCE_SML_COMMENT:
case SCE_SML_COMMENT1:
case SCE_SML_COMMENT2:
case SCE_SML_COMMENT3:
if (sc.Match('(', '*'))
state2 = sc.state + 1, chToken = sc.currentPos,
sc.ch = ' ',
sc.Forward(), nesting++;
else if (sc.Match(')') && sc.chPrev == '*') {
if (nesting)
state2 = (sc.state & 0x0f) - 1, chToken = 0, nesting--;
else
state2 = SCE_SML_DEFAULT;
chColor++;
} else if (useMagic && sc.currentPos - chToken == 4
&& sc.Match('c') && sc.chPrev == 'r' && sc.GetRelative(-2) == '@')
sc.state |= 0x10;
break;
}
if (state2 >= 0)
styler.ColourTo(chColor, sc.state), sc.ChangeState(state2);
if (advance)
sc.Forward();
}
sc.Complete();
}
void FoldSMLDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
//supress "not used" warnings
startPos || length || initStyle || keywordlists[0] || styler.Length();
}
static const char * const SMLWordListDesc[] = {
"Keywords",
"Keywords2",
"Keywords3",
0
};
LexerModule lmSML(SCLEX_SML, ColouriseSMLDoc, "SML", FoldSMLDoc, SMLWordListDesc);

View File

@ -61,7 +61,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
StyleContext sc(startPos, length, initStyle, styler);
// property sql.backslash.escapes
// Enables backslash as an escape character in SQL.
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
for (; sc.More(); sc.Forward()) {

205
scintilla/src/LexSorcus.cxx Normal file
View File

@ -0,0 +1,205 @@
// Scintilla source code edit control
/** @file LexSorcus.cxx
** Lexer for SORCUS installation files
** Written by Eugen Bitter and Christoph Baumann at SORCUS Computer, Heidelberg Germany
** Based on the ASM Lexer by The Black Horus
**/
// 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
//each character a..z and A..Z + '_' can be part of a keyword
//additionally numbers that follow 'M' can be contained in a keyword
static inline bool IsSWordStart(const int ch, const int prev_ch)
{
if (isalpha(ch) || (ch == '_') || ((isdigit(ch)) && (prev_ch == 'M')))
return true;
return false;
}
//only digits that are not preceded by 'M' count as a number
static inline bool IsSorcusNumber(const int ch, const int prev_ch)
{
if ((isdigit(ch)) && (prev_ch != 'M'))
return true;
return false;
}
//only = is a valid operator
static inline bool IsSorcusOperator(const int ch)
{
if (ch == '=')
return true;
return false;
}
static void ColouriseSorcusDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler)
{
WordList &Command = *keywordlists[0];
WordList &Parameter = *keywordlists[1];
WordList &Constant = *keywordlists[2];
// Do not leak onto next line
if (initStyle == SCE_SORCUS_STRINGEOL)
initStyle = SCE_SORCUS_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward())
{
// Prevent SCE_SORCUS_STRINGEOL from leaking back to previous line
if (sc.atLineStart && (sc.state == SCE_SORCUS_STRING))
{
sc.SetState(SCE_SORCUS_STRING);
}
// Determine if the current state should terminate.
if (sc.state == SCE_SORCUS_OPERATOR)
{
if (!IsSorcusOperator(sc.ch))
{
sc.SetState(SCE_SORCUS_DEFAULT);
}
}
else if(sc.state == SCE_SORCUS_NUMBER)
{
if(!IsSorcusNumber(sc.ch, sc.chPrev))
{
sc.SetState(SCE_SORCUS_DEFAULT);
}
}
else if (sc.state == SCE_SORCUS_IDENTIFIER)
{
if (!IsSWordStart(sc.ch, sc.chPrev))
{
char s[100];
sc.GetCurrent(s, sizeof(s));
if (Command.InList(s))
{
sc.ChangeState(SCE_SORCUS_COMMAND);
}
else if (Parameter.InList(s))
{
sc.ChangeState(SCE_SORCUS_PARAMETER);
}
else if (Constant.InList(s))
{
sc.ChangeState(SCE_SORCUS_CONSTANT);
}
sc.SetState(SCE_SORCUS_DEFAULT);
}
}
else if (sc.state == SCE_SORCUS_COMMENTLINE )
{
if (sc.atLineEnd)
{
sc.SetState(SCE_SORCUS_DEFAULT);
}
}
else if (sc.state == SCE_SORCUS_STRING)
{
if (sc.ch == '\"')
{
sc.ForwardSetState(SCE_SORCUS_DEFAULT);
}
else if (sc.atLineEnd)
{
sc.ChangeState(SCE_SORCUS_STRINGEOL);
sc.ForwardSetState(SCE_SORCUS_DEFAULT);
}
}
// Determine if a new state should be entered.
if (sc.state == SCE_SORCUS_DEFAULT)
{
if ((sc.ch == ';') || (sc.ch == '\''))
{
sc.SetState(SCE_SORCUS_COMMENTLINE);
}
else if (IsSWordStart(sc.ch, sc.chPrev))
{
sc.SetState(SCE_SORCUS_IDENTIFIER);
}
else if (sc.ch == '\"')
{
sc.SetState(SCE_SORCUS_STRING);
}
else if (IsSorcusOperator(sc.ch))
{
sc.SetState(SCE_SORCUS_OPERATOR);
}
else if (IsSorcusNumber(sc.ch, sc.chPrev))
{
sc.SetState(SCE_SORCUS_NUMBER);
}
}
}
sc.Complete();
}
static const char* const SorcusWordListDesc[] = {"Command","Parameter", "Constant", 0};
LexerModule lmSorc(SCLEX_SORCUS, ColouriseSorcusDoc, "sorcins", 0, SorcusWordListDesc);

397
scintilla/src/LexTACL.cxx Normal file
View File

@ -0,0 +1,397 @@
// Scintilla source code edit control
/** @file LexTAL.cxx
** Lexer for TAL
** Based on LexPascal.cxx
** Written by Laurent le Tynevez
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments)
** Updated by Rod Falck, Aug 2006 Converted to TACL
**/
#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
inline bool isTACLoperator(char ch)
{
return ch == '\'' || isoperator(ch);
}
inline bool isTACLwordchar(char ch)
{
return ch == '#' || ch == '^' || ch == '|' || ch == '_' || iswordchar(ch);
}
inline bool isTACLwordstart(char ch)
{
return ch == '#' || ch == '|' || ch == '_' || iswordstart(ch);
}
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 bool IsStreamCommentStyle(int style) {
return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR;
}
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
styler.ColourTo(end, SCE_C_REGEX);
} else
styler.ColourTo(end, attr);
}
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
static int classifyWordTACL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) {
int ret = 0;
WordList& keywords = *keywordlists[0];
WordList& builtins = *keywordlists[1];
WordList& commands = *keywordlists[2];
char s[100];
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.')) {
chAttr = SCE_C_NUMBER;
}
else {
if (s[0] == '#' || keywords.InList(s)) {
chAttr = SCE_C_WORD;
if (strcmp(s, "asm") == 0) {
ret = 2;
}
else if (strcmp(s, "end") == 0) {
ret = -1;
}
}
else if (s[0] == '|' || builtins.InList(s)) {
chAttr = SCE_C_WORD2;
}
else if (commands.InList(s)) {
chAttr = SCE_C_UUID;
}
else if (strcmp(s, "comment") == 0) {
chAttr = SCE_C_COMMENTLINE;
ret = 3;
}
}
ColourTo(styler, end, chAttr, (bInAsm && ret != -1));
return ret;
}
static int classifyFoldPointTACL(const char* s) {
int lev = 0;
if (s[0] == '[')
lev=1;
else if (s[0] == ']')
lev=-1;
return lev;
}
static void ColouriseTACLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
int state = initStyle;
if (state == SCE_C_CHARACTER) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
bool bInClassDefinition;
int currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
bInClassDefinition = (styler.GetLineState(currentLine) == 1);
} else {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
}
bool bInAsm = (state == SCE_C_REGEX);
if (bInAsm)
state = SCE_C_DEFAULT;
styler.StartSegment(startPos);
int visibleChars = 0;
unsigned int i;
for (i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
// Avoid triggering two times on Dos/Win
// End of line
if (state == SCE_C_CHARACTER) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
visibleChars = 0;
currentLine++;
styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (isTACLwordstart(ch)) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_IDENTIFIER;
} else if (ch == '{') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENT;
} else if (ch == '{' && chNext == '*') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '=' && chNext == '=') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTLINE;
} else if (ch == '"') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_STRING;
} else if (ch == '?' && visibleChars == 0) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_PREPROCESSOR;
} else if (isTACLoperator(ch)) {
ColourTo(styler, i-1, state, bInAsm);
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
} else if (state == SCE_C_IDENTIFIER) {
if (!isTACLwordchar(ch)) {
int lStateChange = classifyWordTACL(styler.GetStartSegment(), i - 1, keywordlists, styler, bInAsm);
if(lStateChange == 1) {
styler.SetLineState(currentLine, 1);
bInClassDefinition = true;
} else if(lStateChange == 2) {
bInAsm = true;
} else if(lStateChange == -1) {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
bInAsm = false;
}
if (lStateChange == 3) {
state = SCE_C_COMMENTLINE;
}
else {
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{') {
state = SCE_C_COMMENT;
} else if (ch == '{' && chNext == '*') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '=' && chNext == '=') {
state = SCE_C_COMMENTLINE;
} else if (ch == '"') {
state = SCE_C_STRING;
} else if (isTACLoperator(ch)) {
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENT) {
if (ch == '}' || (ch == '\r' || ch == '\n') ) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == '}' || (ch == '\r' || ch == '\n')) {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if (ch == '"' || ch == '\r' || ch == '\n') {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
}
if (!isspacechar(ch))
visibleChars++;
chPrev = ch;
}
// Process to end of document
if (state == SCE_C_IDENTIFIER) {
classifyWordTACL(styler.GetStartSegment(), i - 1, keywordlists, styler, bInAsm);
}
else
ColourTo(styler, lengthDoc - 1, state, bInAsm);
}
static void FoldTACLDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
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;
bool section = false;
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_C_DEFAULT && (style == SCE_C_WORD || style == SCE_C_PREPROCESSOR))
{
// Store last word start point.
lastStart = i;
}
if (stylePrev == SCE_C_WORD || stylePrev == SCE_C_PREPROCESSOR) {
if(isTACLwordchar(ch) && !isTACLwordchar(chNext)) {
char s[100];
getRange(lastStart, i, styler, s, sizeof(s));
if (stylePrev == SCE_C_PREPROCESSOR && strcmp(s, "?section") == 0)
{
section = true;
levelCurrent = 1;
levelPrev = 0;
}
else if (stylePrev == SCE_C_WORD)
levelCurrent += classifyFoldPointTACL(s);
}
}
if (style == SCE_C_OPERATOR) {
if (ch == '[') {
levelCurrent++;
} else if (ch == ']') {
levelCurrent--;
}
}
if (foldComment && (style == SCE_C_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelCurrent++;
} else if (chNext2 == '}') {
levelCurrent--;
}
}
}
if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
if (ch == '{' && chNext == '$') {
unsigned int j=i+2; // skip {$
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
if (styler.Match(j, "region") || styler.Match(j, "if")) {
levelCurrent++;
} else if (styler.Match(j, "end")) {
levelCurrent--;
}
}
}
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelCurrent--;
}
}
if (atEOL) {
int lev = levelPrev | SC_FOLDLEVELBASE;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev || section) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
section = false;
}
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);
}
static const char * const TACLWordListDesc[] = {
"Builtins",
"Labels",
"Commands",
0
};
LexerModule lmTACL(SCLEX_TACL, ColouriseTACLDoc, "TACL", FoldTACLDoc, TACLWordListDesc);

View File

@ -679,7 +679,7 @@ static const int T3_EXPECTINGPUNCTUATION = 1 << 14;
static inline bool IsStringTransition(int s1, int s2) {
return s1 != s2
&& (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING
|| s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT)
|| (s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT))
&& s2 != SCE_T3_LIB_DIRECTIVE
&& s2 != SCE_T3_MSG_PARAM
&& s2 != SCE_T3_HTML_TAG

396
scintilla/src/LexTAL.cxx Normal file
View File

@ -0,0 +1,396 @@
// Scintilla source code edit control
/** @file LexTAL.cxx
** Lexer for TAL
** Based on LexPascal.cxx
** Written by Laurent le Tynevez
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments)
** Updated by Rod Falck, Aug 2006 Converted to TAL
**/
#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
inline bool isTALoperator(char ch)
{
return ch == '\'' || ch == '@' || ch == '#' || isoperator(ch);
}
inline bool isTALwordchar(char ch)
{
return ch == '$' || ch == '^' || iswordchar(ch);
}
inline bool isTALwordstart(char ch)
{
return ch == '$' || ch == '^' || iswordstart(ch);
}
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 bool IsStreamCommentStyle(int style) {
return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR;
}
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
styler.ColourTo(end, SCE_C_REGEX);
} else
styler.ColourTo(end, attr);
}
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
static int classifyWordTAL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) {
int ret = 0;
WordList& keywords = *keywordlists[0];
WordList& builtins = *keywordlists[1];
WordList& nonreserved_keywords = *keywordlists[2];
char s[100];
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.')) {
chAttr = SCE_C_NUMBER;
}
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if (strcmp(s, "asm") == 0) {
ret = 2;
}
else if (strcmp(s, "end") == 0) {
ret = -1;
}
}
else if (s[0] == '$' || builtins.InList(s)) {
chAttr = SCE_C_WORD2;
}
else if (nonreserved_keywords.InList(s)) {
chAttr = SCE_C_UUID;
}
}
ColourTo(styler, end, chAttr, (bInAsm && ret != -1));
return ret;
}
static int classifyFoldPointTAL(const char* s) {
int lev = 0;
if (!(isdigit(s[0]) || (s[0] == '.'))) {
if (strcmp(s, "begin") == 0 ||
strcmp(s, "block") == 0) {
lev=1;
} else if (strcmp(s, "end") == 0) {
lev=-1;
}
}
return lev;
}
static void ColouriseTALDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
int state = initStyle;
if (state == SCE_C_CHARACTER) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
bool bInClassDefinition;
int currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
bInClassDefinition = (styler.GetLineState(currentLine) == 1);
} else {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
}
bool bInAsm = (state == SCE_C_REGEX);
if (bInAsm)
state = SCE_C_DEFAULT;
styler.StartSegment(startPos);
int visibleChars = 0;
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
// Avoid triggering two times on Dos/Win
// End of line
if (state == SCE_C_CHARACTER) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
visibleChars = 0;
currentLine++;
styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (isTALwordstart(ch)) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_IDENTIFIER;
} else if (ch == '!' && chNext != '*') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENT;
} else if (ch == '!' && chNext == '*') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '-' && chNext == '-') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTLINE;
} else if (ch == '"') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_STRING;
} else if (ch == '?' && visibleChars == 0) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_PREPROCESSOR;
} else if (isTALoperator(ch)) {
ColourTo(styler, i-1, state, bInAsm);
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
} else if (state == SCE_C_IDENTIFIER) {
if (!isTALwordchar(ch)) {
int lStateChange = classifyWordTAL(styler.GetStartSegment(), i - 1, keywordlists, styler, bInAsm);
if(lStateChange == 1) {
styler.SetLineState(currentLine, 1);
bInClassDefinition = true;
} else if(lStateChange == 2) {
bInAsm = true;
} else if(lStateChange == -1) {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
bInAsm = false;
}
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '!' && chNext != '*') {
state = SCE_C_COMMENT;
} else if (ch == '!' && chNext == '*') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '"') {
state = SCE_C_STRING;
} else if (isTALoperator(ch)) {
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENT) {
if (ch == '!' || (ch == '\r' || ch == '\n') ) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == '!' || (ch == '\r' || ch == '\n')) {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if (ch == '"') {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
}
if (!isspacechar(ch))
visibleChars++;
chPrev = ch;
}
ColourTo(styler, lengthDoc - 1, state, bInAsm);
}
static void FoldTALDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
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;
bool was_end = false;
bool section = false;
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_C_DEFAULT && (style == SCE_C_WORD || style == SCE_C_UUID || style == SCE_C_PREPROCESSOR))
{
// Store last word start point.
lastStart = i;
}
if (stylePrev == SCE_C_WORD || style == SCE_C_UUID || stylePrev == SCE_C_PREPROCESSOR) {
if(isTALwordchar(ch) && !isTALwordchar(chNext)) {
char s[100];
getRange(lastStart, i, styler, s, sizeof(s));
if (stylePrev == SCE_C_PREPROCESSOR && strcmp(s, "?section") == 0)
{
section = true;
levelCurrent = 1;
levelPrev = 0;
}
else if (stylePrev == SCE_C_WORD || stylePrev == SCE_C_UUID)
{
if (strcmp(s, "block") == 0)
{
// block keyword is ignored immediately after end keyword
if (!was_end)
levelCurrent++;
}
else
levelCurrent += classifyFoldPointTAL(s);
if (strcmp(s, "end") == 0)
{
was_end = true;
}
else
{
was_end = false;
}
}
}
}
if (foldComment && (style == SCE_C_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelCurrent++;
} else if (chNext2 == '}') {
levelCurrent--;
}
}
}
if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
if (ch == '{' && chNext == '$') {
unsigned int j=i+2; // skip {$
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
if (styler.Match(j, "region") || styler.Match(j, "if")) {
levelCurrent++;
} else if (styler.Match(j, "end")) {
levelCurrent--;
}
}
}
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelCurrent--;
}
}
if (atEOL) {
int lev = levelPrev | SC_FOLDLEVELBASE;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev || section) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
section = false;
}
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);
}
static const char * const TALWordListDesc[] = {
"Keywords",
"Builtins",
0
};
LexerModule lmTAL(SCLEX_TAL, ColouriseTALDoc, "TAL", FoldTALDoc, TALWordListDesc);

View File

@ -243,7 +243,10 @@ static void ColouriseTeXDoc(
}
if (isTeXzero(sc.ch)) {
sc.SetState(SCE_TEX_SYMBOL);
if (!endOfLine(styler,sc.currentPos + 1))
sc.ForwardSetState(SCE_TEX_DEFAULT) ;
inComment = ! processComment ;
newifDone = false ;
} else if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) {

View File

@ -248,7 +248,7 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
styler.Match(j, "generate") ||
styler.Match(j, "specify") ||
styler.Match(j, "primitive") ||
styler.Match(j, "module") && foldAtModule ||
(styler.Match(j, "module") && foldAtModule) ||
styler.Match(j, "begin")) {
levelNext++;
} else if (styler.Match(j, "endcase") ||
@ -259,8 +259,8 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
styler.Match(j, "endtable") ||
styler.Match(j, "endspecify") ||
styler.Match(j, "endprimitive") ||
styler.Match(j, "endmodule") && foldAtModule ||
styler.Match(j, "end") && !IsAWordChar(styler.SafeGetCharAt(j+3))) {
(styler.Match(j, "endmodule") && foldAtModule) ||
(styler.Match(j, "end") && !IsAWordChar(styler.SafeGetCharAt(j+3)))) {
levelNext--;
}
}

View File

@ -3,7 +3,7 @@
** Lexer for YAML.
**/
// Copyright 2003- by Sean O'Dell <sean@celsoft.com>
// Release under the same license as Scintilla/SciTE.
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>

464
scintilla/src/PerLine.cxx Normal file
View File

@ -0,0 +1,464 @@
// Scintilla source code edit control
/** @file PerLine.cxx
** Manages data associated with each line of the document
**/
// Copyright 1998-2009 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 "Scintilla.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "CellBuffer.h"
#include "PerLine.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
MarkerHandleSet::MarkerHandleSet() {
root = 0;
}
MarkerHandleSet::~MarkerHandleSet() {
MarkerHandleNumber *mhn = root;
while (mhn) {
MarkerHandleNumber *mhnToFree = mhn;
mhn = mhn->next;
delete mhnToFree;
}
root = 0;
}
int MarkerHandleSet::Length() const {
int c = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
c++;
mhn = mhn->next;
}
return c;
}
int MarkerHandleSet::NumberFromHandle(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return mhn->number;
}
mhn = mhn->next;
}
return - 1;
}
int MarkerHandleSet::MarkValue() const {
unsigned int m = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
m |= (1 << mhn->number);
mhn = mhn->next;
}
return m;
}
bool MarkerHandleSet::Contains(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return true;
}
mhn = mhn->next;
}
return false;
}
bool MarkerHandleSet::InsertHandle(int handle, int markerNum) {
MarkerHandleNumber *mhn = new MarkerHandleNumber;
if (!mhn)
return false;
mhn->handle = handle;
mhn->number = markerNum;
mhn->next = root;
root = mhn;
return true;
}
void MarkerHandleSet::RemoveHandle(int handle) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->handle == handle) {
*pmhn = mhn->next;
delete mhn;
return;
}
pmhn = &((*pmhn)->next);
}
}
bool MarkerHandleSet::RemoveNumber(int markerNum) {
bool performedDeletion = false;
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->number == markerNum) {
*pmhn = mhn->next;
delete mhn;
performedDeletion = true;
} else {
pmhn = &((*pmhn)->next);
}
}
return performedDeletion;
}
void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
pmhn = &((*pmhn)->next);
}
*pmhn = other->root;
other->root = 0;
}
LineMarkers::~LineMarkers() {
for (int line = 0; line < markers.Length(); line++) {
delete markers[line];
markers[line] = 0;
}
markers.DeleteAll();
}
void LineMarkers::InsertLine(int line) {
if (markers.Length()) {
markers.Insert(line, 0);
}
}
void LineMarkers::RemoveLine(int line) {
// Retain the markers from the deleted line by oring them into the previous line
if (markers.Length()) {
if (line > 0) {
MergeMarkers(line - 1);
}
markers.Delete(line);
}
}
int LineMarkers::LineFromHandle(int markerHandle) {
if (markers.Length()) {
for (int line = 0; line < markers.Length(); line++) {
if (markers[line]) {
if (markers[line]->Contains(markerHandle)) {
return line;
}
}
}
}
return -1;
}
void LineMarkers::MergeMarkers(int pos) {
if (markers[pos + 1] != NULL) {
if (markers[pos] == NULL)
markers[pos] = new MarkerHandleSet;
markers[pos]->CombineWith(markers[pos + 1]);
delete markers[pos + 1];
markers[pos + 1] = NULL;
}
}
int LineMarkers::MarkValue(int line) {
if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line])
return markers[line]->MarkValue();
else
return 0;
}
int LineMarkers::AddMark(int line, int markerNum, int lines) {
handleCurrent++;
if (!markers.Length()) {
// No existing markers so allocate one element per line
markers.InsertValue(0, lines, 0);
}
if (!markers[line]) {
// Need new structure to hold marker handle
markers[line] = new MarkerHandleSet();
if (!markers[line])
return - 1;
}
markers[line]->InsertHandle(handleCurrent, markerNum);
return handleCurrent;
}
void LineMarkers::DeleteMark(int line, int markerNum, bool all) {
if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) {
if (markerNum == -1) {
delete markers[line];
markers[line] = NULL;
} else {
bool performedDeletion = markers[line]->RemoveNumber(markerNum);
while (all && performedDeletion) {
performedDeletion = markers[line]->RemoveNumber(markerNum);
}
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
}
void LineMarkers::DeleteMarkFromHandle(int markerHandle) {
int line = LineFromHandle(markerHandle);
if (line >= 0) {
markers[line]->RemoveHandle(markerHandle);
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
LineLevels::~LineLevels() {
}
void LineLevels::InsertLine(int line) {
if (levels.Length()) {
int level = SC_FOLDLEVELBASE;
if ((line > 0) && (line < levels.Length())) {
level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG;
}
levels.InsertValue(line, 1, level);
}
}
void LineLevels::RemoveLine(int line) {
if (levels.Length()) {
// Move up following lines but merge header flag from this line
// to line before to avoid a temporary disappearence causing expansion.
int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG;
levels.Delete(line);
if (line > 0)
levels[line-1] |= firstHeader;
}
}
void LineLevels::ExpandLevels(int sizeNew) {
levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE);
}
void LineLevels::ClearLevels() {
levels.DeleteAll();
}
int LineLevels::SetLevel(int line, int level, int lines) {
int prev = 0;
if ((line >= 0) && (line < lines)) {
if (!levels.Length()) {
ExpandLevels(lines + 1);
}
prev = levels[line];
if (prev != level) {
levels[line] = level;
}
}
return prev;
}
int LineLevels::GetLevel(int line) {
if (levels.Length() && (line >= 0) && (line < levels.Length())) {
return levels[line];
} else {
return SC_FOLDLEVELBASE;
}
}
LineState::~LineState() {
}
void LineState::InsertLine(int line) {
if (lineStates.Length()) {
lineStates.EnsureLength(line);
lineStates.Insert(line, 0);
}
}
void LineState::RemoveLine(int line) {
if (lineStates.Length() > line) {
lineStates.Delete(line);
}
}
int LineState::SetLineState(int line, int state) {
lineStates.EnsureLength(line + 1);
int stateOld = lineStates[line];
lineStates[line] = state;
return stateOld;
}
int LineState::GetLineState(int line) {
lineStates.EnsureLength(line + 1);
return lineStates[line];
}
int LineState::GetMaxLineState() {
return lineStates.Length();
}
static int NumberLines(const char *text) {
if (text) {
int newLines = 0;
while (*text) {
if (*text == '\n')
newLines++;
text++;
}
return newLines+1;
} else {
return 0;
}
}
// Each allocated LineAnnotation is a char array which starts with an AnnotationHeader
// and then has text and optional styles.
static const int IndividualStyles = 0x100;
struct AnnotationHeader {
short style; // Style IndividualStyles implies array of styles
short lines;
int length;
};
LineAnnotation::~LineAnnotation() {
ClearAll();
}
void LineAnnotation::InsertLine(int line) {
if (annotations.Length()) {
annotations.Insert(line, 0);
}
}
void LineAnnotation::RemoveLine(int line) {
if (annotations.Length() && (line < annotations.Length())) {
delete []annotations[line];
annotations.Delete(line);
}
}
bool LineAnnotation::AnySet() const {
return annotations.Length() > 0;
}
bool LineAnnotation::MultipleStyles(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->style == IndividualStyles;
else
return 0;
}
int LineAnnotation::Style(int line) {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->style;
else
return 0;
}
const char *LineAnnotation::Text(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return annotations[line]+sizeof(AnnotationHeader);
else
return 0;
}
const unsigned char *LineAnnotation::Styles(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line] && MultipleStyles(line))
return reinterpret_cast<unsigned char *>(annotations[line] + sizeof(AnnotationHeader) + Length(line));
else
return 0;
}
static char *AllocateAnnotation(int length, int style) {
size_t len = sizeof(AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0);
char *ret = new char[len];
memset(ret, 0, len);
return ret;
}
void LineAnnotation::SetText(int line, const char *text) {
if (text) {
annotations.EnsureLength(line+1);
int style = Style(line);
if (annotations[line]) {
delete []annotations[line];
}
annotations[line] = AllocateAnnotation(strlen(text), style);
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader*>(annotations[line]);
pah->style = static_cast<short>(style);
pah->length = strlen(text);
pah->lines = static_cast<short>(NumberLines(text));
memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length);
} else {
if (annotations.Length() && (line < annotations.Length()) && annotations[line]) {
delete []annotations[line];
annotations[line] = 0;
}
}
}
void LineAnnotation::ClearAll() {
for (int line = 0; line < annotations.Length(); line++) {
delete []annotations[line];
annotations[line] = 0;
}
annotations.DeleteAll();
}
void LineAnnotation::SetStyle(int line, int style) {
annotations.EnsureLength(line+1);
if (!annotations[line]) {
annotations[line] = AllocateAnnotation(0, style);
}
reinterpret_cast<AnnotationHeader *>(annotations[line])->style = static_cast<short>(style);
}
void LineAnnotation::SetStyles(int line, const unsigned char *styles) {
annotations.EnsureLength(line+1);
if (!annotations[line]) {
annotations[line] = AllocateAnnotation(0, IndividualStyles);
} else {
AnnotationHeader *pahSource = reinterpret_cast<AnnotationHeader *>(annotations[line]);
if (pahSource->style != IndividualStyles) {
char *allocation = AllocateAnnotation(pahSource->length, IndividualStyles);
AnnotationHeader *pahAlloc = reinterpret_cast<AnnotationHeader *>(allocation);
pahAlloc->length = pahSource->length;
pahAlloc->lines = pahSource->lines;
memcpy(allocation + sizeof(AnnotationHeader), annotations[line] + sizeof(AnnotationHeader), pahSource->length);
delete []annotations[line];
annotations[line] = allocation;
}
}
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
pah->style = IndividualStyles;
memcpy(annotations[line] + sizeof(AnnotationHeader) + pah->length, styles, pah->length);
}
int LineAnnotation::Length(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->length;
else
return 0;
}
int LineAnnotation::Lines(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->lines;
else
return 0;
}

116
scintilla/src/PerLine.h Normal file
View File

@ -0,0 +1,116 @@
// Scintilla source code edit control
/** @file PerLine.h
** Manages data associated with each line of the document
**/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PERLINE_H
#define PERLINE_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
*/
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
/**
* A marker handle set contains any number of MarkerHandleNumbers.
*/
class MarkerHandleSet {
MarkerHandleNumber *root;
public:
MarkerHandleSet();
~MarkerHandleSet();
int Length() const;
int NumberFromHandle(int handle) const;
int MarkValue() const; ///< Bit set of marker numbers.
bool Contains(int handle) const;
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
bool RemoveNumber(int markerNum);
void CombineWith(MarkerHandleSet *other);
};
class LineMarkers : public PerLine {
SplitVector<MarkerHandleSet *> markers;
/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
public:
LineMarkers() : handleCurrent(0) {
}
virtual ~LineMarkers();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int MarkValue(int line);
int AddMark(int line, int marker, int lines);
void MergeMarkers(int pos);
void DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
};
class LineLevels : public PerLine {
SplitVector<int> levels;
public:
virtual ~LineLevels();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
void ExpandLevels(int sizeNew=-1);
void ClearLevels();
int SetLevel(int line, int level, int lines);
int GetLevel(int line);
};
class LineState : public PerLine {
SplitVector<int> lineStates;
public:
LineState() {
}
virtual ~LineState();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
};
class LineAnnotation : public PerLine {
SplitVector<char *> annotations;
public:
LineAnnotation() {
}
virtual ~LineAnnotation();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
bool AnySet() const;
bool MultipleStyles(int line) const;
int Style(int line);
const char *Text(int line) const;
const unsigned char *Styles(int line) const;
void SetText(int line, const char *text);
void ClearAll();
void SetStyle(int line, int style);
void SetStyles(int line, const unsigned char *styles);
int Length(int line) const;
int Lines(int line) const;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -126,8 +126,8 @@ int LineLayout::LineLastVisible(int line) const {
}
bool LineLayout::InLine(int offset, int line) const {
return ((offset >= LineStart(line)) && (offset < LineStart(line + 1)) ||
((offset == numCharsInLine) && (line == (lines-1))));
return ((offset >= LineStart(line)) && (offset < LineStart(line + 1))) ||
((offset == numCharsInLine) && (line == (lines-1)));
}
void LineLayout::SetLineStart(int line, int start) {

View File

@ -449,11 +449,12 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
char mask; /* xor mask -CCL/NCL */
int c1, c2, prevChar;
if (!pattern || !length)
if (!pattern || !length) {
if (sta)
return 0;
else
return badpat("No previous regular expression");
}
sta = NOP;
const char *p=pattern; /* pattern pointer */
@ -875,7 +876,7 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
eopat[*ap++] = lp;
break;
case BOW:
if (lp!=bol && iswordc(ci.CharAt(lp-1)) || !iswordc(ci.CharAt(lp)))
if ((lp!=bol && iswordc(ci.CharAt(lp-1))) || !iswordc(ci.CharAt(lp)))
return NOTFOUND;
break;
case EOW:

View File

@ -2,5 +2,5 @@
# settings made in SciTEGlobal.properties
command.build.directory.*.cxx=..\win32
command.build.directory.*.h=..\win32
command.build.*.cxx=nmake -f scintilla.mak QUIET=1 DEBUG=1
command.build.*.h=nmake -f scintilla.mak QUIET=1 DEBUG=1
command.build.*.cxx=nmake -f scintilla.mak QUIET=1 DEBUG=0
command.build.*.h=nmake -f scintilla.mak QUIET=1 DEBUG=0

View File

@ -329,6 +329,11 @@ void ScintillaBase::AutoCompleteCharacterDeleted() {
} else {
AutoCompleteMoveToCurrentWord();
}
SCNotification scn = {0};
scn.nmhdr.code = SCN_AUTOCCHARDELETED;
scn.wParam = 0;
scn.listType = 0;
NotifyParent(scn);
}
void ScintillaBase::AutoCompleteCompleted() {
@ -381,6 +386,8 @@ void ScintillaBase::AutoCompleteCompleted() {
}
int ScintillaBase::AutoCompleteGetCurrent() {
if (!ac.Active())
return -1;
return ac.lb->GetSelection();
}

View File

@ -43,7 +43,7 @@ protected:
/// reallocating if more space needed.
void RoomFor(int insertionLength) {
if (gapLength <= insertionLength) {
if (growSize * 6 < size)
while (growSize < size / 6)
growSize *= 2;
ReAllocate(size + insertionLength + growSize);
}

View File

@ -48,7 +48,7 @@ void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned
i++;
unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff);
putf[k++] = static_cast<char>(0xF0 | (xch >> 18));
putf[k++] = static_cast<char>(0x80 | (xch >> 12) & 0x3f);
putf[k++] = static_cast<char>(0x80 | ((xch >> 12) & 0x3f));
putf[k++] = static_cast<char>(0x80 | ((xch >> 6) & 0x3f));
putf[k++] = static_cast<char>(0x80 | (xch & 0x3f));
} else {

View File

@ -140,6 +140,11 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
viewEOL = source.viewEOL;
showMarkedLines = source.showMarkedLines;
extraFontFlag = source.extraFontFlag;
extraAscent = source.extraAscent;
extraDescent = source.extraDescent;
marginStyleOffset = source.marginStyleOffset;
annotationVisible = source.annotationVisible;
annotationStyleOffset = source.annotationStyleOffset;
}
ViewStyle::~ViewStyle() {
@ -235,6 +240,11 @@ void ViewStyle::Init(size_t stylesSize_) {
viewEOL = false;
showMarkedLines = true;
extraFontFlag = false;
extraAscent = 0;
extraDescent = 0;
marginStyleOffset = 0;
annotationVisible = ANNOTATION_HIDDEN;
annotationStyleOffset = 0;
}
void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
@ -286,6 +296,8 @@ void ViewStyle::Refresh(Surface &surface) {
someStylesProtected = true;
}
}
maxAscent += extraAscent;
maxDescent += extraDescent;
lineHeight = maxAscent + maxDescent;
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
@ -324,7 +336,7 @@ void ViewStyle::AllocStyles(size_t sizeNew) {
void ViewStyle::EnsureStyle(size_t index) {
if (index >= stylesSize) {
size_t sizeNew = stylesSize * 2;
while (sizeNew < index)
while (sizeNew <= index)
sizeNew *= 2;
AllocStyles(sizeNew);
}
@ -359,3 +371,8 @@ void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
bool ViewStyle::ProtectionActive() const {
return someStylesProtected;
}
bool ViewStyle::ValidStyle(size_t styleIndex) const {
return styleIndex < stylesSize;
}

View File

@ -103,6 +103,11 @@ public:
int caretWidth;
bool someStylesProtected;
bool extraFontFlag;
int extraAscent;
int extraDescent;
int marginStyleOffset;
int annotationVisible;
int annotationStyleOffset;
ViewStyle();
ViewStyle(const ViewStyle &source);
@ -116,6 +121,7 @@ public:
void ClearStyles();
void SetStyleFontName(int styleIndex, const char *name);
bool ProtectionActive() const;
bool ValidStyle(size_t styleIndex) const;
};
#ifdef SCI_NAMESPACE

View File

@ -43,8 +43,8 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SciLexer_EXPORTS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /G6 /MT /W4 /O1 /I "..\include" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /Fr /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD CPP /nologo /G6 /MT /W4 /O1 /I "..\include" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /FD /c
# SUBTRACT CPP /Fr /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@ -206,6 +206,10 @@ SOURCE=..\src\LexCmake.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexCOBOL.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexConf.cxx
# End Source File
# Begin Source File
@ -318,11 +322,11 @@ SOURCE=..\src\LexMySQL.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexNsis.cxx
SOURCE=..\src\LexNimrod.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexObjC.cxx
SOURCE=..\src\LexNsis.cxx
# End Source File
# Begin Source File
@ -354,6 +358,10 @@ SOURCE=..\src\LexPOV.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexPowerPro.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexPowerShell.cxx
# End Source File
# Begin Source File
@ -386,11 +394,15 @@ SOURCE=..\src\LexScriptol.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexSearchResult.cxx
SOURCE=..\src\LexSmalltalk.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexSmalltalk.cxx
SOURCE=..\src\LexSML.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexSorcus.cxx
# End Source File
# Begin Source File
@ -410,6 +422,14 @@ SOURCE=..\src\LexTADS3.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexTACL.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexTAL.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexTCL.cxx
# End Source File
# Begin Source File
@ -418,10 +438,6 @@ SOURCE=..\src\LexTeX.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexUser.cxx
# End Source File
# Begin Source File
SOURCE=..\src\LexVB.cxx
# End Source File
# Begin Source File
@ -442,6 +458,10 @@ SOURCE=..\src\LineMarker.cxx
# End Source File
# Begin Source File
SOURCE=..\src\PerLine.cxx
# End Source File
# Begin Source File
SOURCE=..\win32\PlatWin.cxx
# End Source File
# Begin Source File

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="8,00"
Name="SciLexer"
ProjectGUID="{D8F4910A-6110-4924-8D40-B382E821A8F6}"
TargetFrameworkVersion="131072"
ProjectGUID="{B1BDB077-3ED7-4C69-9A22-5A65E08C201C}"
RootNamespace="SciLexer"
>
<Platforms>
<Platform
@ -16,10 +16,10 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\../../Build"
OutputDirectory=".\../bin"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops;..\..\PowerEditor\visual.net\no_ms_shit.vsprops"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
@ -76,13 +76,11 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="imm32.lib comctl32.lib"
OutputFile=".\../../Build/SciLexer.dll"
OutputFile=".\../bin/SciLexer.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\../bin/SciLexer.pdb"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\../bin/SciLexer.lib"
TargetMachine="1"
/>
@ -106,6 +104,9 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -115,7 +116,7 @@
OutputDirectory=".\../bin"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops;..\..\PowerEditor\visual.net\no_ms_shit.vsprops"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
@ -145,7 +146,6 @@
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
FavorSizeOrSpeed="2"
AdditionalIncludeDirectories="..\include,..\src"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;SCI_LEXER"
StringPooling="true"
@ -155,8 +155,6 @@
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="2"
BrowseInformationFile=".\Release/"
WarningLevel="4"
SuppressStartupBanner="true"
/>
@ -180,8 +178,6 @@
GenerateMapFile="true"
MapFileName=".\Release/SciLexer.map"
OptimizeForWindows98="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\../bin/SciLexer.lib"
TargetMachine="1"
/>
@ -205,6 +201,9 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -330,6 +329,24 @@
<File
RelativePath="..\src\Decoration.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\Document.cxx"
@ -488,6 +505,24 @@
<File
RelativePath="..\src\LexAbaqus.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexAda.cxx"
@ -580,6 +615,24 @@
<File
RelativePath="..\src\LexASY.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexAU3.cxx"
@ -779,6 +832,28 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexCOBOL.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexConf.cxx"
>
@ -1046,6 +1121,24 @@
<File
RelativePath="..\src\LexGAP.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexGui4Cli.cxx"
@ -1226,6 +1319,24 @@
<File
RelativePath="..\src\LexMagik.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexMatlab.cxx"
@ -1337,6 +1448,50 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexMySQL.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexNimrod.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexNsis.cxx"
>
@ -1362,24 +1517,6 @@
<File
RelativePath="..\src\LexObjC.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexOpal.cxx"
@ -1494,6 +1631,24 @@
<File
RelativePath="..\src\LexPLM.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexPOV.cxx"
@ -1517,13 +1672,71 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexPowerPro.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexPowerShell.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexProgress.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexPS.cxx"
@ -1572,6 +1785,24 @@
<File
RelativePath="..\src\LexR.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexRebol.cxx"
@ -1642,6 +1873,10 @@
<File
RelativePath="..\src\LexSearchResult.cxx"
>
</File>
<File
RelativePath="..\src\LexSmalltalk.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
@ -1662,7 +1897,29 @@
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexSmalltalk.cxx"
RelativePath="..\src\LexSML.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexSorcus.cxx"
>
<FileConfiguration
Name="Debug|Win32"
@ -1749,6 +2006,28 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexTACL.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexTADS3.cxx"
>
@ -1771,6 +2050,28 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexTAL.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexTCL.cxx"
>
@ -1818,24 +2119,6 @@
<File
RelativePath="..\src\LexUser.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\LexVB.cxx"
@ -1947,6 +2230,28 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\PerLine.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\win32\PlatWin.cxx"
>
@ -1972,6 +2277,24 @@
<File
RelativePath="..\src\PositionCache.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\PropSet.cxx"
@ -2020,6 +2343,24 @@
<File
RelativePath="..\src\RunStyles.cxx"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\ScintillaBase.cxx"
@ -2065,6 +2406,28 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\win32\ScintRes.rc"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\source\scintilla.178\win32"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\source\scintilla.178\win32"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\Style.cxx"
>
@ -2202,146 +2565,10 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\include\Accessor.h"
>
</File>
<File
RelativePath="..\src\AutoComplete.h"
>
</File>
<File
RelativePath="..\src\CallTip.h"
>
</File>
<File
RelativePath="..\src\CellBuffer.h"
>
</File>
<File
RelativePath="..\src\CharacterSet.h"
>
</File>
<File
RelativePath="..\src\CharClassify.h"
>
</File>
<File
RelativePath="..\src\ContractionState.h"
>
</File>
<File
RelativePath="..\src\Decoration.h"
>
</File>
<File
RelativePath="..\src\Document.h"
>
</File>
<File
RelativePath="..\src\DocumentAccessor.h"
>
</File>
<File
RelativePath="..\src\Editor.h"
>
</File>
<File
RelativePath="..\src\ExternalLexer.h"
>
</File>
<File
RelativePath="..\src\Indicator.h"
>
</File>
<File
RelativePath="..\src\KeyMap.h"
>
</File>
<File
RelativePath="..\include\KeyWords.h"
>
</File>
<File
RelativePath="..\src\LineMarker.h"
>
</File>
<File
RelativePath="..\src\Partitioning.h"
>
</File>
<File
RelativePath="..\include\Platform.h"
>
</File>
<File
RelativePath="..\src\PositionCache.h"
>
</File>
<File
RelativePath="..\include\PropSet.h"
>
</File>
<File
RelativePath="..\src\RESearch.h"
>
</File>
<File
RelativePath="..\src\RunStyles.h"
>
</File>
<File
RelativePath="..\include\SciLexer.h"
>
</File>
<File
RelativePath="..\include\Scintilla.h"
>
</File>
<File
RelativePath="..\src\ScintillaBase.h"
>
</File>
<File
RelativePath="..\include\ScintillaWidget.h"
>
</File>
<File
RelativePath="..\src\SplitVector.h"
>
</File>
<File
RelativePath="..\include\SString.h"
>
</File>
<File
RelativePath="..\src\Style.h"
>
</File>
<File
RelativePath="..\src\StyleContext.h"
>
</File>
<File
RelativePath="..\src\SVector.h"
>
</File>
<File
RelativePath="..\src\UniConversion.h"
>
</File>
<File
RelativePath="..\src\ViewStyle.h"
>
</File>
<File
RelativePath="..\include\WindowAccessor.h"
>
</File>
<File
RelativePath="..\src\XPM.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

View File

@ -1 +1 @@
177
178

View File

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

View File

@ -53,20 +53,21 @@ deps:
LEXOBJS=\
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 \
LexMySQL.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o LexPB.o LexPerl.o \
LexPLM.o LexPOV.o LexPowerShell.o LexProgress.o LexPS.o LexPython.o LexR.o \
LexRebol.o LexRuby.o LexScriptol.o LexSmalltalk.o LexSpecman.o LexSpice.o \
LexSQL.o LexTADS3.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
LexCOBOL.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 LexMySQL.o LexNimrod.o LexNsis.o LexOpal.o LexOthers.o LexPascal.o \
LexPB.o LexPerl.o LexPLM.o LexPOV.o LexPowerPro.o LexPowerShell.o \
LexProgress.o LexPS.o LexPython.o LexR.o LexRebol.o LexRuby.o LexScriptol.o \
LexSmalltalk.o LexSML.o LexSorcus.o LexSpecman.o LexSpice.o LexSQL.o LexTACL.o \
LexTADS3.o LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
#--Autogenerated -- end of automatically generated section
SOBJS = ScintillaWin.o ScintillaBase.o Editor.o CharClassify.o Decoration.o \
Document.o ContractionState.o CellBuffer.o CallTip.o \
ScintRes.o PlatWin.o PositionCache.o KeyMap.o Indicator.o LineMarker.o RESearch.o RunStyles.o \
Style.o ViewStyle.o AutoComplete.o UniConversion.o PropSet.o XPM.o
Style.o ViewStyle.o AutoComplete.o UniConversion.o PropSet.o XPM.o PerLine.o
$(COMPONENT): $(SOBJS) Scintilla.def
$(DLLWRAP) --add-stdcall-alias --target i386-mingw32 -o $@ $(SOBJS) $(LDFLAGS) -s --relocatable
@ -74,7 +75,7 @@ LOBJS = ScintillaWinL.o ScintillaBaseL.o Editor.o CharClassify.o Decoration.o \
Document.o ContractionState.o CellBuffer.o CallTip.o \
ScintRes.o PlatWin.o PositionCache.o KeyMap.o Indicator.o LineMarker.o RESearch.o RunStyles.o \
Style.o ViewStyle.o AutoComplete.o UniConversion.o KeyWords.o \
DocumentAccessor.o PropSet.o ExternalLexer.o StyleContext.o XPM.o $(LEXOBJS)
DocumentAccessor.o PropSet.o ExternalLexer.o StyleContext.o XPM.o PerLine.o $(LEXOBJS)
$(LEXCOMPONENT): $(LOBJS) Scintilla.def
$(DLLWRAP) --add-stdcall-alias --target i386-mingw32 -o $@ $(LOBJS) $(LDFLAGS) -s --relocatable
@ -90,16 +91,16 @@ ScintillaBaseL.o: ScintillaBase.cxx Platform.h Scintilla.h SciLexer.h \
ContractionState.h CellBuffer.h CallTip.h KeyMap.h Indicator.h \
LineMarker.h Style.h AutoComplete.h ViewStyle.h Document.h Editor.h \
ScintillaBase.h PropSet.h SString.h Accessor.h DocumentAccessor.h \
KeyWords.h ExternalLexer.h
KeyWords.h ExternalLexer.h PerLine.h
ScintillaWinL.o: ScintillaWin.cxx Platform.h Scintilla.h SciLexer.h \
ContractionState.h CellBuffer.h CallTip.h KeyMap.h Indicator.h \
LineMarker.h Style.h AutoComplete.h ViewStyle.h Document.h Editor.h \
ScintillaBase.h PropSet.h SString.h Accessor.h KeyWords.h \
ExternalLexer.h UniConversion.h
ExternalLexer.h UniConversion.h PerLine.h
ScintillaWinS.o: ScintillaWin.cxx Platform.h Scintilla.h \
ContractionState.h CellBuffer.h CallTip.h KeyMap.h Indicator.h \
LineMarker.h Style.h AutoComplete.h ViewStyle.h Document.h Editor.h \
ScintillaBase.h UniConversion.h
ScintillaBase.h UniConversion.h PerLine.h
ScintillaBaseL.o:
$(CC) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@

View File

@ -108,7 +108,8 @@ SOBJS=\
$(DIR_O)\Style.obj \
$(DIR_O)\UniConversion.obj \
$(DIR_O)\ViewStyle.obj \
$(DIR_O)\XPM.obj
$(DIR_O)\XPM.obj \
$(DIR_O)\PerLine.obj
#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\t$(DIR_O)\\\*.obj \\\n\)
@ -128,6 +129,7 @@ LEXOBJS=\
$(DIR_O)\LexCaml.obj \
$(DIR_O)\LexCLW.obj \
$(DIR_O)\LexCmake.obj \
$(DIR_O)\LexCOBOL.obj \
$(DIR_O)\LexConf.obj \
$(DIR_O)\LexCPP.obj \
$(DIR_O)\LexCrontab.obj \
@ -156,6 +158,7 @@ LEXOBJS=\
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNimrod.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
@ -164,6 +167,7 @@ LEXOBJS=\
$(DIR_O)\LexPerl.obj \
$(DIR_O)\LexPLM.obj \
$(DIR_O)\LexPOV.obj \
$(DIR_O)\LexPowerPro.obj \
$(DIR_O)\LexPowerShell.obj \
$(DIR_O)\LexProgress.obj \
$(DIR_O)\LexPS.obj \
@ -173,10 +177,14 @@ LEXOBJS=\
$(DIR_O)\LexRuby.obj \
$(DIR_O)\LexScriptol.obj \
$(DIR_O)\LexSmalltalk.obj \
$(DIR_O)\LexSML.obj \
$(DIR_O)\LexSorcus.obj \
$(DIR_O)\LexSpecman.obj \
$(DIR_O)\LexSpice.obj \
$(DIR_O)\LexSQL.obj \
$(DIR_O)\LexTACL.obj \
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTAL.obj \
$(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexVB.obj \
@ -213,6 +221,7 @@ LOBJS=\
$(DIR_O)\UniConversion.obj \
$(DIR_O)\ViewStyle.obj \
$(DIR_O)\XPM.obj \
$(DIR_O)\PerLine.obj \
$(LEXOBJS)
$(DIR_O)\ScintRes.res : ScintRes.rc
@ -278,7 +287,7 @@ $(DIR_O)\Document.obj: ../src/Document.cxx ../include/Platform.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
../src/RESearch.h ../src/PerLine.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 \
@ -336,6 +345,8 @@ $(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS)
$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS)
$(DIR_O)\LexCOBOL.obj: ..\src\LexCOBOL.cxx $(LEX_HEADERS)
$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS)
$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS)
@ -392,6 +403,8 @@ $(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNimrod.obj: ..\src\LexNimrod.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
@ -408,6 +421,8 @@ $(DIR_O)\LexPLM.obj: ..\src\LexPLM.cxx $(LEX_HEADERS)
$(DIR_O)\LexPOV.obj: ..\src\LexPOV.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerPro.obj: ..\src\LexPowerPro.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerShell.obj: ..\src\LexPowerShell.cxx $(LEX_HEADERS)
$(DIR_O)\LexProgress.obj: ..\src\LexProgress.cxx $(LEX_HEADERS)
@ -426,14 +441,22 @@ $(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS)
$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS)
$(DIR_O)\LexSML.obj: ..\src\LexSML.cxx $(LEX_HEADERS)
$(DIR_O)\LexSorcus.obj: ..\src\LexSorcus.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpice.obj: ..\src\LexSpice.cxx $(LEX_HEADERS)
$(DIR_O)\LexSQL.obj: ..\src\LexSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTACL.obj: ..\src\LexTACL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTADS3.obj: ..\src\LexTADS3.cxx $(LEX_HEADERS)
$(DIR_O)\LexTAL.obj: ..\src\LexTAL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS)
@ -451,6 +474,9 @@ $(DIR_O)\LexYAML.obj: ..\src\LexYAML.cxx $(LEX_HEADERS)
$(DIR_O)\LineMarker.obj: ../src/LineMarker.cxx ../include/Platform.h \
../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h
$(DIR_O)\PerLine.obj: ../src/PerLine.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SVector.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/PerLine.h
$(DIR_O)\PlatWin.obj: PlatWin.cxx ../include/Platform.h PlatformRes.h \
../src/UniConversion.h ../src/XPM.h
$(DIR_O)\PositionCache.obj: ../src/Editor.cxx ../include/Platform.h ../include/Scintilla.h \

View File

@ -100,6 +100,7 @@ SOBJS=\
$(DIR_O)\Indicator.obj \
$(DIR_O)\KeyMap.obj \
$(DIR_O)\LineMarker.obj \
$(DIR_O)\PerLine.obj \
$(DIR_O)\PlatWin.obj \
$(DIR_O)\PositionCache.obj \
$(DIR_O)\PropSet.obj \
@ -130,6 +131,7 @@ LEXOBJS=\
$(DIR_O)\LexCaml.obj \
$(DIR_O)\LexCLW.obj \
$(DIR_O)\LexCmake.obj \
$(DIR_O)\LexCOBOL.obj \
$(DIR_O)\LexConf.obj \
$(DIR_O)\LexCPP.obj \
$(DIR_O)\LexCrontab.obj \
@ -158,6 +160,7 @@ LEXOBJS=\
$(DIR_O)\LexMPT.obj \
$(DIR_O)\LexMSSQL.obj \
$(DIR_O)\LexMySQL.obj \
$(DIR_O)\LexNimrod.obj \
$(DIR_O)\LexNsis.obj \
$(DIR_O)\LexOpal.obj \
$(DIR_O)\LexOthers.obj \
@ -166,6 +169,7 @@ LEXOBJS=\
$(DIR_O)\LexPerl.obj \
$(DIR_O)\LexPLM.obj \
$(DIR_O)\LexPOV.obj \
$(DIR_O)\LexPowerPro.obj \
$(DIR_O)\LexPowerShell.obj \
$(DIR_O)\LexProgress.obj \
$(DIR_O)\LexPS.obj \
@ -175,10 +179,14 @@ LEXOBJS=\
$(DIR_O)\LexRuby.obj \
$(DIR_O)\LexScriptol.obj \
$(DIR_O)\LexSmalltalk.obj \
$(DIR_O)\LexSML.obj \
$(DIR_O)\LexSorcus.obj \
$(DIR_O)\LexSpecman.obj \
$(DIR_O)\LexSpice.obj \
$(DIR_O)\LexSQL.obj \
$(DIR_O)\LexTACL.obj \
$(DIR_O)\LexTADS3.obj \
$(DIR_O)\LexTAL.obj \
$(DIR_O)\LexTCL.obj \
$(DIR_O)\LexTeX.obj \
$(DIR_O)\LexVB.obj \
@ -203,6 +211,7 @@ LOBJS=\
$(DIR_O)\KeyMap.obj \
$(DIR_O)\KeyWords.obj \
$(DIR_O)\LineMarker.obj \
$(DIR_O)\PerLine.obj \
$(DIR_O)\PlatWin.obj \
$(DIR_O)\PositionCache.obj \
$(DIR_O)\RunStyles.obj \
@ -338,6 +347,8 @@ $(DIR_O)\LexCLW.obj: ..\src\LexCLW.cxx $(LEX_HEADERS)
$(DIR_O)\LexCmake.obj: ..\src\LexCmake.cxx $(LEX_HEADERS)
$(DIR_O)\LexCOBOL.obj: ..\src\LexCOBOL.cxx $(LEX_HEADERS)
$(DIR_O)\LexConf.obj: ..\src\LexConf.cxx $(LEX_HEADERS)
$(DIR_O)\LexCPP.obj: ..\src\LexCPP.cxx $(LEX_HEADERS)
@ -394,6 +405,8 @@ $(DIR_O)\LexMSSQL.obj: ..\src\LexMSSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexMySQL.obj: ..\src\LexMySQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexNimrod.obj: ..\src\LexNimrod.cxx $(LEX_HEADERS)
$(DIR_O)\LexNsis.obj: ..\src\LexNsis.cxx $(LEX_HEADERS)
$(DIR_O)\LexOpal.obj: ..\src\LexOpal.cxx $(LEX_HEADERS)
@ -410,6 +423,8 @@ $(DIR_O)\LexPLM.obj: ..\src\LexPLM.cxx $(LEX_HEADERS)
$(DIR_O)\LexPOV.obj: ..\src\LexPOV.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerPro.obj: ..\src\LexPowerPro.cxx $(LEX_HEADERS)
$(DIR_O)\LexPowerShell.obj: ..\src\LexPowerShell.cxx $(LEX_HEADERS)
$(DIR_O)\LexProgress.obj: ..\src\LexProgress.cxx $(LEX_HEADERS)
@ -428,14 +443,22 @@ $(DIR_O)\LexScriptol.obj: ..\src\LexScriptol.cxx $(LEX_HEADERS)
$(DIR_O)\LexSmalltalk.obj: ..\src\LexSmalltalk.cxx $(LEX_HEADERS)
$(DIR_O)\LexSML.obj: ..\src\LexSML.cxx $(LEX_HEADERS)
$(DIR_O)\LexSorcus.obj: ..\src\LexSorcus.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpecman.obj: ..\src\LexSpecman.cxx $(LEX_HEADERS)
$(DIR_O)\LexSpice.obj: ..\src\LexSpice.cxx $(LEX_HEADERS)
$(DIR_O)\LexSQL.obj: ..\src\LexSQL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTACL.obj: ..\src\LexTACL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTADS3.obj: ..\src\LexTADS3.cxx $(LEX_HEADERS)
$(DIR_O)\LexTAL.obj: ..\src\LexTAL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTCL.obj: ..\src\LexTCL.cxx $(LEX_HEADERS)
$(DIR_O)\LexTeX.obj: ..\src\LexTeX.cxx $(LEX_HEADERS)