Upgrade scintilla component to 3.6.3.
This commit is contained in:
parent
6cd442fbaf
commit
b5ac178789
26
Makefile.in
26
Makefile.in
@ -283,7 +283,12 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_LexNsis.o \
|
||||
wxscintilla_LexOpal.o \
|
||||
wxscintilla_LexOScript.o \
|
||||
wxscintilla_LexOthers.o \
|
||||
wxscintilla_LexBatch.o \
|
||||
wxscintilla_LexDiff.o \
|
||||
wxscintilla_LexErrorList.o \
|
||||
wxscintilla_LexMake.o \
|
||||
wxscintilla_LexNull.o \
|
||||
wxscintilla_LexProps.o \
|
||||
wxscintilla_LexPascal.o \
|
||||
wxscintilla_LexPB.o \
|
||||
wxscintilla_LexPerl.o \
|
||||
@ -15309,8 +15314,23 @@ wxscintilla_LexOpal.o: $(srcdir)/src/stc/scintilla/lexers/LexOpal.cxx
|
||||
wxscintilla_LexOScript.o: $(srcdir)/src/stc/scintilla/lexers/LexOScript.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexOScript.cxx
|
||||
|
||||
wxscintilla_LexOthers.o: $(srcdir)/src/stc/scintilla/lexers/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexOthers.cxx
|
||||
wxscintilla_LexBatch.o: $(srcdir)/src/stc/scintilla/lexers/LexBatch.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexBatch.cxx
|
||||
|
||||
wxscintilla_LexDiff.o: $(srcdir)/src/stc/scintilla/lexers/LexDiff.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDiff.cxx
|
||||
|
||||
wxscintilla_LexErrorList.o: $(srcdir)/src/stc/scintilla/lexers/LexErrorList.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexErrorList.cxx
|
||||
|
||||
wxscintilla_LexMake.o: $(srcdir)/src/stc/scintilla/lexers/LexMake.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexMake.cxx
|
||||
|
||||
wxscintilla_LexNull.o: $(srcdir)/src/stc/scintilla/lexers/LexNull.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexNull.cxx
|
||||
|
||||
wxscintilla_LexProps.o: $(srcdir)/src/stc/scintilla/lexers/LexProps.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexProps.cxx
|
||||
|
||||
wxscintilla_LexPascal.o: $(srcdir)/src/stc/scintilla/lexers/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexPascal.cxx
|
||||
|
@ -116,7 +116,6 @@
|
||||
src/stc/scintilla/lexers/LexNsis.cxx
|
||||
src/stc/scintilla/lexers/LexOpal.cxx
|
||||
src/stc/scintilla/lexers/LexOScript.cxx
|
||||
src/stc/scintilla/lexers/LexOthers.cxx
|
||||
src/stc/scintilla/lexers/LexPascal.cxx
|
||||
src/stc/scintilla/lexers/LexPB.cxx
|
||||
src/stc/scintilla/lexers/LexPerl.cxx
|
||||
|
@ -68,6 +68,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_WS_INVISIBLE 0
|
||||
#define wxSTC_WS_VISIBLEALWAYS 1
|
||||
#define wxSTC_WS_VISIBLEAFTERINDENT 2
|
||||
#define wxSTC_WS_VISIBLEONLYININDENT 3
|
||||
#define wxSTC_EOL_CRLF 0
|
||||
#define wxSTC_EOL_CR 1
|
||||
#define wxSTC_EOL_LF 2
|
||||
@ -158,6 +159,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_CHARSET_MAC 77
|
||||
#define wxSTC_CHARSET_OEM 255
|
||||
#define wxSTC_CHARSET_RUSSIAN 204
|
||||
#define wxSTC_CHARSET_OEM866 866
|
||||
#define wxSTC_CHARSET_CYRILLIC 1251
|
||||
#define wxSTC_CHARSET_SHIFTJIS 128
|
||||
#define wxSTC_CHARSET_SYMBOL 2
|
||||
@ -171,6 +173,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_CASE_MIXED 0
|
||||
#define wxSTC_CASE_UPPER 1
|
||||
#define wxSTC_CASE_LOWER 2
|
||||
#define wxSTC_CASE_CAMEL 3
|
||||
#define wxSTC_FONT_SIZE_MULTIPLIER 100
|
||||
#define wxSTC_WEIGHT_NORMAL 400
|
||||
#define wxSTC_WEIGHT_SEMIBOLD 600
|
||||
@ -248,6 +251,10 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define wxSTC_TIME_FOREVER 10000000
|
||||
#define wxSTC_IDLESTYLING_NONE 0
|
||||
#define wxSTC_IDLESTYLING_TOVISIBLE 1
|
||||
#define wxSTC_IDLESTYLING_AFTERVISIBLE 2
|
||||
#define wxSTC_IDLESTYLING_ALL 3
|
||||
#define wxSTC_WRAP_NONE 0
|
||||
#define wxSTC_WRAP_WORD 1
|
||||
#define wxSTC_WRAP_CHAR 2
|
||||
@ -317,7 +324,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
|
||||
/// If CARET_EVEN is not set, instead of having symmetrical UZs,
|
||||
/// the left and bottom UZs are extended up to right and top UZs respectively.
|
||||
/// This way, we favour the displaying of useful information: the begining of lines,
|
||||
/// This way, we favour the displaying of useful information: the beginning of lines,
|
||||
/// where most code reside, and the lines after the caret, eg. the body of a function.
|
||||
#define wxSTC_CARET_EVEN 0x08
|
||||
#define wxSTC_SEL_STREAM 0
|
||||
@ -428,6 +435,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_SCMOD_ALT 4
|
||||
#define wxSTC_SCMOD_SUPER 8
|
||||
#define wxSTC_SCMOD_META 16
|
||||
#define wxSTC_AC_FILLUP 1
|
||||
#define wxSTC_AC_DOUBLECLICK 2
|
||||
#define wxSTC_AC_TAB 3
|
||||
#define wxSTC_AC_NEWLINE 4
|
||||
#define wxSTC_AC_COMMAND 5
|
||||
|
||||
/// For SciLexer.h
|
||||
#define wxSTC_LEX_CONTAINER 0
|
||||
@ -571,7 +583,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_P_WORD2 14
|
||||
#define wxSTC_P_DECORATOR 15
|
||||
|
||||
/// Lexical states for SCLEX_CPP
|
||||
/// Lexical states for SCLEX_CPP, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL
|
||||
#define wxSTC_C_DEFAULT 0
|
||||
#define wxSTC_C_COMMENT 1
|
||||
#define wxSTC_C_COMMENTLINE 2
|
||||
@ -870,7 +882,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_RB_STDERR 40
|
||||
#define wxSTC_RB_UPPER_BOUND 41
|
||||
|
||||
/// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
|
||||
/// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC
|
||||
#define wxSTC_B_DEFAULT 0
|
||||
#define wxSTC_B_COMMENT 1
|
||||
#define wxSTC_B_NUMBER 2
|
||||
@ -965,6 +977,24 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_ERR_JAVA_STACK 20
|
||||
#define wxSTC_ERR_VALUE 21
|
||||
#define wxSTC_ERR_GCC_INCLUDED_FROM 22
|
||||
#define wxSTC_ERR_ESCSEQ 23
|
||||
#define wxSTC_ERR_ESCSEQ_UNKNOWN 24
|
||||
#define wxSTC_ERR_ES_BLACK 40
|
||||
#define wxSTC_ERR_ES_RED 41
|
||||
#define wxSTC_ERR_ES_GREEN 42
|
||||
#define wxSTC_ERR_ES_BROWN 43
|
||||
#define wxSTC_ERR_ES_BLUE 44
|
||||
#define wxSTC_ERR_ES_MAGENTA 45
|
||||
#define wxSTC_ERR_ES_CYAN 46
|
||||
#define wxSTC_ERR_ES_GRAY 47
|
||||
#define wxSTC_ERR_ES_DARK_GRAY 48
|
||||
#define wxSTC_ERR_ES_BRIGHT_RED 49
|
||||
#define wxSTC_ERR_ES_BRIGHT_GREEN 50
|
||||
#define wxSTC_ERR_ES_YELLOW 51
|
||||
#define wxSTC_ERR_ES_BRIGHT_BLUE 52
|
||||
#define wxSTC_ERR_ES_BRIGHT_MAGENTA 53
|
||||
#define wxSTC_ERR_ES_BRIGHT_CYAN 54
|
||||
#define wxSTC_ERR_ES_WHITE 55
|
||||
|
||||
/// Lexical states for SCLEX_BATCH
|
||||
#define wxSTC_BAT_DEFAULT 0
|
||||
@ -2175,6 +2205,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_COFFEESCRIPT_COMMENTBLOCK 22
|
||||
#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX 23
|
||||
#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
|
||||
#define wxSTC_COFFEESCRIPT_INSTANCEPROPERTY 25
|
||||
|
||||
/// Lexical states for SCLEX_AVS
|
||||
#define wxSTC_AVS_DEFAULT 0
|
||||
@ -2900,7 +2931,7 @@ public:
|
||||
// Set the code page used to interpret the bytes of the document as characters.
|
||||
void SetCodePage(int codePage);
|
||||
|
||||
// Is the IME displayed in a winow or inline?
|
||||
// Is the IME displayed in a window or inline?
|
||||
int GetIMEInteraction() const;
|
||||
|
||||
// Choose to display the the IME in a winow or inline.
|
||||
@ -3526,6 +3557,12 @@ public:
|
||||
// Retrieve the text in the target.
|
||||
wxString GetTargetText() const;
|
||||
|
||||
// Make the target range start and end be the same as the selection range start and end.
|
||||
void TargetFromSelection();
|
||||
|
||||
// Sets the target to the whole document.
|
||||
void TargetWholeDocument();
|
||||
|
||||
// Replace the target text with the argument text.
|
||||
// Text is counted so it can contain NULs.
|
||||
// Returns the length of the replacement text.
|
||||
@ -3679,6 +3716,15 @@ public:
|
||||
// Get position of end of word.
|
||||
int WordEndPosition(int pos, bool onlyWordCharacters);
|
||||
|
||||
// Is the range start..end considered a word?
|
||||
bool IsRangeWord(int start, int end);
|
||||
|
||||
// Sets limits to idle styling.
|
||||
void SetIdleStyling(int idleStyling);
|
||||
|
||||
// Retrieve the limits to idle styling.
|
||||
int GetIdleStyling() const;
|
||||
|
||||
// Sets whether text is word wrapped.
|
||||
void SetWrapMode(int mode);
|
||||
|
||||
@ -3782,9 +3828,6 @@ public:
|
||||
// Result is NUL-terminated.
|
||||
wxString GetTag(int tagNumber) const;
|
||||
|
||||
// Make the target range start and end be the same as the selection range start and end.
|
||||
void TargetFromSelection();
|
||||
|
||||
// Join the lines in the target.
|
||||
void LinesJoin();
|
||||
|
||||
@ -4285,7 +4328,7 @@ public:
|
||||
// Change the effect of autocompleting when there are multiple selections.
|
||||
void AutoCompSetMulti(int multi);
|
||||
|
||||
// Retrieve the effect of autocompleting when there are multiple selections..
|
||||
// Retrieve the effect of autocompleting when there are multiple selections.
|
||||
int AutoCompGetMulti() const;
|
||||
|
||||
// Set the way autocompletion lists are ordered.
|
||||
@ -4611,6 +4654,14 @@ public:
|
||||
// Swap that caret and anchor of the main selection.
|
||||
void SwapMainAnchorCaret();
|
||||
|
||||
// Add the next occurrence of the main selection to the set of selections as main.
|
||||
// If the current selection is empty then select word around caret.
|
||||
void MultipleSelectAddNext();
|
||||
|
||||
// Add each occurrence of the main selection in the target to the set of selections.
|
||||
// If the current selection is empty then select word around caret.
|
||||
void MultipleSelectAddEach();
|
||||
|
||||
// Indicate that the internal state of a lexer has changed over a range and therefore
|
||||
// there may be a need to redraw.
|
||||
int ChangeLexerState(int start, int end);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define wxSTC_WS_INVISIBLE 0
|
||||
#define wxSTC_WS_VISIBLEALWAYS 1
|
||||
#define wxSTC_WS_VISIBLEAFTERINDENT 2
|
||||
#define wxSTC_WS_VISIBLEONLYININDENT 3
|
||||
#define wxSTC_EOL_CRLF 0
|
||||
#define wxSTC_EOL_CR 1
|
||||
#define wxSTC_EOL_LF 2
|
||||
@ -114,6 +115,7 @@
|
||||
#define wxSTC_CHARSET_MAC 77
|
||||
#define wxSTC_CHARSET_OEM 255
|
||||
#define wxSTC_CHARSET_RUSSIAN 204
|
||||
#define wxSTC_CHARSET_OEM866 866
|
||||
#define wxSTC_CHARSET_CYRILLIC 1251
|
||||
#define wxSTC_CHARSET_SHIFTJIS 128
|
||||
#define wxSTC_CHARSET_SYMBOL 2
|
||||
@ -127,6 +129,7 @@
|
||||
#define wxSTC_CASE_MIXED 0
|
||||
#define wxSTC_CASE_UPPER 1
|
||||
#define wxSTC_CASE_LOWER 2
|
||||
#define wxSTC_CASE_CAMEL 3
|
||||
#define wxSTC_FONT_SIZE_MULTIPLIER 100
|
||||
#define wxSTC_WEIGHT_NORMAL 400
|
||||
#define wxSTC_WEIGHT_SEMIBOLD 600
|
||||
@ -204,6 +207,10 @@
|
||||
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define wxSTC_TIME_FOREVER 10000000
|
||||
#define wxSTC_IDLESTYLING_NONE 0
|
||||
#define wxSTC_IDLESTYLING_TOVISIBLE 1
|
||||
#define wxSTC_IDLESTYLING_AFTERVISIBLE 2
|
||||
#define wxSTC_IDLESTYLING_ALL 3
|
||||
#define wxSTC_WRAP_NONE 0
|
||||
#define wxSTC_WRAP_WORD 1
|
||||
#define wxSTC_WRAP_CHAR 2
|
||||
@ -273,7 +280,7 @@
|
||||
|
||||
/// If CARET_EVEN is not set, instead of having symmetrical UZs,
|
||||
/// the left and bottom UZs are extended up to right and top UZs respectively.
|
||||
/// This way, we favour the displaying of useful information: the begining of lines,
|
||||
/// This way, we favour the displaying of useful information: the beginning of lines,
|
||||
/// where most code reside, and the lines after the caret, eg. the body of a function.
|
||||
#define wxSTC_CARET_EVEN 0x08
|
||||
#define wxSTC_SEL_STREAM 0
|
||||
@ -384,6 +391,11 @@
|
||||
#define wxSTC_SCMOD_ALT 4
|
||||
#define wxSTC_SCMOD_SUPER 8
|
||||
#define wxSTC_SCMOD_META 16
|
||||
#define wxSTC_AC_FILLUP 1
|
||||
#define wxSTC_AC_DOUBLECLICK 2
|
||||
#define wxSTC_AC_TAB 3
|
||||
#define wxSTC_AC_NEWLINE 4
|
||||
#define wxSTC_AC_COMMAND 5
|
||||
|
||||
/// For SciLexer.h
|
||||
#define wxSTC_LEX_CONTAINER 0
|
||||
@ -527,7 +539,7 @@
|
||||
#define wxSTC_P_WORD2 14
|
||||
#define wxSTC_P_DECORATOR 15
|
||||
|
||||
/// Lexical states for SCLEX_CPP
|
||||
/// Lexical states for SCLEX_CPP, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL
|
||||
#define wxSTC_C_DEFAULT 0
|
||||
#define wxSTC_C_COMMENT 1
|
||||
#define wxSTC_C_COMMENTLINE 2
|
||||
@ -826,7 +838,7 @@
|
||||
#define wxSTC_RB_STDERR 40
|
||||
#define wxSTC_RB_UPPER_BOUND 41
|
||||
|
||||
/// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
|
||||
/// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC
|
||||
#define wxSTC_B_DEFAULT 0
|
||||
#define wxSTC_B_COMMENT 1
|
||||
#define wxSTC_B_NUMBER 2
|
||||
@ -921,6 +933,24 @@
|
||||
#define wxSTC_ERR_JAVA_STACK 20
|
||||
#define wxSTC_ERR_VALUE 21
|
||||
#define wxSTC_ERR_GCC_INCLUDED_FROM 22
|
||||
#define wxSTC_ERR_ESCSEQ 23
|
||||
#define wxSTC_ERR_ESCSEQ_UNKNOWN 24
|
||||
#define wxSTC_ERR_ES_BLACK 40
|
||||
#define wxSTC_ERR_ES_RED 41
|
||||
#define wxSTC_ERR_ES_GREEN 42
|
||||
#define wxSTC_ERR_ES_BROWN 43
|
||||
#define wxSTC_ERR_ES_BLUE 44
|
||||
#define wxSTC_ERR_ES_MAGENTA 45
|
||||
#define wxSTC_ERR_ES_CYAN 46
|
||||
#define wxSTC_ERR_ES_GRAY 47
|
||||
#define wxSTC_ERR_ES_DARK_GRAY 48
|
||||
#define wxSTC_ERR_ES_BRIGHT_RED 49
|
||||
#define wxSTC_ERR_ES_BRIGHT_GREEN 50
|
||||
#define wxSTC_ERR_ES_YELLOW 51
|
||||
#define wxSTC_ERR_ES_BRIGHT_BLUE 52
|
||||
#define wxSTC_ERR_ES_BRIGHT_MAGENTA 53
|
||||
#define wxSTC_ERR_ES_BRIGHT_CYAN 54
|
||||
#define wxSTC_ERR_ES_WHITE 55
|
||||
|
||||
/// Lexical states for SCLEX_BATCH
|
||||
#define wxSTC_BAT_DEFAULT 0
|
||||
@ -2131,6 +2161,7 @@
|
||||
#define wxSTC_COFFEESCRIPT_COMMENTBLOCK 22
|
||||
#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX 23
|
||||
#define wxSTC_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
|
||||
#define wxSTC_COFFEESCRIPT_INSTANCEPROPERTY 25
|
||||
|
||||
/// Lexical states for SCLEX_AVS
|
||||
#define wxSTC_AVS_DEFAULT 0
|
||||
@ -3019,7 +3050,7 @@ public:
|
||||
void SetCodePage(int codePage);
|
||||
|
||||
/**
|
||||
Is the IME displayed in a winow or inline?
|
||||
Is the IME displayed in a window or inline?
|
||||
*/
|
||||
int GetIMEInteraction() const;
|
||||
|
||||
@ -4040,6 +4071,16 @@ public:
|
||||
*/
|
||||
wxString GetTargetText() const;
|
||||
|
||||
/**
|
||||
Make the target range start and end be the same as the selection range start and end.
|
||||
*/
|
||||
void TargetFromSelection();
|
||||
|
||||
/**
|
||||
Sets the target to the whole document.
|
||||
*/
|
||||
void TargetWholeDocument();
|
||||
|
||||
/**
|
||||
Replace the target text with the argument text.
|
||||
Text is counted so it can contain NULs.
|
||||
@ -4287,6 +4328,21 @@ public:
|
||||
*/
|
||||
int WordEndPosition(int pos, bool onlyWordCharacters);
|
||||
|
||||
/**
|
||||
Is the range start..end considered a word?
|
||||
*/
|
||||
bool IsRangeWord(int start, int end);
|
||||
|
||||
/**
|
||||
Sets limits to idle styling.
|
||||
*/
|
||||
void SetIdleStyling(int idleStyling);
|
||||
|
||||
/**
|
||||
Retrieve the limits to idle styling.
|
||||
*/
|
||||
int GetIdleStyling() const;
|
||||
|
||||
/**
|
||||
Sets whether text is word wrapped.
|
||||
*/
|
||||
@ -4452,11 +4508,6 @@ public:
|
||||
*/
|
||||
wxString GetTag(int tagNumber) const;
|
||||
|
||||
/**
|
||||
Make the target range start and end be the same as the selection range start and end.
|
||||
*/
|
||||
void TargetFromSelection();
|
||||
|
||||
/**
|
||||
Join the lines in the target.
|
||||
*/
|
||||
@ -5264,7 +5315,7 @@ public:
|
||||
void AutoCompSetMulti(int multi);
|
||||
|
||||
/**
|
||||
Retrieve the effect of autocompleting when there are multiple selections..
|
||||
Retrieve the effect of autocompleting when there are multiple selections.
|
||||
*/
|
||||
int AutoCompGetMulti() const;
|
||||
|
||||
@ -5787,6 +5838,18 @@ public:
|
||||
*/
|
||||
void SwapMainAnchorCaret();
|
||||
|
||||
/**
|
||||
Add the next occurrence of the main selection to the set of selections as main.
|
||||
If the current selection is empty then select word around caret.
|
||||
*/
|
||||
void MultipleSelectAddNext();
|
||||
|
||||
/**
|
||||
Add each occurrence of the main selection in the target to the set of selections.
|
||||
If the current selection is empty then select word around caret.
|
||||
*/
|
||||
void MultipleSelectAddEach();
|
||||
|
||||
/**
|
||||
Indicate that the internal state of a lexer has changed over a range and therefore
|
||||
there may be a need to redraw.
|
||||
|
@ -1135,7 +1135,7 @@ void ScintillaWX::DoContextMenu(Point pt) {
|
||||
}
|
||||
|
||||
void ScintillaWX::DoOnListBox() {
|
||||
AutoCompleteCompleted();
|
||||
AutoCompleteCompleted(0, SC_AC_COMMAND);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,14 +3,14 @@ directories from the Scintilla source distribution. All other code
|
||||
needed to implement Scintilla on top of wxWidgets is located in the
|
||||
directory above this one.
|
||||
|
||||
The current version of the Scintilla code is 3.5.5
|
||||
The current version of the Scintilla code is 3.6.3
|
||||
|
||||
These are the basic steps needed to update the version of Scintilla used by wxSTC.
|
||||
|
||||
1. Copy include, lexers, lexlib and src folders to src/stc/scintilla
|
||||
|
||||
2. Examine diffs between the new src/stc/scintilla/include/Scintilla.iface
|
||||
file and the version in SVN. You should get familiar especially with
|
||||
file and the previous version. You should get familiar especially with
|
||||
new method names or constants because some of them may need to be
|
||||
tweaked to conform to similar naming patterns already used. (See step
|
||||
#6 below.)
|
||||
|
@ -8,6 +8,8 @@
|
||||
#ifndef ILEXER_H
|
||||
#define ILEXER_H
|
||||
|
||||
#include "Sci_Position.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
namespace Scintilla {
|
||||
#endif
|
||||
@ -24,32 +26,32 @@ class IDocument {
|
||||
public:
|
||||
virtual int SCI_METHOD Version() const = 0;
|
||||
virtual void SCI_METHOD SetErrorStatus(int status) = 0;
|
||||
virtual int SCI_METHOD Length() const = 0;
|
||||
virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0;
|
||||
virtual char SCI_METHOD StyleAt(int position) const = 0;
|
||||
virtual int SCI_METHOD LineFromPosition(int position) const = 0;
|
||||
virtual int SCI_METHOD LineStart(int line) const = 0;
|
||||
virtual int SCI_METHOD GetLevel(int line) const = 0;
|
||||
virtual int SCI_METHOD SetLevel(int line, int level) = 0;
|
||||
virtual int SCI_METHOD GetLineState(int line) const = 0;
|
||||
virtual int SCI_METHOD SetLineState(int line, int state) = 0;
|
||||
virtual void SCI_METHOD StartStyling(int position, char mask) = 0;
|
||||
virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0;
|
||||
virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0;
|
||||
virtual Sci_Position SCI_METHOD Length() const = 0;
|
||||
virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0;
|
||||
virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0;
|
||||
virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0;
|
||||
virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0;
|
||||
virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0;
|
||||
virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0;
|
||||
virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0;
|
||||
virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0;
|
||||
virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0;
|
||||
virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0;
|
||||
virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0;
|
||||
virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
|
||||
virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0;
|
||||
virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0;
|
||||
virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0;
|
||||
virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0;
|
||||
virtual int SCI_METHOD CodePage() const = 0;
|
||||
virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
|
||||
virtual const char * SCI_METHOD BufferPointer() = 0;
|
||||
virtual int SCI_METHOD GetLineIndentation(int line) = 0;
|
||||
virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0;
|
||||
};
|
||||
|
||||
class IDocumentWithLineEnd : public IDocument {
|
||||
public:
|
||||
virtual int SCI_METHOD LineEnd(int line) const = 0;
|
||||
virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0;
|
||||
virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0;
|
||||
virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0;
|
||||
virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0;
|
||||
virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0;
|
||||
};
|
||||
|
||||
enum { lvOriginal=0, lvSubStyles=1 };
|
||||
@ -61,11 +63,11 @@ public:
|
||||
virtual const char * SCI_METHOD PropertyNames() = 0;
|
||||
virtual int SCI_METHOD PropertyType(const char *name) = 0;
|
||||
virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
|
||||
virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0;
|
||||
virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0;
|
||||
virtual const char * SCI_METHOD DescribeWordListSets() = 0;
|
||||
virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0;
|
||||
virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
|
||||
virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
|
||||
virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0;
|
||||
virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
|
||||
virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
|
||||
virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
|
||||
};
|
||||
|
||||
@ -87,7 +89,7 @@ class ILoader {
|
||||
public:
|
||||
virtual int SCI_METHOD Release() = 0;
|
||||
// Returns a status code from SC_STATUS_*
|
||||
virtual int SCI_METHOD AddData(char *data, int length) = 0;
|
||||
virtual int SCI_METHOD AddData(char *data, Sci_Position length) = 0;
|
||||
virtual void * SCI_METHOD ConvertToDocument() = 0;
|
||||
};
|
||||
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
(pt.y >= top) && (pt.y <= bottom);
|
||||
}
|
||||
bool ContainsWholePixel(Point pt) const {
|
||||
// Does the rectangle contain all of the pixel to left/below the point
|
||||
// Does the rectangle contain all of the pixel to left/below the point
|
||||
return (pt.x >= left) && ((pt.x+1) <= right) &&
|
||||
(pt.y >= top) && ((pt.y+1) <= bottom);
|
||||
}
|
||||
|
@ -498,6 +498,24 @@
|
||||
#define SCE_ERR_JAVA_STACK 20
|
||||
#define SCE_ERR_VALUE 21
|
||||
#define SCE_ERR_GCC_INCLUDED_FROM 22
|
||||
#define SCE_ERR_ESCSEQ 23
|
||||
#define SCE_ERR_ESCSEQ_UNKNOWN 24
|
||||
#define SCE_ERR_ES_BLACK 40
|
||||
#define SCE_ERR_ES_RED 41
|
||||
#define SCE_ERR_ES_GREEN 42
|
||||
#define SCE_ERR_ES_BROWN 43
|
||||
#define SCE_ERR_ES_BLUE 44
|
||||
#define SCE_ERR_ES_MAGENTA 45
|
||||
#define SCE_ERR_ES_CYAN 46
|
||||
#define SCE_ERR_ES_GRAY 47
|
||||
#define SCE_ERR_ES_DARK_GRAY 48
|
||||
#define SCE_ERR_ES_BRIGHT_RED 49
|
||||
#define SCE_ERR_ES_BRIGHT_GREEN 50
|
||||
#define SCE_ERR_ES_YELLOW 51
|
||||
#define SCE_ERR_ES_BRIGHT_BLUE 52
|
||||
#define SCE_ERR_ES_BRIGHT_MAGENTA 53
|
||||
#define SCE_ERR_ES_BRIGHT_CYAN 54
|
||||
#define SCE_ERR_ES_WHITE 55
|
||||
#define SCE_BAT_DEFAULT 0
|
||||
#define SCE_BAT_COMMENT 1
|
||||
#define SCE_BAT_WORD 2
|
||||
@ -1567,6 +1585,7 @@
|
||||
#define SCE_COFFEESCRIPT_COMMENTBLOCK 22
|
||||
#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23
|
||||
#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
|
||||
#define SCE_COFFEESCRIPT_INSTANCEPROPERTY 25
|
||||
#define SCE_AVS_DEFAULT 0
|
||||
#define SCE_AVS_COMMENTBLOCK 1
|
||||
#define SCE_AVS_COMMENTBLOCKN 2
|
||||
|
21
src/stc/scintilla/include/Sci_Position.h
Normal file
21
src/stc/scintilla/include/Sci_Position.h
Normal file
@ -0,0 +1,21 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file Sci_Position.h
|
||||
** Define the Sci_Position type used in Scintilla's external interfaces.
|
||||
** These need to be available to clients written in C so are not in a C++ namespace.
|
||||
**/
|
||||
// Copyright 2015 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#ifndef SCI_POSITION_H
|
||||
#define SCI_POSITION_H
|
||||
|
||||
// Basic signed type used throughout interface
|
||||
typedef int Sci_Position;
|
||||
|
||||
// Unsigned variant used for ILexer::Lex and ILexer::Fold
|
||||
typedef unsigned int Sci_PositionU;
|
||||
|
||||
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
|
||||
typedef long Sci_PositionCR;
|
||||
|
||||
#endif
|
@ -11,6 +11,8 @@
|
||||
#ifndef SCINTILLA_H
|
||||
#define SCINTILLA_H
|
||||
|
||||
#include "Sci_Position.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -71,6 +73,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCWS_INVISIBLE 0
|
||||
#define SCWS_VISIBLEALWAYS 1
|
||||
#define SCWS_VISIBLEAFTERINDENT 2
|
||||
#define SCWS_VISIBLEONLYININDENT 3
|
||||
#define SCI_GETVIEWWS 2020
|
||||
#define SCI_SETVIEWWS 2021
|
||||
#define SCI_POSITIONFROMPOINT 2022
|
||||
@ -194,6 +197,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SC_CHARSET_MAC 77
|
||||
#define SC_CHARSET_OEM 255
|
||||
#define SC_CHARSET_RUSSIAN 204
|
||||
#define SC_CHARSET_OEM866 866
|
||||
#define SC_CHARSET_CYRILLIC 1251
|
||||
#define SC_CHARSET_SHIFTJIS 128
|
||||
#define SC_CHARSET_SYMBOL 2
|
||||
@ -217,6 +221,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SC_CASE_MIXED 0
|
||||
#define SC_CASE_UPPER 1
|
||||
#define SC_CASE_LOWER 2
|
||||
#define SC_CASE_CAMEL 3
|
||||
#define SCI_STYLEGETFORE 2481
|
||||
#define SCI_STYLEGETBACK 2482
|
||||
#define SCI_STYLEGETBOLD 2483
|
||||
@ -434,6 +439,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETTARGETEND 2193
|
||||
#define SCI_SETTARGETRANGE 2686
|
||||
#define SCI_GETTARGETTEXT 2687
|
||||
#define SCI_TARGETFROMSELECTION 2287
|
||||
#define SCI_TARGETWHOLEDOCUMENT 2690
|
||||
#define SCI_REPLACETARGET 2194
|
||||
#define SCI_REPLACETARGETRE 2195
|
||||
#define SCI_SEARCHINTARGET 2197
|
||||
@ -498,6 +505,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETMOUSEDWELLTIME 2265
|
||||
#define SCI_WORDSTARTPOSITION 2266
|
||||
#define SCI_WORDENDPOSITION 2267
|
||||
#define SCI_ISRANGEWORD 2691
|
||||
#define SC_IDLESTYLING_NONE 0
|
||||
#define SC_IDLESTYLING_TOVISIBLE 1
|
||||
#define SC_IDLESTYLING_AFTERVISIBLE 2
|
||||
#define SC_IDLESTYLING_ALL 3
|
||||
#define SCI_SETIDLESTYLING 2692
|
||||
#define SCI_GETIDLESTYLING 2693
|
||||
#define SC_WRAP_NONE 0
|
||||
#define SC_WRAP_WORD 1
|
||||
#define SC_WRAP_CHAR 2
|
||||
@ -559,7 +573,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_SETMULTIPASTE 2614
|
||||
#define SCI_GETMULTIPASTE 2615
|
||||
#define SCI_GETTAG 2616
|
||||
#define SCI_TARGETFROMSELECTION 2287
|
||||
#define SCI_LINESJOIN 2288
|
||||
#define SCI_LINESSPLIT 2289
|
||||
#define SCI_SETFOLDMARGINCOLOUR 2290
|
||||
@ -894,6 +907,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETADDITIONALCARETFORE 2605
|
||||
#define SCI_ROTATESELECTION 2606
|
||||
#define SCI_SWAPMAINANCHORCARET 2607
|
||||
#define SCI_MULTIPLESELECTADDNEXT 2688
|
||||
#define SCI_MULTIPLESELECTADDEACH 2689
|
||||
#define SCI_CHANGELEXERSTATE 2617
|
||||
#define SCI_CONTRACTEDFOLDNEXT 2618
|
||||
#define SCI_VERTICALCENTRECARET 2619
|
||||
@ -1019,6 +1034,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCMOD_ALT 4
|
||||
#define SCMOD_SUPER 8
|
||||
#define SCMOD_META 16
|
||||
#define SC_AC_FILLUP 1
|
||||
#define SC_AC_DOUBLECLICK 2
|
||||
#define SC_AC_TAB 3
|
||||
#define SC_AC_NEWLINE 4
|
||||
#define SC_AC_COMMAND 5
|
||||
#define SCN_STYLENEEDED 2000
|
||||
#define SCN_CHARADDED 2001
|
||||
#define SCN_SAVEPOINTREACHED 2002
|
||||
@ -1048,6 +1068,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCN_HOTSPOTRELEASECLICK 2027
|
||||
#define SCN_FOCUSIN 2028
|
||||
#define SCN_FOCUSOUT 2029
|
||||
#define SCN_AUTOCCOMPLETED 2030
|
||||
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
|
||||
|
||||
/* These structures are defined to be exactly the same shape as the Win32
|
||||
@ -1059,8 +1080,8 @@ namespace Scintilla {
|
||||
#endif
|
||||
|
||||
struct Sci_CharacterRange {
|
||||
long cpMin;
|
||||
long cpMax;
|
||||
Sci_PositionCR cpMin;
|
||||
Sci_PositionCR cpMax;
|
||||
};
|
||||
|
||||
struct Sci_TextRange {
|
||||
@ -1113,14 +1134,16 @@ struct Sci_NotifyHeader {
|
||||
|
||||
struct SCNotification {
|
||||
struct Sci_NotifyHeader nmhdr;
|
||||
int position;
|
||||
Sci_Position position;
|
||||
/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
|
||||
/* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
|
||||
/* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
|
||||
/* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
|
||||
/* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
|
||||
|
||||
int ch; /* SCN_CHARADDED, SCN_KEY */
|
||||
int ch;
|
||||
/* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */
|
||||
/* SCN_USERLISTSELECTION */
|
||||
int modifiers;
|
||||
/* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
|
||||
/* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
|
||||
@ -1129,12 +1152,12 @@ struct SCNotification {
|
||||
const char *text;
|
||||
/* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
|
||||
|
||||
int length; /* SCN_MODIFIED */
|
||||
int linesAdded; /* SCN_MODIFIED */
|
||||
Sci_Position length; /* SCN_MODIFIED */
|
||||
Sci_Position linesAdded; /* SCN_MODIFIED */
|
||||
int message; /* SCN_MACRORECORD */
|
||||
uptr_t wParam; /* SCN_MACRORECORD */
|
||||
sptr_t lParam; /* SCN_MACRORECORD */
|
||||
int line; /* SCN_MODIFIED */
|
||||
Sci_Position line; /* SCN_MODIFIED */
|
||||
int foldLevelNow; /* SCN_MODIFIED */
|
||||
int foldLevelPrev; /* SCN_MODIFIED */
|
||||
int margin; /* SCN_MARGINCLICK */
|
||||
@ -1142,8 +1165,10 @@ struct SCNotification {
|
||||
int x; /* SCN_DWELLSTART, SCN_DWELLEND */
|
||||
int y; /* SCN_DWELLSTART, SCN_DWELLEND */
|
||||
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
|
||||
int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
|
||||
Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
|
||||
int updated; /* SCN_UPDATEUI */
|
||||
int listCompletionMethod;
|
||||
/* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */
|
||||
};
|
||||
|
||||
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
|
||||
|
@ -159,6 +159,7 @@ enu WhiteSpace=SCWS_
|
||||
val SCWS_INVISIBLE=0
|
||||
val SCWS_VISIBLEALWAYS=1
|
||||
val SCWS_VISIBLEAFTERINDENT=2
|
||||
val SCWS_VISIBLEONLYININDENT=3
|
||||
|
||||
# Are white space characters currently visible?
|
||||
# Returns one of SCWS_* constants.
|
||||
@ -248,11 +249,11 @@ enu IMEInteraction=SC_IME_
|
||||
val SC_IME_WINDOWED=0
|
||||
val SC_IME_INLINE=1
|
||||
|
||||
# Is the IME displayed in a winow or inline?
|
||||
# Is the IME displayed in a window or inline?
|
||||
get int GetIMEInteraction=2678(,)
|
||||
|
||||
# Choose to display the the IME in a winow or inline.
|
||||
set void SetIMEInteraction=2679(int imeInteraction,)
|
||||
set void SetIMEInteraction=2679(int imeInteraction,)
|
||||
|
||||
enu MarkerSymbol=SC_MARK_
|
||||
val MARKER_MAX=31
|
||||
@ -417,6 +418,7 @@ val SC_CHARSET_HANGUL=129
|
||||
val SC_CHARSET_MAC=77
|
||||
val SC_CHARSET_OEM=255
|
||||
val SC_CHARSET_RUSSIAN=204
|
||||
val SC_CHARSET_OEM866=866
|
||||
val SC_CHARSET_CYRILLIC=1251
|
||||
val SC_CHARSET_SHIFTJIS=128
|
||||
val SC_CHARSET_SYMBOL=2
|
||||
@ -462,6 +464,7 @@ enu CaseVisible=SC_CASE_
|
||||
val SC_CASE_MIXED=0
|
||||
val SC_CASE_UPPER=1
|
||||
val SC_CASE_LOWER=2
|
||||
val SC_CASE_CAMEL=3
|
||||
|
||||
# Get the foreground colour of a style.
|
||||
get colour StyleGetFore=2481(int style,)
|
||||
@ -1069,6 +1072,12 @@ fun void SetTargetRange=2686(position start, position end)
|
||||
# Retrieve the text in the target.
|
||||
get int GetTargetText=2687(, stringresult characters)
|
||||
|
||||
# Make the target range start and end be the same as the selection range start and end.
|
||||
fun void TargetFromSelection=2287(,)
|
||||
|
||||
# Sets the target to the whole document.
|
||||
fun void TargetWholeDocument=2690(,)
|
||||
|
||||
# Replace the target text with the argument text.
|
||||
# Text is counted so it can contain NULs.
|
||||
# Returns the length of the replacement text.
|
||||
@ -1248,6 +1257,21 @@ fun int WordStartPosition=2266(position pos, bool onlyWordCharacters)
|
||||
# Get position of end of word.
|
||||
fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
|
||||
|
||||
# Is the range start..end considered a word?
|
||||
fun bool IsRangeWord=2691(position start, position end)
|
||||
|
||||
enu IdleStyling=SC_IDLESTYLING_
|
||||
val SC_IDLESTYLING_NONE=0
|
||||
val SC_IDLESTYLING_TOVISIBLE=1
|
||||
val SC_IDLESTYLING_AFTERVISIBLE=2
|
||||
val SC_IDLESTYLING_ALL=3
|
||||
|
||||
# Sets limits to idle styling.
|
||||
set void SetIdleStyling=2692(int idleStyling,)
|
||||
|
||||
# Retrieve the limits to idle styling.
|
||||
get int GetIdleStyling=2693(,)
|
||||
|
||||
enu Wrap=SC_WRAP_
|
||||
val SC_WRAP_NONE=0
|
||||
val SC_WRAP_WORD=1
|
||||
@ -1396,16 +1420,13 @@ val SC_MULTIPASTE_EACH=1
|
||||
# Change the effect of pasting when there are multiple selections.
|
||||
set void SetMultiPaste=2614(int multiPaste,)
|
||||
|
||||
# Retrieve the effect of pasting when there are multiple selections..
|
||||
# Retrieve the effect of pasting when there are multiple selections.
|
||||
get int GetMultiPaste=2615(,)
|
||||
|
||||
# Retrieve the value of a tag from a regular expression search.
|
||||
# Result is NUL-terminated.
|
||||
get int GetTag=2616(int tagNumber, stringresult tagValue)
|
||||
|
||||
# Make the target range start and end be the same as the selection range start and end.
|
||||
fun void TargetFromSelection=2287(,)
|
||||
|
||||
# Join the lines in the target.
|
||||
fun void LinesJoin=2288(,)
|
||||
|
||||
@ -1785,7 +1806,7 @@ val CARET_STRICT=0x04
|
||||
val CARET_JUMPS=0x10
|
||||
# If CARET_EVEN is not set, instead of having symmetrical UZs,
|
||||
# the left and bottom UZs are extended up to right and top UZs respectively.
|
||||
# This way, we favour the displaying of useful information: the begining of lines,
|
||||
# This way, we favour the displaying of useful information: the beginning of lines,
|
||||
# where most code reside, and the lines after the caret, eg. the body of a function.
|
||||
val CARET_EVEN=0x08
|
||||
|
||||
@ -1968,7 +1989,7 @@ val SC_MULTIAUTOC_EACH=1
|
||||
# Change the effect of autocompleting when there are multiple selections.
|
||||
set void AutoCSetMulti=2636(int multi,)
|
||||
|
||||
# Retrieve the effect of autocompleting when there are multiple selections..
|
||||
# Retrieve the effect of autocompleting when there are multiple selections.
|
||||
get int AutoCGetMulti=2637(,)
|
||||
|
||||
enu Ordering=SC_ORDER_
|
||||
@ -2350,6 +2371,14 @@ fun void RotateSelection=2606(,)
|
||||
# Swap that caret and anchor of the main selection.
|
||||
fun void SwapMainAnchorCaret=2607(,)
|
||||
|
||||
# Add the next occurrence of the main selection to the set of selections as main.
|
||||
# If the current selection is empty then select word around caret.
|
||||
fun void MultipleSelectAddNext=2688(,)
|
||||
|
||||
# Add each occurrence of the main selection in the target to the set of selections.
|
||||
# If the current selection is empty then select word around caret.
|
||||
fun void MultipleSelectAddEach=2689(,)
|
||||
|
||||
# Indicate that the internal state of a lexer has changed over a range and therefore
|
||||
# there may be a need to redraw.
|
||||
fun int ChangeLexerState=2617(position start, position end)
|
||||
@ -2642,6 +2671,13 @@ val SCMOD_ALT=4
|
||||
val SCMOD_SUPER=8
|
||||
val SCMOD_META=16
|
||||
|
||||
enu CompletionMethods=SC_AC_
|
||||
val SC_AC_FILLUP=1
|
||||
val SC_AC_DOUBLECLICK=2
|
||||
val SC_AC_TAB=3
|
||||
val SC_AC_NEWLINE=4
|
||||
val SC_AC_COMMAND=5
|
||||
|
||||
################################################
|
||||
# For SciLexer.h
|
||||
enu Lexer=SCLEX_
|
||||
@ -2786,9 +2822,12 @@ val SCE_P_COMMENTBLOCK=12
|
||||
val SCE_P_STRINGEOL=13
|
||||
val SCE_P_WORD2=14
|
||||
val SCE_P_DECORATOR=15
|
||||
# Lexical states for SCLEX_CPP
|
||||
# Lexical states for SCLEX_CPP, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL
|
||||
lex Cpp=SCLEX_CPP SCE_C_
|
||||
lex BullAnt=SCLEX_BULLANT SCE_C_
|
||||
lex COBOL=SCLEX_COBOL SCE_C_
|
||||
lex TACL=SCLEX_TACL SCE_C_
|
||||
lex TAL=SCLEX_TAL SCE_C_
|
||||
val SCE_C_DEFAULT=0
|
||||
val SCE_C_COMMENT=1
|
||||
val SCE_C_COMMENTLINE=2
|
||||
@ -3075,10 +3114,13 @@ val SCE_RB_STDIN=30
|
||||
val SCE_RB_STDOUT=31
|
||||
val SCE_RB_STDERR=40
|
||||
val SCE_RB_UPPER_BOUND=41
|
||||
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
|
||||
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC
|
||||
lex VB=SCLEX_VB SCE_B_
|
||||
lex VBScript=SCLEX_VBSCRIPT SCE_B_
|
||||
lex PowerBasic=SCLEX_POWERBASIC SCE_B_
|
||||
lex BlitzBasic=SCLEX_BLITZBASIC SCE_B_
|
||||
lex PureBasic=SCLEX_PUREBASIC SCE_B_
|
||||
lex FreeBasic=SCLEX_FREEBASIC SCE_B_
|
||||
val SCE_B_DEFAULT=0
|
||||
val SCE_B_COMMENT=1
|
||||
val SCE_B_NUMBER=2
|
||||
@ -3173,6 +3215,24 @@ val SCE_ERR_TIDY=19
|
||||
val SCE_ERR_JAVA_STACK=20
|
||||
val SCE_ERR_VALUE=21
|
||||
val SCE_ERR_GCC_INCLUDED_FROM=22
|
||||
val SCE_ERR_ESCSEQ=23
|
||||
val SCE_ERR_ESCSEQ_UNKNOWN=24
|
||||
val SCE_ERR_ES_BLACK=40
|
||||
val SCE_ERR_ES_RED=41
|
||||
val SCE_ERR_ES_GREEN=42
|
||||
val SCE_ERR_ES_BROWN=43
|
||||
val SCE_ERR_ES_BLUE=44
|
||||
val SCE_ERR_ES_MAGENTA=45
|
||||
val SCE_ERR_ES_CYAN=46
|
||||
val SCE_ERR_ES_GRAY=47
|
||||
val SCE_ERR_ES_DARK_GRAY=48
|
||||
val SCE_ERR_ES_BRIGHT_RED=49
|
||||
val SCE_ERR_ES_BRIGHT_GREEN=50
|
||||
val SCE_ERR_ES_YELLOW=51
|
||||
val SCE_ERR_ES_BRIGHT_BLUE=52
|
||||
val SCE_ERR_ES_BRIGHT_MAGENTA=53
|
||||
val SCE_ERR_ES_BRIGHT_CYAN=54
|
||||
val SCE_ERR_ES_WHITE=55
|
||||
# Lexical states for SCLEX_BATCH
|
||||
lex Batch=SCLEX_BATCH SCE_BAT_
|
||||
val SCE_BAT_DEFAULT=0
|
||||
@ -4387,6 +4447,7 @@ val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21
|
||||
val SCE_COFFEESCRIPT_COMMENTBLOCK=22
|
||||
val SCE_COFFEESCRIPT_VERBOSE_REGEX=23
|
||||
val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24
|
||||
val SCE_COFFEESCRIPT_INSTANCEPROPERTY=25
|
||||
# Lexical states for SCLEX_AVS
|
||||
lex AVS=SCLEX_AVS SCE_AVS_
|
||||
val SCE_AVS_DEFAULT=0
|
||||
@ -4633,7 +4694,7 @@ evt void MacroRecord=2009(int message, int wParam, int lParam)
|
||||
evt void MarginClick=2010(int modifiers, int position, int margin)
|
||||
evt void NeedShown=2011(int position, int length)
|
||||
evt void Painted=2013(void)
|
||||
evt void UserListSelection=2014(int listType, string text, int position)
|
||||
evt void UserListSelection=2014(int listType, string text, int positionint, int ch, CompletionMethods listCompletionMethod)
|
||||
evt void URIDropped=2015(string text)
|
||||
evt void DwellStart=2016(int position, int x, int y)
|
||||
evt void DwellEnd=2017(int position, int x, int y)
|
||||
@ -4641,7 +4702,7 @@ evt void Zoom=2018(void)
|
||||
evt void HotSpotClick=2019(int modifiers, int position)
|
||||
evt void HotSpotDoubleClick=2020(int modifiers, int position)
|
||||
evt void CallTipClick=2021(int position)
|
||||
evt void AutoCSelection=2022(string text, int position)
|
||||
evt void AutoCSelection=2022(string text, int position, int ch, CompletionMethods listCompletionMethod)
|
||||
evt void IndicatorClick=2023(int modifiers, int position)
|
||||
evt void IndicatorRelease=2024(int modifiers, int position)
|
||||
evt void AutoCCancelled=2025(void)
|
||||
@ -4649,6 +4710,7 @@ evt void AutoCCharDeleted=2026(void)
|
||||
evt void HotSpotReleaseClick=2027(int modifiers, int position)
|
||||
evt void FocusIn=2028(void)
|
||||
evt void FocusOut=2029(void)
|
||||
evt void AutoCCompleted=2030(string text, int position, int ch, CompletionMethods listCompletionMethod)
|
||||
|
||||
# There are no provisional features currently
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* 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.
|
||||
**/
|
||||
/* @file ScintillaWidget.h
|
||||
* Definition of Scintilla widget for GTK+.
|
||||
* Only needed by GTK+ code but is harmless on other platforms.
|
||||
* This comment is not a doc-comment as that causes warnings from g-ir-scanner.
|
||||
*/
|
||||
/* Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
* The License.txt file describes the conditions under which this software may be distributed. */
|
||||
|
||||
@ -19,8 +20,15 @@ extern "C" {
|
||||
#define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass)
|
||||
#define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ())
|
||||
|
||||
#define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type())
|
||||
#define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject))
|
||||
#define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT))
|
||||
#define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass))
|
||||
#define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT))
|
||||
#define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass))
|
||||
|
||||
typedef struct _ScintillaObject ScintillaObject;
|
||||
typedef struct _ScintillaClass ScintillaClass;
|
||||
typedef struct _ScintillaClass ScintillaObjectClass;
|
||||
|
||||
struct _ScintillaObject {
|
||||
GtkContainer cont;
|
||||
@ -34,11 +42,20 @@ struct _ScintillaClass {
|
||||
void (* notify) (ScintillaObject *ttt);
|
||||
};
|
||||
|
||||
GType scintilla_object_get_type (void);
|
||||
GtkWidget* scintilla_object_new (void);
|
||||
long scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam);
|
||||
|
||||
#ifndef G_IR_SCANNING
|
||||
/* The legacy names confuse the g-ir-scanner program */
|
||||
typedef struct _ScintillaClass ScintillaClass;
|
||||
|
||||
GType scintilla_get_type (void);
|
||||
GtkWidget* scintilla_new (void);
|
||||
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
|
||||
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
|
||||
void scintilla_release_resources(void);
|
||||
#endif
|
||||
|
||||
#define SCINTILLA_NOTIFY "sci-notify"
|
||||
|
||||
|
@ -115,22 +115,22 @@ static inline bool IsDoxygenChar (const int ch)
|
||||
* Main function, which colourises a 68k source
|
||||
*/
|
||||
|
||||
static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler)
|
||||
static void ColouriseA68kDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
// Used to buffer a string, to be able to compare it using built-in functions
|
||||
char Buffer[100];
|
||||
|
||||
|
||||
// Used to know the length of an operator
|
||||
int OpType;
|
||||
|
||||
// Used to buffer a string, to be able to compare it using built-in functions
|
||||
char Buffer[100];
|
||||
|
||||
|
||||
// Used to know the length of an operator
|
||||
int OpType;
|
||||
|
||||
|
||||
// Get references to keywords lists
|
||||
WordList &cpuInstruction = *keywordlists[0];
|
||||
WordList ®isters = *keywordlists[1];
|
||||
WordList &directive = *keywordlists[2];
|
||||
WordList &extInstruction = *keywordlists[3];
|
||||
WordList &alert = *keywordlists[4];
|
||||
WordList &alert = *keywordlists[4];
|
||||
WordList &doxygenKeyword = *keywordlists[5];
|
||||
|
||||
|
||||
@ -140,109 +140,109 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Parse the source
|
||||
* Parse the source
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
for ( ; sc.More(); sc.Forward())
|
||||
{
|
||||
/************************************************************
|
||||
*
|
||||
* A style always terminates at the end of a line, even for
|
||||
* comments (no multi-lines comments)
|
||||
*
|
||||
************************************************************/
|
||||
if (sc.atLineStart) {
|
||||
/************************************************************
|
||||
*
|
||||
* A style always terminates at the end of a line, even for
|
||||
* comments (no multi-lines comments)
|
||||
*
|
||||
************************************************************/
|
||||
if (sc.atLineStart) {
|
||||
sc.SetState(SCE_A68K_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* If we are not in "default style", check if the style continues
|
||||
* In this case, we just have to loop
|
||||
* If we are not in "default style", check if the style continues
|
||||
* In this case, we just have to loop
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
if (sc.state != SCE_A68K_DEFAULT)
|
||||
{
|
||||
if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number
|
||||
if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number
|
||||
|| ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number
|
||||
|| ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number
|
||||
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument
|
||||
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument
|
||||
|| ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted
|
||||
|| ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted
|
||||
|| ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point)
|
||||
|| ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier
|
||||
|| ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local)
|
||||
|| ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword
|
||||
|| ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert
|
||||
|| ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment
|
||||
|| ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point)
|
||||
|| ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier
|
||||
|| ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local)
|
||||
|| ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword
|
||||
|| ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert
|
||||
|| ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Check if current state terminates
|
||||
*
|
||||
************************************************************/
|
||||
/************************************************************
|
||||
*
|
||||
* Check if current state terminates
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// Strings: include terminal ' or " in the current string by skipping it
|
||||
if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) {
|
||||
sc.Forward();
|
||||
// Strings: include terminal ' or " in the current string by skipping it
|
||||
if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) {
|
||||
sc.Forward();
|
||||
}
|
||||
|
||||
|
||||
// If a macro declaration was terminated with ':', it was a label
|
||||
else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
|
||||
|
||||
// If a macro declaration was terminated with ':', it was a label
|
||||
else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
}
|
||||
|
||||
|
||||
// If it wasn't a Doxygen keyword, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) {
|
||||
|
||||
// If it wasn't a Doxygen keyword, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) {
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (!doxygenKeyword.InList(Buffer)) {
|
||||
if (!doxygenKeyword.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_COMMENT);
|
||||
}
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// If it wasn't an Alert, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_SPECIAL) {
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (!alert.InList(Buffer)) {
|
||||
|
||||
// If it wasn't an Alert, change it to normal comment
|
||||
else if (sc.state == SCE_A68K_COMMENT_SPECIAL) {
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (!alert.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_COMMENT);
|
||||
}
|
||||
// Reset style to normal comment, or to Doxygen keyword if it begins with '\'
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
// Reset style to normal comment, or to Doxygen keyword if it begins with '\'
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// If we are in a comment, it's a Doxygen keyword or an Alert
|
||||
else if (sc.state == SCE_A68K_COMMENT) {
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
sc.SetState(SCE_A68K_COMMENT_SPECIAL);
|
||||
}
|
||||
continue;
|
||||
|
||||
// If we are in a comment, it's a Doxygen keyword or an Alert
|
||||
else if (sc.state == SCE_A68K_COMMENT) {
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else {
|
||||
sc.SetState(SCE_A68K_COMMENT_SPECIAL);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check if we are at the end of an identifier
|
||||
// In this case, colourise it if was a keyword.
|
||||
else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) {
|
||||
else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) {
|
||||
sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context
|
||||
if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list
|
||||
sc.ChangeState(SCE_A68K_CPUINSTRUCTION);
|
||||
@ -269,30 +269,30 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// Something which begins at the beginning of a line, and with
|
||||
// - '\' + an identifier start char, or
|
||||
// - '\\@' + an identifier start char
|
||||
// is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) {
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) {
|
||||
sc.Forward(2);
|
||||
if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
// Label and macro identifiers start at the beginning of a line
|
||||
// We set both as a macro id, but if it wasn't one (':' at the end),
|
||||
// it will be changed as a label.
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) {
|
||||
sc.SetState(SCE_A68K_MACRO_DECLARATION);
|
||||
// Something which begins at the beginning of a line, and with
|
||||
// - '\' + an identifier start char, or
|
||||
// - '\\@' + an identifier start char
|
||||
// is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) {
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match
|
||||
sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment
|
||||
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) {
|
||||
sc.Forward(2);
|
||||
if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) {
|
||||
sc.ChangeState(SCE_A68K_LABEL);
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
// Label and macro identifiers start at the beginning of a line
|
||||
// We set both as a macro id, but if it wasn't one (':' at the end),
|
||||
// it will be changed as a label.
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) {
|
||||
sc.SetState(SCE_A68K_MACRO_DECLARATION);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match
|
||||
sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment
|
||||
}
|
||||
else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix
|
||||
sc.SetState(SCE_A68K_NUMBER_DEC);
|
||||
@ -309,7 +309,7 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted)
|
||||
sc.SetState(SCE_A68K_STRING2);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\'
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\'
|
||||
sc.SetState(SCE_A68K_MACRO_ARG);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc...
|
||||
|
@ -43,7 +43,7 @@ static inline bool IsAnOperator(char ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColouriseAPDLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseAPDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
int stringStart = ' ';
|
||||
@ -184,16 +184,16 @@ static int CheckAPDLFoldPoint(char const *token, int &level) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void FoldAPDLDoc(unsigned int startPos, int length, int,
|
||||
static void FoldAPDLDoc(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
|
||||
int line = styler.GetLine(startPos);
|
||||
Sci_Position line = styler.GetLine(startPos);
|
||||
int level = styler.LevelAt(line);
|
||||
int go = 0, done = 0;
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
char word[256];
|
||||
int wordlen = 0;
|
||||
int i;
|
||||
Sci_Position i;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
// Scan for tokens at the start of the line (they may include
|
||||
// whitespace, for tokens like "End Function"
|
||||
|
@ -23,7 +23,7 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -152,7 +152,7 @@ static inline bool isASYidentifier(int ch) {
|
||||
((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ;
|
||||
}
|
||||
|
||||
static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)
|
||||
static int ParseASYWord(Sci_PositionU pos, Accessor &styler, char *word)
|
||||
{
|
||||
int length=0;
|
||||
char ch=styler.SafeGetCharAt(pos);
|
||||
@ -167,11 +167,11 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)
|
||||
return length;
|
||||
}
|
||||
|
||||
static bool IsASYDrawingLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
static bool IsASYDrawingLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
|
||||
int startpos = pos;
|
||||
Sci_Position startpos = pos;
|
||||
char buffer[100]="";
|
||||
|
||||
while (startpos<eol_pos){
|
||||
@ -186,14 +186,14 @@ static bool IsASYDrawingLine(int line, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -202,7 +202,7 @@ static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -170,10 +170,10 @@ static int GetSendKey(const char *szLine, char *szKey)
|
||||
//
|
||||
// Routine to check the last "none comment" character on a line to see if its a continuation
|
||||
//
|
||||
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
|
||||
static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler)
|
||||
{
|
||||
int nsPos = styler.LineStart(szLine);
|
||||
int nePos = styler.LineStart(szLine+1) - 2;
|
||||
Sci_Position nsPos = styler.LineStart(szLine);
|
||||
Sci_Position nePos = styler.LineStart(szLine+1) - 2;
|
||||
//int stylech = styler.StyleAt(nsPos);
|
||||
while (nsPos < nePos)
|
||||
{
|
||||
@ -195,8 +195,8 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
|
||||
|
||||
//
|
||||
// syntax highlighting logic
|
||||
static void ColouriseAU3Doc(unsigned int startPos,
|
||||
int length, int initStyle,
|
||||
static void ColouriseAU3Doc(Sci_PositionU startPos,
|
||||
Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
@ -209,8 +209,8 @@ static void ColouriseAU3Doc(unsigned int startPos,
|
||||
WordList &keywords7 = *keywordlists[6];
|
||||
WordList &keywords8 = *keywordlists[7];
|
||||
// find the first previous line without continuation character at the end
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int s_startPos = startPos;
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position s_startPos = startPos;
|
||||
// When not inside a Block comment: find First line without _
|
||||
if (!(initStyle==SCE_AU3_COMMENTBLOCK)) {
|
||||
while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
|
||||
@ -447,7 +447,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
|
||||
{
|
||||
si=0;
|
||||
// at line end and not found a continuation char then reset to default
|
||||
int lineCurrent = styler.GetLine(sc.currentPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(sc.currentPos);
|
||||
if (!IsContinuationLine(lineCurrent,styler))
|
||||
{
|
||||
sc.SetState(SCE_AU3_DEFAULT);
|
||||
@ -492,7 +492,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
|
||||
else
|
||||
{
|
||||
// check if the start is a valid SendKey start
|
||||
int nPos = 0;
|
||||
Sci_Position nPos = 0;
|
||||
int nState = 1;
|
||||
char cTemp;
|
||||
while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
|
||||
@ -659,10 +659,10 @@ static bool IsStreamCommentStyle(int style) {
|
||||
//
|
||||
// Routine to find first none space on the current line and return its Style
|
||||
// needed for comment lines not starting on pos 1
|
||||
static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
|
||||
static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler)
|
||||
{
|
||||
int nsPos = styler.LineStart(szLine);
|
||||
int nePos = styler.LineStart(szLine+1) - 1;
|
||||
Sci_Position nsPos = styler.LineStart(szLine);
|
||||
Sci_Position nePos = styler.LineStart(szLine+1) - 1;
|
||||
while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos)
|
||||
{
|
||||
nsPos++; // skip to next char
|
||||
@ -674,16 +674,16 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
|
||||
|
||||
|
||||
//
|
||||
static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
// get settings from the config files for folding comments and preprocessor lines
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
@ -720,7 +720,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
char chPrev = ' ';
|
||||
//
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
if (IsAWordChar(ch)) {
|
||||
|
@ -59,8 +59,8 @@ inline bool isAveOperator(char ch) {
|
||||
}
|
||||
|
||||
static void ColouriseAveDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -82,7 +82,7 @@ static void ColouriseAveDoc(
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
if (sc.atLineEnd) {
|
||||
// Update the line state, so it can be seen by next line
|
||||
int currentLine = styler.GetLine(sc.currentPos);
|
||||
Sci_Position currentLine = styler.GetLine(sc.currentPos);
|
||||
styler.SetLineState(currentLine, 0);
|
||||
}
|
||||
if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) {
|
||||
@ -157,11 +157,11 @@ static void ColouriseAveDoc(
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||
static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
|
||||
Accessor &styler) {
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = static_cast<char>(tolower(styler[startPos]));
|
||||
@ -169,7 +169,7 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
char s[10] = "";
|
||||
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = static_cast<char>(tolower(chNext));
|
||||
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
|
||||
int style = styleNext;
|
||||
|
@ -44,8 +44,8 @@ static inline bool IsANumberChar(int ch) {
|
||||
}
|
||||
|
||||
static void ColouriseAvsDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -57,7 +57,7 @@ static void ColouriseAvsDoc(
|
||||
WordList &clipProperties = *keywordlists[4];
|
||||
WordList &userDefined = *keywordlists[5];
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
// Initialize the block comment nesting level, if we are inside such a comment.
|
||||
int blockCommentLevel = 0;
|
||||
if (initStyle == SCE_AVS_COMMENTBLOCK || initStyle == SCE_AVS_COMMENTBLOCKN) {
|
||||
@ -83,7 +83,7 @@ static void ColouriseAvsDoc(
|
||||
styler.SetLineState(currentLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_AVS_OPERATOR) {
|
||||
sc.SetState(SCE_AVS_DEFAULT);
|
||||
@ -208,24 +208,24 @@ static void ColouriseAvsDoc(
|
||||
}
|
||||
|
||||
static void FoldAvsDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *[],
|
||||
Accessor &styler) {
|
||||
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -38,7 +38,7 @@ static inline bool IsASetChar(const int ch) {
|
||||
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
|
||||
}
|
||||
|
||||
static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
|
||||
static void ColouriseABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList*[] /* *keywordlists[] */,
|
||||
Accessor &styler) {
|
||||
enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \
|
||||
DAT_LINE_VAL, DAT_LINE_COMMA,\
|
||||
@ -301,10 +301,10 @@ static int LowerCase(int c)
|
||||
return c;
|
||||
}
|
||||
|
||||
static int LineEnd(int line, Accessor &styler)
|
||||
static Sci_Position LineEnd(Sci_Position line, Accessor &styler)
|
||||
{
|
||||
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||
int eol_pos ;
|
||||
const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||
Sci_Position eol_pos ;
|
||||
// if the line is the last line, the eol_pos is styler.Length()
|
||||
// eol will contain a new line, or a virtual new line
|
||||
if ( docLines == line )
|
||||
@ -314,7 +314,7 @@ static int LineEnd(int line, Accessor &styler)
|
||||
return eol_pos ;
|
||||
}
|
||||
|
||||
static int LineStart(int line, Accessor &styler)
|
||||
static Sci_Position LineStart(Sci_Position line, Accessor &styler)
|
||||
{
|
||||
return styler.LineStart(line) ;
|
||||
}
|
||||
@ -330,14 +330,14 @@ static int LineStart(int line, Accessor &styler)
|
||||
// 6 : block close keyword line
|
||||
// 7 : keyword line in error
|
||||
// 8 : comment line
|
||||
static int LineType(int line, Accessor &styler) {
|
||||
int pos = LineStart(line, styler) ;
|
||||
int eol_pos = LineEnd(line, styler) ;
|
||||
static int LineType(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = LineStart(line, styler) ;
|
||||
Sci_Position eol_pos = LineEnd(line, styler) ;
|
||||
|
||||
int c ;
|
||||
char ch = ' ';
|
||||
|
||||
int i = pos ;
|
||||
Sci_Position i = pos ;
|
||||
while ( i < eol_pos ) {
|
||||
c = styler.SafeGetCharAt(i);
|
||||
ch = static_cast<char>(LowerCase(c));
|
||||
@ -418,7 +418,7 @@ static int LineType(int line, Accessor &styler) {
|
||||
return 4 ;
|
||||
}
|
||||
|
||||
static void SafeSetLevel(int line, int level, Accessor &styler)
|
||||
static void SafeSetLevel(Sci_Position line, int level, Accessor &styler)
|
||||
{
|
||||
if ( line < 0 )
|
||||
return ;
|
||||
@ -432,20 +432,20 @@ static void SafeSetLevel(int line, int level, Accessor &styler)
|
||||
styler.SetLevel(line, level) ;
|
||||
}
|
||||
|
||||
static void FoldABAQUSDoc(unsigned int startPos, int length, int,
|
||||
static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
int startLine = styler.GetLine(startPos) ;
|
||||
int endLine = styler.GetLine(startPos+length-1) ;
|
||||
Sci_Position startLine = styler.GetLine(startPos) ;
|
||||
Sci_Position endLine = styler.GetLine(startPos+length-1) ;
|
||||
|
||||
// bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
// We want to deal with all the cases
|
||||
// To know the correct indentlevel, we need to look back to the
|
||||
// previous command line indentation level
|
||||
// order of formatting keyline datalines commentlines
|
||||
int beginData = -1 ;
|
||||
int beginComment = -1 ;
|
||||
int prvKeyLine = startLine ;
|
||||
int prvKeyLineTp = 0 ;
|
||||
Sci_Position beginData = -1 ;
|
||||
Sci_Position beginComment = -1 ;
|
||||
Sci_Position prvKeyLine = startLine ;
|
||||
Sci_Position prvKeyLineTp = 0 ;
|
||||
|
||||
// Scan until we find the previous keyword line
|
||||
// this will give us the level reference that we need
|
||||
@ -467,7 +467,7 @@ WordList *[], Accessor &styler) {
|
||||
prvKeyLine = -1 ;
|
||||
|
||||
// Now start scanning over the lines.
|
||||
for ( int line = startLine; line <= endLine; line++ ) {
|
||||
for ( Sci_Position line = startLine; line <= endLine; line++ ) {
|
||||
int lineType = LineType(line, styler) ;
|
||||
|
||||
// Check for comment line
|
||||
@ -516,7 +516,7 @@ WordList *[], Accessor &styler) {
|
||||
datLevel = level ;
|
||||
}
|
||||
|
||||
for ( int ll = beginData; ll < beginComment; ll++ )
|
||||
for ( Sci_Position ll = beginData; ll < beginComment; ll++ )
|
||||
SafeSetLevel(ll, datLevel, styler) ;
|
||||
|
||||
// The keyword we just found is going to be written at another level
|
||||
@ -532,7 +532,7 @@ WordList *[], Accessor &styler) {
|
||||
}
|
||||
}
|
||||
|
||||
for ( int lll = beginComment; lll < line; lll++ )
|
||||
for ( Sci_Position lll = beginComment; lll < line; lll++ )
|
||||
SafeSetLevel(lll, level, styler) ;
|
||||
|
||||
// wrap and reset
|
||||
@ -549,10 +549,10 @@ WordList *[], Accessor &styler) {
|
||||
} else {
|
||||
// We need to find out whether this comment block is followed by
|
||||
// a data line or a keyword line
|
||||
const int docLines = styler.GetLine(styler.Length() - 1);
|
||||
const Sci_Position docLines = styler.GetLine(styler.Length() - 1);
|
||||
|
||||
for ( int line = endLine + 1; line <= docLines; line++ ) {
|
||||
int lineType = LineType(line, styler) ;
|
||||
for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) {
|
||||
Sci_Position lineType = LineType(line, styler) ;
|
||||
|
||||
if ( lineType != 8 ) {
|
||||
if ( !(lineType & 4) ) {
|
||||
@ -578,7 +578,7 @@ WordList *[], Accessor &styler) {
|
||||
datLevel = level ;
|
||||
}
|
||||
|
||||
for ( int ll = beginData; ll < beginComment; ll++ )
|
||||
for ( Sci_Position ll = beginData; ll < beginComment; ll++ )
|
||||
SafeSetLevel(ll, datLevel, styler) ;
|
||||
|
||||
if ( prvKeyLineTp == 5 ) {
|
||||
@ -588,7 +588,7 @@ WordList *[], Accessor &styler) {
|
||||
if ( prvKeyLineTp == 6 ) {
|
||||
level -= 1 ;
|
||||
}
|
||||
for ( int m = beginComment; m <= endLine; m++ )
|
||||
for ( Sci_Position m = beginComment; m <= endLine; m++ )
|
||||
SafeSetLevel(m, level, styler) ;
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ using namespace Scintilla;
|
||||
*/
|
||||
|
||||
static void ColouriseDocument(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler);
|
||||
@ -222,8 +222,8 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe
|
||||
//
|
||||
|
||||
static void ColouriseDocument(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -231,7 +231,7 @@ static void ColouriseDocument(
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
|
||||
|
||||
while (sc.More()) {
|
||||
|
@ -172,13 +172,13 @@ public:
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osAsm.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osAsm.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -193,14 +193,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) {
|
||||
if (osAsm.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -228,7 +228,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
|
||||
wordListN = &directives4foldend;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -240,7 +240,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
// Do not leak onto next line
|
||||
@ -371,16 +371,16 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "else".
|
||||
|
||||
void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -391,7 +391,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle,
|
||||
char word[100];
|
||||
int wordlen = 0;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -453,7 +453,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
|
||||
if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length() - 1))) {
|
||||
// There is an empty line at end of file so give it same level and empty
|
||||
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ static bool isAsn1Char(int ch)
|
||||
// Function determining the color of a given code portion
|
||||
// Based on a "state"
|
||||
//
|
||||
static void ColouriseAsn1Doc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[], Accessor &styler)
|
||||
static void ColouriseAsn1Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[], Accessor &styler)
|
||||
{
|
||||
// The keywords
|
||||
WordList &Keywords = *keywordLists[0];
|
||||
@ -168,7 +168,7 @@ asn1_default:
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldAsn1Doc(unsigned int, int, int, WordList *[], Accessor &styler)
|
||||
static void FoldAsn1Doc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
// No folding enabled, no reason to continue...
|
||||
if( styler.GetPropertyInt("fold") == 0 )
|
||||
|
@ -36,7 +36,7 @@ static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static void ColouriseBaanDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseBaanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -137,19 +137,19 @@ static void ColouriseBaanDoc(unsigned int startPos, int length, int initStyle, W
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldBaanDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
||||
static void FoldBaanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -96,7 +96,20 @@ static int opposite(int ch) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
static int GlobScan(StyleContext &sc) {
|
||||
// forward scan for a glob-like (...), no whitespace allowed
|
||||
int c, sLen = 0;
|
||||
while ((c = sc.GetRelativeCharacter(++sLen)) != 0) {
|
||||
if (IsASpace(c)) {
|
||||
return 0;
|
||||
} else if (c == ')') {
|
||||
return sLen;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -113,9 +126,9 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@");
|
||||
CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn");
|
||||
CharacterSet setParam(CharacterSet::setAlphaNum, "$_");
|
||||
CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!");
|
||||
CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!");
|
||||
CharacterSet setLeftShift(CharacterSet::setDigits, "=$");
|
||||
CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!%*,./:?@[]^`{}~");
|
||||
CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!%*,./:=?@[]^`{}~");
|
||||
CharacterSet setLeftShift(CharacterSet::setDigits, "$");
|
||||
|
||||
class HereDocCls { // Class to manage HERE document elements
|
||||
public:
|
||||
@ -126,14 +139,13 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
bool Quoted; // true if Quote in ('\'','"','`')
|
||||
bool Indent; // indented delimiter (for <<-)
|
||||
int DelimiterLength; // strlen(Delimiter)
|
||||
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
|
||||
char Delimiter[HERE_DELIM_MAX]; // the Delimiter
|
||||
HereDocCls() {
|
||||
State = 0;
|
||||
Quote = 0;
|
||||
Quoted = false;
|
||||
Indent = 0;
|
||||
DelimiterLength = 0;
|
||||
Delimiter = new char[HERE_DELIM_MAX];
|
||||
Delimiter[0] = '\0';
|
||||
}
|
||||
void Append(int ch) {
|
||||
@ -141,7 +153,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
Delimiter[DelimiterLength] = '\0';
|
||||
}
|
||||
~HereDocCls() {
|
||||
delete []Delimiter;
|
||||
}
|
||||
};
|
||||
HereDocCls HereDoc;
|
||||
@ -173,18 +184,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
int Up, Down;
|
||||
int Style;
|
||||
int Depth; // levels pushed
|
||||
int *CountStack;
|
||||
int *UpStack;
|
||||
int *StyleStack;
|
||||
int CountStack[BASH_DELIM_STACK_MAX];
|
||||
int UpStack [BASH_DELIM_STACK_MAX];
|
||||
int StyleStack[BASH_DELIM_STACK_MAX];
|
||||
QuoteStackCls() {
|
||||
Count = 0;
|
||||
Up = '\0';
|
||||
Down = '\0';
|
||||
Style = 0;
|
||||
Depth = 0;
|
||||
CountStack = new int[BASH_DELIM_STACK_MAX];
|
||||
UpStack = new int[BASH_DELIM_STACK_MAX];
|
||||
StyleStack = new int[BASH_DELIM_STACK_MAX];
|
||||
}
|
||||
void Start(int u, int s) {
|
||||
Count = 1;
|
||||
@ -214,23 +222,20 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
Down = opposite(Up);
|
||||
}
|
||||
~QuoteStackCls() {
|
||||
delete []CountStack;
|
||||
delete []UpStack;
|
||||
delete []StyleStack;
|
||||
}
|
||||
};
|
||||
QuoteStackCls QuoteStack;
|
||||
|
||||
int numBase = 0;
|
||||
int digit;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int cmdState = BASH_CMD_START;
|
||||
int testExprType = 0;
|
||||
|
||||
// Always backtracks to the start of a line that is not a continuation
|
||||
// of the previous line (i.e. start of a bash command segment)
|
||||
int ln = styler.GetLine(startPos);
|
||||
if (ln > 0 && startPos == static_cast<unsigned int>(styler.LineStart(ln)))
|
||||
Sci_Position ln = styler.GetLine(startPos);
|
||||
if (ln > 0 && startPos == static_cast<Sci_PositionU>(styler.LineStart(ln)))
|
||||
ln--;
|
||||
for (;;) {
|
||||
startPos = styler.LineStart(ln);
|
||||
@ -345,6 +350,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.ForwardSetState(SCE_SH_DEFAULT);
|
||||
} else if (!setWord.Contains(sc.ch)) {
|
||||
sc.SetState(SCE_SH_DEFAULT);
|
||||
} else if (cmdState == BASH_CMD_ARITH && !setWordStart.Contains(sc.ch)) {
|
||||
sc.SetState(SCE_SH_DEFAULT);
|
||||
}
|
||||
break;
|
||||
case SCE_SH_NUMBER:
|
||||
@ -419,17 +426,18 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Forward();
|
||||
HereDoc.Quoted = true;
|
||||
HereDoc.State = 1;
|
||||
} else if (setHereDoc.Contains(sc.chNext)) {
|
||||
} else if (setHereDoc.Contains(sc.chNext) ||
|
||||
(sc.chNext == '=' && cmdState != BASH_CMD_ARITH)) {
|
||||
// an unquoted here-doc delimiter, no special handling
|
||||
// TODO check what exactly bash considers part of the delim
|
||||
HereDoc.State = 1;
|
||||
} else if (sc.chNext == '<') { // HERE string <<<
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_SH_DEFAULT);
|
||||
} else if (IsASpace(sc.chNext)) {
|
||||
// eat whitespace
|
||||
} else if (setLeftShift.Contains(sc.chNext)) {
|
||||
// left shift << or <<= operator cases
|
||||
} else if (setLeftShift.Contains(sc.chNext) ||
|
||||
(sc.chNext == '=' && cmdState == BASH_CMD_ARITH)) {
|
||||
// left shift <<$var or <<= cases
|
||||
sc.ChangeState(SCE_SH_OPERATOR);
|
||||
sc.ForwardSetState(SCE_SH_DEFAULT);
|
||||
} else {
|
||||
@ -584,12 +592,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
HereDoc.State = 2;
|
||||
if (HereDoc.Quoted) {
|
||||
if (sc.state == SCE_SH_HERE_DELIM) {
|
||||
// Missing quote at end of string! We are stricter than bash.
|
||||
// Colour here-doc anyway while marking this bit as an error.
|
||||
// Missing quote at end of string! Syntax error in bash 4.3
|
||||
// Mark this bit as an error, do not colour any here-doc
|
||||
sc.ChangeState(SCE_SH_ERROR);
|
||||
sc.SetState(SCE_SH_DEFAULT);
|
||||
} else {
|
||||
// HereDoc.Quote always == '\''
|
||||
sc.SetState(SCE_SH_HERE_Q);
|
||||
}
|
||||
// HereDoc.Quote always == '\''
|
||||
sc.SetState(SCE_SH_HERE_Q);
|
||||
} else if (HereDoc.DelimiterLength == 0) {
|
||||
// no delimiter, illegal (but '' and "" are legal)
|
||||
sc.ChangeState(SCE_SH_ERROR);
|
||||
@ -634,6 +644,23 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else {
|
||||
sc.SetState(SCE_SH_WORD);
|
||||
}
|
||||
// handle some zsh features within arithmetic expressions only
|
||||
if (cmdState == BASH_CMD_ARITH) {
|
||||
if (sc.chPrev == '[') { // [#8] [##8] output digit setting
|
||||
sc.SetState(SCE_SH_WORD);
|
||||
if (sc.chNext == '#') {
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.Match("##^") && IsUpperCase(sc.GetRelative(3))) { // ##^A
|
||||
sc.SetState(SCE_SH_IDENTIFIER);
|
||||
sc.Forward(3);
|
||||
} else if (sc.chNext == '#' && !IsASpace(sc.GetRelative(2))) { // ##a
|
||||
sc.SetState(SCE_SH_IDENTIFIER);
|
||||
sc.Forward(2);
|
||||
} else if (setWordStart.Contains(sc.chNext)) { // #name
|
||||
sc.SetState(SCE_SH_IDENTIFIER);
|
||||
}
|
||||
}
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_SH_STRING);
|
||||
QuoteStack.Start(sc.ch, BASH_DELIM_STRING);
|
||||
@ -687,6 +714,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
char s[10];
|
||||
bool isCmdDelim = false;
|
||||
sc.SetState(SCE_SH_OPERATOR);
|
||||
// globs have no whitespace, do not appear in arithmetic expressions
|
||||
if (cmdState != BASH_CMD_ARITH && sc.ch == '(' && sc.chNext != '(') {
|
||||
int i = GlobScan(sc);
|
||||
if (i > 1) {
|
||||
sc.SetState(SCE_SH_IDENTIFIER);
|
||||
sc.Forward(i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// handle opening delimiters for test/arithmetic expressions - ((,[[,[
|
||||
if (cmdState == BASH_CMD_START
|
||||
|| cmdState == BASH_CMD_BODY) {
|
||||
@ -752,10 +788,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eol_pos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eol_pos; i++) {
|
||||
char ch = styler[i];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
@ -765,19 +801,19 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
static void FoldBashDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int skipHereCh = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -255,13 +255,13 @@ public:
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osBasic.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osBasic.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -277,14 +277,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) {
|
||||
if (osBasic.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -300,7 +300,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
|
||||
wordListN = &keywordlists[3];
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -312,7 +312,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerBasic::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
bool wasfirst = true, isfirst = true; // true if first token in a line
|
||||
@ -471,17 +471,17 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
|
||||
|
||||
void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
int line = styler.GetLine(startPos);
|
||||
Sci_Position line = styler.GetLine(startPos);
|
||||
int level = styler.LevelAt(line);
|
||||
int go = 0, done = 0;
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
char word[256];
|
||||
int wordlen = 0;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
@ -489,7 +489,7 @@ void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initS
|
||||
|
||||
// Scan for tokens at the start of the line (they may include
|
||||
// whitespace, for tokens like "End Function"
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
int c = cNext;
|
||||
cNext = styler.SafeGetCharAt(i + 1);
|
||||
bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n');
|
||||
|
500
src/stc/scintilla/lexers/LexBatch.cxx
Normal file
500
src/stc/scintilla/lexers/LexBatch.cxx
Normal file
@ -0,0 +1,500 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexBatch.cxx
|
||||
** Lexer for batch files.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static bool Is0To9(char ch) {
|
||||
return (ch >= '0') && (ch <= '9');
|
||||
}
|
||||
|
||||
static bool IsAlphabetic(int ch) {
|
||||
return IsASCII(ch) && isalpha(ch);
|
||||
}
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
}
|
||||
|
||||
// Tests for BATCH Operators
|
||||
static bool IsBOperator(char ch) {
|
||||
return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') ||
|
||||
(ch == '|') || (ch == '?') || (ch == '*');
|
||||
}
|
||||
|
||||
// Tests for BATCH Separators
|
||||
static bool IsBSeparator(char ch) {
|
||||
return (ch == '\\') || (ch == '.') || (ch == ';') ||
|
||||
(ch == '\"') || (ch == '\'') || (ch == '/');
|
||||
}
|
||||
|
||||
static void ColouriseBatchLine(
|
||||
char *lineBuffer,
|
||||
Sci_PositionU lengthLine,
|
||||
Sci_PositionU startLine,
|
||||
Sci_PositionU endPos,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
Sci_PositionU offset = 0; // Line Buffer Offset
|
||||
Sci_PositionU cmdLoc; // External Command / Program Location
|
||||
char wordBuffer[81]; // Word Buffer - large to catch long paths
|
||||
Sci_PositionU wbl; // Word Buffer Length
|
||||
Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length
|
||||
WordList &keywords = *keywordlists[0]; // Internal Commands
|
||||
WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
|
||||
|
||||
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
|
||||
// Toggling Regular Keyword Checking off improves readability
|
||||
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
|
||||
// Need a more robust algorithm to properly toggle Regular Keyword Checking
|
||||
bool continueProcessing = true; // Used to toggle Regular Keyword Checking
|
||||
// Special Keywords are those that allow certain characters without whitespace after the command
|
||||
// Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path=
|
||||
// Special Keyword Buffer used to determine if the first n characters is a Keyword
|
||||
char sKeywordBuffer[10]; // Special Keyword Buffer
|
||||
bool sKeywordFound; // Exit Special Keyword for-loop if found
|
||||
|
||||
// Skip initial spaces
|
||||
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
|
||||
offset++;
|
||||
}
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
|
||||
// Set External Command / Program Location
|
||||
cmdLoc = offset;
|
||||
|
||||
// Check for Fake Label (Comment) or Real Label - return if found
|
||||
if (lineBuffer[offset] == ':') {
|
||||
if (lineBuffer[offset + 1] == ':') {
|
||||
// Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
|
||||
styler.ColourTo(endPos, SCE_BAT_COMMENT);
|
||||
} else {
|
||||
// Colorize Real Label
|
||||
styler.ColourTo(endPos, SCE_BAT_LABEL);
|
||||
}
|
||||
return;
|
||||
// Check for Drive Change (Drive Change is internal command) - return if found
|
||||
} else if ((IsAlphabetic(lineBuffer[offset])) &&
|
||||
(lineBuffer[offset + 1] == ':') &&
|
||||
((isspacechar(lineBuffer[offset + 2])) ||
|
||||
(((lineBuffer[offset + 2] == '\\')) &&
|
||||
(isspacechar(lineBuffer[offset + 3]))))) {
|
||||
// Colorize Regular Keyword
|
||||
styler.ColourTo(endPos, SCE_BAT_WORD);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for Hide Command (@ECHO OFF/ON)
|
||||
if (lineBuffer[offset] == '@') {
|
||||
styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
|
||||
offset++;
|
||||
}
|
||||
// Skip next spaces
|
||||
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
|
||||
offset++;
|
||||
}
|
||||
|
||||
// Read remainder of line word-at-a-time or remainder-of-word-at-a-time
|
||||
while (offset < lengthLine) {
|
||||
if (offset > startLine) {
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
|
||||
}
|
||||
// Copy word from Line Buffer into Word Buffer
|
||||
wbl = 0;
|
||||
for (; offset < lengthLine && wbl < 80 &&
|
||||
!isspacechar(lineBuffer[offset]); wbl++, offset++) {
|
||||
wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
|
||||
}
|
||||
wordBuffer[wbl] = '\0';
|
||||
wbo = 0;
|
||||
|
||||
// Check for Comment - return if found
|
||||
if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
|
||||
styler.ColourTo(endPos, SCE_BAT_COMMENT);
|
||||
return;
|
||||
}
|
||||
// Check for Separator
|
||||
if (IsBSeparator(wordBuffer[0])) {
|
||||
// Check for External Command / Program
|
||||
if ((cmdLoc == offset - wbl) &&
|
||||
((wordBuffer[0] == ':') ||
|
||||
(wordBuffer[0] == '\\') ||
|
||||
(wordBuffer[0] == '.'))) {
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 1);
|
||||
// Colorize External Command / Program
|
||||
if (!keywords2) {
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
|
||||
} else if (keywords2.InList(wordBuffer)) {
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
|
||||
} else {
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
|
||||
}
|
||||
// Reset External Command / Program Location
|
||||
cmdLoc = offset;
|
||||
} else {
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 1);
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
|
||||
}
|
||||
// Check for Regular Keyword in list
|
||||
} else if ((keywords.InList(wordBuffer)) &&
|
||||
(continueProcessing)) {
|
||||
// ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
|
||||
if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "prompt") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "set") == 0)) {
|
||||
continueProcessing = false;
|
||||
}
|
||||
// Identify External Command / Program Location for ERRORLEVEL, and EXIST
|
||||
if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "exist") == 0)) {
|
||||
// Reset External Command / Program Location
|
||||
cmdLoc = offset;
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Skip comparison
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(!isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Identify External Command / Program Location for CALL, DO, LOADHIGH and LH
|
||||
} else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "do") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) ||
|
||||
(CompareCaseInsensitive(wordBuffer, "lh") == 0)) {
|
||||
// Reset External Command / Program Location
|
||||
cmdLoc = offset;
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
}
|
||||
// Colorize Regular keyword
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);
|
||||
// No need to Reset Offset
|
||||
// Check for Special Keyword in list, External Command / Program, or Default Text
|
||||
} else if ((wordBuffer[0] != '%') &&
|
||||
(wordBuffer[0] != '!') &&
|
||||
(!IsBOperator(wordBuffer[0])) &&
|
||||
(continueProcessing)) {
|
||||
// Check for Special Keyword
|
||||
// Affected Commands are in Length range 2-6
|
||||
// Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected
|
||||
sKeywordFound = false;
|
||||
for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) {
|
||||
wbo = 0;
|
||||
// Copy Keyword Length from Word Buffer into Special Keyword Buffer
|
||||
for (; wbo < keywordLength; wbo++) {
|
||||
sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]);
|
||||
}
|
||||
sKeywordBuffer[wbo] = '\0';
|
||||
// Check for Special Keyword in list
|
||||
if ((keywords.InList(sKeywordBuffer)) &&
|
||||
((IsBOperator(wordBuffer[wbo])) ||
|
||||
(IsBSeparator(wordBuffer[wbo])))) {
|
||||
sKeywordFound = true;
|
||||
// ECHO requires no further Regular Keyword Checking
|
||||
if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) {
|
||||
continueProcessing = false;
|
||||
}
|
||||
// Colorize Special Keyword as Regular Keyword
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
}
|
||||
}
|
||||
// Check for External Command / Program or Default Text
|
||||
if (!sKeywordFound) {
|
||||
wbo = 0;
|
||||
// Check for External Command / Program
|
||||
if (cmdLoc == offset - wbl) {
|
||||
// Read up to %, Operator or Separator
|
||||
while ((wbo < wbl) &&
|
||||
(wordBuffer[wbo] != '%') &&
|
||||
(wordBuffer[wbo] != '!') &&
|
||||
(!IsBOperator(wordBuffer[wbo])) &&
|
||||
(!IsBSeparator(wordBuffer[wbo]))) {
|
||||
wbo++;
|
||||
}
|
||||
// Reset External Command / Program Location
|
||||
cmdLoc = offset - (wbl - wbo);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
// CHOICE requires no further Regular Keyword Checking
|
||||
if (CompareCaseInsensitive(wordBuffer, "choice") == 0) {
|
||||
continueProcessing = false;
|
||||
}
|
||||
// Check for START (and its switches) - What follows is External Command \ Program
|
||||
if (CompareCaseInsensitive(wordBuffer, "start") == 0) {
|
||||
// Reset External Command / Program Location
|
||||
cmdLoc = offset;
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Reset External Command / Program Location if command switch detected
|
||||
if (lineBuffer[cmdLoc] == '/') {
|
||||
// Skip command switch
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(!isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Colorize External Command / Program
|
||||
if (!keywords2) {
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
|
||||
} else if (keywords2.InList(wordBuffer)) {
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
|
||||
} else {
|
||||
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
|
||||
}
|
||||
// No need to Reset Offset
|
||||
// Check for Default Text
|
||||
} else {
|
||||
// Read up to %, Operator or Separator
|
||||
while ((wbo < wbl) &&
|
||||
(wordBuffer[wbo] != '%') &&
|
||||
(wordBuffer[wbo] != '!') &&
|
||||
(!IsBOperator(wordBuffer[wbo])) &&
|
||||
(!IsBSeparator(wordBuffer[wbo]))) {
|
||||
wbo++;
|
||||
}
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
}
|
||||
}
|
||||
// Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a)
|
||||
} else if (wordBuffer[0] == '%') {
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
|
||||
wbo++;
|
||||
// Search to end of word for second % (can be a long path)
|
||||
while ((wbo < wbl) &&
|
||||
(wordBuffer[wbo] != '%') &&
|
||||
(!IsBOperator(wordBuffer[wbo])) &&
|
||||
(!IsBSeparator(wordBuffer[wbo]))) {
|
||||
wbo++;
|
||||
}
|
||||
// Check for Argument (%n) or (%*)
|
||||
if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) &&
|
||||
(wordBuffer[wbo] != '%')) {
|
||||
// Check for External Command / Program
|
||||
if (cmdLoc == offset - wbl) {
|
||||
cmdLoc = offset - (wbl - 2);
|
||||
}
|
||||
// Colorize Argument
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 2);
|
||||
// Check for Expanded Argument (%~...) / Variable (%%~...)
|
||||
} else if (((wbl > 1) && (wordBuffer[1] == '~')) ||
|
||||
((wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] == '~'))) {
|
||||
// Check for External Command / Program
|
||||
if (cmdLoc == offset - wbl) {
|
||||
cmdLoc = offset - (wbl - wbo);
|
||||
}
|
||||
// Colorize Expanded Argument / Variable
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
// Check for Environment Variable (%x...%)
|
||||
} else if ((wordBuffer[1] != '%') &&
|
||||
(wordBuffer[wbo] == '%')) {
|
||||
wbo++;
|
||||
// Check for External Command / Program
|
||||
if (cmdLoc == offset - wbl) {
|
||||
cmdLoc = offset - (wbl - wbo);
|
||||
}
|
||||
// Colorize Environment Variable
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
// Check for Local Variable (%%a)
|
||||
} else if (
|
||||
(wbl > 2) &&
|
||||
(wordBuffer[1] == '%') &&
|
||||
(wordBuffer[2] != '%') &&
|
||||
(!IsBOperator(wordBuffer[2])) &&
|
||||
(!IsBSeparator(wordBuffer[2]))) {
|
||||
// Check for External Command / Program
|
||||
if (cmdLoc == offset - wbl) {
|
||||
cmdLoc = offset - (wbl - 3);
|
||||
}
|
||||
// Colorize Local Variable
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 3);
|
||||
}
|
||||
// Check for Environment Variable (!x...!)
|
||||
} else if (wordBuffer[0] == '!') {
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
|
||||
wbo++;
|
||||
// Search to end of word for second ! (can be a long path)
|
||||
while ((wbo < wbl) &&
|
||||
(wordBuffer[wbo] != '!') &&
|
||||
(!IsBOperator(wordBuffer[wbo])) &&
|
||||
(!IsBSeparator(wordBuffer[wbo]))) {
|
||||
wbo++;
|
||||
}
|
||||
if (wordBuffer[wbo] == '!') {
|
||||
wbo++;
|
||||
// Check for External Command / Program
|
||||
if (cmdLoc == offset - wbl) {
|
||||
cmdLoc = offset - (wbl - wbo);
|
||||
}
|
||||
// Colorize Environment Variable
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
}
|
||||
// Check for Operator
|
||||
} else if (IsBOperator(wordBuffer[0])) {
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
|
||||
// Check for Comparison Operator
|
||||
if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) {
|
||||
// Identify External Command / Program Location for IF
|
||||
cmdLoc = offset;
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Colorize Comparison Operator
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 2);
|
||||
// Check for Pipe Operator
|
||||
} else if (wordBuffer[0] == '|') {
|
||||
// Reset External Command / Program Location
|
||||
cmdLoc = offset - wbl + 1;
|
||||
// Skip next spaces
|
||||
while ((cmdLoc < lengthLine) &&
|
||||
(isspacechar(lineBuffer[cmdLoc]))) {
|
||||
cmdLoc++;
|
||||
}
|
||||
// Colorize Pipe Operator
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 1);
|
||||
// Check for Other Operator
|
||||
} else {
|
||||
// Check for > Operator
|
||||
if (wordBuffer[0] == '>') {
|
||||
// Turn Keyword and External Command / Program checking back on
|
||||
continueProcessing = true;
|
||||
}
|
||||
// Colorize Other Operator
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - 1);
|
||||
}
|
||||
// Check for Default Text
|
||||
} else {
|
||||
// Read up to %, Operator or Separator
|
||||
while ((wbo < wbl) &&
|
||||
(wordBuffer[wbo] != '%') &&
|
||||
(wordBuffer[wbo] != '!') &&
|
||||
(!IsBOperator(wordBuffer[wbo])) &&
|
||||
(!IsBSeparator(wordBuffer[wbo]))) {
|
||||
wbo++;
|
||||
}
|
||||
// Colorize Default Text
|
||||
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
|
||||
// Reset Offset to re-process remainder of word
|
||||
offset -= (wbl - wbo);
|
||||
}
|
||||
// Skip next spaces - nothing happens if Offset was Reset
|
||||
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
// Colorize Default Text for remainder of line - currently not lexed
|
||||
styler.ColourTo(endPos, SCE_BAT_DEFAULT);
|
||||
}
|
||||
|
||||
static void ColouriseBatchDoc(
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int /*initStyle*/,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
char lineBuffer[1024];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
Sci_PositionU linePos = 0;
|
||||
Sci_PositionU startLine = startPos;
|
||||
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
// End of line (or of line buffer) met, colourise it
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
|
||||
linePos = 0;
|
||||
startLine = i + 1;
|
||||
}
|
||||
}
|
||||
if (linePos > 0) { // Last line does not have ending characters
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
|
||||
keywordlists, styler);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *const batchWordListDesc[] = {
|
||||
"Internal Commands",
|
||||
"External Commands",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
|
@ -76,7 +76,7 @@ namespace {
|
||||
return IsEntryStart(sc.chPrev, sc.ch);
|
||||
}
|
||||
|
||||
void ColorizeBibTeX(unsigned start_pos, int length, int /*init_style*/, WordList* keywordlists[], Accessor& styler)
|
||||
void ColorizeBibTeX(Sci_PositionU start_pos, Sci_Position length, int /*init_style*/, WordList* keywordlists[], Accessor& styler)
|
||||
{
|
||||
WordList &EntryNames = *keywordlists[0];
|
||||
bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
@ -94,7 +94,7 @@ namespace {
|
||||
styler.StartAt(start_pos);
|
||||
styler.StartSegment(start_pos);
|
||||
|
||||
int current_line = styler.GetLine(start_pos);
|
||||
Sci_Position current_line = styler.GetLine(start_pos);
|
||||
int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK;
|
||||
int current_level = prev_level;
|
||||
int visible_chars = 0;
|
||||
@ -153,7 +153,7 @@ namespace {
|
||||
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the =
|
||||
sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization
|
||||
|
||||
int start = sc.currentPos;
|
||||
Sci_Position start = sc.currentPos;
|
||||
|
||||
// We need to handle multiple situations:
|
||||
// 1. name"one two {three}"
|
||||
@ -227,12 +227,12 @@ namespace {
|
||||
state = SCE_BIBTEX_DEFAULT;
|
||||
}
|
||||
|
||||
int end = sc.currentPos;
|
||||
Sci_Position end = sc.currentPos;
|
||||
current_line = styler.GetLine(end);
|
||||
|
||||
// We have possibly skipped some lines, so the folding levels
|
||||
// have to be adjusted separately
|
||||
for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i)
|
||||
for (Sci_Position i = styler.GetLine(start); i <= styler.GetLine(end); ++i)
|
||||
styler.SetLevel(i, prev_level);
|
||||
|
||||
sc.ForwardSetState(state);
|
||||
|
@ -23,10 +23,10 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
static int classifyWordBullant(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
|
||||
char s[100];
|
||||
s[0] = '\0';
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
@ -58,14 +58,14 @@ static int classifyWordBullant(unsigned int start, unsigned int end, WordList &k
|
||||
return lev;
|
||||
}
|
||||
|
||||
static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
bool fold = styler.GetPropertyInt("fold") != 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
|
||||
@ -74,11 +74,11 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle
|
||||
state = SCE_C_DEFAULT;
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
styler.StartSegment(startPos);
|
||||
int endFoundThisLine = 0;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
|
@ -142,12 +142,12 @@ inline bool SetNumericConstantState(StyleContext &scDoc) {
|
||||
}
|
||||
|
||||
// Get the next word in uppercase from the current position (keyword lookahead)
|
||||
inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) {
|
||||
inline bool GetNextWordUpper(Accessor &styler, Sci_PositionU uiStartPos, Sci_Position iLength, char *cWord) {
|
||||
|
||||
unsigned int iIndex = 0; // Buffer Index
|
||||
Sci_PositionU iIndex = 0; // Buffer Index
|
||||
|
||||
// Loop through the remaining string from the current position
|
||||
for (int iOffset = uiStartPos; iOffset < iLength; iOffset++) {
|
||||
for (Sci_Position iOffset = uiStartPos; iOffset < iLength; iOffset++) {
|
||||
// Get the character from the buffer using the offset
|
||||
char cCharacter = styler[iOffset];
|
||||
if (IsEOL(cCharacter)) {
|
||||
@ -174,7 +174,7 @@ inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLen
|
||||
}
|
||||
|
||||
// Clarion Language Colouring Procedure
|
||||
static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
|
||||
static void ColouriseClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
|
||||
|
||||
int iParenthesesLevel = 0; // Parenthese Level
|
||||
int iColumn1Label = false; // Label starts in Column 1
|
||||
@ -521,22 +521,22 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS
|
||||
}
|
||||
|
||||
// Clarion Language Case Sensitive Colouring Procedure
|
||||
static void ColouriseClarionDocSensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
static void ColouriseClarionDocSensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
|
||||
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true);
|
||||
}
|
||||
|
||||
// Clarion Language Case Insensitive Colouring Procedure
|
||||
static void ColouriseClarionDocInsensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
static void ColouriseClarionDocInsensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
|
||||
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false);
|
||||
}
|
||||
|
||||
// Fill Buffer
|
||||
|
||||
static void FillBuffer(unsigned int uiStart, unsigned int uiEnd, Accessor &accStyler, char *szBuffer, unsigned int uiLength) {
|
||||
static void FillBuffer(Sci_PositionU uiStart, Sci_PositionU uiEnd, Accessor &accStyler, char *szBuffer, Sci_PositionU uiLength) {
|
||||
|
||||
unsigned int uiPos = 0;
|
||||
Sci_PositionU uiPos = 0;
|
||||
|
||||
while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) {
|
||||
szBuffer[uiPos] = static_cast<char>(toupper(accStyler[uiStart + uiPos]));
|
||||
@ -599,19 +599,19 @@ static int ClassifyClarionFoldPoint(int iLevel, const char* szString) {
|
||||
}
|
||||
|
||||
// Clarion Language Folding Procedure
|
||||
static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
|
||||
static void FoldClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
|
||||
|
||||
unsigned int uiEndPos = uiStartPos + iLength;
|
||||
int iLineCurrent = accStyler.GetLine(uiStartPos);
|
||||
Sci_PositionU uiEndPos = uiStartPos + iLength;
|
||||
Sci_Position iLineCurrent = accStyler.GetLine(uiStartPos);
|
||||
int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int iLevelCurrent = iLevelPrev;
|
||||
char chNext = accStyler[uiStartPos];
|
||||
int iStyle = iInitStyle;
|
||||
int iStyleNext = accStyler.StyleAt(uiStartPos);
|
||||
int iVisibleChars = 0;
|
||||
int iLastStart = 0;
|
||||
Sci_Position iLastStart = 0;
|
||||
|
||||
for (unsigned int uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
|
||||
for (Sci_PositionU uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
|
||||
|
||||
char chChar = chNext;
|
||||
chNext = accStyler.SafeGetCharAt(uiPos + 1);
|
||||
|
@ -64,12 +64,12 @@ static int CountBits(int nBits)
|
||||
return count;
|
||||
}
|
||||
|
||||
static void getRange(unsigned int start,
|
||||
unsigned int end,
|
||||
static void getRange(Sci_PositionU start,
|
||||
Sci_PositionU end,
|
||||
Accessor &styler,
|
||||
char *s,
|
||||
unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while ((i < end - start + 1) && (i < len-1)) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
i++;
|
||||
@ -77,12 +77,12 @@ static void getRange(unsigned int start,
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) {
|
||||
static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) {
|
||||
styler.ColourTo(end, attr);
|
||||
}
|
||||
|
||||
|
||||
static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
|
||||
static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
|
||||
int ret = 0;
|
||||
|
||||
WordList& a_keywords = *keywordlists[0];
|
||||
@ -142,7 +142,7 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
styler.StartAt(startPos);
|
||||
@ -152,11 +152,11 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
|
||||
state = SCE_C_DEFAULT;
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
|
||||
int nContainment;
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
if (currentLine > 0) {
|
||||
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
|
||||
nContainment = styler.GetLineState(currentLine);
|
||||
@ -170,7 +170,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
|
||||
bool bNewLine = true;
|
||||
bool bAarea = !isspacechar(chNext);
|
||||
int column = 0;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -277,7 +277,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
if (((i > styler.GetStartSegment() + 2) || (
|
||||
(initStyle == SCE_C_COMMENTDOC) &&
|
||||
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
|
||||
(styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) {
|
||||
ColourTo(styler, i, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
@ -309,12 +309,12 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
|
||||
ColourTo(styler, lengthDoc - 1, state);
|
||||
}
|
||||
|
||||
static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF;
|
||||
char chNext = styler[startPos];
|
||||
|
||||
@ -322,7 +322,7 @@ static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
bool bAarea = !isspacechar(chNext);
|
||||
int column = 0;
|
||||
bool bComment = false;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
++column;
|
||||
|
@ -54,7 +54,7 @@ bool IsSpaceEquiv(int state) {
|
||||
// Putting a space between the '++' post-inc operator and the '+' binary op
|
||||
// fixes this, and is highly recommended for readability anyway.
|
||||
bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
int pos = (int) sc.currentPos;
|
||||
Sci_Position pos = (Sci_Position) sc.currentPos;
|
||||
while (--pos > 0) {
|
||||
char ch = styler[pos];
|
||||
if (ch == '+' || ch == '-') {
|
||||
@ -66,9 +66,9 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
|
||||
bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
|
||||
// Don't look at styles, so no need to flush.
|
||||
int pos = (int) sc.currentPos;
|
||||
int currentLine = styler.GetLine(pos);
|
||||
int lineStartPos = styler.LineStart(currentLine);
|
||||
Sci_Position pos = (Sci_Position) sc.currentPos;
|
||||
Sci_Position currentLine = styler.GetLine(pos);
|
||||
Sci_Position lineStartPos = styler.LineStart(currentLine);
|
||||
while (--pos > lineStartPos) {
|
||||
char ch = styler.SafeGetCharAt(pos);
|
||||
if (ch != ' ' && ch != '\t') {
|
||||
@ -145,7 +145,7 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
|
||||
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
|
||||
const int lengthMarker = 50;
|
||||
char marker[lengthMarker+1];
|
||||
int currPos = (int) sc.currentPos;
|
||||
Sci_Position currPos = (Sci_Position) sc.currentPos;
|
||||
int i = 0;
|
||||
while (i < lengthMarker) {
|
||||
char ch = styler.SafeGetCharAt(currPos + i);
|
||||
@ -199,11 +199,11 @@ struct EscapeSequence {
|
||||
}
|
||||
};
|
||||
|
||||
std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
|
||||
std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) {
|
||||
std::string restOfLine;
|
||||
int i =0;
|
||||
Sci_Position i =0;
|
||||
char ch = styler.SafeGetCharAt(start, '\n');
|
||||
int endLine = styler.LineEnd(styler.GetLine(start));
|
||||
Sci_Position endLine = styler.LineEnd(styler.GetLine(start));
|
||||
while (((start+i) < endLine) && (ch != '\r')) {
|
||||
char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
|
||||
if (ch == '/' && (chNext == '/' || chNext == '*'))
|
||||
@ -224,12 +224,12 @@ bool IsStreamCommentStyle(int style) {
|
||||
}
|
||||
|
||||
struct PPDefinition {
|
||||
int line;
|
||||
Sci_Position line;
|
||||
std::string key;
|
||||
std::string value;
|
||||
bool isUndef;
|
||||
std::string arguments;
|
||||
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
|
||||
PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
|
||||
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
|
||||
}
|
||||
};
|
||||
@ -285,14 +285,14 @@ public:
|
||||
class PPStates {
|
||||
std::vector<LinePPState> vlls;
|
||||
public:
|
||||
LinePPState ForLine(int line) const {
|
||||
LinePPState ForLine(Sci_Position line) const {
|
||||
if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {
|
||||
return vlls[line];
|
||||
} else {
|
||||
return LinePPState();
|
||||
}
|
||||
}
|
||||
void Add(int line, LinePPState lls) {
|
||||
void Add(Sci_Position line, LinePPState lls) {
|
||||
vlls.resize(line+1);
|
||||
vlls[line] = lls;
|
||||
}
|
||||
@ -374,7 +374,7 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
|
||||
|
||||
DefineProperty("lexer.cpp.verbatim.strings.allow.escapes", &OptionsCPP::verbatimStringsAllowEscapes,
|
||||
"Set to 1 to allow verbatim strings to contain escape sequences.");
|
||||
|
||||
|
||||
DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings,
|
||||
"Set to 1 to enable highlighting of triple-quoted strings.");
|
||||
|
||||
@ -495,13 +495,13 @@ public:
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osCPP.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osCPP.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -555,7 +555,7 @@ public:
|
||||
bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions);
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
|
||||
if (osCPP.PropertySet(&options, key, val)) {
|
||||
if (strcmp(key, "lexer.cpp.allow.dollars") == 0) {
|
||||
setWord = CharacterSet(CharacterSet::setAlphaNum, "._", 0x80, true);
|
||||
@ -568,7 +568,7 @@ int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -590,7 +590,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
wordListN = &markerList;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -630,14 +630,14 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
|
||||
// Functor used to truncate history
|
||||
struct After {
|
||||
int line;
|
||||
explicit After(int line_) : line(line_) {}
|
||||
Sci_Position line;
|
||||
explicit After(Sci_Position line_) : line(line_) {}
|
||||
bool operator()(PPDefinition &p) const {
|
||||
return p.line > line;
|
||||
}
|
||||
};
|
||||
|
||||
void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
|
||||
@ -664,13 +664,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
bool inRERange = false;
|
||||
bool seenDocKeyBrace = false;
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) ||
|
||||
(MaskActive(initStyle) == SCE_C_COMMENTLINE) ||
|
||||
(MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) {
|
||||
// Set continuationLine if last character of previous line is '\'
|
||||
if (lineCurrent > 0) {
|
||||
int endLinePrevious = styler.LineEnd(lineCurrent - 1);
|
||||
Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1);
|
||||
if (endLinePrevious > 0) {
|
||||
continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\';
|
||||
}
|
||||
@ -679,7 +679,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
// look back to set chPrevNonWhite properly for better regex colouring
|
||||
if (startPos > 0) {
|
||||
int back = startPos;
|
||||
Sci_Position back = startPos;
|
||||
while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back))))
|
||||
;
|
||||
if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) {
|
||||
@ -719,7 +719,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER);
|
||||
const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD);
|
||||
|
||||
int lineEndNext = styler.LineEnd(lineCurrent);
|
||||
Sci_Position lineEndNext = styler.LineEnd(lineCurrent);
|
||||
|
||||
for (; sc.More();) {
|
||||
|
||||
@ -757,7 +757,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
// Handle line continuation generically.
|
||||
if (sc.ch == '\\') {
|
||||
if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) {
|
||||
if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) {
|
||||
lineCurrent++;
|
||||
lineEndNext = styler.LineEnd(lineCurrent);
|
||||
vlls.Add(lineCurrent, preproc);
|
||||
@ -1026,7 +1026,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
while ((sc.ch < 0x80) && islower(sc.ch))
|
||||
sc.Forward(); // gobble regex flags
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
} else if (sc.ch == '\\' && (static_cast<int>(sc.currentPos+1) < lineEndNext)) {
|
||||
} else if (sc.ch == '\\' && (static_cast<Sci_Position>(sc.currentPos+1) < lineEndNext)) {
|
||||
// Gobble up the escaped character
|
||||
sc.Forward();
|
||||
} else if (sc.ch == '[') {
|
||||
@ -1092,7 +1092,6 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (options.backQuotedStrings && sc.Match('`')) {
|
||||
sc.SetState(SCE_C_STRINGRAW|activitySet);
|
||||
rawStringTerminator = "`";
|
||||
sc.Forward();
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
if (lastWordWasUUID) {
|
||||
sc.SetState(SCE_C_UUID|activitySet);
|
||||
@ -1133,7 +1132,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) {
|
||||
sc.SetState(SCE_C_STRINGRAW|activitySet);
|
||||
rawStringTerminator = ")";
|
||||
for (int termPos = sc.currentPos + 1;; termPos++) {
|
||||
for (Sci_Position termPos = sc.currentPos + 1;; termPos++) {
|
||||
char chTerminator = styler.SafeGetCharAt(termPos, '(');
|
||||
if (chTerminator == '(')
|
||||
break;
|
||||
@ -1246,11 +1245,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
} else if (sc.Match("undef")) {
|
||||
if (options.updatePreprocessor && !preproc.IsInactive()) {
|
||||
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, true);
|
||||
const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false);
|
||||
std::vector<std::string> tokens = Tokenize(restOfLine);
|
||||
std::string key;
|
||||
if (tokens.size() >= 1) {
|
||||
key = tokens[0];
|
||||
const std::string key = tokens[0];
|
||||
preprocessorDefinitions.erase(key);
|
||||
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true));
|
||||
definitionsChanged = true;
|
||||
@ -1281,28 +1279,28 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
|
||||
void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
bool inLineComment = false;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
unsigned int lineStartNext = styler.LineStart(lineCurrent+1);
|
||||
Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1);
|
||||
int levelMinCurrent = levelCurrent;
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = MaskActive(styler.StyleAt(startPos));
|
||||
int style = MaskActive(initStyle);
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -1339,7 +1337,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
|
||||
if (ch == '#') {
|
||||
unsigned int j = i + 1;
|
||||
Sci_PositionU j = i + 1;
|
||||
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
@ -1381,7 +1379,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
lineStartNext = styler.LineStart(lineCurrent+1);
|
||||
levelCurrent = levelNext;
|
||||
levelMinCurrent = levelCurrent;
|
||||
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
|
||||
if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) {
|
||||
// There is an empty line at end of file so give it same level and empty
|
||||
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
|
||||
}
|
||||
@ -1469,7 +1467,7 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
|
||||
}
|
||||
iMacro++;
|
||||
}
|
||||
|
||||
|
||||
// Insert results back into tokens
|
||||
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
|
||||
|
||||
@ -1483,7 +1481,7 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
|
||||
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
|
||||
}
|
||||
} else {
|
||||
// Identifier not found
|
||||
// Identifier not found
|
||||
tokens.erase(tokens.begin() + i);
|
||||
}
|
||||
} else {
|
||||
|
@ -58,11 +58,11 @@ inline bool IsCssOperator(const int ch) {
|
||||
}
|
||||
|
||||
// look behind (from start of document to our start position) to determine current nesting level
|
||||
inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) {
|
||||
inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) {
|
||||
int ch;
|
||||
int nestingLevel = 0;
|
||||
|
||||
for (unsigned int i = 0; i < startPos; i++) {
|
||||
for (Sci_PositionU i = 0; i < startPos; i++) {
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
if (ch == '{')
|
||||
nestingLevel++;
|
||||
@ -73,7 +73,7 @@ inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) {
|
||||
return nestingLevel;
|
||||
}
|
||||
|
||||
static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
WordList &css1Props = *keywordlists[0];
|
||||
WordList &pseudoClasses = *keywordlists[1];
|
||||
WordList &css2Props = *keywordlists[2];
|
||||
@ -131,7 +131,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
if (lastStateC == -1) {
|
||||
// backtrack to get last state:
|
||||
// comments are like whitespace, so we must return to the previous state
|
||||
unsigned int i = startPos;
|
||||
Sci_PositionU i = startPos;
|
||||
for (; i > 0; i--) {
|
||||
if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) {
|
||||
if (lastStateC == SCE_CSS_OPERATOR) {
|
||||
@ -165,7 +165,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) {
|
||||
if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\''))
|
||||
continue;
|
||||
unsigned int i = sc.currentPos;
|
||||
Sci_PositionU i = sc.currentPos;
|
||||
while (i && styler[i-1] == '\\')
|
||||
i--;
|
||||
if ((sc.currentPos - i) % 2 == 1)
|
||||
@ -175,7 +175,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
|
||||
if (sc.state == SCE_CSS_OPERATOR) {
|
||||
if (op == ' ') {
|
||||
unsigned int i = startPos;
|
||||
Sci_PositionU i = startPos;
|
||||
op = styler.SafeGetCharAt(i-1);
|
||||
opPrev = styler.SafeGetCharAt(i-2);
|
||||
while (--i) {
|
||||
@ -380,10 +380,10 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
// check for nested rule selector
|
||||
if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) {
|
||||
// look ahead to see whether { comes before next ; and }
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int ch;
|
||||
|
||||
for (unsigned int i = sc.currentPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = sc.currentPos; i < endPos; i++) {
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
if (ch == ';' || ch == '}')
|
||||
break;
|
||||
@ -502,17 +502,17 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT);
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styler.StyleAt(i);
|
||||
|
@ -66,18 +66,18 @@ using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColouriseCamlDoc(
|
||||
unsigned int startPos, int length,
|
||||
Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler);
|
||||
|
||||
static void FoldCamlDoc(
|
||||
unsigned int startPos, int length,
|
||||
Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler);
|
||||
|
||||
static void InternalLexOrFold(int lexOrFold, unsigned int startPos, int length,
|
||||
static void InternalLexOrFold(int lexOrFold, Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, char *words[], WindowID window, char *props);
|
||||
|
||||
static const char* LexerName = "caml";
|
||||
@ -109,7 +109,7 @@ long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long
|
||||
reinterpret_cast<LPARAM>(lParam));
|
||||
}
|
||||
|
||||
void EXT_LEXER_DECL Fold(unsigned int lexer, unsigned int startPos, int length,
|
||||
void EXT_LEXER_DECL Fold(unsigned int lexer, Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, char *words[], WindowID window, char *props)
|
||||
{
|
||||
// below useless evaluation(s) to supress "not used" warnings
|
||||
@ -138,7 +138,7 @@ void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
|
||||
}
|
||||
}
|
||||
|
||||
void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length,
|
||||
void EXT_LEXER_DECL Lex(unsigned int lexer, Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, char *words[], WindowID window, char *props)
|
||||
{
|
||||
// below useless evaluation(s) to supress "not used" warnings
|
||||
@ -147,7 +147,7 @@ void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length,
|
||||
InternalLexOrFold(0, startPos, length, initStyle, words, window, props);
|
||||
}
|
||||
|
||||
static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length,
|
||||
static void InternalLexOrFold(int foldOrLex, Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, char *words[], WindowID window, char *props)
|
||||
{
|
||||
// create and initialize a WindowAccessor (including contained PropSet)
|
||||
@ -180,7 +180,7 @@ static
|
||||
#endif /* BUILD_AS_EXTERNAL_LEXER */
|
||||
|
||||
void ColouriseCamlDoc(
|
||||
unsigned int startPos, int length,
|
||||
Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler)
|
||||
@ -188,7 +188,8 @@ void ColouriseCamlDoc(
|
||||
// initialize styler
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
int chBase = 0, chToken = 0, chLit = 0;
|
||||
Sci_PositionU chToken = 0;
|
||||
int chBase = 0, chLit = 0;
|
||||
WordList& keywords = *keywordlists[0];
|
||||
WordList& keywords2 = *keywordlists[1];
|
||||
WordList& keywords3 = *keywordlists[2];
|
||||
@ -206,7 +207,7 @@ void ColouriseCamlDoc(
|
||||
while (sc.More()) {
|
||||
// set up [per-char] state info
|
||||
int state2 = -1; // (ASSUME no state change)
|
||||
int chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
|
||||
Sci_Position chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
|
||||
bool advance = true; // (ASSUME scanner "eats" 1 char)
|
||||
|
||||
// step state machine
|
||||
@ -254,11 +255,11 @@ void ColouriseCamlDoc(
|
||||
case SCE_CAML_IDENTIFIER:
|
||||
// [try to] interpret as [additional] identifier char
|
||||
if (!(iscaml(sc.ch) || sc.Match('\''))) {
|
||||
const int n = sc.currentPos - chToken;
|
||||
const Sci_Position n = sc.currentPos - chToken;
|
||||
if (n < 24) {
|
||||
// length is believable as keyword, [re-]construct token
|
||||
char t[24];
|
||||
for (int i = -n; i < 0; i++)
|
||||
for (Sci_Position i = -n; i < 0; i++)
|
||||
t[n + i] = static_cast<char>(sc.GetRelative(i));
|
||||
t[n] = '\0';
|
||||
// special-case "_" token as KEYWORD
|
||||
@ -390,7 +391,7 @@ void ColouriseCamlDoc(
|
||||
state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++,
|
||||
styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush();
|
||||
// ... then backtrack to determine original SML literal type
|
||||
int p = chColor - 2;
|
||||
Sci_Position p = chColor - 2;
|
||||
for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ;
|
||||
if (p >= 0)
|
||||
state2 = static_cast<int>(styler.StyleAt(p));
|
||||
@ -437,7 +438,7 @@ void ColouriseCamlDoc(
|
||||
static
|
||||
#endif /* BUILD_AS_EXTERNAL_LEXER */
|
||||
void FoldCamlDoc(
|
||||
unsigned int, int,
|
||||
Sci_PositionU, Sci_Position,
|
||||
int,
|
||||
WordList *[],
|
||||
Accessor &)
|
||||
|
@ -43,10 +43,10 @@ static bool isCmakeLetter(char ch)
|
||||
return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
|
||||
}
|
||||
|
||||
static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
|
||||
static bool CmakeNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler)
|
||||
{
|
||||
int nNextLine = -1;
|
||||
for ( unsigned int i = start; i < end; i++ ) {
|
||||
Sci_Position nNextLine = -1;
|
||||
for ( Sci_PositionU i = start; i < end; i++ ) {
|
||||
char cNext = styler.SafeGetCharAt( i );
|
||||
if ( cNext == '\n' ) {
|
||||
nNextLine = i+1;
|
||||
@ -57,7 +57,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor
|
||||
if ( nNextLine == -1 ) // We never foudn the next line...
|
||||
return false;
|
||||
|
||||
for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) {
|
||||
for ( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) {
|
||||
char cNext = styler.SafeGetCharAt( firstChar );
|
||||
if ( cNext == ' ' )
|
||||
continue;
|
||||
@ -71,7 +71,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor
|
||||
return false;
|
||||
}
|
||||
|
||||
static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse)
|
||||
static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse)
|
||||
{
|
||||
// If the word is too long, it is not what we are looking for
|
||||
if ( end - start > 20 )
|
||||
@ -100,7 +100,7 @@ static int calculateFoldCmake(unsigned int start, unsigned int end, int foldleve
|
||||
return newFoldlevel;
|
||||
}
|
||||
|
||||
static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler )
|
||||
static int classifyWordCmake(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler )
|
||||
{
|
||||
char word[100] = {0};
|
||||
char lowercaseWord[100] = {0};
|
||||
@ -109,7 +109,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key
|
||||
WordList &Parameters = *keywordLists[1];
|
||||
WordList &UserDefined = *keywordLists[2];
|
||||
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) {
|
||||
for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) {
|
||||
word[i] = static_cast<char>( styler[ start + i ] );
|
||||
lowercaseWord[i] = static_cast<char>(tolower(word[i]));
|
||||
}
|
||||
@ -162,7 +162,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key
|
||||
return SCE_CMAKE_DEFAULT;
|
||||
}
|
||||
|
||||
static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
|
||||
static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
|
||||
{
|
||||
int state = SCE_CMAKE_DEFAULT;
|
||||
if ( startPos > 0 )
|
||||
@ -171,14 +171,14 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
|
||||
styler.StartAt( startPos );
|
||||
styler.GetLine( startPos );
|
||||
|
||||
unsigned int nLengthDoc = startPos + length;
|
||||
Sci_PositionU nLengthDoc = startPos + length;
|
||||
styler.StartSegment( startPos );
|
||||
|
||||
char cCurrChar;
|
||||
bool bVarInString = false;
|
||||
bool bClassicVarInString = false;
|
||||
|
||||
unsigned int i;
|
||||
Sci_PositionU i;
|
||||
for ( i = startPos; i < nLengthDoc; i++ ) {
|
||||
cCurrChar = styler.SafeGetCharAt( i );
|
||||
char cNextChar = styler.SafeGetCharAt(i+1);
|
||||
@ -263,8 +263,8 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
|
||||
}
|
||||
|
||||
if ( cNextChar == '\r' || cNextChar == '\n' ) {
|
||||
int nCurLine = styler.GetLine(i+1);
|
||||
int nBack = i;
|
||||
Sci_Position nCurLine = styler.GetLine(i+1);
|
||||
Sci_Position nBack = i;
|
||||
// We need to check if the previous line has a \ in it...
|
||||
bool bNextLine = false;
|
||||
|
||||
@ -377,7 +377,7 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
|
||||
styler.ColourTo(nLengthDoc-1,state);
|
||||
}
|
||||
|
||||
static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
static void FoldCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
// No folding enabled, no reason to continue...
|
||||
if ( styler.GetPropertyInt("fold") == 0 )
|
||||
@ -385,18 +385,18 @@ static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], A
|
||||
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1;
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
unsigned int safeStartPos = styler.LineStart( lineCurrent );
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
Sci_PositionU safeStartPos = styler.LineStart( lineCurrent );
|
||||
|
||||
bool bArg1 = true;
|
||||
int nWordStart = -1;
|
||||
Sci_Position nWordStart = -1;
|
||||
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
int levelNext = levelCurrent;
|
||||
|
||||
for (unsigned int i = safeStartPos; i < startPos + length; i++) {
|
||||
for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) {
|
||||
char chCurr = styler.SafeGetCharAt(i);
|
||||
|
||||
if ( bArg1 ) {
|
||||
|
@ -48,7 +48,7 @@ static bool IsSpaceEquiv(int state) {
|
||||
// Putting a space between the '++' post-inc operator and the '+' binary op
|
||||
// fixes this, and is highly recommended for readability anyway.
|
||||
static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
|
||||
int pos = (int) sc.currentPos;
|
||||
Sci_Position pos = (Sci_Position) sc.currentPos;
|
||||
while (--pos > 0) {
|
||||
char ch = styler[pos];
|
||||
if (ch == '+' || ch == '-') {
|
||||
@ -58,29 +58,21 @@ static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) {
|
||||
// Don't look at styles, so no need to flush.
|
||||
int pos = (int) sc.currentPos;
|
||||
int currentLine = styler.GetLine(pos);
|
||||
int lineStartPos = styler.LineStart(currentLine);
|
||||
static bool followsKeyword(StyleContext &sc, Accessor &styler) {
|
||||
Sci_Position pos = (Sci_Position) sc.currentPos;
|
||||
Sci_Position currentLine = styler.GetLine(pos);
|
||||
Sci_Position lineStartPos = styler.LineStart(currentLine);
|
||||
while (--pos > lineStartPos) {
|
||||
char ch = styler.SafeGetCharAt(pos);
|
||||
if (ch != ' ' && ch != '\t') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const char *retBack = "nruter";
|
||||
const char *s = retBack;
|
||||
while (*s
|
||||
&& pos >= lineStartPos
|
||||
&& styler.SafeGetCharAt(pos) == *s) {
|
||||
s++;
|
||||
pos--;
|
||||
}
|
||||
return !*s;
|
||||
styler.Flush();
|
||||
return styler.StyleAt(pos) == SCE_COFFEESCRIPT_WORD;
|
||||
}
|
||||
|
||||
static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -97,9 +89,9 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
int visibleChars = 0;
|
||||
|
||||
// look back to set chPrevNonWhite properly for better regex colouring
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
if (startPos > 0 && IsSpaceEquiv(initStyle)) {
|
||||
unsigned int back = startPos;
|
||||
Sci_PositionU back = startPos;
|
||||
styler.Flush();
|
||||
while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back)))
|
||||
;
|
||||
@ -146,6 +138,8 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.ChangeState(SCE_COFFEESCRIPT_WORD2);
|
||||
} else if (keywords4.InList(s)) {
|
||||
sc.ChangeState(SCE_COFFEESCRIPT_GLOBALCLASS);
|
||||
} else if (sc.LengthCurrent() > 0 && s[0] == '@') {
|
||||
sc.ChangeState(SCE_COFFEESCRIPT_INSTANCEPROPERTY);
|
||||
}
|
||||
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
|
||||
}
|
||||
@ -153,6 +147,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
case SCE_COFFEESCRIPT_WORD:
|
||||
case SCE_COFFEESCRIPT_WORD2:
|
||||
case SCE_COFFEESCRIPT_GLOBALCLASS:
|
||||
case SCE_COFFEESCRIPT_INSTANCEPROPERTY:
|
||||
if (!setWord.Contains(sc.ch)) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
|
||||
}
|
||||
@ -239,7 +234,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.Forward();
|
||||
} else if (sc.ch == '/'
|
||||
&& (setOKBeforeRE.Contains(chPrevNonWhite)
|
||||
|| followsReturnKeyword(sc, styler))
|
||||
|| followsKeyword(sc, styler))
|
||||
&& (!setCouldBePostOp.Contains(chPrevNonWhite)
|
||||
|| !FollowsPostfixOperator(sc, styler))) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx
|
||||
@ -257,6 +252,10 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
}
|
||||
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_OPERATOR);
|
||||
// Handle '..' and '...' operators correctly.
|
||||
if (sc.ch == '.') {
|
||||
for (int i = 0; i < 2 && sc.chNext == '.'; i++, sc.Forward()) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,10 +267,10 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eol_pos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eol_pos; i++) {
|
||||
char ch = styler[i];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
@ -281,12 +280,12 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
|
||||
static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
// A simplified version of FoldPyDoc
|
||||
const int maxPos = startPos + length;
|
||||
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
|
||||
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||
const Sci_Position maxPos = startPos + length;
|
||||
const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
|
||||
const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||
|
||||
// property fold.coffeescript.comment
|
||||
const bool foldComment = styler.GetPropertyInt("fold.coffeescript.comment") != 0;
|
||||
@ -298,7 +297,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
|
||||
// and so we can fix any preceding fold level (which is why we go back
|
||||
// at least one line in all cases)
|
||||
int spaceFlags = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
|
||||
while (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
@ -321,7 +320,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
|
||||
|
||||
// Gather info
|
||||
int lev = indentCurrent;
|
||||
int lineNext = lineCurrent + 1;
|
||||
Sci_Position lineNext = lineCurrent + 1;
|
||||
int indentNext = indentCurrent;
|
||||
if (lineNext <= docLines) {
|
||||
// Information about next line is only available if not at end of document
|
||||
@ -365,7 +364,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
|
||||
// which is indented more than the line after the end of
|
||||
// the comment-block, use the level of the block before
|
||||
|
||||
int skipLine = lineNext;
|
||||
Sci_Position skipLine = lineNext;
|
||||
int skipLevel = levelAfterComments;
|
||||
|
||||
while (--skipLine > lineCurrent) {
|
||||
|
@ -31,14 +31,14 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
|
||||
static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
|
||||
{
|
||||
int state = SCE_CONF_DEFAULT;
|
||||
char chNext = styler[startPos];
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
// create a buffer large enough to take the largest chunk...
|
||||
char *buffer = new char[length+1];
|
||||
int bufferCount = 0;
|
||||
Sci_Position bufferCount = 0;
|
||||
|
||||
// this assumes that we have 2 keyword list in conf.properties
|
||||
WordList &directives = *keywordLists[0];
|
||||
@ -48,7 +48,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
|
||||
// using the hand-written state machine shown below
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
|
@ -29,15 +29,15 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
|
||||
static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, int, WordList
|
||||
*keywordLists[], Accessor &styler)
|
||||
{
|
||||
int state = SCE_NNCRONTAB_DEFAULT;
|
||||
char chNext = styler[startPos];
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
// create a buffer large enough to take the largest chunk...
|
||||
char *buffer = new char[length+1];
|
||||
int bufferCount = 0;
|
||||
Sci_Position bufferCount = 0;
|
||||
// used when highliting environment variables inside quoted string:
|
||||
bool insideString = false;
|
||||
|
||||
@ -50,7 +50,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
|
||||
// using the hand-written state machine shown below
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
|
@ -51,7 +51,7 @@ static inline bool IsCsoundOperator(char ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseCsoundDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &opcode = *keywordlists[0];
|
||||
@ -150,17 +150,17 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||
static void FoldCsoundInstruments(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
|
||||
Accessor &styler) {
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int stylePrev = 0;
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -177,13 +177,13 @@ public:
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osD.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osD.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -197,14 +197,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {
|
||||
if (osD.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -229,7 +229,7 @@ int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
|
||||
wordListN = &keywords7;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -241,14 +241,14 @@ int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerD::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
int styleBeforeDCKeyword = SCE_D_DEFAULT;
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0;
|
||||
bool numFloat = false; // Float literals have '+' and '-' signs
|
||||
bool numHex = false;
|
||||
@ -471,16 +471,16 @@ void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, ID
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
|
||||
void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -491,7 +491,7 @@ void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, I
|
||||
int style = initStyle;
|
||||
bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -38,14 +38,14 @@ static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch));
|
||||
}
|
||||
/***************************************/
|
||||
static void ColouriseDMAPDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2];
|
||||
/***************************************/
|
||||
int posLineStart = 0, numNonBlank = 0;
|
||||
int endPos = startPos + length;
|
||||
Sci_Position posLineStart = 0, numNonBlank = 0;
|
||||
Sci_Position endPos = startPos + length;
|
||||
/***************************************/
|
||||
// backtrack to the nearest keyword
|
||||
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) {
|
||||
@ -65,7 +65,7 @@ static void ColouriseDMAPDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (!IsASpaceOrTab(sc.ch)) numNonBlank ++;
|
||||
/***********************************************/
|
||||
// Handle data appearing after column 72; it is ignored
|
||||
int toLineStart = sc.currentPos - posLineStart;
|
||||
Sci_Position toLineStart = sc.currentPos - posLineStart;
|
||||
if (toLineStart >= 72 || sc.ch == '$') {
|
||||
sc.SetState(SCE_DMAP_COMMENT);
|
||||
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
|
||||
@ -151,26 +151,26 @@ static int classifyFoldPointDMAP(const char* s, const char* prevWord) {
|
||||
return lev;
|
||||
}
|
||||
// Folding the code
|
||||
static void FoldDMAPDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
//
|
||||
// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
// Do not know how to fold the comment at the moment.
|
||||
//
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
/***************************************/
|
||||
int lastStart = 0;
|
||||
Sci_Position lastStart = 0;
|
||||
char prevWord[32] = "";
|
||||
/***************************************/
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -186,7 +186,7 @@ static void FoldDMAPDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (style == SCE_DMAP_WORD) {
|
||||
if(iswordchar(ch) && !iswordchar(chNext)) {
|
||||
char s[32];
|
||||
unsigned int k;
|
||||
Sci_PositionU k;
|
||||
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
|
||||
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ class LexerDMIS : public ILexer
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertySet(const char *, const char *) {
|
||||
Sci_Position SCI_METHOD PropertySet(const char *, const char *) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return NULL;
|
||||
@ -91,8 +91,8 @@ class LexerDMIS : public ILexer
|
||||
}
|
||||
|
||||
const char * SCI_METHOD DescribeWordListSets();
|
||||
void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
|
||||
};
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ LexerDMIS::~LexerDMIS(void) {
|
||||
delete[] this->m_wordListSets;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl)
|
||||
Sci_Position SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl)
|
||||
{
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -185,9 +185,9 @@ const char * SCI_METHOD LexerDMIS::DescribeWordListSets()
|
||||
return this->m_wordListSets;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess)
|
||||
void SCI_METHOD LexerDMIS::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess)
|
||||
{
|
||||
const unsigned int MAX_STR_LEN = 100;
|
||||
const Sci_PositionU MAX_STR_LEN = 100;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
StyleContext scCTX(startPos, lengthDoc, initStyle, styler);
|
||||
@ -281,14 +281,14 @@ void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initSty
|
||||
scCTX.Complete();
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocument *pAccess)
|
||||
void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int, IDocument *pAccess)
|
||||
{
|
||||
const int MAX_STR_LEN = 100;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
unsigned int endPos = startPos + lengthDoc;
|
||||
Sci_PositionU endPos = startPos + lengthDoc;
|
||||
char chNext = styler[startPos];
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
int strPos = 0;
|
||||
@ -300,7 +300,7 @@ void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocu
|
||||
tmpStr = new char[MAX_STR_LEN];
|
||||
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
|
||||
|
||||
for (unsigned int i=startPos; i<endPos; i++) {
|
||||
for (Sci_PositionU i=startPos; i<endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i+1);
|
||||
|
||||
|
153
src/stc/scintilla/lexers/LexDiff.cxx
Normal file
153
src/stc/scintilla/lexers/LexDiff.cxx
Normal file
@ -0,0 +1,153 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexDiff.cxx
|
||||
** Lexer for diff results.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
}
|
||||
|
||||
#define DIFF_BUFFER_START_SIZE 16
|
||||
// Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE
|
||||
// characters of each line to classify the line.
|
||||
|
||||
static void ColouriseDiffLine(char *lineBuffer, Sci_Position endLine, Accessor &styler) {
|
||||
// It is needed to remember the current state to recognize starting
|
||||
// comment lines before the first "diff " or "--- ". If a real
|
||||
// difference starts then each line starting with ' ' is a whitespace
|
||||
// otherwise it is considered a comment (Only in..., Binary file...)
|
||||
if (0 == strncmp(lineBuffer, "diff ", 5)) {
|
||||
styler.ColourTo(endLine, SCE_DIFF_COMMAND);
|
||||
} else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff
|
||||
styler.ColourTo(endLine, SCE_DIFF_COMMAND);
|
||||
} else if (0 == strncmp(lineBuffer, "---", 3) && lineBuffer[3] != '-') {
|
||||
// In a context diff, --- appears in both the header and the position markers
|
||||
if (lineBuffer[3] == ' ' && atoi(lineBuffer + 4) && !strchr(lineBuffer, '/'))
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
else if (lineBuffer[3] == '\r' || lineBuffer[3] == '\n')
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
else
|
||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||
} else if (0 == strncmp(lineBuffer, "+++ ", 4)) {
|
||||
// I don't know of any diff where "+++ " is a position marker, but for
|
||||
// consistency, do the same as with "--- " and "*** ".
|
||||
if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/'))
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
else
|
||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||
} else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff
|
||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||
} else if (0 == strncmp(lineBuffer, "***", 3)) {
|
||||
// In a context diff, *** appears in both the header and the position markers.
|
||||
// Also ******** is a chunk header, but here it's treated as part of the
|
||||
// position marker since there is no separate style for a chunk header.
|
||||
if (lineBuffer[3] == ' ' && atoi(lineBuffer+4) && !strchr(lineBuffer, '/'))
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
else if (lineBuffer[3] == '*')
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
else
|
||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||
} else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib
|
||||
styler.ColourTo(endLine, SCE_DIFF_HEADER);
|
||||
} else if (lineBuffer[0] == '@') {
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
} else if (lineBuffer[0] >= '0' && lineBuffer[0] <= '9') {
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
} else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') {
|
||||
styler.ColourTo(endLine, SCE_DIFF_DELETED);
|
||||
} else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') {
|
||||
styler.ColourTo(endLine, SCE_DIFF_ADDED);
|
||||
} else if (lineBuffer[0] == '!') {
|
||||
styler.ColourTo(endLine, SCE_DIFF_CHANGED);
|
||||
} else if (lineBuffer[0] != ' ') {
|
||||
styler.ColourTo(endLine, SCE_DIFF_COMMENT);
|
||||
} else {
|
||||
styler.ColourTo(endLine, SCE_DIFF_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[DIFF_BUFFER_START_SIZE] = "";
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
Sci_PositionU linePos = 0;
|
||||
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
|
||||
if (AtEOL(styler, i)) {
|
||||
if (linePos < DIFF_BUFFER_START_SIZE) {
|
||||
lineBuffer[linePos] = 0;
|
||||
}
|
||||
ColouriseDiffLine(lineBuffer, i, styler);
|
||||
linePos = 0;
|
||||
} else if (linePos < DIFF_BUFFER_START_SIZE - 1) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
} else if (linePos == DIFF_BUFFER_START_SIZE - 1) {
|
||||
lineBuffer[linePos++] = 0;
|
||||
}
|
||||
}
|
||||
if (linePos > 0) { // Last line does not have ending characters
|
||||
if (linePos < DIFF_BUFFER_START_SIZE) {
|
||||
lineBuffer[linePos] = 0;
|
||||
}
|
||||
ColouriseDiffLine(lineBuffer, startPos + length - 1, styler);
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLineStart = styler.LineStart(curLine);
|
||||
int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE;
|
||||
int nextLevel;
|
||||
|
||||
do {
|
||||
int lineType = styler.StyleAt(curLineStart);
|
||||
if (lineType == SCE_DIFF_COMMAND)
|
||||
nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
|
||||
else if (lineType == SCE_DIFF_HEADER)
|
||||
nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG;
|
||||
else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-')
|
||||
nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG;
|
||||
else if (prevLevel & SC_FOLDLEVELHEADERFLAG)
|
||||
nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
|
||||
else
|
||||
nextLevel = prevLevel;
|
||||
|
||||
if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel))
|
||||
styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG);
|
||||
|
||||
styler.SetLevel(curLine, nextLevel);
|
||||
prevLevel = nextLevel;
|
||||
|
||||
curLineStart = styler.LineStart(++curLine);
|
||||
} while (static_cast<Sci_Position>(startPos)+length > curLineStart);
|
||||
}
|
||||
|
||||
static const char *const emptyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);
|
@ -62,7 +62,7 @@ static bool IsSpaceEquiv(int state) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
WordList &keywords0 = *keywordlists[0];
|
||||
WordList &keywords1 = *keywordlists[1];
|
||||
@ -90,7 +90,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
|
||||
if (initStyle == SCE_ECL_PREPROCESSOR) {
|
||||
// Set continuationLine if last character of previous line is '\'
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (lineCurrent > 0) {
|
||||
int chBack = styler.SafeGetCharAt(startPos-1, 0);
|
||||
int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
|
||||
@ -106,7 +106,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
|
||||
// look back to set chPrevNonWhite properly for better regex colouring
|
||||
if (startPos > 0) {
|
||||
int back = startPos;
|
||||
Sci_Position back = startPos;
|
||||
while (--back && IsSpaceEquiv(styler.StyleAt(back)))
|
||||
;
|
||||
if (styler.StyleAt(back) == SCE_ECL_OPERATOR) {
|
||||
@ -175,7 +175,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
} else if (keywords5.InList(s)) {
|
||||
sc.ChangeState(SCE_ECL_WORD5);
|
||||
}
|
||||
else //Data types are of from KEYWORD##
|
||||
else //Data types are of from KEYWORD##
|
||||
{
|
||||
int i = static_cast<int>(strlen(s)) - 1;
|
||||
while(i >= 0 && (isdigit(s[i]) || s[i] == '_'))
|
||||
@ -186,7 +186,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
s2[i + 1] = 0;
|
||||
if (keywords3.InList(s2)) {
|
||||
sc.ChangeState(SCE_ECL_WORD3);
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.SetState(SCE_ECL_DEFAULT);
|
||||
}
|
||||
@ -311,7 +311,7 @@ static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
}
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
int lineCurrent = styler.GetLine(sc.currentPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(sc.currentPos);
|
||||
int lineState = styler.GetLineState(lineCurrent);
|
||||
if (sc.state == SCE_ECL_DEFAULT) {
|
||||
if (lineState) {
|
||||
@ -388,12 +388,12 @@ static bool IsStreamCommentStyle(int style) {
|
||||
style == SCE_ECL_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) {
|
||||
int i=0;
|
||||
static bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) {
|
||||
Sci_Position i=0;
|
||||
for (; *s; i++) {
|
||||
char compare_char = tolower(*s);
|
||||
char styler_char = tolower(styler.SafeGetCharAt(pos+i));
|
||||
if (compare_char != styler_char)
|
||||
if (compare_char != styler_char)
|
||||
return false;
|
||||
s++;
|
||||
}
|
||||
@ -405,15 +405,15 @@ bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) {
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
static void FoldEclDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
bool foldComment = true;
|
||||
bool foldPreprocessor = true;
|
||||
bool foldCompact = true;
|
||||
bool foldAtElse = true;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -422,7 +422,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle,
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -449,7 +449,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
if (foldPreprocessor && (style == SCE_ECL_PREPROCESSOR)) {
|
||||
if (ch == '#') {
|
||||
unsigned int j = i + 1;
|
||||
Sci_PositionU j = i + 1;
|
||||
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
@ -473,7 +473,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
if (style == SCE_ECL_WORD2) {
|
||||
if (MatchNoCase(styler, i, "record") || MatchNoCase(styler, i, "transform") || MatchNoCase(styler, i, "type") || MatchNoCase(styler, i, "function") ||
|
||||
if (MatchNoCase(styler, i, "record") || MatchNoCase(styler, i, "transform") || MatchNoCase(styler, i, "type") || MatchNoCase(styler, i, "function") ||
|
||||
MatchNoCase(styler, i, "module") || MatchNoCase(styler, i, "service") || MatchNoCase(styler, i, "interface") || MatchNoCase(styler, i, "ifblock") ||
|
||||
MatchNoCase(styler, i, "macro") || MatchNoCase(styler, i, "beginc++")) {
|
||||
levelNext++;
|
||||
@ -497,7 +497,7 @@ static void FoldEclDoc(unsigned int startPos, int length, int initStyle,
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
levelMinCurrent = levelCurrent;
|
||||
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
|
||||
if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) {
|
||||
// There is an empty line at end of file so give it same level and empty
|
||||
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static inline bool IsAWordStart(const int ch) {
|
||||
|
||||
|
||||
|
||||
static void ColouriseESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -176,24 +176,24 @@ static bool IsStreamCommentStyle(int style) {
|
||||
style == SCE_ESCRIPT_COMMENTLINE;
|
||||
}
|
||||
|
||||
static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
|
||||
static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) {
|
||||
//~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
// Do not know how to fold the comment at the moment.
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldComment = true;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
|
||||
int lastStart = 0;
|
||||
Sci_Position lastStart = 0;
|
||||
char prevWord[32] = "";
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -231,7 +231,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
if (style == SCE_ESCRIPT_WORD3) {
|
||||
if(iswordchar(ch) && !iswordchar(chNext)) {
|
||||
char s[32];
|
||||
unsigned int j;
|
||||
Sci_PositionU j;
|
||||
for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) {
|
||||
s[j] = static_cast<char>(tolower(styler[lastStart + j]));
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ static inline bool IsAWordStart(unsigned int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static void ColouriseEiffelDoc(unsigned int startPos,
|
||||
int length,
|
||||
static void ColouriseEiffelDoc(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -118,16 +118,16 @@ static void ColouriseEiffelDoc(unsigned int startPos,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsEiffelComment(Accessor &styler, int pos, int len) {
|
||||
static bool IsEiffelComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
|
||||
return len>1 && styler[pos]=='-' && styler[pos+1]=='-';
|
||||
}
|
||||
|
||||
static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
|
||||
static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
@ -137,7 +137,7 @@ static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
|
||||
int spaceFlags = 0;
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment);
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -164,11 +164,11 @@ static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||
static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
|
||||
Accessor &styler) {
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
@ -177,7 +177,7 @@ static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* init
|
||||
// lastDeferred should be determined by looking back to last keyword in case
|
||||
// the "deferred" is on a line before "class"
|
||||
bool lastDeferred = false;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
@ -185,7 +185,7 @@ static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* init
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) {
|
||||
char s[20];
|
||||
unsigned int j = 0;
|
||||
Sci_PositionU j = 0;
|
||||
while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) {
|
||||
s[j] = styler[i + j];
|
||||
j++;
|
||||
|
@ -75,7 +75,7 @@ static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (ch != ' ') && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseErlangDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
@ -500,7 +500,7 @@ static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
|
||||
static int ClassifyErlangFoldPoint(
|
||||
Accessor &styler,
|
||||
int styleNext,
|
||||
int keyword_start
|
||||
Sci_Position keyword_start
|
||||
) {
|
||||
int lev = 0;
|
||||
if (styler.Match(keyword_start,"case")
|
||||
@ -521,23 +521,23 @@ static int ClassifyErlangFoldPoint(
|
||||
}
|
||||
|
||||
static void FoldErlangDoc(
|
||||
unsigned int startPos, int length, int initStyle,
|
||||
Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList** /*keywordlists*/, Accessor &styler
|
||||
) {
|
||||
unsigned int endPos = startPos + length;
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
int lev;
|
||||
int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK;
|
||||
int currentLevel = previousLevel;
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
int stylePrev;
|
||||
int keyword_start = 0;
|
||||
Sci_Position keyword_start = 0;
|
||||
char ch;
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
bool atEOL;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
|
390
src/stc/scintilla/lexers/LexErrorList.cxx
Normal file
390
src/stc/scintilla/lexers/LexErrorList.cxx
Normal file
@ -0,0 +1,390 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexErrorList.cxx
|
||||
** Lexer for error lists. Used for the output pane in SciTE.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static bool strstart(const char *haystack, const char *needle) {
|
||||
return strncmp(haystack, needle, strlen(needle)) == 0;
|
||||
}
|
||||
|
||||
static bool Is0To9(char ch) {
|
||||
return (ch >= '0') && (ch <= '9');
|
||||
}
|
||||
|
||||
static bool Is1To9(char ch) {
|
||||
return (ch >= '1') && (ch <= '9');
|
||||
}
|
||||
|
||||
static bool IsAlphabetic(int ch) {
|
||||
return IsASCII(ch) && isalpha(ch);
|
||||
}
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
}
|
||||
|
||||
static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) {
|
||||
if (lineBuffer[0] == '>') {
|
||||
// Command or return status
|
||||
return SCE_ERR_CMD;
|
||||
} else if (lineBuffer[0] == '<') {
|
||||
// Diff removal.
|
||||
return SCE_ERR_DIFF_DELETION;
|
||||
} else if (lineBuffer[0] == '!') {
|
||||
return SCE_ERR_DIFF_CHANGED;
|
||||
} else if (lineBuffer[0] == '+') {
|
||||
if (strstart(lineBuffer, "+++ ")) {
|
||||
return SCE_ERR_DIFF_MESSAGE;
|
||||
} else {
|
||||
return SCE_ERR_DIFF_ADDITION;
|
||||
}
|
||||
} else if (lineBuffer[0] == '-') {
|
||||
if (strstart(lineBuffer, "--- ")) {
|
||||
return SCE_ERR_DIFF_MESSAGE;
|
||||
} else {
|
||||
return SCE_ERR_DIFF_DELETION;
|
||||
}
|
||||
} else if (strstart(lineBuffer, "cf90-")) {
|
||||
// Absoft Pro Fortran 90/95 v8.2 error and/or warning message
|
||||
return SCE_ERR_ABSF;
|
||||
} else if (strstart(lineBuffer, "fortcom:")) {
|
||||
// Intel Fortran Compiler v8.0 error/warning message
|
||||
return SCE_ERR_IFORT;
|
||||
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
|
||||
return SCE_ERR_PYTHON;
|
||||
} else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {
|
||||
return SCE_ERR_PHP;
|
||||
} else if ((strstart(lineBuffer, "Error ") ||
|
||||
strstart(lineBuffer, "Warning ")) &&
|
||||
strstr(lineBuffer, " at (") &&
|
||||
strstr(lineBuffer, ") : ") &&
|
||||
(strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {
|
||||
// Intel Fortran Compiler error/warning message
|
||||
return SCE_ERR_IFC;
|
||||
} else if (strstart(lineBuffer, "Error ")) {
|
||||
// Borland error message
|
||||
return SCE_ERR_BORLAND;
|
||||
} else if (strstart(lineBuffer, "Warning ")) {
|
||||
// Borland warning message
|
||||
return SCE_ERR_BORLAND;
|
||||
} else if (strstr(lineBuffer, "at line ") &&
|
||||
(strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) &&
|
||||
strstr(lineBuffer, "file ") &&
|
||||
(strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) {
|
||||
// Lua 4 error message
|
||||
return SCE_ERR_LUA;
|
||||
} else if (strstr(lineBuffer, " at ") &&
|
||||
(strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) &&
|
||||
strstr(lineBuffer, " line ") &&
|
||||
(strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&
|
||||
(strstr(lineBuffer, " at ") + 4 < (strstr(lineBuffer, " line ")))) {
|
||||
// perl error message:
|
||||
// <message> at <file> line <line>
|
||||
return SCE_ERR_PERL;
|
||||
} else if ((memcmp(lineBuffer, " at ", 6) == 0) &&
|
||||
strstr(lineBuffer, ":line ")) {
|
||||
// A .NET traceback
|
||||
return SCE_ERR_NET;
|
||||
} else if (strstart(lineBuffer, "Line ") &&
|
||||
strstr(lineBuffer, ", file ")) {
|
||||
// Essential Lahey Fortran error message
|
||||
return SCE_ERR_ELF;
|
||||
} else if (strstart(lineBuffer, "line ") &&
|
||||
strstr(lineBuffer, " column ")) {
|
||||
// HTML tidy style: line 42 column 1
|
||||
return SCE_ERR_TIDY;
|
||||
} else if (strstart(lineBuffer, "\tat ") &&
|
||||
strstr(lineBuffer, "(") &&
|
||||
strstr(lineBuffer, ".java:")) {
|
||||
// Java stack back trace
|
||||
return SCE_ERR_JAVA_STACK;
|
||||
} else if (strstart(lineBuffer, "In file included from ") ||
|
||||
strstart(lineBuffer, " from ")) {
|
||||
// GCC showing include path to following error
|
||||
return SCE_ERR_GCC_INCLUDED_FROM;
|
||||
} else if (strstr(lineBuffer, "warning LNK")) {
|
||||
// Microsoft linker warning:
|
||||
// {<object> : } warning LNK9999
|
||||
return SCE_ERR_MS;
|
||||
} else {
|
||||
// Look for one of the following formats:
|
||||
// GCC: <filename>:<line>:<message>
|
||||
// Microsoft: <filename>(<line>) :<message>
|
||||
// Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal
|
||||
// Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal
|
||||
// Microsoft: <filename>(<line>,<column>)<message>
|
||||
// CTags: <identifier>\t<filename>\t<message>
|
||||
// Lua 5 traceback: \t<filename>:<line>:<message>
|
||||
// Lua 5.1: <exe>: <filename>:<line>:<message>
|
||||
bool initialTab = (lineBuffer[0] == '\t');
|
||||
bool initialColonPart = false;
|
||||
bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab
|
||||
enum { stInitial,
|
||||
stGccStart, stGccDigit, stGccColumn, stGcc,
|
||||
stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
|
||||
stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags,
|
||||
stUnrecognized
|
||||
} state = stInitial;
|
||||
for (Sci_PositionU i = 0; i < lengthLine; i++) {
|
||||
char ch = lineBuffer[i];
|
||||
char chNext = ' ';
|
||||
if ((i + 1) < lengthLine)
|
||||
chNext = lineBuffer[i + 1];
|
||||
if (state == stInitial) {
|
||||
if (ch == ':') {
|
||||
// May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
|
||||
if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) {
|
||||
// This check is not completely accurate as may be on
|
||||
// GTK+ with a file name that includes ':'.
|
||||
state = stGccStart;
|
||||
} else if (chNext == ' ') { // indicates a Lua 5.1 error message
|
||||
initialColonPart = true;
|
||||
}
|
||||
} else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
|
||||
// May be Microsoft
|
||||
// Check against '0' often removes phone numbers
|
||||
state = stMsStart;
|
||||
} else if ((ch == '\t') && canBeCtags) {
|
||||
// May be CTags
|
||||
state = stCtagsStart;
|
||||
} else if (ch == ' ') {
|
||||
canBeCtags = false;
|
||||
}
|
||||
} else if (state == stGccStart) { // <filename>:
|
||||
state = Is0To9(ch) ? stGccDigit : stUnrecognized;
|
||||
} else if (state == stGccDigit) { // <filename>:<line>
|
||||
if (ch == ':') {
|
||||
state = stGccColumn; // :9.*: is GCC
|
||||
startValue = i + 1;
|
||||
} else if (!Is0To9(ch)) {
|
||||
state = stUnrecognized;
|
||||
}
|
||||
} else if (state == stGccColumn) { // <filename>:<line>:<column>
|
||||
if (!Is0To9(ch)) {
|
||||
state = stGcc;
|
||||
if (ch == ':')
|
||||
startValue = i + 1;
|
||||
break;
|
||||
}
|
||||
} else if (state == stMsStart) { // <filename>(
|
||||
state = Is0To9(ch) ? stMsDigit : stUnrecognized;
|
||||
} else if (state == stMsDigit) { // <filename>(<line>
|
||||
if (ch == ',') {
|
||||
state = stMsDigitComma;
|
||||
} else if (ch == ')') {
|
||||
state = stMsBracket;
|
||||
} else if ((ch != ' ') && !Is0To9(ch)) {
|
||||
state = stUnrecognized;
|
||||
}
|
||||
} else if (state == stMsBracket) { // <filename>(<line>)
|
||||
if ((ch == ' ') && (chNext == ':')) {
|
||||
state = stMsVc;
|
||||
} else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {
|
||||
// Possibly Delphi.. don't test against chNext as it's one of the strings below.
|
||||
char word[512];
|
||||
Sci_PositionU j, chPos;
|
||||
unsigned numstep;
|
||||
chPos = 0;
|
||||
if (ch == ' ')
|
||||
numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
|
||||
else
|
||||
numstep = 2; // otherwise add 2.
|
||||
for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
|
||||
word[chPos++] = lineBuffer[j];
|
||||
word[chPos] = 0;
|
||||
if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
|
||||
!CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
|
||||
!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
|
||||
state = stMsVc;
|
||||
} else {
|
||||
state = stUnrecognized;
|
||||
}
|
||||
} else {
|
||||
state = stUnrecognized;
|
||||
}
|
||||
} else if (state == stMsDigitComma) { // <filename>(<line>,
|
||||
if (ch == ')') {
|
||||
state = stMsDotNet;
|
||||
break;
|
||||
} else if ((ch != ' ') && !Is0To9(ch)) {
|
||||
state = stUnrecognized;
|
||||
}
|
||||
} else if (state == stCtagsStart) {
|
||||
if (ch == '\t') {
|
||||
state = stCtagsFile;
|
||||
}
|
||||
} else if (state == stCtagsFile) {
|
||||
if ((lineBuffer[i - 1] == '\t') &&
|
||||
((ch == '/' && chNext == '^') || Is0To9(ch))) {
|
||||
state = stCtags;
|
||||
break;
|
||||
} else if ((ch == '/') && (chNext == '^')) {
|
||||
state = stCtagsStartString;
|
||||
}
|
||||
} else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) {
|
||||
state = stCtagsStringDollar;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state == stGcc) {
|
||||
return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC;
|
||||
} else if ((state == stMsVc) || (state == stMsDotNet)) {
|
||||
return SCE_ERR_MS;
|
||||
} else if ((state == stCtagsStringDollar) || (state == stCtags)) {
|
||||
return SCE_ERR_CTAG;
|
||||
} else {
|
||||
return SCE_ERR_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define CSI "\033["
|
||||
|
||||
namespace {
|
||||
|
||||
bool SequenceEnd(int ch) {
|
||||
return (ch == 0) || ((ch >= '@') && (ch <= '~'));
|
||||
}
|
||||
|
||||
int StyleFromSequence(const char *seq) {
|
||||
int bold = 0;
|
||||
int colour = 0;
|
||||
while (!SequenceEnd(*seq)) {
|
||||
if (Is0To9(*seq)) {
|
||||
int base = *seq - '0';
|
||||
if (Is0To9(seq[1])) {
|
||||
base = base * 10;
|
||||
base += seq[1] - '0';
|
||||
seq++;
|
||||
}
|
||||
if (base == 0) {
|
||||
colour = 0;
|
||||
bold = 0;
|
||||
}
|
||||
else if (base == 1) {
|
||||
bold = 1;
|
||||
}
|
||||
else if (base >= 30 && base <= 37) {
|
||||
colour = base - 30;
|
||||
}
|
||||
}
|
||||
seq++;
|
||||
}
|
||||
return SCE_ERR_ES_BLACK + bold * 8 + colour;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void ColouriseErrorListLine(
|
||||
char *lineBuffer,
|
||||
Sci_PositionU lengthLine,
|
||||
Sci_PositionU endPos,
|
||||
Accessor &styler,
|
||||
bool valueSeparate,
|
||||
bool escapeSequences) {
|
||||
Sci_Position startValue = -1;
|
||||
int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
|
||||
if (escapeSequences && strstr(lineBuffer, CSI)) {
|
||||
const int startPos = endPos - lengthLine;
|
||||
const char *linePortion = lineBuffer;
|
||||
int startPortion = startPos;
|
||||
int portionStyle = style;
|
||||
while (const char *startSeq = strstr(linePortion, CSI)) {
|
||||
if (startSeq > linePortion) {
|
||||
styler.ColourTo(startPortion + (startSeq - linePortion), portionStyle);
|
||||
}
|
||||
const char *endSeq = startSeq + 2;
|
||||
while (!SequenceEnd(*endSeq))
|
||||
endSeq++;
|
||||
const int endSeqPosition = startPortion + (endSeq - linePortion) + 1;
|
||||
switch (*endSeq) {
|
||||
case 0:
|
||||
styler.ColourTo(endPos, SCE_ERR_ESCSEQ_UNKNOWN);
|
||||
return;
|
||||
case 'm': // Colour command
|
||||
styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ);
|
||||
portionStyle = StyleFromSequence(startSeq+2);
|
||||
break;
|
||||
case 'K': // Erase to end of line -> ignore
|
||||
styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ);
|
||||
break;
|
||||
default:
|
||||
styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ_UNKNOWN);
|
||||
portionStyle = style;
|
||||
}
|
||||
startPortion = endSeqPosition;
|
||||
linePortion = endSeq + 1;
|
||||
}
|
||||
styler.ColourTo(endPos, portionStyle);
|
||||
} else {
|
||||
if (valueSeparate && (startValue >= 0)) {
|
||||
styler.ColourTo(endPos - (lengthLine - startValue), style);
|
||||
styler.ColourTo(endPos, SCE_ERR_VALUE);
|
||||
} else {
|
||||
styler.ColourTo(endPos, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[10000];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
Sci_PositionU linePos = 0;
|
||||
|
||||
// property lexer.errorlist.value.separate
|
||||
// For lines in the output pane that are matches from Find in Files or GCC-style
|
||||
// diagnostics, style the path and line number separately from the rest of the
|
||||
// line with style 21 used for the rest of the line.
|
||||
// This allows matched text to be more easily distinguished from its location.
|
||||
bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
|
||||
|
||||
// property lexer.errorlist.escape.sequences
|
||||
// Set to 1 to interpret escape sequences.
|
||||
const bool escapeSequences = styler.GetPropertyInt("lexer.errorlist.escape.sequences") != 0;
|
||||
|
||||
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
// End of line (or of line buffer) met, colourise it
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate, escapeSequences);
|
||||
linePos = 0;
|
||||
}
|
||||
}
|
||||
if (linePos > 0) { // Last line does not have ending characters
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate, escapeSequences);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *const emptyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);
|
@ -37,7 +37,7 @@ static inline bool IsAWordChar(int ch)
|
||||
(isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
|
||||
@ -271,9 +271,9 @@ static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyl
|
||||
}
|
||||
}
|
||||
} else if (bEnableCode && sc.ch == '{') {
|
||||
int p = 0;
|
||||
Sci_Position p = 0;
|
||||
int chSeek;
|
||||
unsigned int endPos(startPos + length);
|
||||
Sci_PositionU endPos(startPos + length);
|
||||
do { // Skip whitespace
|
||||
chSeek = sc.GetRelative(++p);
|
||||
} while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos));
|
||||
@ -302,14 +302,14 @@ static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyl
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldFlagShipDoc(unsigned int startPos, int length, int,
|
||||
static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler)
|
||||
{
|
||||
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0 && lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
startPos = styler.LineStart(lineCurrent);
|
||||
@ -317,7 +317,7 @@ static void FoldFlagShipDoc(unsigned int startPos, int length, int,
|
||||
int spaceFlags = 0;
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
|
@ -39,7 +39,7 @@ static inline bool IsASpaceChar(int ch) {
|
||||
return (ch < 0x80) && isspace(ch);
|
||||
}
|
||||
|
||||
static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[],
|
||||
static void ColouriseForthDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &control = *keywordLists[0];
|
||||
@ -151,7 +151,7 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldForthDoc(unsigned int, int, int, WordList *[],
|
||||
static void FoldForthDoc(Sci_PositionU, Sci_Position, int, WordList *[],
|
||||
Accessor &) {
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ static inline bool IsALineEnd(char ch) {
|
||||
return ((ch == '\n') || (ch == '\r')) ;
|
||||
}
|
||||
/***************************************/
|
||||
static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
|
||||
static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) {
|
||||
while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue;
|
||||
if (styler.SafeGetCharAt(pos) == '\n') pos++;
|
||||
while (IsABlank(styler.SafeGetCharAt(pos++))) continue;
|
||||
@ -59,14 +59,15 @@ static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
|
||||
}
|
||||
}
|
||||
/***************************************/
|
||||
static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2];
|
||||
/***************************************/
|
||||
int posLineStart = 0, numNonBlank = 0, prevState = 0;
|
||||
int endPos = startPos + length;
|
||||
Sci_Position posLineStart = 0;
|
||||
int numNonBlank = 0, prevState = 0;
|
||||
Sci_Position endPos = startPos + length;
|
||||
/***************************************/
|
||||
// backtrack to the nearest keyword
|
||||
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) {
|
||||
@ -86,7 +87,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
if (!IsASpaceOrTab(sc.ch)) numNonBlank ++;
|
||||
/***********************************************/
|
||||
// Handle the fix format generically
|
||||
int toLineStart = sc.currentPos - posLineStart;
|
||||
Sci_Position toLineStart = sc.currentPos - posLineStart;
|
||||
if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) {
|
||||
if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
|
||||
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
|
||||
@ -130,7 +131,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
// Handle line continuation generically.
|
||||
if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) {
|
||||
char chTemp = ' ';
|
||||
int j = 1;
|
||||
Sci_Position j = 1;
|
||||
while (IsABlank(chTemp) && j<132) {
|
||||
chTemp = static_cast<char>(sc.GetRelative(j));
|
||||
j++;
|
||||
@ -260,6 +261,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
|
||||
lev = 0;
|
||||
} else if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
|
||||
|| strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
|
||||
|| strcmp(s, "selecttype") == 0 || strcmp(s, "selectcase") == 0
|
||||
|| strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
|
||||
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
|
||||
|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
|
||||
@ -294,16 +296,16 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
|
||||
}
|
||||
/***************************************/
|
||||
// Folding the code
|
||||
static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
Accessor &styler, bool isFixFormat) {
|
||||
//
|
||||
// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
// Do not know how to fold the comment at the moment.
|
||||
//
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent;
|
||||
bool isPrevLine;
|
||||
if (lineCurrent > 0) {
|
||||
@ -320,10 +322,10 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
int style = initStyle;
|
||||
int levelDeltaNext = 0;
|
||||
/***************************************/
|
||||
int lastStart = 0;
|
||||
Sci_Position lastStart = 0;
|
||||
char prevWord[32] = "";
|
||||
/***************************************/
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
char chNextNonBlank = chNext;
|
||||
@ -331,7 +333,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (IsALineEnd(chNextNonBlank)) {
|
||||
nextEOL = true;
|
||||
}
|
||||
unsigned int j=i+1;
|
||||
Sci_PositionU j=i+1;
|
||||
while(IsABlank(chNextNonBlank) && j<endPos) {
|
||||
j ++ ;
|
||||
chNextNonBlank = styler.SafeGetCharAt(j);
|
||||
@ -356,7 +358,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (style == SCE_F_WORD) {
|
||||
if(iswordchar(ch) && !iswordchar(chNext)) {
|
||||
char s[32];
|
||||
unsigned int k;
|
||||
Sci_PositionU k;
|
||||
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
|
||||
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
|
||||
}
|
||||
@ -385,7 +387,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (depth == 0) break;
|
||||
}
|
||||
}
|
||||
int tmpLineCurrent = lineCurrent;
|
||||
Sci_Position tmpLineCurrent = lineCurrent;
|
||||
while (j<endPos) {
|
||||
j++;
|
||||
chAtPos = styler.SafeGetCharAt(j);
|
||||
@ -489,22 +491,22 @@ static const char * const FortranWordLists[] = {
|
||||
0,
|
||||
};
|
||||
/***************************************/
|
||||
static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
|
||||
}
|
||||
/***************************************/
|
||||
static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||
}
|
||||
/***************************************/
|
||||
static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldFortranDoc(startPos, length, initStyle,styler, false);
|
||||
}
|
||||
/***************************************/
|
||||
static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldFortranDoc(startPos, length, initStyle,styler, true);
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ static inline bool IsGAPOperator(char ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
static void GetRange(Sci_PositionU start, Sci_PositionU end, Accessor &styler, char *s, Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while ((i < end - start + 1) && (i < len-1)) {
|
||||
s[i] = static_cast<char>(styler[start + i]);
|
||||
i++;
|
||||
@ -48,7 +48,7 @@ static void GetRange(unsigned int start, unsigned int end, Accessor &styler, cha
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static void ColouriseGAPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
static void ColouriseGAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords1 = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
@ -197,19 +197,19 @@ static int ClassifyFoldPointGAP(const char* s) {
|
||||
return level;
|
||||
}
|
||||
|
||||
static void FoldGAPDoc( unsigned int startPos, int length, int initStyle, WordList** , Accessor &styler) {
|
||||
unsigned int endPos = startPos + length;
|
||||
static void FoldGAPDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** , Accessor &styler) {
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
|
||||
int lastStart = 0;
|
||||
Sci_Position lastStart = 0;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -68,9 +68,9 @@ inline bool isGCOperator(int ch)
|
||||
#define isFoldPoint(x) ((styler.LevelAt(x) & SC_FOLDLEVELNUMBERMASK) == 1024)
|
||||
|
||||
static void colorFirstWord(WordList *keywordlists[], Accessor &styler,
|
||||
StyleContext *sc, char *buff, int length, int)
|
||||
StyleContext *sc, char *buff, Sci_Position length, int)
|
||||
{
|
||||
int c = 0;
|
||||
Sci_Position c = 0;
|
||||
while (sc->More() && isSpaceOrNL(sc->ch))
|
||||
{ sc->Forward();
|
||||
}
|
||||
@ -119,12 +119,13 @@ static void colorFirstWord(WordList *keywordlists[], Accessor &styler,
|
||||
|
||||
// Main colorizing function called by Scintilla
|
||||
static void
|
||||
ColouriseGui4CliDoc(unsigned int startPos, int length, int initStyle,
|
||||
ColouriseGui4CliDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
styler.StartAt(startPos);
|
||||
|
||||
int quotestart = 0, oldstate, currentline = styler.GetLine(startPos);
|
||||
Sci_Position currentline = styler.GetLine(startPos);
|
||||
int quotestart = 0, oldstate;
|
||||
styler.StartSegment(startPos);
|
||||
bool noforward;
|
||||
char buff[BUFFSIZE+1]; // buffer for command name
|
||||
@ -243,20 +244,20 @@ ColouriseGui4CliDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
|
||||
// Main folding function called by Scintilla - (based on props (.ini) files function)
|
||||
static void FoldGui4Cli(unsigned int startPos, int length, int,
|
||||
static void FoldGui4Cli(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler)
|
||||
{
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
bool headerPoint = false;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++)
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler[i+1];
|
||||
|
@ -57,17 +57,17 @@ inline bool IsOperator(int ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
|
||||
unsigned int i = 0;
|
||||
static void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) {
|
||||
Sci_PositionU i = 0;
|
||||
for (; (i < end - start + 1) && (i < len-1); i++) {
|
||||
s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
|
||||
}
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) {
|
||||
static const char *GetNextWord(Accessor &styler, Sci_PositionU start, char *s, size_t sLen) {
|
||||
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
for (; i < sLen-1; i++) {
|
||||
char ch = static_cast<char>(styler.SafeGetCharAt(start + i));
|
||||
if ((i == 0) && !IsAWordStart(ch))
|
||||
@ -81,7 +81,7 @@ static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, si
|
||||
return s;
|
||||
}
|
||||
|
||||
static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
|
||||
static script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) {
|
||||
char s[100];
|
||||
GetTextSegment(styler, start, end, s, sizeof(s));
|
||||
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
|
||||
@ -110,7 +110,7 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start,
|
||||
return prevValue;
|
||||
}
|
||||
|
||||
static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
|
||||
static int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) {
|
||||
int iResult = 0;
|
||||
char s[100];
|
||||
GetTextSegment(styler, start, end, s, sizeof(s));
|
||||
@ -171,7 +171,7 @@ static int stateForPrintState(int StateToPrint) {
|
||||
return state;
|
||||
}
|
||||
|
||||
static inline bool IsNumber(unsigned int start, Accessor &styler) {
|
||||
static inline bool IsNumber(Sci_PositionU start, Accessor &styler) {
|
||||
return IsADigit(styler[start]) || (styler[start] == '.') ||
|
||||
(styler[start] == '-') || (styler[start] == '#');
|
||||
}
|
||||
@ -242,7 +242,7 @@ static inline bool isCommentASPState(int state) {
|
||||
return bResult;
|
||||
}
|
||||
|
||||
static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
static void classifyAttribHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
|
||||
bool wordIsNumber = IsNumber(start, styler);
|
||||
char chAttr = SCE_H_ATTRIBUTEUNKNOWN;
|
||||
if (wordIsNumber) {
|
||||
@ -259,14 +259,14 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
|
||||
styler.ColourTo(end, chAttr);
|
||||
}
|
||||
|
||||
static int classifyTagHTML(unsigned int start, unsigned int end,
|
||||
static int classifyTagHTML(Sci_PositionU start, Sci_PositionU end,
|
||||
WordList &keywords, Accessor &styler, bool &tagDontFold,
|
||||
bool caseSensitive, bool isXml, bool allowScripts) {
|
||||
char withSpace[30 + 2] = " ";
|
||||
const char *s = withSpace + 1;
|
||||
// Copy after the '<'
|
||||
unsigned int i = 1;
|
||||
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
|
||||
Sci_PositionU i = 1;
|
||||
for (Sci_PositionU cPos = start; cPos <= end && i < 30; cPos++) {
|
||||
char ch = styler[cPos];
|
||||
if ((ch != '<') && (ch != '/')) {
|
||||
withSpace[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
|
||||
@ -298,7 +298,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
|
||||
if (allowScripts && 0 == strcmp(s, "script")) {
|
||||
// check to see if this is a self-closing tag by sniffing ahead
|
||||
bool isSelfClose = false;
|
||||
for (unsigned int cPos = end; cPos <= end + 200; cPos++) {
|
||||
for (Sci_PositionU cPos = end; cPos <= end + 200; cPos++) {
|
||||
char ch = styler.SafeGetCharAt(cPos, '\0');
|
||||
if (ch == '\0' || ch == '>')
|
||||
break;
|
||||
@ -318,10 +318,10 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
|
||||
return chAttr;
|
||||
}
|
||||
|
||||
static void classifyWordHTJS(unsigned int start, unsigned int end,
|
||||
static void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end,
|
||||
WordList &keywords, Accessor &styler, script_mode inScriptType) {
|
||||
char s[30 + 1];
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
for (; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
}
|
||||
@ -337,7 +337,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
|
||||
styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
|
||||
}
|
||||
|
||||
static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
|
||||
static int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
|
||||
char chAttr = SCE_HB_IDENTIFIER;
|
||||
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
|
||||
if (wordIsNumber) {
|
||||
@ -358,10 +358,10 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
|
||||
return SCE_HB_DEFAULT;
|
||||
}
|
||||
|
||||
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) {
|
||||
static void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) {
|
||||
bool wordIsNumber = IsADigit(styler[start]);
|
||||
char s[30 + 1];
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
for (; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
}
|
||||
@ -383,7 +383,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
|
||||
|
||||
// Update the word colour to default or keyword
|
||||
// Called when in a PHP word
|
||||
static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
static void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
|
||||
char chAttr = SCE_HPHP_DEFAULT;
|
||||
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1]));
|
||||
if (wordIsNumber) {
|
||||
@ -397,9 +397,9 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke
|
||||
styler.ColourTo(end, chAttr);
|
||||
}
|
||||
|
||||
static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
static bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
|
||||
char s[30 + 1];
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
for (; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
}
|
||||
@ -407,9 +407,9 @@ static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords
|
||||
return keywords.InList(s);
|
||||
}
|
||||
|
||||
static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) {
|
||||
static bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) {
|
||||
char s[30 + 1];
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
for (; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
}
|
||||
@ -520,9 +520,9 @@ static bool isPHPStringState(int state) {
|
||||
(state == SCE_HPHP_COMPLEX_VARIABLE);
|
||||
}
|
||||
|
||||
static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler, bool &isSimpleString) {
|
||||
int j;
|
||||
const int beginning = i - 1;
|
||||
static Sci_Position FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) {
|
||||
Sci_Position j;
|
||||
const Sci_Position beginning = i - 1;
|
||||
bool isValidSimpleString = false;
|
||||
|
||||
while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t'))
|
||||
@ -567,7 +567,7 @@ static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringD
|
||||
return j - 1;
|
||||
}
|
||||
|
||||
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler, bool isXml) {
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
@ -592,7 +592,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
// If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen
|
||||
if (InTagState(state)) {
|
||||
while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
|
||||
int backLineStart = styler.LineStart(styler.GetLine(startPos-1));
|
||||
Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1));
|
||||
length += startPos - backLineStart;
|
||||
startPos = backLineStart;
|
||||
}
|
||||
@ -610,7 +610,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
styler.StartAt(startPos);
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int lineState;
|
||||
if (lineCurrent > 0) {
|
||||
lineState = styler.GetLineState(lineCurrent-1);
|
||||
@ -695,7 +695,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
int chPrevNonWhite = ' ';
|
||||
// look back to set chPrevNonWhite properly for better regex colouring
|
||||
if (scriptLanguage == eScriptJS && startPos > 0) {
|
||||
int back = startPos;
|
||||
Sci_Position back = startPos;
|
||||
int style = 0;
|
||||
while (--back) {
|
||||
style = styler.StyleAt(back);
|
||||
@ -709,8 +709,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
|
||||
styler.StartSegment(startPos);
|
||||
const int lengthDoc = startPos + length;
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
const Sci_Position lengthDoc = startPos + length;
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++) {
|
||||
const int chPrev2 = chPrev;
|
||||
chPrev = ch;
|
||||
if (!IsASpace(ch) && state != SCE_HJ_COMMENT &&
|
||||
@ -746,7 +746,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
//Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle);
|
||||
//if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) {
|
||||
if (ch == '#') {
|
||||
int j = i + 1;
|
||||
Sci_Position j = i + 1;
|
||||
while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
@ -769,7 +769,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
|
||||
// check if the number of tabs is lower than the level
|
||||
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
|
||||
for (int j = 0; Findlevel > 0; j++) {
|
||||
for (Sci_Position j = 0; Findlevel > 0; j++) {
|
||||
char chTmp = styler.SafeGetCharAt(i + j + 1);
|
||||
if (chTmp == '\t') {
|
||||
Findlevel -= 8;
|
||||
@ -875,7 +875,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
if (const char *tag =
|
||||
state == SCE_HJ_COMMENTLINE || isXml ? "script" :
|
||||
state == SCE_H_COMMENT ? "comment" : 0) {
|
||||
int j = i + 2;
|
||||
Sci_Position j = i + 2;
|
||||
int chr;
|
||||
do {
|
||||
chr = static_cast<int>(*tag++);
|
||||
@ -1237,7 +1237,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
styler.ColourTo(i - 1, StateToPrint);
|
||||
state = SCE_H_SGML_SIMPLESTRING;
|
||||
} else if ((ch == '-') && (chPrev == '-')) {
|
||||
if (static_cast<int>(styler.GetStartSegment()) <= (i - 2)) {
|
||||
if (static_cast<Sci_Position>(styler.GetStartSegment()) <= (i - 2)) {
|
||||
styler.ColourTo(i - 2, StateToPrint);
|
||||
}
|
||||
state = SCE_H_SGML_COMMENT;
|
||||
@ -2080,7 +2080,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
// Some of the above terminated their lexeme but since the same character starts
|
||||
// the same class again, only reenter if non empty segment.
|
||||
|
||||
bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
|
||||
bool nonEmptySegment = i >= static_cast<Sci_Position>(styler.GetStartSegment());
|
||||
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
|
||||
if ((ch == '\"') && (nonEmptySegment)) {
|
||||
state = SCE_HB_STRING;
|
||||
@ -2136,7 +2136,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
break;
|
||||
default:
|
||||
StateToPrint = statePrintForState(state, inScriptType);
|
||||
if (static_cast<int>(styler.GetStartSegment()) < lengthDoc)
|
||||
if (static_cast<Sci_Position>(styler.GetStartSegment()) < lengthDoc)
|
||||
styler.ColourTo(lengthDoc - 1, StateToPrint);
|
||||
break;
|
||||
}
|
||||
@ -2148,19 +2148,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseXMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseXMLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
// Passing in true because we're lexing XML
|
||||
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||
}
|
||||
|
||||
static void ColouriseHTMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseHTMLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
// Passing in false because we're notlexing XML
|
||||
ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, false);
|
||||
}
|
||||
|
||||
static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColourisePHPScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
if (startPos == 0)
|
||||
initStyle = SCE_HPHP_DEFAULT;
|
||||
|
@ -143,13 +143,13 @@ static inline int CommentBlockStyleFromNestLevel(const unsigned int nestLevel) {
|
||||
// Mangled version of lexlib/Accessor.cxx IndentAmount.
|
||||
// Modified to treat comment blocks as whitespace
|
||||
// plus special case for commentline/preprocessor.
|
||||
static int HaskellIndentAmount(Accessor &styler, const int line) {
|
||||
static int HaskellIndentAmount(Accessor &styler, const Sci_Position line) {
|
||||
|
||||
// Determines the indentation level of the current line
|
||||
// Comment blocks are treated as whitespace
|
||||
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
|
||||
char ch = styler[pos];
|
||||
int style = styler.StyleAt(pos);
|
||||
@ -157,7 +157,7 @@ static int HaskellIndentAmount(Accessor &styler, const int line) {
|
||||
int indent = 0;
|
||||
bool inPrevPrefix = line > 0;
|
||||
|
||||
int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0;
|
||||
Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0;
|
||||
|
||||
while (( ch == ' ' || ch == '\t'
|
||||
|| IsCommentBlockStyle(style)
|
||||
@ -271,7 +271,7 @@ struct OptionSetHaskell : public OptionSet<OptionsHaskell> {
|
||||
|
||||
class LexerHaskell : public ILexer {
|
||||
bool literate;
|
||||
int firstImportLine;
|
||||
Sci_Position firstImportLine;
|
||||
int firstImportIndent;
|
||||
WordList keywords;
|
||||
WordList ffi;
|
||||
@ -347,12 +347,12 @@ class LexerHaskell : public ILexer {
|
||||
}
|
||||
}
|
||||
|
||||
bool LineContainsImport(const int line, Accessor &styler) const {
|
||||
bool LineContainsImport(const Sci_Position line, Accessor &styler) const {
|
||||
if (options.foldImports) {
|
||||
int currentPos = styler.LineStart(line);
|
||||
Sci_Position currentPos = styler.LineStart(line);
|
||||
int style = styler.StyleAt(currentPos);
|
||||
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
|
||||
while (currentPos < eol_pos) {
|
||||
int ch = styler[currentPos];
|
||||
@ -374,7 +374,7 @@ class LexerHaskell : public ILexer {
|
||||
}
|
||||
}
|
||||
|
||||
inline int IndentAmountWithOffset(Accessor &styler, const int line) const {
|
||||
inline int IndentAmountWithOffset(Accessor &styler, const Sci_Position line) const {
|
||||
const int indent = HaskellIndentAmount(styler, line);
|
||||
const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK;
|
||||
return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE)
|
||||
@ -416,17 +416,17 @@ public:
|
||||
return osHaskell.DescribeProperty(name);
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osHaskell.DescribeWordListSets();
|
||||
}
|
||||
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -441,14 +441,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerHaskell::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerHaskell::PropertySet(const char *key, const char *val) {
|
||||
if (osHaskell.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -461,7 +461,7 @@ int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) {
|
||||
wordListN = &reserved_operators;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -473,11 +473,11 @@ int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) {
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initStyle
|
||||
void SCI_METHOD LexerHaskell::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle
|
||||
,IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
HaskellLineInfo hs = HaskellLineInfo(lineCurrent ? styler.GetLineState(lineCurrent-1) : 0);
|
||||
|
||||
@ -961,26 +961,26 @@ void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initSty
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // initStyle
|
||||
void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, int // initStyle
|
||||
,IDocument *pAccess) {
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
Accessor styler(pAccess, NULL);
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
if (lineCurrent <= firstImportLine) {
|
||||
firstImportLine = -1; // readjust first import position
|
||||
firstImportIndent = 0;
|
||||
}
|
||||
|
||||
const int maxPos = startPos + length;
|
||||
const int maxLines =
|
||||
const Sci_Position maxPos = startPos + length;
|
||||
const Sci_Position maxLines =
|
||||
maxPos == styler.Length()
|
||||
? styler.GetLine(maxPos)
|
||||
: styler.GetLine(maxPos - 1); // Requested last line
|
||||
const int docLines = styler.GetLine(styler.Length()); // Available last line
|
||||
const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line
|
||||
|
||||
// Backtrack to previous non-blank line so we can determine indent level
|
||||
// for any white space lines
|
||||
@ -1018,7 +1018,7 @@ void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // ini
|
||||
while (lineCurrent <= docLines && lineCurrent <= maxLines) {
|
||||
|
||||
// Gather info
|
||||
int lineNext = lineCurrent + 1;
|
||||
Sci_Position lineNext = lineCurrent + 1;
|
||||
importHere = false;
|
||||
int indentNext = indentCurrent;
|
||||
|
||||
@ -1063,7 +1063,7 @@ void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // ini
|
||||
// which is indented more than the line after the end of
|
||||
// the comment-block, use the level of the block before
|
||||
|
||||
int skipLine = lineNext;
|
||||
Sci_Position skipLine = lineNext;
|
||||
int skipLevel = indentNextLevel;
|
||||
|
||||
while (--skipLine > lineCurrent) {
|
||||
|
@ -126,37 +126,37 @@ using namespace Scintilla;
|
||||
static inline bool IsNewline(const int ch);
|
||||
static int GetHexaNibble(char hd);
|
||||
static int GetHexaChar(char hd1, char hd2);
|
||||
static int GetHexaChar(unsigned int pos, Accessor &styler);
|
||||
static bool ForwardWithinLine(StyleContext &sc, int nb = 1);
|
||||
static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler);
|
||||
static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler);
|
||||
static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler);
|
||||
static int GetHexaChar(Sci_PositionU pos, Accessor &styler);
|
||||
static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb = 1);
|
||||
static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler);
|
||||
static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler);
|
||||
static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler);
|
||||
|
||||
// prototypes for file format specific helper functions
|
||||
static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler);
|
||||
static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler);
|
||||
static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler);
|
||||
static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler);
|
||||
static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler);
|
||||
static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler);
|
||||
|
||||
static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler);
|
||||
static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler);
|
||||
static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler);
|
||||
static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler);
|
||||
static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler);
|
||||
static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler);
|
||||
|
||||
static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler);
|
||||
static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler);
|
||||
static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler);
|
||||
static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler);
|
||||
static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler);
|
||||
|
||||
static inline bool IsNewline(const int ch)
|
||||
{
|
||||
@ -207,7 +207,7 @@ static int GetHexaChar(char hd1, char hd2)
|
||||
return hexValue;
|
||||
}
|
||||
|
||||
static int GetHexaChar(unsigned int pos, Accessor &styler)
|
||||
static int GetHexaChar(Sci_PositionU pos, Accessor &styler)
|
||||
{
|
||||
char highNibble, lowNibble;
|
||||
|
||||
@ -221,9 +221,9 @@ static int GetHexaChar(unsigned int pos, Accessor &styler)
|
||||
// end. Return true if forwarding within the line was possible.
|
||||
// Avoids influence on highlighting of the subsequent line if the current line
|
||||
// is malformed (too short).
|
||||
static bool ForwardWithinLine(StyleContext &sc, int nb)
|
||||
static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb)
|
||||
{
|
||||
for (int i = 0; i < nb; i++) {
|
||||
for (Sci_Position i = 0; i < nb; i++) {
|
||||
if (sc.atLineEnd) {
|
||||
// line is too short
|
||||
sc.SetState(SCE_HEX_DEFAULT);
|
||||
@ -238,7 +238,7 @@ static bool ForwardWithinLine(StyleContext &sc, int nb)
|
||||
}
|
||||
|
||||
// Checks whether the given positions are in the same record.
|
||||
static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler)
|
||||
static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler)
|
||||
{
|
||||
return styler.GetLine(pos1) == styler.GetLine(pos2);
|
||||
}
|
||||
@ -246,10 +246,10 @@ static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styl
|
||||
// Count the number of digit pairs from <startPos> till end of record, ignoring
|
||||
// <uncountedDigits> digits.
|
||||
// If the record is too short, a negative count may be returned.
|
||||
static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler)
|
||||
static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler)
|
||||
{
|
||||
int cnt;
|
||||
unsigned int pos;
|
||||
Sci_Position cnt;
|
||||
Sci_PositionU pos;
|
||||
|
||||
pos = startPos;
|
||||
|
||||
@ -258,7 +258,7 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &
|
||||
}
|
||||
|
||||
// number of digits in this line minus number of digits of uncounted fields
|
||||
cnt = static_cast<int>(pos - startPos) - uncountedDigits;
|
||||
cnt = static_cast<Sci_Position>(pos - startPos) - uncountedDigits;
|
||||
|
||||
// Prepare round up if odd (digit pair incomplete), this way the byte
|
||||
// count is considered to be valid if the checksum is incomplete.
|
||||
@ -275,11 +275,11 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &
|
||||
// Calculate the checksum of the record.
|
||||
// <startPos> is the position of the first character of the starting digit
|
||||
// pair, <cnt> is the number of digit pairs.
|
||||
static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler)
|
||||
static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler)
|
||||
{
|
||||
int cs = 0;
|
||||
|
||||
for (unsigned int pos = startPos; pos < startPos + cnt; pos += 2) {
|
||||
for (Sci_PositionU pos = startPos; pos < startPos + cnt; pos += 2) {
|
||||
int val = GetHexaChar(pos, styler);
|
||||
|
||||
if (val < 0) {
|
||||
@ -301,7 +301,7 @@ static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor
|
||||
|
||||
// Get the position of the record "start" field (first character in line) in
|
||||
// the record around position <pos>.
|
||||
static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler)
|
||||
static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler)
|
||||
{
|
||||
while (styler.SafeGetCharAt(pos) != 'S') {
|
||||
pos--;
|
||||
@ -312,7 +312,7 @@ static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler)
|
||||
|
||||
// Get the value of the "byte count" field, it counts the number of bytes in
|
||||
// the subsequent fields ("address", "data" and "checksum" fields).
|
||||
static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -327,13 +327,13 @@ static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler)
|
||||
// Count the number of digit pairs for the "address", "data" and "checksum"
|
||||
// fields in this record. Has to be equal to the "byte count" field value.
|
||||
// If the record is too short, a negative count may be returned.
|
||||
static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler)
|
||||
static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
return CountByteCount(recStartPos, 4, styler);
|
||||
}
|
||||
|
||||
// Get the size of the "address" field.
|
||||
static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (styler.SafeGetCharAt(recStartPos + 1)) {
|
||||
case '0':
|
||||
@ -357,7 +357,7 @@ static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler)
|
||||
}
|
||||
|
||||
// Get the type of the "address" field content.
|
||||
static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (styler.SafeGetCharAt(recStartPos + 1)) {
|
||||
case '0':
|
||||
@ -383,7 +383,7 @@ static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
}
|
||||
|
||||
// Get the type of the "data" field content.
|
||||
static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (styler.SafeGetCharAt(recStartPos + 1)) {
|
||||
case '0':
|
||||
@ -407,7 +407,7 @@ static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
// Get the required size of the "data" field. Useless for block header and
|
||||
// ordinary data records (type S0, S1, S2, S3), return the value calculated
|
||||
// from the "byte count" and "address field" size in this case.
|
||||
static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler)
|
||||
static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (styler.SafeGetCharAt(recStartPos + 1)) {
|
||||
case '5':
|
||||
@ -425,7 +425,7 @@ static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl
|
||||
}
|
||||
|
||||
// Get the value of the "checksum" field.
|
||||
static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int byteCount;
|
||||
|
||||
@ -435,9 +435,9 @@ static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
}
|
||||
|
||||
// Calculate the checksum of the record.
|
||||
static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int byteCount;
|
||||
Sci_Position byteCount;
|
||||
|
||||
byteCount = GetSrecByteCount(recStartPos, styler);
|
||||
|
||||
@ -447,7 +447,7 @@ static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
|
||||
// Get the position of the record "start" field (first character in line) in
|
||||
// the record around position <pos>.
|
||||
static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler)
|
||||
static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler)
|
||||
{
|
||||
while (styler.SafeGetCharAt(pos) != ':') {
|
||||
pos--;
|
||||
@ -458,7 +458,7 @@ static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler)
|
||||
|
||||
// Get the value of the "byte count" field, it counts the number of bytes in
|
||||
// the "data" field.
|
||||
static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -473,13 +473,13 @@ static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler)
|
||||
// Count the number of digit pairs for the "data" field in this record. Has to
|
||||
// be equal to the "byte count" field value.
|
||||
// If the record is too short, a negative count may be returned.
|
||||
static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler)
|
||||
static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
return CountByteCount(recStartPos, 11, styler);
|
||||
}
|
||||
|
||||
// Get the type of the "address" field content.
|
||||
static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
if (!PosInSameRecord(recStartPos, recStartPos + 7, styler)) {
|
||||
// malformed (record too short)
|
||||
@ -504,7 +504,7 @@ static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
}
|
||||
|
||||
// Get the type of the "data" field content.
|
||||
static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (GetHexaChar(recStartPos + 7, styler)) {
|
||||
case 0x00:
|
||||
@ -528,7 +528,7 @@ static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
|
||||
// Get the required size of the "data" field. Useless for an ordinary data
|
||||
// record (type 00), return the "byte count" in this case.
|
||||
static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (GetHexaChar(recStartPos + 7, styler)) {
|
||||
case 0x01:
|
||||
@ -548,7 +548,7 @@ static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl
|
||||
}
|
||||
|
||||
// Get the value of the "checksum" field.
|
||||
static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int byteCount;
|
||||
|
||||
@ -558,7 +558,7 @@ static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
}
|
||||
|
||||
// Calculate the checksum of the record.
|
||||
static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int byteCount;
|
||||
|
||||
@ -571,7 +571,7 @@ static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
|
||||
// Get the value of the "record length" field, it counts the number of digits in
|
||||
// the record excluding the percent.
|
||||
static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
int val = GetHexaChar(recStartPos + 1, styler);
|
||||
if (val < 0)
|
||||
@ -582,9 +582,9 @@ static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler)
|
||||
|
||||
// Count the number of digits in this record. Has to
|
||||
// be equal to the "record length" field value.
|
||||
static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler)
|
||||
static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
unsigned int pos;
|
||||
Sci_PositionU pos;
|
||||
|
||||
pos = recStartPos+1;
|
||||
|
||||
@ -592,11 +592,11 @@ static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler)
|
||||
pos++;
|
||||
}
|
||||
|
||||
return static_cast<int>(pos - (recStartPos+1));
|
||||
return static_cast<Sci_Position>(pos - (recStartPos+1));
|
||||
}
|
||||
|
||||
// Get the type of the "address" field content.
|
||||
static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
switch (styler.SafeGetCharAt(recStartPos + 3)) {
|
||||
case '6':
|
||||
@ -611,16 +611,16 @@ static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler)
|
||||
}
|
||||
|
||||
// Get the value of the "checksum" field.
|
||||
static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
return GetHexaChar(recStartPos+4, styler);
|
||||
}
|
||||
|
||||
// Calculate the checksum of the record (excluding the checksum field).
|
||||
static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler)
|
||||
{
|
||||
unsigned int pos = recStartPos +1;
|
||||
unsigned int length = GetTEHexDigitCount(recStartPos, styler);
|
||||
Sci_PositionU pos = recStartPos +1;
|
||||
Sci_PositionU length = GetTEHexDigitCount(recStartPos, styler);
|
||||
|
||||
int cs = GetHexaNibble(styler.SafeGetCharAt(pos++));//length
|
||||
cs += GetHexaNibble(styler.SafeGetCharAt(pos++));//length
|
||||
@ -645,12 +645,12 @@ static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler)
|
||||
|
||||
}
|
||||
|
||||
static void ColouriseSrecDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler)
|
||||
static void ColouriseSrecDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler)
|
||||
{
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
while (sc.More()) {
|
||||
unsigned int recStartPos;
|
||||
Sci_PositionU recStartPos;
|
||||
int byteCount, reqByteCount, addrFieldSize, addrFieldType, dataFieldSize, dataFieldType;
|
||||
int cs1, cs2;
|
||||
|
||||
@ -769,12 +769,12 @@ static void ColouriseSrecDoc(unsigned int startPos, int length, int initStyle, W
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void ColouriseIHexDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler)
|
||||
static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler)
|
||||
{
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
while (sc.More()) {
|
||||
unsigned int recStartPos;
|
||||
Sci_PositionU recStartPos;
|
||||
int byteCount, addrFieldType, dataFieldSize, dataFieldType;
|
||||
int cs1, cs2;
|
||||
|
||||
@ -890,19 +890,19 @@ static void ColouriseIHexDoc(unsigned int startPos, int length, int initStyle, W
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldIHexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent - 1);
|
||||
|
||||
unsigned int lineStartNext = styler.LineStart(lineCurrent + 1);
|
||||
Sci_PositionU lineStartNext = styler.LineStart(lineCurrent + 1);
|
||||
int levelNext = SC_FOLDLEVELBASE; // default if no specific line found
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
bool atEOL = i == (lineStartNext - 1);
|
||||
int style = styler.StyleAt(i);
|
||||
|
||||
@ -912,7 +912,7 @@ static void FoldIHexDoc(unsigned int startPos, int length, int, WordList *[], Ac
|
||||
levelNext = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
|
||||
} else if (style == SCE_HEX_DATAADDRESS
|
||||
|| (style == SCE_HEX_DEFAULT
|
||||
&& i == (unsigned int)styler.LineStart(lineCurrent))) {
|
||||
&& i == (Sci_PositionU)styler.LineStart(lineCurrent))) {
|
||||
// data record or no record start code at all
|
||||
if (levelCurrent & SC_FOLDLEVELHEADERFLAG) {
|
||||
levelNext = SC_FOLDLEVELBASE + 1;
|
||||
@ -933,12 +933,12 @@ static void FoldIHexDoc(unsigned int startPos, int length, int, WordList *[], Ac
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseTEHexDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler)
|
||||
static void ColouriseTEHexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler)
|
||||
{
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
while (sc.More()) {
|
||||
unsigned int recStartPos;
|
||||
Sci_PositionU recStartPos;
|
||||
int digitCount, addrFieldType;
|
||||
int cs1, cs2;
|
||||
|
||||
|
@ -27,14 +27,14 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
|
||||
static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) {
|
||||
int state = SCE_INNO_DEFAULT;
|
||||
char chPrev;
|
||||
char ch = 0;
|
||||
char chNext = styler[startPos];
|
||||
int lengthDoc = startPos + length;
|
||||
char *buffer = new char[length];
|
||||
int bufferCount = 0;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
char *buffer = new char[length+1];
|
||||
Sci_Position bufferCount = 0;
|
||||
bool isBOL, isEOL, isWS, isBOLWS = 0;
|
||||
bool isCStyleComment = false;
|
||||
|
||||
@ -45,7 +45,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
|
||||
WordList &pascalKeywords = *keywordLists[4];
|
||||
WordList &userKeywords = *keywordLists[5];
|
||||
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
|
||||
bool isCode = (curLineState == 1);
|
||||
|
||||
@ -53,7 +53,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
|
||||
// using the hand-written state machine shown below
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++) {
|
||||
chPrev = ch;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -248,17 +248,17 @@ static const char * const innoWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
unsigned int endPos = startPos + length;
|
||||
static void FoldInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
char chNext = styler[startPos];
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
bool sectionFlag = false;
|
||||
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE;
|
||||
int level;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler[i+1];
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
|
@ -49,7 +49,7 @@ static inline bool IsAWordStart(int ch) {
|
||||
|
||||
/* Interface function called by Scintilla to request some text to be
|
||||
syntax highlighted */
|
||||
static void ColouriseKVIrcDoc(unsigned int startPos, int length,
|
||||
static void ColouriseKVIrcDoc(Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler)
|
||||
{
|
||||
@ -313,10 +313,10 @@ static void ColouriseKVIrcDoc(unsigned int startPos, int length,
|
||||
* fetching the current word, NULL-terminated like
|
||||
* the keyword list */
|
||||
char s[100];
|
||||
int wordLen = sc.currentPos - styler.GetStartSegment();
|
||||
Sci_Position wordLen = sc.currentPos - styler.GetStartSegment();
|
||||
if (wordLen > 99)
|
||||
wordLen = 99; /* Include '\0' in buffer */
|
||||
int i;
|
||||
Sci_Position i;
|
||||
for( i = 0; i < wordLen; ++i )
|
||||
{
|
||||
s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i );
|
||||
@ -355,21 +355,21 @@ static void ColouriseKVIrcDoc(unsigned int startPos, int length,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
|
||||
static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/,
|
||||
WordList *[], Accessor &styler)
|
||||
{
|
||||
/* Based on CMake's folder */
|
||||
|
||||
|
||||
/* Exiting if folding isnt enabled */
|
||||
if ( styler.GetPropertyInt("fold") == 0 )
|
||||
return;
|
||||
|
||||
/* Obtaining current line number*/
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
|
||||
/* Obtaining starting character - indentation is done on a line basis,
|
||||
* not character */
|
||||
unsigned int safeStartPos = styler.LineStart( currentLine );
|
||||
Sci_PositionU safeStartPos = styler.LineStart( currentLine );
|
||||
|
||||
/* Initialising current level - this is defined as indentation level
|
||||
* in the low 12 bits, with flag bits in the upper four bits.
|
||||
@ -386,7 +386,7 @@ static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - un
|
||||
int nextLevel = currentLevel;
|
||||
|
||||
// Looping for characters in range
|
||||
for (unsigned int i = safeStartPos; i < startPos + length; ++i)
|
||||
for (Sci_PositionU i = safeStartPos; i < startPos + length; ++i)
|
||||
{
|
||||
/* Folding occurs after syntax highlighting, meaning Scintilla
|
||||
* already knows where the comments are
|
||||
|
@ -37,7 +37,7 @@ static inline bool IsOperator(const int ch) {
|
||||
return (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '&' || ch == '|' || ch == '<' || ch == '>' || ch == '=');
|
||||
}
|
||||
|
||||
static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseKixDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
@ -48,41 +48,41 @@ struct latexFoldSave {
|
||||
class LexerLaTeX : public LexerBase {
|
||||
private:
|
||||
vector<int> modes;
|
||||
void setMode(int line, int mode) {
|
||||
if (line >= static_cast<int>(modes.size())) modes.resize(line + 1, 0);
|
||||
void setMode(Sci_Position line, int mode) {
|
||||
if (line >= static_cast<Sci_Position>(modes.size())) modes.resize(line + 1, 0);
|
||||
modes[line] = mode;
|
||||
}
|
||||
int getMode(int line) {
|
||||
if (line >= 0 && line < static_cast<int>(modes.size())) return modes[line];
|
||||
int getMode(Sci_Position line) {
|
||||
if (line >= 0 && line < static_cast<Sci_Position>(modes.size())) return modes[line];
|
||||
return 0;
|
||||
}
|
||||
void truncModes(int numLines) {
|
||||
if (static_cast<int>(modes.size()) > numLines * 2 + 256)
|
||||
void truncModes(Sci_Position numLines) {
|
||||
if (static_cast<Sci_Position>(modes.size()) > numLines * 2 + 256)
|
||||
modes.resize(numLines + 128);
|
||||
}
|
||||
|
||||
|
||||
vector<latexFoldSave> saves;
|
||||
void setSave(int line, const latexFoldSave &save) {
|
||||
if (line >= static_cast<int>(saves.size())) saves.resize(line + 1);
|
||||
void setSave(Sci_Position line, const latexFoldSave &save) {
|
||||
if (line >= static_cast<Sci_Position>(saves.size())) saves.resize(line + 1);
|
||||
saves[line] = save;
|
||||
}
|
||||
void getSave(int line, latexFoldSave &save) {
|
||||
if (line >= 0 && line < static_cast<int>(saves.size())) save = saves[line];
|
||||
void getSave(Sci_Position line, latexFoldSave &save) {
|
||||
if (line >= 0 && line < static_cast<Sci_Position>(saves.size())) save = saves[line];
|
||||
else {
|
||||
save.structLev = 0;
|
||||
for (int i = 0; i < 8; ++i) save.openBegins[i] = 0;
|
||||
}
|
||||
}
|
||||
void truncSaves(int numLines) {
|
||||
if (static_cast<int>(saves.size()) > numLines * 2 + 256)
|
||||
void truncSaves(Sci_Position numLines) {
|
||||
if (static_cast<Sci_Position>(saves.size()) > numLines * 2 + 256)
|
||||
saves.resize(numLines + 128);
|
||||
}
|
||||
public:
|
||||
static ILexer *LexerFactoryLaTeX() {
|
||||
return new LexerLaTeX();
|
||||
}
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
};
|
||||
|
||||
static bool latexIsSpecial(int ch) {
|
||||
@ -102,7 +102,7 @@ static bool latexIsLetter(int ch) {
|
||||
return IsASCII(ch) && isalpha(ch);
|
||||
}
|
||||
|
||||
static bool latexIsTagValid(int &i, int l, Accessor &styler) {
|
||||
static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) {
|
||||
while (i < l) {
|
||||
if (styler.SafeGetCharAt(i) == '{') {
|
||||
while (i < l) {
|
||||
@ -122,7 +122,7 @@ static bool latexIsTagValid(int &i, int l, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) {
|
||||
static bool latexNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) {
|
||||
char ch;
|
||||
while (i < styler.Length()) {
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
@ -137,10 +137,10 @@ static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool latexLastWordIs(int start, Accessor &styler, const char *needle) {
|
||||
unsigned int i = 0;
|
||||
unsigned int l = static_cast<unsigned int>(strlen(needle));
|
||||
int ini = start-l+1;
|
||||
static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *needle) {
|
||||
Sci_PositionU i = 0;
|
||||
Sci_PositionU l = static_cast<Sci_PositionU>(strlen(needle));
|
||||
Sci_Position ini = start-l+1;
|
||||
char s[32];
|
||||
|
||||
while (i < l && i < 31) {
|
||||
@ -152,8 +152,8 @@ static bool latexLastWordIs(int start, Accessor &styler, const char *needle) {
|
||||
return (strcmp(s, needle) == 0);
|
||||
}
|
||||
|
||||
static bool latexLastWordIsMathEnv(int pos, Accessor &styler) {
|
||||
int i, j;
|
||||
static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) {
|
||||
Sci_Position i, j;
|
||||
char s[32];
|
||||
const char *mathEnvs[] = { "align", "alignat", "flalign", "gather",
|
||||
"multiline", "displaymath", "eqnarray", "equation" };
|
||||
@ -184,7 +184,7 @@ static inline void latexStateReset(int &mode, int &state) {
|
||||
|
||||
// There are cases not handled correctly, like $abcd\textrm{what is $x+y$}z+w$.
|
||||
// But I think it's already good enough.
|
||||
void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
// startPos is assumed to be the first character of a line
|
||||
Accessor styler(pAccess, &props);
|
||||
styler.StartAt(startPos);
|
||||
@ -192,13 +192,13 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
int state = initStyle;
|
||||
if (state == SCE_L_ERROR || state == SCE_L_SHORTCMD || state == SCE_L_SPECIAL) // should not happen
|
||||
latexStateReset(mode, state);
|
||||
|
||||
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
char chVerbatimDelim = '\0';
|
||||
styler.StartSegment(startPos);
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
|
||||
for (int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -207,7 +207,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (ch == '\r' || ch == '\n')
|
||||
setMode(styler.GetLine(i), mode);
|
||||
|
||||
@ -256,7 +256,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
state = SCE_L_COMMENT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
// These 3 will never be reached.
|
||||
case SCE_L_ERROR:
|
||||
case SCE_L_SPECIAL:
|
||||
@ -325,7 +325,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
case '\\' :
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (latexIsLetter(chNext)) {
|
||||
int match = i + 3;
|
||||
Sci_Position match = i + 3;
|
||||
if (latexLastWordIs(match, styler, "\\end")) {
|
||||
match++;
|
||||
if (latexIsTagValid(match, lengthDoc, styler)) {
|
||||
@ -367,7 +367,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
case '\\' :
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (latexIsLetter(chNext)) {
|
||||
int match = i + 3;
|
||||
Sci_Position match = i + 3;
|
||||
if (latexLastWordIs(match, styler, "\\end")) {
|
||||
match++;
|
||||
if (latexIsTagValid(match, lengthDoc, styler)) {
|
||||
@ -400,7 +400,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
mode = 0;
|
||||
state = SCE_L_DEFAULT;
|
||||
} else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation}
|
||||
} else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation}
|
||||
styler.ColourTo(i, SCE_L_SHORTCMD);
|
||||
}
|
||||
break;
|
||||
@ -418,7 +418,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
break;
|
||||
case SCE_L_COMMENT2 :
|
||||
if (ch == '\\') {
|
||||
int match = i + 3;
|
||||
Sci_Position match = i + 3;
|
||||
if (latexLastWordIs(match, styler, "\\end")) {
|
||||
match++;
|
||||
if (latexIsTagValid(match, lengthDoc, styler)) {
|
||||
@ -432,7 +432,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
|
||||
break;
|
||||
case SCE_L_VERBATIM :
|
||||
if (ch == '\\') {
|
||||
int match = i + 3;
|
||||
Sci_Position match = i + 3;
|
||||
if (latexLastWordIs(match, styler, "\\end")) {
|
||||
match++;
|
||||
if (latexIsTagValid(match, lengthDoc, styler)) {
|
||||
@ -470,23 +470,24 @@ static int latexFoldSaveToInt(const latexFoldSave &save) {
|
||||
|
||||
// Change folding state while processing a line
|
||||
// Return the level before the first relevant command
|
||||
void SCI_METHOD LexerLaTeX::Fold(unsigned int startPos, int length, int, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) {
|
||||
const char *structWords[7] = {"part", "chapter", "section", "subsection",
|
||||
"subsubsection", "paragraph", "subparagraph"};
|
||||
Accessor styler(pAccess, &props);
|
||||
unsigned int endPos = startPos + length;
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
latexFoldSave save;
|
||||
getSave(curLine - 1, save);
|
||||
do {
|
||||
char ch, buf[16];
|
||||
int i, j, lev = -1;
|
||||
Sci_Position i, j;
|
||||
int lev = -1;
|
||||
bool needFold = false;
|
||||
for (i = static_cast<int>(startPos); i < static_cast<int>(endPos); ++i) {
|
||||
for (i = static_cast<Sci_Position>(startPos); i < static_cast<Sci_Position>(endPos); ++i) {
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
if (ch == '\r' || ch == '\n') break;
|
||||
if (ch != '\\' || styler.StyleAt(i) != SCE_L_COMMAND) continue;
|
||||
for (j = 0; j < 15 && i + 1 < static_cast<int>(endPos); ++j, ++i) {
|
||||
for (j = 0; j < 15 && i + 1 < static_cast<Sci_Position>(endPos); ++j, ++i) {
|
||||
buf[j] = styler.SafeGetCharAt(i + 1);
|
||||
if (!latexIsLetter(buf[j])) break;
|
||||
}
|
||||
@ -522,7 +523,7 @@ void SCI_METHOD LexerLaTeX::Fold(unsigned int startPos, int length, int, IDocume
|
||||
setSave(curLine, save);
|
||||
++curLine;
|
||||
startPos = styler.LineStart(curLine);
|
||||
if (static_cast<int>(startPos) == styler.Length()) {
|
||||
if (static_cast<Sci_Position>(startPos) == styler.Length()) {
|
||||
lev = latexFoldSaveToInt(save);
|
||||
styler.SetLevel(curLine, lev);
|
||||
setSave(curLine, save);
|
||||
|
@ -46,10 +46,10 @@ static inline bool isLispwordstart(char ch) {
|
||||
}
|
||||
|
||||
|
||||
static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
|
||||
static void classifyWordLisp(Sci_PositionU start, Sci_PositionU end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
|
||||
assert(end >= start);
|
||||
char s[100];
|
||||
unsigned int i;
|
||||
Sci_PositionU i;
|
||||
bool digit_flag = true;
|
||||
for (i = 0; (i < end - start + 1) && (i < 99); i++) {
|
||||
s[i] = styler[start + i];
|
||||
@ -74,7 +74,7 @@ static void classifyWordLisp(unsigned int start, unsigned int end, WordList &key
|
||||
}
|
||||
|
||||
|
||||
static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -84,9 +84,9 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
|
||||
|
||||
int state = initStyle, radix = -1;
|
||||
char chNext = styler[startPos];
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
styler.StartSegment(startPos);
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -233,16 +233,16 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
}
|
||||
|
||||
static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||
static void FoldLispDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
|
||||
Accessor &styler) {
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -40,7 +40,7 @@ static inline bool IsAnOther(const int ch) {
|
||||
ch == ']' || ch == '^' || ch == '`' || ch == '|' || ch == '~');
|
||||
}
|
||||
|
||||
static void ColouriseLoutDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseLoutDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -140,12 +140,12 @@ static void ColouriseLoutDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
@ -153,7 +153,7 @@ static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
char s[10] = "";
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
@ -162,7 +162,7 @@ static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
|
||||
if (style == SCE_LOUT_WORD) {
|
||||
if (ch == '@') {
|
||||
for (unsigned int j = 0; j < 8; j++) {
|
||||
for (Sci_PositionU j = 0; j < 8; j++) {
|
||||
if (!IsAWordChar(styler[i + j])) {
|
||||
break;
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ static int LongDelimCheck(StyleContext &sc) {
|
||||
}
|
||||
|
||||
static void ColouriseLuaDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -64,10 +64,10 @@ static void ColouriseLuaDoc(
|
||||
// but probably enough in most cases. [pP] is for hex floats.
|
||||
CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefpABCDEFP");
|
||||
CharacterSet setExponent(CharacterSet::setNone, "eEpP");
|
||||
CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#");
|
||||
CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#&|");
|
||||
CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\");
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
// Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level,
|
||||
// if we are inside such a string. Block comment was introduced in Lua 5.0,
|
||||
// blocks with separators [=[ ... ]=] in Lua 5.1.
|
||||
@ -132,10 +132,10 @@ static void ColouriseLuaDoc(
|
||||
if (sc.state == SCE_LUA_OPERATOR) {
|
||||
if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan
|
||||
sc.Forward();
|
||||
int ln = 0;
|
||||
Sci_Position ln = 0;
|
||||
while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs
|
||||
ln++;
|
||||
int ws1 = ln;
|
||||
Sci_Position ws1 = ln;
|
||||
if (setWordStart.Contains(sc.GetRelative(ln))) {
|
||||
int c, i = 0;
|
||||
char s[100];
|
||||
@ -144,11 +144,11 @@ static void ColouriseLuaDoc(
|
||||
s[i++] = static_cast<char>(c);
|
||||
ln++;
|
||||
}
|
||||
s[i] = '\0'; int lbl = ln;
|
||||
s[i] = '\0'; Sci_Position lbl = ln;
|
||||
if (!keywords.InList(s)) {
|
||||
while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs
|
||||
ln++;
|
||||
int ws2 = ln - lbl;
|
||||
Sci_Position ws2 = ln - lbl;
|
||||
if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') {
|
||||
// final :: found, complete valid label construct
|
||||
sc.ChangeState(SCE_LUA_LABEL);
|
||||
@ -347,18 +347,18 @@ static void ColouriseLuaDoc(
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||
static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
|
||||
Accessor &styler) {
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
@ -367,7 +367,7 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
|
||||
if (style == SCE_LUA_WORD) {
|
||||
if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') {
|
||||
char s[10] = "";
|
||||
for (unsigned int j = 0; j < 8; j++) {
|
||||
for (Sci_PositionU j = 0; j < 8; j++) {
|
||||
if (!iswordchar(styler[i + j])) {
|
||||
break;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ inline bool isMMIXALOperator(char ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColouriseMMIXALDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseMMIXALDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &opcodes = *keywordlists[0];
|
||||
|
@ -80,7 +80,7 @@ static int GetLotLineState(std::string &line) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
static void ColourizeLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
bool atLineStart = true;// Arms the 'at line start' flag
|
||||
@ -89,7 +89,7 @@ static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[]
|
||||
line.reserve(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations
|
||||
|
||||
// Styles LOT document
|
||||
unsigned int i; // Declared here because it's used after the for loop
|
||||
Sci_PositionU i; // Declared here because it's used after the for loop
|
||||
for (i = startPos; i < startPos + length; ++i) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -118,11 +118,11 @@ static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[]
|
||||
// sections (headed by a set line)
|
||||
// passes (contiguous pass results within a section)
|
||||
// fails (contiguous fail results within a section)
|
||||
static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
static void FoldLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
int style = SCE_LOT_DEFAULT;
|
||||
@ -133,7 +133,7 @@ static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Acc
|
||||
if (startPos > 1)
|
||||
style = styler.StyleAt(startPos - 2);
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
|
@ -35,8 +35,8 @@ using namespace Scintilla;
|
||||
#define KW_MSSQL_STORED_PROCEDURES 5
|
||||
#define KW_MSSQL_OPERATORS 6
|
||||
|
||||
static char classifyWordSQL(unsigned int start,
|
||||
unsigned int end,
|
||||
static char classifyWordSQL(Sci_PositionU start,
|
||||
Sci_PositionU end,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler,
|
||||
unsigned int actualState,
|
||||
@ -52,7 +52,7 @@ static char classifyWordSQL(unsigned int start,
|
||||
WordList &kwStoredProcedures = *keywordlists[KW_MSSQL_STORED_PROCEDURES];
|
||||
WordList &kwOperators = *keywordlists[KW_MSSQL_OPERATORS];
|
||||
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 128; i++) {
|
||||
for (Sci_PositionU i = 0; i < end - start + 1 && i < 128; i++) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
@ -101,14 +101,14 @@ static char classifyWordSQL(unsigned int start,
|
||||
return chAttr;
|
||||
}
|
||||
|
||||
static void ColouriseMSSQLDoc(unsigned int startPos, int length,
|
||||
static void ColouriseMSSQLDoc(Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
bool fold = styler.GetPropertyInt("fold") != 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int spaceFlags = 0;
|
||||
|
||||
int state = initStyle;
|
||||
@ -116,8 +116,8 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length,
|
||||
char chPrev = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -277,18 +277,18 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length,
|
||||
styler.ColourTo(lengthDoc - 1, state);
|
||||
}
|
||||
|
||||
static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
static void FoldMSSQLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
bool inComment = (styler.StyleAt(startPos-1) == SCE_MSSQL_COMMENT);
|
||||
char s[10] = "";
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styler.StyleAt(i);
|
||||
@ -304,7 +304,7 @@ static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], A
|
||||
if (style == SCE_MSSQL_STATEMENT) {
|
||||
// Folding between begin or case and end
|
||||
if (ch == 'b' || ch == 'B' || ch == 'c' || ch == 'C' || ch == 'e' || ch == 'E') {
|
||||
for (unsigned int j = 0; j < 5; j++) {
|
||||
for (Sci_PositionU j = 0; j < 5; j++) {
|
||||
if (!iswordchar(styler[i + j])) {
|
||||
break;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ static inline bool IsAlNumSym(int ch) {
|
||||
* \param keywordslists The keywordslists, currently, number 5 is used
|
||||
* \param styler The styler
|
||||
*/
|
||||
static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseMagikDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
styler.StartAt(startPos);
|
||||
|
||||
@ -141,7 +141,7 @@ static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle,
|
||||
char keywordChar = static_cast<char>(
|
||||
tolower(styler.SafeGetCharAt(
|
||||
scanPosition +
|
||||
static_cast<int>(sc.currentPos+1), ' ')));
|
||||
static_cast<Sci_Position>(sc.currentPos+1), ' ')));
|
||||
if(IsAlpha(keywordChar)) {
|
||||
keyword[scanPosition] = keywordChar;
|
||||
} else {
|
||||
@ -359,24 +359,24 @@ static inline int IsFoldingContainer(WordList &keywordslist, char * keyword) {
|
||||
* \param keywordslists The keywordslists, currently, number 5 is used
|
||||
* \param styler The styler
|
||||
*/
|
||||
static void FoldMagikDoc(unsigned int startPos, int length, int,
|
||||
static void FoldMagikDoc(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *keywordslists[], Accessor &styler) {
|
||||
|
||||
bool compact = styler.GetPropertyInt("fold.compact") != 0;
|
||||
|
||||
WordList &foldingElements = *keywordslists[5];
|
||||
int endPos = startPos + length;
|
||||
int line = styler.GetLine(startPos);
|
||||
Sci_Position endPos = startPos + length;
|
||||
Sci_Position line = styler.GetLine(startPos);
|
||||
int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK;
|
||||
int flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK;
|
||||
|
||||
for(
|
||||
int currentPos = startPos;
|
||||
Sci_Position currentPos = startPos;
|
||||
currentPos < endPos;
|
||||
currentPos++) {
|
||||
char currentState = styler.StyleAt(currentPos);
|
||||
char c = styler.SafeGetCharAt(currentPos, ' ');
|
||||
int prevLine = styler.GetLine(currentPos - 1);
|
||||
Sci_Position prevLine = styler.GetLine(currentPos - 1);
|
||||
line = styler.GetLine(currentPos);
|
||||
|
||||
// Default situation
|
||||
|
144
src/stc/scintilla/lexers/LexMake.cxx
Normal file
144
src/stc/scintilla/lexers/LexMake.cxx
Normal file
@ -0,0 +1,144 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexMake.cxx
|
||||
** Lexer for make files.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
}
|
||||
|
||||
static void ColouriseMakeLine(
|
||||
char *lineBuffer,
|
||||
Sci_PositionU lengthLine,
|
||||
Sci_PositionU startLine,
|
||||
Sci_PositionU endPos,
|
||||
Accessor &styler) {
|
||||
|
||||
Sci_PositionU i = 0;
|
||||
Sci_Position lastNonSpace = -1;
|
||||
unsigned int state = SCE_MAKE_DEFAULT;
|
||||
bool bSpecial = false;
|
||||
|
||||
// check for a tab character in column 0 indicating a command
|
||||
bool bCommand = false;
|
||||
if ((lengthLine > 0) && (lineBuffer[0] == '\t'))
|
||||
bCommand = true;
|
||||
|
||||
// Skip initial spaces
|
||||
while ((i < lengthLine) && isspacechar(lineBuffer[i])) {
|
||||
i++;
|
||||
}
|
||||
if (i < lengthLine) {
|
||||
if (lineBuffer[i] == '#') { // Comment
|
||||
styler.ColourTo(endPos, SCE_MAKE_COMMENT);
|
||||
return;
|
||||
}
|
||||
if (lineBuffer[i] == '!') { // Special directive
|
||||
styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
int varCount = 0;
|
||||
while (i < lengthLine) {
|
||||
if (((i + 1) < lengthLine) && (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(')) {
|
||||
styler.ColourTo(startLine + i - 1, state);
|
||||
state = SCE_MAKE_IDENTIFIER;
|
||||
varCount++;
|
||||
} else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') {
|
||||
if (--varCount == 0) {
|
||||
styler.ColourTo(startLine + i, state);
|
||||
state = SCE_MAKE_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
// skip identifier and target styling if this is a command line
|
||||
if (!bSpecial && !bCommand) {
|
||||
if (lineBuffer[i] == ':') {
|
||||
if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) {
|
||||
// it's a ':=', so style as an identifier
|
||||
if (lastNonSpace >= 0)
|
||||
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
|
||||
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
||||
styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR);
|
||||
} else {
|
||||
// We should check that no colouring was made since the beginning of the line,
|
||||
// to avoid colouring stuff like /OUT:file
|
||||
if (lastNonSpace >= 0)
|
||||
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
|
||||
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
||||
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
|
||||
}
|
||||
bSpecial = true; // Only react to the first ':' of the line
|
||||
state = SCE_MAKE_DEFAULT;
|
||||
} else if (lineBuffer[i] == '=') {
|
||||
if (lastNonSpace >= 0)
|
||||
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
|
||||
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
|
||||
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
|
||||
bSpecial = true; // Only react to the first '=' of the line
|
||||
state = SCE_MAKE_DEFAULT;
|
||||
}
|
||||
}
|
||||
if (!isspacechar(lineBuffer[i])) {
|
||||
lastNonSpace = i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (state == SCE_MAKE_IDENTIFIER) {
|
||||
styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended
|
||||
} else {
|
||||
styler.ColourTo(endPos, SCE_MAKE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
Sci_PositionU linePos = 0;
|
||||
Sci_PositionU startLine = startPos;
|
||||
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
// End of line (or of line buffer) met, colourise it
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler);
|
||||
linePos = 0;
|
||||
startLine = i + 1;
|
||||
}
|
||||
}
|
||||
if (linePos > 0) { // Last line does not have ending characters
|
||||
ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *const emptyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);
|
@ -60,8 +60,8 @@ static inline bool IsNewline(const int ch) {
|
||||
}
|
||||
|
||||
// True if can follow ch down to the end with possibly trailing whitespace
|
||||
static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) {
|
||||
unsigned int i = 0;
|
||||
static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) {
|
||||
Sci_PositionU i = 0;
|
||||
while (sc.GetRelative(++i) == ch)
|
||||
;
|
||||
// Skip over whitespace
|
||||
@ -78,7 +78,7 @@ static bool FollowToLineEnd(const int ch, const int state, const unsigned int en
|
||||
|
||||
// Set the state on text section from current to length characters,
|
||||
// then set the rest until the newline to default, except for any characters matching token
|
||||
static void SetStateAndZoom(const int state, const int length, const int token, StyleContext &sc) {
|
||||
static void SetStateAndZoom(const int state, const Sci_Position length, const int token, StyleContext &sc) {
|
||||
sc.SetState(state);
|
||||
sc.Forward(length);
|
||||
sc.SetState(SCE_MARKDOWN_DEFAULT);
|
||||
@ -100,11 +100,11 @@ static void SetStateAndZoom(const int state, const int length, const int token,
|
||||
|
||||
// Does the previous line have more than spaces and tabs?
|
||||
static bool HasPrevLineContent(StyleContext &sc) {
|
||||
int i = 0;
|
||||
Sci_Position i = 0;
|
||||
// Go back to the previous newline
|
||||
while ((--i + (int)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i)))
|
||||
while ((--i + (Sci_Position)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i)))
|
||||
;
|
||||
while ((--i + (int)sc.currentPos) >= 0) {
|
||||
while ((--i + (Sci_Position)sc.currentPos) >= 0) {
|
||||
if (IsNewline(sc.GetRelative(i)))
|
||||
break;
|
||||
if (!IsASpaceOrTab(sc.GetRelative(i)))
|
||||
@ -114,12 +114,12 @@ static bool HasPrevLineContent(StyleContext &sc) {
|
||||
}
|
||||
|
||||
static bool AtTermStart(StyleContext &sc) {
|
||||
return sc.currentPos == 0 || isspacechar(sc.chPrev);
|
||||
return sc.currentPos == 0 || sc.chPrev == 0 || isspacechar(sc.chPrev);
|
||||
}
|
||||
|
||||
static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
|
||||
static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) {
|
||||
int count = 1;
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
for (;;) {
|
||||
++i;
|
||||
int c = sc.GetRelative(i);
|
||||
@ -143,9 +143,9 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList **, Accessor &styler) {
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int precharCount = 0;
|
||||
// Don't advance on a new loop iteration and retry at the same position.
|
||||
// Useful in the corner case of having to start at the beginning file position
|
||||
@ -225,7 +225,7 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
else if (sc.state == SCE_MARKDOWN_CODEBK) {
|
||||
if (sc.atLineStart && sc.Match("~~~")) {
|
||||
int i = 1;
|
||||
Sci_Position i = 1;
|
||||
while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos)
|
||||
i++;
|
||||
sc.Forward(i);
|
||||
@ -347,8 +347,8 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
// Links and Images
|
||||
if (sc.Match("![") || sc.ch == '[') {
|
||||
int i = 0, j = 0, k = 0;
|
||||
int len = endPos - sc.currentPos;
|
||||
Sci_Position i = 0, j = 0, k = 0;
|
||||
Sci_Position len = endPos - sc.currentPos;
|
||||
while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
|
||||
;
|
||||
if (sc.GetRelative(i) == ']') {
|
||||
|
@ -49,16 +49,16 @@ static bool IsOctaveCommentChar(int c) {
|
||||
return (c == '%' || c == '#') ;
|
||||
}
|
||||
|
||||
static bool IsMatlabComment(Accessor &styler, int pos, int len) {
|
||||
static bool IsMatlabComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
|
||||
return len > 0 && IsMatlabCommentChar(styler[pos]) ;
|
||||
}
|
||||
|
||||
static bool IsOctaveComment(Accessor &styler, int pos, int len) {
|
||||
static bool IsOctaveComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
|
||||
return len > 0 && IsOctaveCommentChar(styler[pos]) ;
|
||||
}
|
||||
|
||||
static void ColouriseMatlabOctaveDoc(
|
||||
unsigned int startPos, int length, int initStyle,
|
||||
Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler,
|
||||
bool (*IsCommentChar)(int),
|
||||
bool ismatlab) {
|
||||
@ -67,7 +67,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
// boolean for when the ' is allowed to be transpose vs the start/end
|
||||
// boolean for when the ' is allowed to be transpose vs the start/end
|
||||
// of a string
|
||||
bool transpose = false;
|
||||
|
||||
@ -77,7 +77,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
int column = 0;
|
||||
|
||||
// use the line state of each line to store the block comment depth
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
int commentDepth = curLine > 0 ? styler.GetLineState(curLine-1) : 0;
|
||||
|
||||
|
||||
@ -86,13 +86,13 @@ static void ColouriseMatlabOctaveDoc(
|
||||
for (; sc.More(); sc.Forward(), column++) {
|
||||
|
||||
if(sc.atLineStart) {
|
||||
// set the line state to the current commentDepth
|
||||
// set the line state to the current commentDepth
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
styler.SetLineState(curLine, commentDepth);
|
||||
|
||||
// reset the column to 0, nonSpace to -1 (not set)
|
||||
column = 0;
|
||||
nonSpaceColumn = -1;
|
||||
nonSpaceColumn = -1;
|
||||
}
|
||||
|
||||
// save the column position of first non space character in a line
|
||||
@ -111,7 +111,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
|
||||
transpose = true;
|
||||
} else if(sc.ch == '.' && sc.chNext == '.') {
|
||||
// we werent an operator, but a '...'
|
||||
// we werent an operator, but a '...'
|
||||
sc.ChangeState(SCE_MATLAB_COMMENT);
|
||||
transpose = false;
|
||||
} else {
|
||||
@ -165,7 +165,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
// end or start of a nested a block comment?
|
||||
if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column) {
|
||||
if(commentDepth > 0) commentDepth --;
|
||||
|
||||
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
styler.SetLineState(curLine, commentDepth);
|
||||
sc.Forward();
|
||||
@ -235,24 +235,24 @@ static void ColouriseMatlabOctaveDoc(
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true);
|
||||
}
|
||||
|
||||
static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false);
|
||||
}
|
||||
|
||||
static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
|
||||
static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int,
|
||||
WordList *[], Accessor &styler,
|
||||
bool (*IsComment)(Accessor&, int, int)) {
|
||||
bool (*IsComment)(Accessor&, Sci_Position, Sci_Position)) {
|
||||
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
@ -262,7 +262,7 @@ static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
|
||||
int spaceFlags = 0;
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsComment);
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -289,12 +289,12 @@ static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabComment);
|
||||
}
|
||||
|
||||
static void FoldOctaveDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveComment);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ using namespace Scintilla;
|
||||
|
||||
// Auxiliary functions:
|
||||
|
||||
static inline bool endOfLine(Accessor &styler, unsigned int i) {
|
||||
static inline bool endOfLine(Accessor &styler, Sci_PositionU i) {
|
||||
return
|
||||
(styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ;
|
||||
}
|
||||
@ -119,18 +119,18 @@ static inline bool isMETAPOSTequal(int ch) {
|
||||
}
|
||||
|
||||
static int CheckMETAPOSTInterface(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
Accessor &styler,
|
||||
int defaultInterface) {
|
||||
|
||||
char lineBuffer[1024] ;
|
||||
unsigned int linePos = 0 ;
|
||||
Sci_PositionU linePos = 0 ;
|
||||
|
||||
// some day we can make something lexer.metapost.mapping=(none,0)(metapost,1)(mp,1)(metafun,2)...
|
||||
|
||||
if (styler.SafeGetCharAt(0) == '%') {
|
||||
for (unsigned int i = 0; i < startPos + length; i++) {
|
||||
for (Sci_PositionU i = 0; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler.SafeGetCharAt(i) ;
|
||||
if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
lineBuffer[linePos] = '\0';
|
||||
@ -154,8 +154,8 @@ static int CheckMETAPOSTInterface(
|
||||
}
|
||||
|
||||
static void ColouriseMETAPOSTDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -336,7 +336,7 @@ static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) {
|
||||
|
||||
}
|
||||
|
||||
static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)
|
||||
static int ParseMetapostWord(Sci_PositionU pos, Accessor &styler, char *word)
|
||||
{
|
||||
int length=0;
|
||||
char ch=styler.SafeGetCharAt(pos);
|
||||
@ -351,19 +351,19 @@ static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)
|
||||
return length;
|
||||
}
|
||||
|
||||
static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler)
|
||||
static void FoldMetapostDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos+length;
|
||||
Sci_PositionU endPos = startPos+length;
|
||||
int visibleChars=0;
|
||||
int lineCurrent=styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent=styler.GetLine(startPos);
|
||||
int levelPrev=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent=levelPrev;
|
||||
char chNext=styler[startPos];
|
||||
|
||||
char buffer[100]="";
|
||||
|
||||
for (unsigned int i=startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i=startPos; i < endPos; i++) {
|
||||
char ch=chNext;
|
||||
chNext=styler.SafeGetCharAt(i+1);
|
||||
char chPrev=styler.SafeGetCharAt(i-1);
|
||||
|
@ -79,7 +79,7 @@ static inline unsigned IsOperator( StyleContext & sc, WordList & op ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool IsEOL( Accessor &styler, unsigned curPos ) {
|
||||
static inline bool IsEOL( Accessor &styler, Sci_PositionU curPos ) {
|
||||
unsigned ch = styler.SafeGetCharAt( curPos );
|
||||
if( ( ch == '\r' && styler.SafeGetCharAt( curPos + 1 ) == '\n' ) ||
|
||||
( ch == '\n' ) ) {
|
||||
@ -90,7 +90,7 @@ static inline bool IsEOL( Accessor &styler, unsigned curPos ) {
|
||||
|
||||
static inline bool checkStatement(
|
||||
Accessor &styler,
|
||||
int &curPos,
|
||||
Sci_Position &curPos,
|
||||
const char *stt, bool spaceAfter = true ) {
|
||||
int len = static_cast<int>(strlen( stt ));
|
||||
int i;
|
||||
@ -110,7 +110,7 @@ static inline bool checkStatement(
|
||||
|
||||
static inline bool checkEndSemicolon(
|
||||
Accessor &styler,
|
||||
int &curPos, int endPos )
|
||||
Sci_Position &curPos, Sci_Position endPos )
|
||||
{
|
||||
const char *stt = "END";
|
||||
int len = static_cast<int>(strlen( stt ));
|
||||
@ -134,9 +134,9 @@ static inline bool checkEndSemicolon(
|
||||
static inline bool checkKeyIdentOper(
|
||||
|
||||
Accessor &styler,
|
||||
int &curPos, int endPos,
|
||||
Sci_Position &curPos, Sci_Position endPos,
|
||||
const char *stt, const char etk ) {
|
||||
int newPos = curPos;
|
||||
Sci_Position newPos = curPos;
|
||||
if( ! checkStatement( styler, newPos, stt ) )
|
||||
return false;
|
||||
newPos++;
|
||||
@ -174,17 +174,17 @@ static inline bool checkKeyIdentOper(
|
||||
return true;
|
||||
}
|
||||
|
||||
static void FoldModulaDoc( unsigned int startPos,
|
||||
int length,
|
||||
static void FoldModulaDoc( Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int , WordList *[],
|
||||
Accessor &styler)
|
||||
{
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
int curLevel = SC_FOLDLEVELBASE;
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
if( curLine > 0 )
|
||||
curLevel = styler.LevelAt( curLine - 1 ) >> 16;
|
||||
int curPos = startPos;
|
||||
Sci_Position curPos = startPos;
|
||||
int style = styler.StyleAt( curPos );
|
||||
int visChars = 0;
|
||||
int nextLevel = curLevel;
|
||||
@ -250,9 +250,9 @@ static void FoldModulaDoc( unsigned int startPos,
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkKeyIdentOper( styler, curPos, endPos, "END", ';' ) ) {
|
||||
int cln = curLine;
|
||||
Sci_Position cln = curLine;
|
||||
int clv_old = curLevel;
|
||||
int pos;
|
||||
Sci_Position pos;
|
||||
char ch;
|
||||
int clv_new;
|
||||
while( cln > 0 ) {
|
||||
@ -325,8 +325,8 @@ static inline bool skipWhiteSpaces( StyleContext & sc ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ColouriseModulaDoc( unsigned int startPos,
|
||||
int length,
|
||||
static void ColouriseModulaDoc( Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *wl[],
|
||||
Accessor &styler ) {
|
||||
@ -342,7 +342,7 @@ static void ColouriseModulaDoc( unsigned int startPos,
|
||||
char buf[BUFLEN];
|
||||
int i, kl;
|
||||
|
||||
int charPos = 0;
|
||||
Sci_Position charPos = 0;
|
||||
|
||||
StyleContext sc( startPos, length, initStyle, styler );
|
||||
|
||||
|
@ -105,7 +105,7 @@ static void ForwardDefaultState(StyleContext& sc, int activeState)
|
||||
sc.ForwardSetState(SCE_MYSQL_HIDDENCOMMAND);
|
||||
}
|
||||
|
||||
static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler)
|
||||
{
|
||||
StyleContext sc(startPos, length, initStyle, styler, 127);
|
||||
@ -150,7 +150,7 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
case SCE_MYSQL_SYSTEMVARIABLE:
|
||||
if (!IsAWordChar(sc.ch))
|
||||
{
|
||||
int length = sc.LengthCurrent() + 1;
|
||||
Sci_Position length = sc.LengthCurrent() + 1;
|
||||
char* s = new char[length];
|
||||
sc.GetCurrentLowered(s, length);
|
||||
|
||||
@ -267,10 +267,13 @@ static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
{
|
||||
sc.SetState(SCE_MYSQL_COMMENT | activeState);
|
||||
|
||||
// Skip comment introducer and check for hidden command.
|
||||
sc.Forward(2);
|
||||
if (sc.ch == '!')
|
||||
// Skip first char of comment introducer and check for hidden command.
|
||||
// The second char is skipped by the outer loop.
|
||||
sc.Forward();
|
||||
if (sc.GetRelativeCharacter(1) == '!')
|
||||
{
|
||||
// Version comment found. Skip * now.
|
||||
sc.Forward();
|
||||
activeState = HIDDENCOMMAND_STATE;
|
||||
sc.ChangeState(SCE_MYSQL_HIDDENCOMMAND);
|
||||
}
|
||||
@ -328,9 +331,9 @@ static bool IsStreamCommentStyle(int style)
|
||||
* Code copied from StyleContext and modified to work here. Should go into Accessor as a
|
||||
* companion to Match()...
|
||||
*/
|
||||
bool MatchIgnoreCase(Accessor &styler, int currentPos, const char *s)
|
||||
static bool MatchIgnoreCase(Accessor &styler, Sci_Position currentPos, const char *s)
|
||||
{
|
||||
for (int n = 0; *s; n++)
|
||||
for (Sci_Position n = 0; *s; n++)
|
||||
{
|
||||
if (*s != tolower(styler.SafeGetCharAt(currentPos + n)))
|
||||
return false;
|
||||
@ -343,14 +346,14 @@ bool MatchIgnoreCase(Accessor &styler, int currentPos, const char *s)
|
||||
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment.
|
||||
static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler)
|
||||
static void FoldMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler)
|
||||
{
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
|
||||
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
|
||||
@ -359,24 +362,24 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
int activeState = (style == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : style & HIDDENCOMMAND_STATE;
|
||||
|
||||
|
||||
bool endPending = false;
|
||||
bool whenPending = false;
|
||||
bool elseIfPending = false;
|
||||
|
||||
char nextChar = styler.SafeGetCharAt(startPos);
|
||||
for (unsigned int i = startPos; length > 0; i++, length--)
|
||||
for (Sci_PositionU i = startPos; length > 0; i++, length--)
|
||||
{
|
||||
int stylePrev = style;
|
||||
int lastActiveState = activeState;
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
activeState = (style == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : style & HIDDENCOMMAND_STATE;
|
||||
|
||||
|
||||
char currentChar = nextChar;
|
||||
nextChar = styler.SafeGetCharAt(i + 1);
|
||||
bool atEOL = (currentChar == '\r' && nextChar != '\n') || (currentChar == '\n');
|
||||
|
||||
|
||||
switch (MASKACTIVE(style))
|
||||
{
|
||||
case SCE_MYSQL_COMMENT:
|
||||
@ -389,7 +392,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
|
||||
break;
|
||||
case SCE_MYSQL_COMMENTLINE:
|
||||
if (foldComment)
|
||||
{
|
||||
{
|
||||
// Not really a standard, but we add support for single line comments
|
||||
// with special curly braces syntax as foldable comments too.
|
||||
// MySQL needs -- comments to be followed by space or control char
|
||||
@ -497,12 +500,12 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Keep the current end state for the next round.
|
||||
endPending = endFound;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (!isspacechar(currentChar) && endPending)
|
||||
{
|
||||
@ -544,7 +547,7 @@ static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordL
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (lev != styler.LevelAt(lineCurrent))
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
|
||||
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
visibleChars = 0;
|
||||
|
@ -33,7 +33,7 @@ static inline bool IsAWordChar(int ch) {
|
||||
return (ch >= 0x80) || isalnum(ch) || ch == '_';
|
||||
}
|
||||
|
||||
static int tillEndOfTripleQuote(Accessor &styler, int pos, int max) {
|
||||
static Sci_Position tillEndOfTripleQuote(Accessor &styler, Sci_Position pos, Sci_Position max) {
|
||||
/* search for """ */
|
||||
for (;;) {
|
||||
if (styler.SafeGetCharAt(pos, '\0') == '\0') return pos;
|
||||
@ -52,7 +52,7 @@ static bool inline isNewLine(int ch) {
|
||||
return ch == CR || ch == LF;
|
||||
}
|
||||
|
||||
static int scanString(Accessor &styler, int pos, int max, bool rawMode) {
|
||||
static Sci_Position scanString(Accessor &styler, Sci_Position pos, Sci_Position max, bool rawMode) {
|
||||
for (;;) {
|
||||
if (pos >= max) return pos;
|
||||
char ch = styler.SafeGetCharAt(pos, '\0');
|
||||
@ -66,7 +66,7 @@ static int scanString(Accessor &styler, int pos, int max, bool rawMode) {
|
||||
}
|
||||
}
|
||||
|
||||
static int scanChar(Accessor &styler, int pos, int max) {
|
||||
static Sci_Position scanChar(Accessor &styler, Sci_Position pos, Sci_Position max) {
|
||||
for (;;) {
|
||||
if (pos >= max) return pos;
|
||||
char ch = styler.SafeGetCharAt(pos, '\0');
|
||||
@ -81,9 +81,9 @@ static int scanChar(Accessor &styler, int pos, int max) {
|
||||
}
|
||||
}
|
||||
|
||||
static int scanIdent(Accessor &styler, int pos, WordList &keywords) {
|
||||
static Sci_Position scanIdent(Accessor &styler, Sci_Position pos, WordList &keywords) {
|
||||
char buf[100]; /* copy to lowercase and ignore underscores */
|
||||
int i = 0;
|
||||
Sci_Position i = 0;
|
||||
|
||||
for (;;) {
|
||||
char ch = styler.SafeGetCharAt(pos, '\0');
|
||||
@ -104,7 +104,7 @@ static int scanIdent(Accessor &styler, int pos, WordList &keywords) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int scanNumber(Accessor &styler, int pos) {
|
||||
static Sci_Position scanNumber(Accessor &styler, Sci_Position pos) {
|
||||
char ch, ch2;
|
||||
ch = styler.SafeGetCharAt(pos, '\0');
|
||||
ch2 = styler.SafeGetCharAt(pos+1, '\0');
|
||||
@ -179,10 +179,10 @@ static int scanNumber(Accessor &styler, int pos) {
|
||||
/* rewritten from scratch, because I couldn't get rid of the bugs...
|
||||
(A character based approach sucks!)
|
||||
*/
|
||||
static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseNimrodDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
int pos = startPos;
|
||||
int max = startPos + length;
|
||||
Sci_Position pos = startPos;
|
||||
Sci_Position max = startPos + length;
|
||||
char ch;
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
@ -264,10 +264,10 @@ static void ColouriseNimrodDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eol_pos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eol_pos; i++) {
|
||||
char ch = styler[i];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
@ -277,18 +277,18 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsQuoteLine(int line, Accessor &styler) {
|
||||
static bool IsQuoteLine(Sci_Position line, Accessor &styler) {
|
||||
int style = styler.StyleAt(styler.LineStart(line)) & 31;
|
||||
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
|
||||
}
|
||||
|
||||
|
||||
static void FoldNimrodDoc(unsigned int startPos, int length,
|
||||
static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length,
|
||||
int /*initStyle - unused*/,
|
||||
WordList *[], Accessor &styler) {
|
||||
const int maxPos = startPos + length;
|
||||
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
|
||||
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||
const Sci_Position maxPos = startPos + length;
|
||||
const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
|
||||
const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
|
||||
const bool foldComment = styler.GetPropertyInt("fold.comment.nimrod") != 0;
|
||||
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.nimrod") != 0;
|
||||
|
||||
@ -297,7 +297,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,
|
||||
// and so we can fix any preceding fold level (which is why we go back
|
||||
// at least one line in all cases)
|
||||
int spaceFlags = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
|
||||
while (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
@ -328,7 +328,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,
|
||||
|
||||
// Gather info
|
||||
int lev = indentCurrent;
|
||||
int lineNext = lineCurrent + 1;
|
||||
Sci_Position lineNext = lineCurrent + 1;
|
||||
int indentNext = indentCurrent;
|
||||
int quote = false;
|
||||
if (lineNext <= docLines) {
|
||||
@ -388,7 +388,7 @@ static void FoldNimrodDoc(unsigned int startPos, int length,
|
||||
// which is indented more than the line after the end of
|
||||
// the comment-block, use the level of the block before
|
||||
|
||||
int skipLine = lineNext;
|
||||
Sci_Position skipLine = lineNext;
|
||||
int skipLevel = levelAfterComments;
|
||||
|
||||
while (--skipLine > lineCurrent) {
|
||||
|
@ -69,10 +69,10 @@ static bool isNsisLetter(char ch)
|
||||
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
|
||||
}
|
||||
|
||||
static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
|
||||
static bool NsisNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler)
|
||||
{
|
||||
int nNextLine = -1;
|
||||
for( unsigned int i = start; i < end; i++ )
|
||||
Sci_Position nNextLine = -1;
|
||||
for( Sci_PositionU i = start; i < end; i++ )
|
||||
{
|
||||
char cNext = styler.SafeGetCharAt( i );
|
||||
if( cNext == '\n' )
|
||||
@ -85,7 +85,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &
|
||||
if( nNextLine == -1 ) // We never found the next line...
|
||||
return false;
|
||||
|
||||
for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ )
|
||||
for( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ )
|
||||
{
|
||||
char cNext = styler.SafeGetCharAt( firstChar );
|
||||
if( cNext == ' ' )
|
||||
@ -111,7 +111,7 @@ static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase )
|
||||
return strcmp( s1, s2 );
|
||||
}
|
||||
|
||||
static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd )
|
||||
static int calculateFoldNsis(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd )
|
||||
{
|
||||
int style = styler.StyleAt(end);
|
||||
|
||||
@ -143,7 +143,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
|
||||
|
||||
char s[20]; // The key word we are looking for has atmost 13 characters
|
||||
s[0] = '\0';
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 19; i++)
|
||||
for (Sci_PositionU i = 0; i < end - start + 1 && i < 19; i++)
|
||||
{
|
||||
s[i] = static_cast<char>( styler[ start + i ] );
|
||||
s[i + 1] = '\0';
|
||||
@ -169,7 +169,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
|
||||
return newFoldlevel;
|
||||
}
|
||||
|
||||
static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler )
|
||||
static int classifyWordNsis(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler )
|
||||
{
|
||||
bool bIgnoreCase = false;
|
||||
if( styler.GetPropertyInt("nsis.ignorecase") == 1 )
|
||||
@ -188,7 +188,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
|
||||
WordList &Lables = *keywordLists[2];
|
||||
WordList &UserDefined = *keywordLists[3];
|
||||
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 99; i++)
|
||||
for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++)
|
||||
{
|
||||
if( bIgnoreCase )
|
||||
s[i] = static_cast<char>( tolower(styler[ start + i ] ) );
|
||||
@ -247,7 +247,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
|
||||
if( s[0] == '$' && bUserVars )
|
||||
{
|
||||
bool bHasSimpleNsisChars = true;
|
||||
for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
|
||||
for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++)
|
||||
{
|
||||
if( !isNsisChar( s[j] ) )
|
||||
{
|
||||
@ -264,7 +264,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
|
||||
if( isNsisNumber( s[0] ) )
|
||||
{
|
||||
bool bHasSimpleNsisNumber = true;
|
||||
for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
|
||||
for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++)
|
||||
{
|
||||
if( !isNsisNumber( s[j] ) )
|
||||
{
|
||||
@ -280,7 +280,7 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
|
||||
return SCE_NSIS_DEFAULT;
|
||||
}
|
||||
|
||||
static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
|
||||
static void ColouriseNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
|
||||
{
|
||||
int state = SCE_NSIS_DEFAULT;
|
||||
if( startPos > 0 )
|
||||
@ -289,14 +289,14 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
|
||||
styler.StartAt( startPos );
|
||||
styler.GetLine( startPos );
|
||||
|
||||
unsigned int nLengthDoc = startPos + length;
|
||||
Sci_PositionU nLengthDoc = startPos + length;
|
||||
styler.StartSegment( startPos );
|
||||
|
||||
char cCurrChar;
|
||||
bool bVarInString = false;
|
||||
bool bClassicVarInString = false;
|
||||
|
||||
unsigned int i;
|
||||
Sci_PositionU i;
|
||||
for( i = startPos; i < nLengthDoc; i++ )
|
||||
{
|
||||
cCurrChar = styler.SafeGetCharAt( i );
|
||||
@ -403,8 +403,8 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
|
||||
|
||||
if( cNextChar == '\r' || cNextChar == '\n' )
|
||||
{
|
||||
int nCurLine = styler.GetLine(i+1);
|
||||
int nBack = i;
|
||||
Sci_Position nCurLine = styler.GetLine(i+1);
|
||||
Sci_Position nBack = i;
|
||||
// We need to check if the previous line has a \ in it...
|
||||
bool bNextLine = false;
|
||||
|
||||
@ -552,7 +552,7 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
|
||||
styler.ColourTo(nLengthDoc-1,state);
|
||||
}
|
||||
|
||||
static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
static void FoldNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
// No folding enabled, no reason to continue...
|
||||
if( styler.GetPropertyInt("fold") == 0 )
|
||||
@ -562,11 +562,11 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac
|
||||
bool foldUtilityCmd = styler.GetPropertyInt("nsis.foldutilcmd", 1) == 1;
|
||||
bool blockComment = false;
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
unsigned int safeStartPos = styler.LineStart( lineCurrent );
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
Sci_PositionU safeStartPos = styler.LineStart( lineCurrent );
|
||||
|
||||
bool bArg1 = true;
|
||||
int nWordStart = -1;
|
||||
Sci_Position nWordStart = -1;
|
||||
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
@ -580,7 +580,7 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac
|
||||
blockComment = true;
|
||||
}
|
||||
|
||||
for (unsigned int i = safeStartPos; i < startPos + length; i++)
|
||||
for (Sci_PositionU i = safeStartPos; i < startPos + length; i++)
|
||||
{
|
||||
char chCurr = styler.SafeGetCharAt(i);
|
||||
style = styler.StyleAt(i);
|
||||
|
40
src/stc/scintilla/lexers/LexNull.cxx
Normal file
40
src/stc/scintilla/lexers/LexNull.cxx
Normal file
@ -0,0 +1,40 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexNull.cxx
|
||||
** Lexer for no language. Used for plain text and unrecognized files.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColouriseNullDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
// Null language means all style bytes are 0 so just mark the end - no need to fill in.
|
||||
if (length > 0) {
|
||||
styler.StartAt(startPos + length - 1);
|
||||
styler.StartSegment(startPos + length - 1);
|
||||
styler.ColourTo(startPos + length - 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
|
@ -183,7 +183,7 @@ public:
|
||||
// ------------------------------------------------
|
||||
// Function colourising an excerpt of OScript code.
|
||||
|
||||
static void ColouriseOScriptDoc(unsigned int startPos, int length,
|
||||
static void ColouriseOScriptDoc(Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
// I wonder how whole-line styles ended by EOLN can escape the resetting
|
||||
@ -205,12 +205,12 @@ static void ColouriseOScriptDoc(unsigned int startPos, int length,
|
||||
bool isFirstToken = true;
|
||||
// It starts with true at the beginning of a line and changes to false as
|
||||
// soon as the first identifier on the line is passed by.
|
||||
bool isFirstIdentifier = true;
|
||||
bool isFirstIdentifier = true;
|
||||
// It becomes false when #ifdef DOC (the preprocessor directive often
|
||||
// used to start a documentation comment) is encountered and remain false
|
||||
// until the end of the documentation block is not detected. This is done
|
||||
// by checking for the complementary #endif preprocessor directive.
|
||||
bool endDocComment = false;
|
||||
bool endDocComment = false;
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
@ -374,10 +374,10 @@ static inline bool IsBlockComment(int style) {
|
||||
return style == SCE_OSCRIPT_BLOCK_COMMENT;
|
||||
}
|
||||
|
||||
static bool IsLineComment(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eolPos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eolPos; i++) {
|
||||
static bool IsLineComment(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eolPos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eolPos; i++) {
|
||||
char ch = styler[i];
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styler.StyleAt(i);
|
||||
@ -395,9 +395,9 @@ static inline bool IsPreprocessor(int style) {
|
||||
style == SCE_OSCRIPT_DOC_COMMENT;
|
||||
}
|
||||
|
||||
static void GetRangeLowered(unsigned int start, unsigned int end,
|
||||
Accessor &styler, char *s, unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
static void GetRangeLowered(Sci_PositionU start, Sci_PositionU end,
|
||||
Accessor &styler, char *s, Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while (i < end - start + 1 && i < len - 1) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
i++;
|
||||
@ -405,9 +405,9 @@ static void GetRangeLowered(unsigned int start, unsigned int end,
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static void GetForwardWordLowered(unsigned int start, Accessor &styler,
|
||||
char *s, unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
static void GetForwardWordLowered(Sci_PositionU start, Accessor &styler,
|
||||
char *s, Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while (i < len - 1 && IsAlpha(styler.SafeGetCharAt(start + i))) {
|
||||
s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i)));
|
||||
i++;
|
||||
@ -416,7 +416,7 @@ static void GetForwardWordLowered(unsigned int start, Accessor &styler,
|
||||
}
|
||||
|
||||
static void UpdatePreprocessorFoldLevel(int &levelCurrent,
|
||||
unsigned int startPos, Accessor &styler) {
|
||||
Sci_PositionU startPos, Accessor &styler) {
|
||||
char s[7]; // Size of the longest possible keyword + null.
|
||||
GetForwardWordLowered(startPos, styler, s, sizeof(s));
|
||||
|
||||
@ -431,8 +431,8 @@ static void UpdatePreprocessorFoldLevel(int &levelCurrent,
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateKeywordFoldLevel(int &levelCurrent, unsigned int lastStart,
|
||||
unsigned int currentPos, Accessor &styler) {
|
||||
static void UpdateKeywordFoldLevel(int &levelCurrent, Sci_PositionU lastStart,
|
||||
Sci_PositionU currentPos, Accessor &styler) {
|
||||
char s[9];
|
||||
GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s));
|
||||
|
||||
@ -451,14 +451,14 @@ static void UpdateKeywordFoldLevel(int &levelCurrent, unsigned int lastStart,
|
||||
// ------------------------------
|
||||
// Function folding OScript code.
|
||||
|
||||
static void FoldOScriptDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldOScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
int endPos = startPos + length;
|
||||
Sci_Position endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
@ -466,7 +466,7 @@ static void FoldOScriptDoc(unsigned int startPos, int length, int initStyle,
|
||||
int style = initStyle;
|
||||
int lastStart = 0;
|
||||
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -26,9 +26,9 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
|
||||
inline static void getRange( Sci_PositionU start, Sci_PositionU end, Accessor & styler, char * s, Sci_PositionU len )
|
||||
{
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
while( ( i < end - start + 1 ) && ( i < len - 1 ) )
|
||||
{
|
||||
s[i] = static_cast<char>( styler[ start + i ] );
|
||||
@ -37,7 +37,7 @@ inline static void getRange( unsigned int start, unsigned int end, Accessor & st
|
||||
s[ i ] = '\0';
|
||||
}
|
||||
|
||||
inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
|
||||
inline bool HandleString( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
|
||||
{
|
||||
char ch;
|
||||
|
||||
@ -92,7 +92,7 @@ inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accesso
|
||||
}
|
||||
}
|
||||
|
||||
inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
|
||||
inline bool HandleCommentBlock( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail )
|
||||
{
|
||||
char ch;
|
||||
|
||||
@ -155,7 +155,7 @@ inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, A
|
||||
}
|
||||
}
|
||||
|
||||
inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
|
||||
inline bool HandleCommentLine( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail )
|
||||
{
|
||||
char ch;
|
||||
|
||||
@ -240,7 +240,7 @@ inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Ac
|
||||
}
|
||||
}
|
||||
|
||||
inline bool HandlePar( unsigned int & cur, Accessor & styler )
|
||||
inline bool HandlePar( Sci_PositionU & cur, Accessor & styler )
|
||||
{
|
||||
styler.ColourTo( cur, SCE_OPAL_PAR );
|
||||
|
||||
@ -250,7 +250,7 @@ inline bool HandlePar( unsigned int & cur, Accessor & styler )
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
|
||||
inline bool HandleSpace( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
|
||||
{
|
||||
char ch;
|
||||
|
||||
@ -281,7 +281,7 @@ inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor
|
||||
}
|
||||
}
|
||||
|
||||
inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
|
||||
inline bool HandleInteger( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
|
||||
{
|
||||
char ch;
|
||||
|
||||
@ -304,10 +304,10 @@ inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Access
|
||||
}
|
||||
}
|
||||
|
||||
inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] )
|
||||
inline bool HandleWord( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, WordList * keywordlists[] )
|
||||
{
|
||||
char ch;
|
||||
const unsigned int beg = cur;
|
||||
const Sci_PositionU beg = cur;
|
||||
|
||||
cur++;
|
||||
for( ; ; )
|
||||
@ -323,7 +323,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor
|
||||
}
|
||||
}
|
||||
|
||||
const int ide_len = cur - beg + 1;
|
||||
const Sci_Position ide_len = cur - beg + 1;
|
||||
char * ide = new char[ ide_len ];
|
||||
getRange( beg, cur, styler, ide, ide_len );
|
||||
|
||||
@ -393,7 +393,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor
|
||||
|
||||
}
|
||||
|
||||
inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
|
||||
inline bool HandleSkip( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler )
|
||||
{
|
||||
cur++;
|
||||
styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
|
||||
@ -408,13 +408,13 @@ inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor & styler )
|
||||
static void ColouriseOpalDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor & styler )
|
||||
{
|
||||
styler.StartAt( startPos );
|
||||
styler.StartSegment( startPos );
|
||||
|
||||
unsigned int & cur = startPos;
|
||||
const unsigned int one_too_much = startPos + length;
|
||||
Sci_PositionU & cur = startPos;
|
||||
const Sci_PositionU one_too_much = startPos + length;
|
||||
|
||||
int state = initStyle;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -70,10 +70,10 @@ static inline bool IsAWordStart(const int ch)
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
|
||||
static bool MatchUpperCase(Accessor &styler, Sci_Position pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
|
||||
{
|
||||
char ch;
|
||||
for (int i=0; *s; i++)
|
||||
for (Sci_Position i=0; *s; i++)
|
||||
{
|
||||
ch=styler.SafeGetCharAt(pos+i);
|
||||
if (ch > 0x60) ch -= '\x20';
|
||||
@ -83,7 +83,7 @@ bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ColourisePBDoc(unsigned int startPos, int length, int initStyle,WordList *keywordlists[],Accessor &styler) {
|
||||
static void ColourisePBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,WordList *keywordlists[],Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
@ -185,14 +185,14 @@ static void ColourisePBDoc(unsigned int startPos, int length, int initStyle,Word
|
||||
//GFA Basic which is dead now. After testing the feature of toggling FOR-NEXT loops, WHILE-WEND loops
|
||||
//and so on too I found this is more disturbing then helping (for me). So if You think in another way
|
||||
//you can (or must) write Your own toggling routine ;-)
|
||||
static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
static void FoldPBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
// No folding enabled, no reason to continue...
|
||||
if( styler.GetPropertyInt("fold") == 0 )
|
||||
return;
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -202,7 +202,7 @@ static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Acce
|
||||
bool fNewLine=true;
|
||||
bool fMightBeMultiLineMacro=false;
|
||||
bool fBeginOfCommentFound=false;
|
||||
for (unsigned int i = startPos; i < endPos; i++)
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -354,7 +354,7 @@ static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Acce
|
||||
break;
|
||||
}
|
||||
} //switch (ch)
|
||||
} //for (unsigned int i = startPos; i < endPos; i++)
|
||||
} //for (Sci_PositionU i = startPos; i < endPos; i++)
|
||||
}
|
||||
|
||||
static const char * const pbWordListDesc[] = {
|
||||
|
@ -24,12 +24,12 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void GetRange(unsigned int start,
|
||||
unsigned int end,
|
||||
static void GetRange(Sci_PositionU start,
|
||||
Sci_PositionU end,
|
||||
Accessor &styler,
|
||||
char *s,
|
||||
unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while ((i < end - start + 1) && (i < len-1)) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
i++;
|
||||
@ -37,19 +37,19 @@ static void GetRange(unsigned int start,
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static void ColourisePlmDoc(unsigned int startPos,
|
||||
int length,
|
||||
static void ColourisePlmDoc(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler)
|
||||
{
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int state = initStyle;
|
||||
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = styler.SafeGetCharAt(i);
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -99,7 +99,7 @@ static void ColourisePlmDoc(unsigned int startPos,
|
||||
if (!isdigit(ch) && !isalpha(ch) && ch != '$') {
|
||||
// Get the entire identifier.
|
||||
char word[1024];
|
||||
int segmentStart = styler.GetStartSegment();
|
||||
Sci_Position segmentStart = styler.GetStartSegment();
|
||||
GetRange(segmentStart, i - 1, styler, word, sizeof(word));
|
||||
|
||||
i--;
|
||||
@ -125,25 +125,25 @@ static void ColourisePlmDoc(unsigned int startPos,
|
||||
styler.ColourTo(endPos - 1, state);
|
||||
}
|
||||
|
||||
static void FoldPlmDoc(unsigned int startPos,
|
||||
int length,
|
||||
static void FoldPlmDoc(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *[],
|
||||
Accessor &styler)
|
||||
{
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
int startKeyword = 0;
|
||||
Sci_Position startKeyword = 0;
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -35,13 +35,13 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ColourisePODoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
|
||||
static void ColourisePODoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) {
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
bool escaped = false;
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
// the line state holds the last state on or before the line that isn't the default style
|
||||
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT;
|
||||
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
// whether we should leave a state
|
||||
switch (sc.state) {
|
||||
@ -57,19 +57,19 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
// on its own like a keyword rather than changing the whole flags style
|
||||
sc.ChangeState(SCE_PO_FUZZY);
|
||||
break;
|
||||
|
||||
|
||||
case SCE_PO_MSGCTXT:
|
||||
case SCE_PO_MSGID:
|
||||
case SCE_PO_MSGSTR:
|
||||
if (isspacechar(sc.ch))
|
||||
sc.SetState(SCE_PO_DEFAULT);
|
||||
break;
|
||||
|
||||
|
||||
case SCE_PO_ERROR:
|
||||
if (sc.atLineEnd)
|
||||
sc.SetState(SCE_PO_DEFAULT);
|
||||
break;
|
||||
|
||||
|
||||
case SCE_PO_MSGCTXT_TEXT:
|
||||
case SCE_PO_MSGID_TEXT:
|
||||
case SCE_PO_MSGSTR_TEXT:
|
||||
@ -92,7 +92,7 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// whether we should enter a new state
|
||||
if (sc.state == SCE_PO_DEFAULT) {
|
||||
// forward to the first non-white character on the line
|
||||
@ -103,11 +103,11 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
// and anyway the styling don't use line state for comments
|
||||
if (curLineState == SCE_PO_COMMENT)
|
||||
curLineState = SCE_PO_DEFAULT;
|
||||
|
||||
|
||||
while (sc.More() && ! sc.atLineEnd && isspacechar(sc.ch))
|
||||
sc.Forward();
|
||||
}
|
||||
|
||||
|
||||
if (atLineStart && sc.ch == '#') {
|
||||
if (sc.chNext == '.')
|
||||
sc.SetState(SCE_PO_PROGRAMMER_COMMENT);
|
||||
@ -134,11 +134,11 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
sc.SetState(SCE_PO_ERROR);
|
||||
} else if (! isspacechar(sc.ch))
|
||||
sc.SetState(SCE_PO_ERROR);
|
||||
|
||||
|
||||
if (sc.state != SCE_PO_DEFAULT)
|
||||
curLineState = sc.state;
|
||||
}
|
||||
|
||||
|
||||
if (sc.atLineEnd) {
|
||||
// Update the line state, so it can be seen by next line
|
||||
curLine = styler.GetLine(sc.currentPos);
|
||||
@ -148,9 +148,9 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static int FindNextNonEmptyLineState(unsigned int startPos, Accessor &styler) {
|
||||
unsigned int length = styler.Length();
|
||||
for (unsigned int i = startPos; i < length; i++) {
|
||||
static int FindNextNonEmptyLineState(Sci_PositionU startPos, Accessor &styler) {
|
||||
Sci_PositionU length = styler.Length();
|
||||
for (Sci_PositionU i = startPos; i < length; i++) {
|
||||
if (! isspacechar(styler[i])) {
|
||||
return styler.GetLineState(styler.GetLine(i));
|
||||
}
|
||||
@ -158,31 +158,31 @@ static int FindNextNonEmptyLineState(unsigned int startPos, Accessor &styler) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
static void FoldPODoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
if (! styler.GetPropertyInt("fold"))
|
||||
return;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact") != 0;
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
int curLine = styler.GetLine(startPos);
|
||||
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
int lineState = styler.GetLineState(curLine);
|
||||
int nextLineState;
|
||||
int level = styler.LevelAt(curLine) & SC_FOLDLEVELNUMBERMASK;
|
||||
int nextLevel;
|
||||
int visible = 0;
|
||||
int chNext = styler[startPos];
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
int ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i+1);
|
||||
|
||||
|
||||
if (! isspacechar(ch)) {
|
||||
visible++;
|
||||
} else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) {
|
||||
int lvl = level;
|
||||
int nextLine = curLine + 1;
|
||||
|
||||
Sci_Position nextLine = curLine + 1;
|
||||
|
||||
nextLineState = styler.GetLineState(nextLine);
|
||||
if ((lineState != SCE_PO_COMMENT || foldComment) &&
|
||||
nextLineState == lineState &&
|
||||
@ -190,14 +190,14 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
|
||||
nextLevel = SC_FOLDLEVELBASE + 1;
|
||||
else
|
||||
nextLevel = SC_FOLDLEVELBASE;
|
||||
|
||||
|
||||
if (nextLevel > level)
|
||||
lvl |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (visible == 0 && foldCompact)
|
||||
lvl |= SC_FOLDLEVELWHITEFLAG;
|
||||
|
||||
|
||||
styler.SetLevel(curLine, lvl);
|
||||
|
||||
|
||||
lineState = nextLineState;
|
||||
curLine = nextLine;
|
||||
level = nextLevel;
|
||||
|
@ -53,8 +53,8 @@ static inline bool IsANumberChar(int ch) {
|
||||
}
|
||||
|
||||
static void ColourisePovDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -68,7 +68,7 @@ static void ColourisePovDoc(
|
||||
WordList &keywords7 = *keywordlists[6];
|
||||
WordList &keywords8 = *keywordlists[7];
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
// Initialize the block comment /* */ nesting level, if we are inside such a comment.
|
||||
int blockCommentLevel = 0;
|
||||
if (initStyle == SCE_POV_COMMENT) {
|
||||
@ -226,8 +226,8 @@ static void ColourisePovDoc(
|
||||
}
|
||||
|
||||
static void FoldPovDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *[],
|
||||
Accessor &styler) {
|
||||
@ -235,15 +235,15 @@ static void FoldPovDoc(
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldDirective = styler.GetPropertyInt("fold.directive") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -270,7 +270,7 @@ static void FoldPovDoc(
|
||||
}
|
||||
if (foldDirective && (style == SCE_POV_DIRECTIVE)) {
|
||||
if (ch == '#') {
|
||||
unsigned int j=i+1;
|
||||
Sci_PositionU j=i+1;
|
||||
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
|
@ -64,8 +64,8 @@ static inline bool IsABase85Char(const int ch) {
|
||||
}
|
||||
|
||||
static void ColourisePSDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
@ -79,7 +79,7 @@ static void ColourisePSDoc(
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
int pslevel = styler.GetPropertyInt("ps.level", 3);
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int nestTextCurrent = 0;
|
||||
if (lineCurrent > 0 && initStyle == SCE_PS_TEXT)
|
||||
nestTextCurrent = styler.GetLineState(lineCurrent - 1);
|
||||
@ -266,13 +266,13 @@ static void ColourisePSDoc(
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
static void FoldPSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -280,7 +280,7 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -132,12 +132,12 @@ contains requires
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void GetRangeLowered(unsigned int start,
|
||||
unsigned int end,
|
||||
static void GetRangeLowered(Sci_PositionU start,
|
||||
Sci_PositionU end,
|
||||
Accessor &styler,
|
||||
char *s,
|
||||
unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while ((i < end - start + 1) && (i < len-1)) {
|
||||
s[i] = static_cast<char>(tolower(styler[start + i]));
|
||||
i++;
|
||||
@ -145,12 +145,12 @@ static void GetRangeLowered(unsigned int start,
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static void GetForwardRangeLowered(unsigned int start,
|
||||
static void GetForwardRangeLowered(Sci_PositionU start,
|
||||
CharacterSet &charSet,
|
||||
Accessor &styler,
|
||||
char *s,
|
||||
unsigned int len) {
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU len) {
|
||||
Sci_PositionU i = 0;
|
||||
while ((i < len-1) && charSet.Contains(styler.SafeGetCharAt(start + i))) {
|
||||
s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i)));
|
||||
i++;
|
||||
@ -214,7 +214,7 @@ static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &
|
||||
sc.SetState(SCE_PAS_DEFAULT);
|
||||
}
|
||||
|
||||
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
bool bSmartHighlighting = styler.GetPropertyInt("lexer.pascal.smart.highlighting", 1) != 0;
|
||||
|
||||
@ -224,7 +224,7 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
|
||||
CharacterSet setHexNumber(CharacterSet::setDigits, "abcdefABCDEF");
|
||||
CharacterSet setOperator(CharacterSet::setNone, "#$&'()*+,-./:;<=>@[]^{}");
|
||||
|
||||
int curLine = styler.GetLine(startPos);
|
||||
Sci_Position curLine = styler.GetLine(startPos);
|
||||
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
@ -347,10 +347,10 @@ static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_PAS_COMMENT || style == SCE_PAS_COMMENT2;
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eolPos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eolPos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eolPos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eolPos; i++) {
|
||||
char ch = styler[i];
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styler.StyleAt(i);
|
||||
@ -373,7 +373,7 @@ static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned i
|
||||
}
|
||||
|
||||
static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
|
||||
unsigned int startPos, Accessor &styler) {
|
||||
Sci_PositionU startPos, Accessor &styler) {
|
||||
CharacterSet setWord(CharacterSet::setAlpha);
|
||||
|
||||
char s[11]; // Size of the longest possible keyword + one additional character + null
|
||||
@ -405,10 +405,10 @@ static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFold
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
|
||||
static Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endPos,
|
||||
Accessor &styler, bool includeChars = false) {
|
||||
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
|
||||
unsigned int j = currentPos + 1;
|
||||
Sci_PositionU j = currentPos + 1;
|
||||
char ch = styler.SafeGetCharAt(j);
|
||||
while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
|
||||
IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) {
|
||||
@ -419,8 +419,8 @@ static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
|
||||
}
|
||||
|
||||
static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
|
||||
int startPos, unsigned int endPos,
|
||||
unsigned int lastStart, unsigned int currentPos, Accessor &styler) {
|
||||
Sci_Position startPos, Sci_PositionU endPos,
|
||||
Sci_PositionU lastStart, Sci_PositionU currentPos, Accessor &styler) {
|
||||
char s[100];
|
||||
GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s));
|
||||
|
||||
@ -435,7 +435,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
|
||||
} else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) {
|
||||
// "class" & "object" keywords require special handling...
|
||||
bool ignoreKeyword = false;
|
||||
unsigned int j = SkipWhiteSpace(currentPos, endPos, styler);
|
||||
Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler);
|
||||
if (j < endPos) {
|
||||
CharacterSet setWordStart(CharacterSet::setAlpha, "_");
|
||||
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
|
||||
@ -476,7 +476,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
|
||||
} else if (strcmp(s, "interface") == 0) {
|
||||
// "interface" keyword requires special handling...
|
||||
bool ignoreKeyword = true;
|
||||
int j = lastStart - 1;
|
||||
Sci_Position j = lastStart - 1;
|
||||
char ch = styler.SafeGetCharAt(j);
|
||||
while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' ||
|
||||
IsStreamCommentStyle(styler.StyleAt(j)))) {
|
||||
@ -487,7 +487,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
|
||||
ignoreKeyword = false;
|
||||
}
|
||||
if (!ignoreKeyword) {
|
||||
unsigned int k = SkipWhiteSpace(currentPos, endPos, styler);
|
||||
Sci_PositionU k = SkipWhiteSpace(currentPos, endPos, styler);
|
||||
if (k < endPos && styler.SafeGetCharAt(k) == ';') {
|
||||
// Handle forward interface declarations ("type IMyInterface = interface;")
|
||||
ignoreKeyword = true;
|
||||
@ -499,7 +499,7 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
|
||||
} else if (strcmp(s, "dispinterface") == 0) {
|
||||
// "dispinterface" keyword requires special handling...
|
||||
bool ignoreKeyword = false;
|
||||
unsigned int j = SkipWhiteSpace(currentPos, endPos, styler);
|
||||
Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler);
|
||||
if (j < endPos && styler.SafeGetCharAt(j) == ';') {
|
||||
// Handle forward dispinterface declarations ("type IMyInterface = dispinterface;")
|
||||
ignoreKeyword = true;
|
||||
@ -516,14 +516,14 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
||||
static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
int lineFoldStateCurrent = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) & stateFoldMaskAll : 0;
|
||||
@ -531,10 +531,10 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
|
||||
int lastStart = 0;
|
||||
Sci_Position lastStart = 0;
|
||||
CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -52,10 +52,10 @@ using namespace Scintilla;
|
||||
|
||||
#define HERE_DELIM_MAX 256 // maximum length of HERE doc delimiter
|
||||
|
||||
#define PERLNUM_BINARY 1 // order is significant: 1-4 cannot have a dot
|
||||
#define PERLNUM_HEX 2
|
||||
#define PERLNUM_OCTAL 3
|
||||
#define PERLNUM_FLOAT_EXP 4 // exponent part only
|
||||
#define PERLNUM_BINARY 1 // order is significant: 1-3 cannot have a dot
|
||||
#define PERLNUM_OCTAL 2
|
||||
#define PERLNUM_FLOAT_EXP 3 // exponent part only
|
||||
#define PERLNUM_HEX 4 // may be a hex float
|
||||
#define PERLNUM_DECIMAL 5 // 1-5 are numbers; 6-7 are strings
|
||||
#define PERLNUM_VECTOR 6
|
||||
#define PERLNUM_V_VECTOR 7
|
||||
@ -65,23 +65,29 @@ using namespace Scintilla;
|
||||
#define BACK_OPERATOR 1 // whitespace/comments are insignificant
|
||||
#define BACK_KEYWORD 2 // operators/keywords are needed for disambiguation
|
||||
|
||||
#define SUB_BEGIN 0 // states for subroutine prototype scan:
|
||||
#define SUB_HAS_PROTO 1 // only 'prototype' attribute allows prototypes
|
||||
#define SUB_HAS_ATTRIB 2 // other attributes can exist leftward
|
||||
#define SUB_HAS_MODULE 3 // sub name can have a ::identifier part
|
||||
#define SUB_HAS_SUB 4 // 'sub' keyword
|
||||
|
||||
// all interpolated styles are different from their parent styles by a constant difference
|
||||
// we also assume SCE_PL_STRING_VAR is the interpolated style with the smallest value
|
||||
#define INTERPOLATE_SHIFT (SCE_PL_STRING_VAR - SCE_PL_STRING)
|
||||
|
||||
static bool isPerlKeyword(unsigned int start, unsigned int end, WordList &keywords, LexAccessor &styler) {
|
||||
static bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keywords, LexAccessor &styler) {
|
||||
// old-style keyword matcher; needed because GetCurrent() needs
|
||||
// current segment to be committed, but we may abandon early...
|
||||
char s[100];
|
||||
unsigned int i, len = end - start;
|
||||
Sci_PositionU i, len = end - start;
|
||||
if (len > 30) { len = 30; }
|
||||
for (i = 0; i < len; i++, start++) s[i] = styler[start];
|
||||
s[i] = '\0';
|
||||
return keywords.InList(s);
|
||||
}
|
||||
|
||||
static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned int fw,
|
||||
int backFlag, unsigned int backPos, unsigned int endPos) {
|
||||
static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_PositionU fw,
|
||||
int backFlag, Sci_PositionU backPos, Sci_PositionU endPos) {
|
||||
// identifiers are recognized by Perl as barewords under some
|
||||
// conditions, the following attempts to do the disambiguation
|
||||
// by looking backward and forward; result in 2 LSB
|
||||
@ -93,7 +99,7 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i
|
||||
return result;
|
||||
// first look backwards past whitespace/comments to set EOL flag
|
||||
// (some disambiguation patterns must be on a single line)
|
||||
if (backPos <= static_cast<unsigned int>(styler.LineStart(styler.GetLine(bk))))
|
||||
if (backPos <= static_cast<Sci_PositionU>(styler.LineStart(styler.GetLine(bk))))
|
||||
moreback = true;
|
||||
// look backwards at last significant lexed item for disambiguation
|
||||
bk = backPos - 1;
|
||||
@ -105,9 +111,11 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i
|
||||
// &bareword: subroutine call
|
||||
|| styler.Match(bk - 1, "->")
|
||||
// ->bareword: part of variable spec
|
||||
|| styler.Match(bk - 1, "::")
|
||||
// ::bareword: part of module spec
|
||||
|| styler.Match(bk - 2, "sub")) {
|
||||
// sub bareword: subroutine declaration
|
||||
// (implied BACK_KEYWORD, no keywords end in 'sub'!)
|
||||
// sub bareword: subroutine declaration
|
||||
// (implied BACK_KEYWORD, no keywords end in 'sub'!)
|
||||
result |= 1;
|
||||
}
|
||||
// next, scan forward after word past tab/spaces only;
|
||||
@ -121,14 +129,14 @@ static int disambiguateBareword(LexAccessor &styler, unsigned int bk, unsigned i
|
||||
if ((ch == '}' && brace)
|
||||
// {bareword}: variable spec
|
||||
|| styler.Match(fw, "=>")) {
|
||||
// [{(, bareword=>: hash literal
|
||||
// [{(, bareword=>: hash literal
|
||||
result |= 2;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void skipWhitespaceComment(LexAccessor &styler, unsigned int &p) {
|
||||
static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) {
|
||||
// when backtracking, we need to skip whitespace and comments
|
||||
int style;
|
||||
while ((p > 0) && (style = styler.StyleAt(p),
|
||||
@ -136,7 +144,23 @@ static void skipWhitespaceComment(LexAccessor &styler, unsigned int &p) {
|
||||
p--;
|
||||
}
|
||||
|
||||
static int styleBeforeBracePair(LexAccessor &styler, unsigned int bk) {
|
||||
static int findPrevLexeme(LexAccessor &styler, Sci_PositionU &bk, int &style) {
|
||||
// scan backward past whitespace and comments to find a lexeme
|
||||
skipWhitespaceComment(styler, bk);
|
||||
if (bk == 0)
|
||||
return 0;
|
||||
int sz = 1;
|
||||
style = styler.StyleAt(bk);
|
||||
while (bk > 0) { // find extent of lexeme
|
||||
if (styler.StyleAt(bk - 1) == style) {
|
||||
bk--; sz++;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) {
|
||||
// backtrack to find open '{' corresponding to a '}', balanced
|
||||
// return significant style to be tested for '/' disambiguation
|
||||
int braceCount = 1;
|
||||
@ -163,7 +187,7 @@ static int styleBeforeBracePair(LexAccessor &styler, unsigned int bk) {
|
||||
return SCE_PL_DEFAULT;
|
||||
}
|
||||
|
||||
static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) {
|
||||
static int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) {
|
||||
// backtrack to classify sub-styles of identifier under test
|
||||
// return sub-style to be tested for '/' disambiguation
|
||||
if (styler.SafeGetCharAt(bk) == '>') // inputsymbol, like <foo>
|
||||
@ -188,7 +212,7 @@ static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endPos) {
|
||||
static int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU endPos) {
|
||||
// forward scan the current line to classify line for POD style
|
||||
int state = -1;
|
||||
while (pos < endPos) {
|
||||
@ -212,22 +236,61 @@ static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endP
|
||||
return state;
|
||||
}
|
||||
|
||||
static bool styleCheckSubPrototype(LexAccessor &styler, unsigned int bk) {
|
||||
static bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) {
|
||||
// backtrack to identify if we're starting a subroutine prototype
|
||||
// we also need to ignore whitespace/comments:
|
||||
// 'sub' [whitespace|comment] <identifier> [whitespace|comment]
|
||||
// we also need to ignore whitespace/comments, format is like:
|
||||
// sub abc::pqr :const :prototype(...)
|
||||
// lexemes are tested in pairs, e.g. '::'+'pqr', ':'+'const', etc.
|
||||
// and a state machine generates legal subroutine syntax matches
|
||||
styler.Flush();
|
||||
skipWhitespaceComment(styler, bk);
|
||||
if (bk == 0 || styler.StyleAt(bk) != SCE_PL_IDENTIFIER) // check identifier
|
||||
return false;
|
||||
while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_IDENTIFIER)) {
|
||||
bk--;
|
||||
}
|
||||
skipWhitespaceComment(styler, bk);
|
||||
if (bk < 2 || styler.StyleAt(bk) != SCE_PL_WORD // check "sub" keyword
|
||||
|| !styler.Match(bk - 2, "sub")) // assume suffix is unique!
|
||||
return false;
|
||||
return true;
|
||||
int state = SUB_BEGIN;
|
||||
do {
|
||||
// find two lexemes, lexeme 2 follows lexeme 1
|
||||
int style2 = SCE_PL_DEFAULT;
|
||||
Sci_PositionU pos2 = bk;
|
||||
int len2 = findPrevLexeme(styler, pos2, style2);
|
||||
int style1 = SCE_PL_DEFAULT;
|
||||
Sci_PositionU pos1 = pos2;
|
||||
if (pos1 > 0) pos1--;
|
||||
int len1 = findPrevLexeme(styler, pos1, style1);
|
||||
if (len1 == 0 || len2 == 0) // lexeme pair must exist
|
||||
break;
|
||||
|
||||
// match parts of syntax, if invalid subroutine syntax, break off
|
||||
if (style1 == SCE_PL_OPERATOR && len1 == 1 &&
|
||||
styler.SafeGetCharAt(pos1) == ':') { // ':'
|
||||
if (style2 == SCE_PL_IDENTIFIER || style2 == SCE_PL_WORD) {
|
||||
if (len2 == 9 && styler.Match(pos2, "prototype")) { // ':' 'prototype'
|
||||
if (state == SUB_BEGIN) {
|
||||
state = SUB_HAS_PROTO;
|
||||
} else
|
||||
break;
|
||||
} else { // ':' <attribute>
|
||||
if (state == SUB_HAS_PROTO || state == SUB_HAS_ATTRIB) {
|
||||
state = SUB_HAS_ATTRIB;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
} else
|
||||
break;
|
||||
} else if (style1 == SCE_PL_OPERATOR && len1 == 2 &&
|
||||
styler.Match(pos1, "::")) { // '::'
|
||||
if (style2 == SCE_PL_IDENTIFIER) { // '::' <identifier>
|
||||
state = SUB_HAS_MODULE;
|
||||
} else
|
||||
break;
|
||||
} else if (style1 == SCE_PL_WORD && len1 == 3 &&
|
||||
styler.Match(pos1, "sub")) { // 'sub'
|
||||
if (style2 == SCE_PL_IDENTIFIER) { // 'sub' <identifier>
|
||||
state = SUB_HAS_SUB;
|
||||
} else
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
bk = pos1; // set position for finding next lexeme pair
|
||||
if (bk > 0) bk--;
|
||||
} while (state != SUB_HAS_SUB);
|
||||
return (state == SUB_HAS_SUB);
|
||||
}
|
||||
|
||||
static int actualNumStyle(int numberStyle) {
|
||||
@ -247,10 +310,10 @@ static int opposite(int ch) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, LexAccessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eol_pos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eol_pos; i++) {
|
||||
char ch = styler[i];
|
||||
int style = styler.StyleAt(i);
|
||||
if (ch == '#' && style == SCE_PL_COMMENTLINE)
|
||||
@ -261,8 +324,8 @@ static bool IsCommentLine(int line, LexAccessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsPackageLine(int line, LexAccessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
static bool IsPackageLine(Sci_Position line, LexAccessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
int style = styler.StyleAt(pos);
|
||||
if (style == SCE_PL_WORD && styler.Match(pos, "package")) {
|
||||
return true;
|
||||
@ -270,7 +333,7 @@ static bool IsPackageLine(int line, LexAccessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static int PodHeadingLevel(int pos, LexAccessor &styler) {
|
||||
static int PodHeadingLevel(Sci_Position pos, LexAccessor &styler) {
|
||||
int lvl = static_cast<unsigned char>(styler.SafeGetCharAt(pos + 5));
|
||||
if (lvl >= '1' && lvl <= '4') {
|
||||
return lvl - '0';
|
||||
@ -367,13 +430,13 @@ public:
|
||||
const char *SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osPerl.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char *SCI_METHOD DescribeWordListSets() {
|
||||
return osPerl.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void *SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -386,21 +449,21 @@ public:
|
||||
void InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern=false);
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerPerl::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerPerl::PropertySet(const char *key, const char *val) {
|
||||
if (osPerl.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
wordListN = &keywords;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -515,7 +578,7 @@ void LexerPerl::InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern)
|
||||
sc.SetState(sc.state - INTERPOLATE_SHIFT);
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
// keywords that forces /PATTERN/ at all times; should track vim's behaviour
|
||||
@ -537,7 +600,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
CharacterSet &setPOD = setModifiers;
|
||||
CharacterSet setNonHereDoc(CharacterSet::setDigits, "=$@");
|
||||
CharacterSet setHereDocDelim(CharacterSet::setAlphaNum, "_");
|
||||
CharacterSet setSubPrototype(CharacterSet::setNone, "\\[$@%&*+];");
|
||||
CharacterSet setSubPrototype(CharacterSet::setNone, "\\[$@%&*+];_ \t");
|
||||
CharacterSet setRepetition(CharacterSet::setDigits, ")\"'");
|
||||
// for format identifiers
|
||||
CharacterSet setFormatStart(CharacterSet::setAlpha, "_=");
|
||||
CharacterSet &setFormat = setHereDocDelim;
|
||||
@ -555,13 +619,12 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
int Quote; // the char after '<<'
|
||||
bool Quoted; // true if Quote in ('\'','"','`')
|
||||
int DelimiterLength; // strlen(Delimiter)
|
||||
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
|
||||
char Delimiter[HERE_DELIM_MAX]; // the Delimiter
|
||||
HereDocCls() {
|
||||
State = 0;
|
||||
Quote = 0;
|
||||
Quoted = false;
|
||||
DelimiterLength = 0;
|
||||
Delimiter = new char[HERE_DELIM_MAX];
|
||||
Delimiter[0] = '\0';
|
||||
}
|
||||
void Append(int ch) {
|
||||
@ -569,7 +632,6 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
Delimiter[DelimiterLength] = '\0';
|
||||
}
|
||||
~HereDocCls() {
|
||||
delete []Delimiter;
|
||||
}
|
||||
};
|
||||
HereDocCls HereDoc; // TODO: FIFO for stacked here-docs
|
||||
@ -600,7 +662,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
int numState = PERLNUM_DECIMAL;
|
||||
int dotCount = 0;
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
|
||||
// Backtrack to beginning of style if required...
|
||||
// If in a long distance lexical state, backtrack to find quote characters.
|
||||
@ -663,7 +725,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
|| initStyle == SCE_PL_POD_VERB
|
||||
) {
|
||||
// POD backtracking finds preceding blank lines and goes back past them
|
||||
int ln = styler.GetLine(startPos);
|
||||
Sci_Position ln = styler.GetLine(startPos);
|
||||
if (ln > 0) {
|
||||
initStyle = styler.StyleAt(styler.LineStart(--ln));
|
||||
if (initStyle == SCE_PL_POD || initStyle == SCE_PL_POD_VERB) {
|
||||
@ -682,7 +744,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// Look backwards past whitespace and comments in order to detect either
|
||||
// operator or keyword. Later updated as we go along.
|
||||
int backFlag = BACK_NONE;
|
||||
unsigned int backPos = startPos;
|
||||
Sci_PositionU backPos = startPos;
|
||||
if (backPos > 0) {
|
||||
backPos--;
|
||||
skipWhitespaceComment(styler, backPos);
|
||||
@ -762,6 +824,14 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
break;
|
||||
}
|
||||
// number then dot (go through)
|
||||
} else if (numState == PERLNUM_HEX) {
|
||||
if (dotCount <= 1 && IsADigit(sc.chNext, 16)) {
|
||||
break; // hex with one dot is a hex float
|
||||
} else {
|
||||
sc.SetState(SCE_PL_OPERATOR);
|
||||
break;
|
||||
}
|
||||
// hex then dot (go through)
|
||||
} else if (IsADigit(sc.chNext)) // vectors
|
||||
break;
|
||||
// vector then dot (go through)
|
||||
@ -780,8 +850,15 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
break;
|
||||
// number then word (go through)
|
||||
} else if (numState == PERLNUM_HEX) {
|
||||
if (IsADigit(sc.ch, 16))
|
||||
if (sc.ch == 'P' || sc.ch == 'p') { // hex float exponent, sign
|
||||
numState = PERLNUM_FLOAT_EXP;
|
||||
if (sc.chNext == '+' || sc.chNext == '-') {
|
||||
sc.Forward();
|
||||
}
|
||||
break;
|
||||
} else if (IsADigit(sc.ch, 16))
|
||||
break;
|
||||
// hex or hex float then word (go through)
|
||||
} else if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
|
||||
if (IsADigit(sc.ch)) // vector
|
||||
break;
|
||||
@ -814,7 +891,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
case SCE_PL_HERE_DELIM:
|
||||
if (HereDoc.State == 0) { // '<<' encountered
|
||||
int delim_ch = sc.chNext;
|
||||
int ws_skip = 0;
|
||||
Sci_Position ws_skip = 0;
|
||||
HereDoc.State = 1; // pre-init HERE doc class
|
||||
HereDoc.Quote = sc.chNext;
|
||||
HereDoc.Quoted = false;
|
||||
@ -822,7 +899,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
|
||||
if (IsASpaceOrTab(delim_ch)) {
|
||||
// skip whitespace; legal only for quoted delimiters
|
||||
unsigned int i = sc.currentPos + 1;
|
||||
Sci_PositionU i = sc.currentPos + 1;
|
||||
while ((i < endPos) && IsASpaceOrTab(delim_ch)) {
|
||||
i++;
|
||||
delim_ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
|
||||
@ -929,8 +1006,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
break;
|
||||
case SCE_PL_POD:
|
||||
case SCE_PL_POD_VERB: {
|
||||
unsigned int fw = sc.currentPos;
|
||||
int ln = styler.GetLine(fw);
|
||||
Sci_PositionU fw = sc.currentPos;
|
||||
Sci_Position ln = styler.GetLine(fw);
|
||||
if (sc.atLineStart && sc.Match("=cut")) { // end of POD
|
||||
sc.SetState(SCE_PL_POD);
|
||||
sc.Forward(4);
|
||||
@ -942,7 +1019,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
styler.SetLineState(ln, pod);
|
||||
if (pod == SCE_PL_DEFAULT) {
|
||||
if (sc.state == SCE_PL_POD_VERB) {
|
||||
unsigned int fw2 = fw;
|
||||
Sci_PositionU fw2 = fw;
|
||||
while (fw2 < (endPos - 1) && pod == SCE_PL_DEFAULT) {
|
||||
fw = fw2++; // penultimate line (last blank line)
|
||||
pod = podLineScan(styler, fw2, endPos);
|
||||
@ -1234,8 +1311,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.chPrev == ':' && sc.GetRelative(-2) == ':') {
|
||||
sc.ChangeState(SCE_PL_IDENTIFIER);
|
||||
}
|
||||
unsigned int bk = sc.currentPos;
|
||||
unsigned int fw = sc.currentPos + 1;
|
||||
Sci_PositionU bk = sc.currentPos;
|
||||
Sci_PositionU fw = sc.currentPos + 1;
|
||||
// first check for possible quote-like delimiter
|
||||
if (sc.ch == 's' && !setWord.Contains(sc.chNext)) {
|
||||
sc.ChangeState(SCE_PL_REGSUBST);
|
||||
@ -1265,7 +1342,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
fw++;
|
||||
} else if (sc.ch == 'x' && (sc.chNext == '=' || // repetition
|
||||
!setWord.Contains(sc.chNext) ||
|
||||
(IsADigit(sc.chPrev) && IsADigit(sc.chNext)))) {
|
||||
(setRepetition.Contains(sc.chPrev) && IsADigit(sc.chNext)))) {
|
||||
sc.ChangeState(SCE_PL_OPERATOR);
|
||||
}
|
||||
// if potentially a keyword, scan forward and grab word, then check
|
||||
@ -1341,7 +1418,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
bool preferRE = false;
|
||||
bool isHereDoc = sc.Match('<', '<');
|
||||
bool hereDocSpace = false; // for: SCALAR [whitespace] '<<'
|
||||
unsigned int bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0;
|
||||
Sci_PositionU bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0;
|
||||
sc.Complete();
|
||||
styler.Flush();
|
||||
if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
|
||||
@ -1410,7 +1487,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// keywords always forced as /PATTERN/: split, if, elsif, while
|
||||
// everything else /PATTERN/ unless digit/space immediately after '/'
|
||||
// for '//', defined-or favoured unless special keywords
|
||||
unsigned int bkend = bk + 1;
|
||||
Sci_PositionU bkend = bk + 1;
|
||||
while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) {
|
||||
bk--;
|
||||
}
|
||||
@ -1438,7 +1515,10 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
backFlag = BACK_NONE;
|
||||
if (isHereDoc) { // handle '<<', HERE doc
|
||||
if (preferRE) {
|
||||
if (sc.Match("<<>>")) { // double-diamond operator (5.22)
|
||||
sc.SetState(SCE_PL_OPERATOR);
|
||||
sc.Forward(3);
|
||||
} else if (preferRE) {
|
||||
sc.SetState(SCE_PL_HERE_DELIM);
|
||||
HereDoc.State = 0;
|
||||
} else { // << operator
|
||||
@ -1506,8 +1586,8 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
sc.SetState(SCE_PL_POD);
|
||||
backFlag = BACK_NONE;
|
||||
} else if (sc.ch == '-' && setWordStart.Contains(sc.chNext)) { // extended '-' cases
|
||||
unsigned int bk = sc.currentPos;
|
||||
unsigned int fw = 2;
|
||||
Sci_PositionU bk = sc.currentPos;
|
||||
Sci_PositionU fw = 2;
|
||||
if (setSingleCharOp.Contains(sc.chNext) && // file test operators
|
||||
!setWord.Contains(sc.GetRelative(2))) {
|
||||
sc.SetState(SCE_PL_WORD);
|
||||
@ -1557,16 +1637,16 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
#define PERL_HEADFOLD_SHIFT 4
|
||||
#define PERL_HEADFOLD_MASK 0xF0
|
||||
|
||||
void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerPerl::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
if (startPos > 0) {
|
||||
@ -1586,7 +1666,7 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
|
||||
// Used at end of line to determine if the line was a package definition
|
||||
bool isPackageLine = false;
|
||||
int podHeading = 0;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -57,10 +57,10 @@ static inline bool IsLineEndChar(unsigned char ch) {
|
||||
|| ch == 0x0d; //CR
|
||||
}
|
||||
|
||||
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
|
||||
static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler)
|
||||
{
|
||||
int startPos = styler.LineStart(szLine);
|
||||
int endPos = styler.LineStart(szLine + 1) - 2;
|
||||
Sci_Position startPos = styler.LineStart(szLine);
|
||||
Sci_Position endPos = styler.LineStart(szLine + 1) - 2;
|
||||
while (startPos < endPos)
|
||||
{
|
||||
char stylech = styler.StyleAt(startPos);
|
||||
@ -78,10 +78,10 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
|
||||
|
||||
// Routine to find first none space on the current line and return its Style
|
||||
// needed for comment lines not starting on pos 1
|
||||
static int GetStyleFirstWord(int szLine, Accessor &styler)
|
||||
static int GetStyleFirstWord(Sci_Position szLine, Accessor &styler)
|
||||
{
|
||||
int startPos = styler.LineStart(szLine);
|
||||
int endPos = styler.LineStart(szLine + 1) - 1;
|
||||
Sci_Position startPos = styler.LineStart(szLine);
|
||||
Sci_Position endPos = styler.LineStart(szLine + 1) - 1;
|
||||
char ch = styler.SafeGetCharAt(startPos);
|
||||
|
||||
while (ch > 0 && isspacechar(ch) && startPos < endPos)
|
||||
@ -97,15 +97,15 @@ static int GetStyleFirstWord(int szLine, Accessor &styler)
|
||||
//note:
|
||||
// sample line (without quotes): "\tfunction asdf()
|
||||
// currentPos will be the position of 'a'
|
||||
static bool IsFunction(Accessor &styler, unsigned int currentPos) {
|
||||
static bool IsFunction(Accessor &styler, Sci_PositionU currentPos) {
|
||||
|
||||
const char function[10] = "function "; //10 includes \0
|
||||
unsigned int numberOfCharacters = sizeof(function) - 1;
|
||||
unsigned int position = currentPos - numberOfCharacters;
|
||||
Sci_PositionU position = currentPos - numberOfCharacters;
|
||||
|
||||
//compare each character with the letters in the function array
|
||||
//return false if ALL don't match
|
||||
for (unsigned int i = 0; i < numberOfCharacters; i++) {
|
||||
for (Sci_PositionU i = 0; i < numberOfCharacters; i++) {
|
||||
char c = styler.SafeGetCharAt(position++);
|
||||
if (c != function[i])
|
||||
return false;
|
||||
@ -114,7 +114,7 @@ static bool IsFunction(Accessor &styler, unsigned int currentPos) {
|
||||
//make sure that there are only spaces (or tabs) between the beginning
|
||||
//of the line and the function declaration
|
||||
position = currentPos - numberOfCharacters - 1; //-1 to move to char before 'function'
|
||||
for (unsigned int j = 0; j < 16; j++) { //check up to 16 preceeding characters
|
||||
for (Sci_PositionU j = 0; j < 16; j++) { //check up to 16 preceeding characters
|
||||
char c = styler.SafeGetCharAt(position--, '\0'); //if can't read char, return NUL (past beginning of document)
|
||||
if (c <= 0) //reached beginning of document
|
||||
return true;
|
||||
@ -128,7 +128,7 @@ static bool IsFunction(Accessor &styler, unsigned int currentPos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColourisePowerProDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler, bool caseSensitive) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -360,7 +360,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
static void FoldPowerProDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
//define the character sets
|
||||
CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
|
||||
@ -369,8 +369,8 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]
|
||||
//used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function)
|
||||
bool isFoldingAll = true;
|
||||
|
||||
int endPos = startPos + length;
|
||||
int lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly
|
||||
Sci_Position endPos = startPos + length;
|
||||
Sci_Position lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly
|
||||
|
||||
// get settings from the config files for folding comments and preprocessor lines
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
@ -378,7 +378,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]
|
||||
bool foldCompact = true;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
isFoldingAll = false;
|
||||
if (lineCurrent > 0) {
|
||||
@ -427,7 +427,7 @@ static void FoldPowerProDoc(unsigned int startPos, int length, int, WordList *[]
|
||||
char chPrevPrev = '\0';
|
||||
char chPrevPrevPrev = '\0';
|
||||
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -620,7 +620,7 @@ static const char * const powerProWordLists[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
static void ColourisePowerProDocWrapper(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColourisePowerProDocWrapper(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ static inline bool IsAWordChar(int ch) {
|
||||
return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_';
|
||||
}
|
||||
|
||||
static void ColourisePowerShellDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -158,14 +158,14 @@ static void ColourisePowerShellDoc(unsigned int startPos, int length, int initSt
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -174,7 +174,7 @@ static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle,
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -200,7 +200,7 @@ static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
} else if (foldComment && style == SCE_POWERSHELL_COMMENT) {
|
||||
if (ch == '#') {
|
||||
unsigned int j = i + 1;
|
||||
Sci_PositionU j = i + 1;
|
||||
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ static inline bool IsAWordStart(int ch) {
|
||||
|
||||
enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
|
||||
|
||||
static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords1 = *keywordlists[0]; // regular keywords
|
||||
@ -205,14 +205,14 @@ static bool IsStreamCommentStyle(int style) {
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldNoBox4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -221,7 +221,7 @@ static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle,
|
||||
char chNext = static_cast<char>(tolower(styler[startPos]));
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
|
||||
int stylePrev = style;
|
||||
@ -265,7 +265,7 @@ static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
static void Fold4glDoc(unsigned int startPos, int length, int initStyle, WordList *[],
|
||||
static void Fold4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],
|
||||
Accessor &styler) {
|
||||
FoldNoBox4glDoc(startPos, length, initStyle, styler);
|
||||
}
|
||||
|
189
src/stc/scintilla/lexers/LexProps.cxx
Normal file
189
src/stc/scintilla/lexers/LexProps.cxx
Normal file
@ -0,0 +1,189 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexProps.cxx
|
||||
** Lexer for properties files.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
}
|
||||
|
||||
static inline bool isassignchar(unsigned char ch) {
|
||||
return (ch == '=') || (ch == ':');
|
||||
}
|
||||
|
||||
static void ColourisePropsLine(
|
||||
char *lineBuffer,
|
||||
Sci_PositionU lengthLine,
|
||||
Sci_PositionU startLine,
|
||||
Sci_PositionU endPos,
|
||||
Accessor &styler,
|
||||
bool allowInitialSpaces) {
|
||||
|
||||
Sci_PositionU i = 0;
|
||||
if (allowInitialSpaces) {
|
||||
while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces
|
||||
i++;
|
||||
} else {
|
||||
if (isspacechar(lineBuffer[i])) // don't allow initial spaces
|
||||
i = lengthLine;
|
||||
}
|
||||
|
||||
if (i < lengthLine) {
|
||||
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
|
||||
styler.ColourTo(endPos, SCE_PROPS_COMMENT);
|
||||
} else if (lineBuffer[i] == '[') {
|
||||
styler.ColourTo(endPos, SCE_PROPS_SECTION);
|
||||
} else if (lineBuffer[i] == '@') {
|
||||
styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
|
||||
if (isassignchar(lineBuffer[i++]))
|
||||
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
|
||||
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
|
||||
} else {
|
||||
// Search for the '=' character
|
||||
while ((i < lengthLine) && !isassignchar(lineBuffer[i]))
|
||||
i++;
|
||||
if ((i < lengthLine) && isassignchar(lineBuffer[i])) {
|
||||
styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
|
||||
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
|
||||
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
|
||||
} else {
|
||||
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
Sci_PositionU linePos = 0;
|
||||
Sci_PositionU startLine = startPos;
|
||||
|
||||
// property lexer.props.allow.initial.spaces
|
||||
// For properties files, set to 0 to style all lines that start with whitespace in the default style.
|
||||
// This is not suitable for SciTE .properties files which use indentation for flow control but
|
||||
// can be used for RFC2822 text where indentation is used for continuation lines.
|
||||
bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0;
|
||||
|
||||
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
// End of line (or of line buffer) met, colourise it
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces);
|
||||
linePos = 0;
|
||||
startLine = i + 1;
|
||||
}
|
||||
}
|
||||
if (linePos > 0) { // Last line does not have ending characters
|
||||
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces);
|
||||
}
|
||||
}
|
||||
|
||||
// adaption by ksc, using the "} else {" trick of 1.53
|
||||
// 030721
|
||||
static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
bool headerPoint = false;
|
||||
int lev;
|
||||
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler[i+1];
|
||||
|
||||
int style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
|
||||
if (style == SCE_PROPS_SECTION) {
|
||||
headerPoint = true;
|
||||
}
|
||||
|
||||
if (atEOL) {
|
||||
lev = SC_FOLDLEVELBASE;
|
||||
|
||||
if (lineCurrent > 0) {
|
||||
int levelPrevious = styler.LevelAt(lineCurrent - 1);
|
||||
|
||||
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
|
||||
lev = SC_FOLDLEVELBASE + 1;
|
||||
} else {
|
||||
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
|
||||
}
|
||||
}
|
||||
|
||||
if (headerPoint) {
|
||||
lev = SC_FOLDLEVELBASE;
|
||||
}
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
|
||||
if (headerPoint) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
if (lev != styler.LevelAt(lineCurrent)) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
|
||||
lineCurrent++;
|
||||
visibleChars = 0;
|
||||
headerPoint = false;
|
||||
}
|
||||
if (!isspacechar(ch))
|
||||
visibleChars++;
|
||||
}
|
||||
|
||||
if (lineCurrent > 0) {
|
||||
int levelPrevious = styler.LevelAt(lineCurrent - 1);
|
||||
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
|
||||
lev = SC_FOLDLEVELBASE + 1;
|
||||
} else {
|
||||
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
|
||||
}
|
||||
} else {
|
||||
lev = SC_FOLDLEVELBASE;
|
||||
}
|
||||
int flagsNext = styler.LevelAt(lineCurrent);
|
||||
styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
|
||||
}
|
||||
|
||||
static const char *const emptyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);
|
@ -12,6 +12,10 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
@ -22,29 +26,34 @@
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
#include "SubStyles.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
// Use an unnamed namespace to protect the functions and classes from name conflicts
|
||||
|
||||
/* kwCDef, kwCTypeName only used for Cython */
|
||||
enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName, kwCPDef };
|
||||
|
||||
static const int indicatorWhitespace = 1;
|
||||
enum literalsAllowed { litNone = 0, litU = 1, litB = 2 };
|
||||
|
||||
static bool IsPyComment(Accessor &styler, int pos, int len) {
|
||||
const int indicatorWhitespace = 1;
|
||||
|
||||
bool IsPyComment(Accessor &styler, Sci_Position pos, Sci_Position len) {
|
||||
return len > 0 && styler[pos] == '#';
|
||||
}
|
||||
|
||||
enum literalsAllowed { litNone=0, litU=1, litB=2};
|
||||
|
||||
static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
|
||||
bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
|
||||
return
|
||||
((allowed & litB) && (ch == 'b' || ch == 'B')) ||
|
||||
((allowed & litU) && (ch == 'u' || ch == 'U'));
|
||||
}
|
||||
|
||||
static bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) {
|
||||
bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) {
|
||||
if (ch == '\'' || ch == '"')
|
||||
return true;
|
||||
if (IsPyStringTypeChar(ch, allowed)) {
|
||||
@ -60,7 +69,7 @@ static bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed all
|
||||
}
|
||||
|
||||
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
|
||||
static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, literalsAllowed allowed) {
|
||||
int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex, literalsAllowed allowed) {
|
||||
char ch = styler.SafeGetCharAt(i);
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@ -100,27 +109,214 @@ static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, li
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool IsAWordChar(int ch) {
|
||||
inline bool IsAWordChar(int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(int ch) {
|
||||
inline bool IsAWordStart(int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
// Options used for LexerPython
|
||||
struct OptionsPython {
|
||||
int whingeLevel;
|
||||
bool base2or8Literals;
|
||||
bool stringsU;
|
||||
bool stringsB;
|
||||
bool stringsOverNewline;
|
||||
bool keywords2NoSubIdentifiers;
|
||||
bool fold;
|
||||
bool foldQuotes;
|
||||
bool foldCompact;
|
||||
|
||||
int endPos = startPos + length;
|
||||
OptionsPython() {
|
||||
whingeLevel = 0;
|
||||
base2or8Literals = true;
|
||||
stringsU = true;
|
||||
stringsB = true;
|
||||
stringsOverNewline = false;
|
||||
keywords2NoSubIdentifiers = false;
|
||||
fold = false;
|
||||
foldQuotes = false;
|
||||
foldCompact = false;
|
||||
}
|
||||
|
||||
literalsAllowed AllowedLiterals() const {
|
||||
literalsAllowed allowedLiterals = stringsU ? litU : litNone;
|
||||
if (stringsB)
|
||||
allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
|
||||
return allowedLiterals;
|
||||
}
|
||||
};
|
||||
|
||||
static const char *const pythonWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Highlighted identifiers",
|
||||
0
|
||||
};
|
||||
|
||||
struct OptionSetPython : public OptionSet<OptionsPython> {
|
||||
OptionSetPython() {
|
||||
DefineProperty("tab.timmy.whinge.level", &OptionsPython::whingeLevel,
|
||||
"For Python code, checks whether indenting is consistent. "
|
||||
"The default, 0 turns off indentation checking, "
|
||||
"1 checks whether each line is potentially inconsistent with the previous line, "
|
||||
"2 checks whether any space characters occur before a tab character in the indentation, "
|
||||
"3 checks whether any spaces are in the indentation, and "
|
||||
"4 checks for any tab characters in the indentation. "
|
||||
"1 is a good level to use.");
|
||||
|
||||
DefineProperty("lexer.python.literals.binary", &OptionsPython::base2or8Literals,
|
||||
"Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712.");
|
||||
|
||||
DefineProperty("lexer.python.strings.u", &OptionsPython::stringsU,
|
||||
"Set to 0 to not recognise Python Unicode literals u\"x\" as used before Python 3.");
|
||||
|
||||
DefineProperty("lexer.python.strings.b", &OptionsPython::stringsB,
|
||||
"Set to 0 to not recognise Python 3 bytes literals b\"x\".");
|
||||
|
||||
DefineProperty("lexer.python.strings.over.newline", &OptionsPython::stringsOverNewline,
|
||||
"Set to 1 to allow strings to span newline characters.");
|
||||
|
||||
DefineProperty("lexer.python.keywords2.no.sub.identifiers", &OptionsPython::keywords2NoSubIdentifiers,
|
||||
"When enabled, it will not style keywords2 items that are used as a sub-identifier. "
|
||||
"Example: when set, will not highlight \"foo.open\" when \"open\" is a keywords2 item.");
|
||||
|
||||
DefineProperty("fold", &OptionsPython::fold);
|
||||
|
||||
DefineProperty("fold.quotes.python", &OptionsPython::foldQuotes,
|
||||
"This option enables folding multi-line quoted strings when using the Python lexer.");
|
||||
|
||||
DefineProperty("fold.compact", &OptionsPython::foldCompact);
|
||||
|
||||
DefineWordListSets(pythonWordListDesc);
|
||||
}
|
||||
};
|
||||
|
||||
const char styleSubable[] = { SCE_P_IDENTIFIER, 0 };
|
||||
|
||||
}
|
||||
|
||||
class LexerPython : public ILexerWithSubStyles {
|
||||
WordList keywords;
|
||||
WordList keywords2;
|
||||
OptionsPython options;
|
||||
OptionSetPython osPython;
|
||||
enum { ssIdentifier };
|
||||
SubStyles subStyles;
|
||||
public:
|
||||
explicit LexerPython() :
|
||||
subStyles(styleSubable, 0x80, 0x40, 0) {
|
||||
}
|
||||
virtual ~LexerPython() {
|
||||
}
|
||||
void SCI_METHOD Release() {
|
||||
delete this;
|
||||
}
|
||||
int SCI_METHOD Version() const {
|
||||
return lvSubStyles;
|
||||
}
|
||||
const char * SCI_METHOD PropertyNames() {
|
||||
return osPython.PropertyNames();
|
||||
}
|
||||
int SCI_METHOD PropertyType(const char *name) {
|
||||
return osPython.PropertyType(name);
|
||||
}
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osPython.DescribeProperty(name);
|
||||
}
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osPython.DescribeWordListSets();
|
||||
}
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SCI_METHOD LineEndTypesSupported() {
|
||||
return SC_LINE_END_TYPE_UNICODE;
|
||||
}
|
||||
|
||||
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
|
||||
return subStyles.Allocate(styleBase, numberStyles);
|
||||
}
|
||||
int SCI_METHOD SubStylesStart(int styleBase) {
|
||||
return subStyles.Start(styleBase);
|
||||
}
|
||||
int SCI_METHOD SubStylesLength(int styleBase) {
|
||||
return subStyles.Length(styleBase);
|
||||
}
|
||||
int SCI_METHOD StyleFromSubStyle(int subStyle) {
|
||||
int styleBase = subStyles.BaseStyle(subStyle);
|
||||
return styleBase;
|
||||
}
|
||||
int SCI_METHOD PrimaryStyleFromStyle(int style) {
|
||||
return style;
|
||||
}
|
||||
void SCI_METHOD FreeSubStyles() {
|
||||
subStyles.Free();
|
||||
}
|
||||
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) {
|
||||
subStyles.SetIdentifiers(style, identifiers);
|
||||
}
|
||||
int SCI_METHOD DistanceToSecondaryStyles() {
|
||||
return 0;
|
||||
}
|
||||
const char * SCI_METHOD GetSubStyleBases() {
|
||||
return styleSubable;
|
||||
}
|
||||
|
||||
static ILexer *LexerFactoryPython() {
|
||||
return new LexerPython();
|
||||
}
|
||||
};
|
||||
|
||||
Sci_Position SCI_METHOD LexerPython::PropertySet(const char *key, const char *val) {
|
||||
if (osPython.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
wordListN = &keywords;
|
||||
break;
|
||||
case 1:
|
||||
wordListN = &keywords2;
|
||||
break;
|
||||
}
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
if (*wordListN != wlNew) {
|
||||
wordListN->Set(wl);
|
||||
firstModification = 0;
|
||||
}
|
||||
}
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
Accessor styler(pAccess, NULL);
|
||||
|
||||
const Sci_Position endPos = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its tab whinging
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
// Look for backslash-continued lines
|
||||
while (lineCurrent > 0) {
|
||||
int eolPos = styler.LineStart(lineCurrent) - 1;
|
||||
Sci_Position eolPos = styler.LineStart(lineCurrent) - 1;
|
||||
int eolStyle = styler.StyleAt(eolPos);
|
||||
if (eolStyle == SCE_P_STRING
|
||||
|| eolStyle == SCE_P_CHARACTER
|
||||
@ -135,40 +331,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
initStyle = startPos == 0 ? SCE_P_DEFAULT : styler.StyleAt(startPos - 1);
|
||||
}
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
|
||||
// property tab.timmy.whinge.level
|
||||
// For Python code, checks whether indenting is consistent.
|
||||
// The default, 0 turns off indentation checking,
|
||||
// 1 checks whether each line is potentially inconsistent with the previous line,
|
||||
// 2 checks whether any space characters occur before a tab character in the indentation,
|
||||
// 3 checks whether any spaces are in the indentation, and
|
||||
// 4 checks for any tab characters in the indentation.
|
||||
// 1 is a good level to use.
|
||||
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||
|
||||
// property lexer.python.literals.binary
|
||||
// Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712.
|
||||
bool base2or8Literals = styler.GetPropertyInt("lexer.python.literals.binary", 1) != 0;
|
||||
|
||||
// property lexer.python.strings.u
|
||||
// Set to 0 to not recognise Python Unicode literals u"x" as used before Python 3.
|
||||
literalsAllowed allowedLiterals = (styler.GetPropertyInt("lexer.python.strings.u", 1)) ? litU : litNone;
|
||||
|
||||
// property lexer.python.strings.b
|
||||
// Set to 0 to not recognise Python 3 bytes literals b"x".
|
||||
if (styler.GetPropertyInt("lexer.python.strings.b", 1))
|
||||
allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
|
||||
|
||||
// property lexer.python.strings.over.newline
|
||||
// Set to 1 to allow strings to span newline characters.
|
||||
bool stringsOverNewline = styler.GetPropertyInt("lexer.python.strings.over.newline") != 0;
|
||||
|
||||
// property lexer.python.keywords2.no.sub.identifiers
|
||||
// When enabled, it will not style keywords2 items that are used as a sub-identifier.
|
||||
// Example: when set, will not highlight "foo.open" when "open" is a keywords2 item.
|
||||
const bool keywords2NoSubIdentifiers = styler.GetPropertyInt("lexer.python.keywords2.no.sub.identifiers") != 0;
|
||||
const literalsAllowed allowedLiterals = options.AllowedLiterals();
|
||||
|
||||
initStyle = initStyle & 31;
|
||||
if (initStyle == SCE_P_STRINGEOL) {
|
||||
@ -180,10 +343,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||
bool base_n_number = false;
|
||||
|
||||
const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_P_IDENTIFIER);
|
||||
|
||||
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
|
||||
|
||||
bool indentGood = true;
|
||||
int startIndicator = sc.currentPos;
|
||||
Sci_Position startIndicator = sc.currentPos;
|
||||
bool inContinuedString = false;
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
@ -191,13 +356,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.atLineStart) {
|
||||
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
|
||||
indentGood = true;
|
||||
if (whingeLevel == 1) {
|
||||
if (options.whingeLevel == 1) {
|
||||
indentGood = (spaceFlags & wsInconsistent) == 0;
|
||||
} else if (whingeLevel == 2) {
|
||||
} else if (options.whingeLevel == 2) {
|
||||
indentGood = (spaceFlags & wsSpaceTab) == 0;
|
||||
} else if (whingeLevel == 3) {
|
||||
} else if (options.whingeLevel == 3) {
|
||||
indentGood = (spaceFlags & wsSpace) == 0;
|
||||
} else if (whingeLevel == 4) {
|
||||
} else if (options.whingeLevel == 4) {
|
||||
indentGood = (spaceFlags & wsTab) == 0;
|
||||
}
|
||||
if (!indentGood) {
|
||||
@ -216,7 +381,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
lineCurrent++;
|
||||
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
|
||||
if (inContinuedString || stringsOverNewline) {
|
||||
if (inContinuedString || options.stringsOverNewline) {
|
||||
inContinuedString = false;
|
||||
} else {
|
||||
sc.ChangeState(SCE_P_STRINGEOL);
|
||||
@ -252,7 +417,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (kwLast == kwDef) {
|
||||
style = SCE_P_DEFNAME;
|
||||
} else if (kwLast == kwCDef || kwLast == kwCPDef) {
|
||||
int pos = sc.currentPos;
|
||||
Sci_Position pos = sc.currentPos;
|
||||
unsigned char ch = styler.SafeGetCharAt(pos, '\0');
|
||||
while (ch != '\0') {
|
||||
if (ch == '(') {
|
||||
@ -269,16 +434,21 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
} else if (keywords2.InList(s)) {
|
||||
if (keywords2NoSubIdentifiers) {
|
||||
if (options.keywords2NoSubIdentifiers) {
|
||||
// We don't want to highlight keywords2
|
||||
// that are used as a sub-identifier,
|
||||
// i.e. not open in "foo.open".
|
||||
int pos = styler.GetStartSegment() - 1;
|
||||
Sci_Position pos = styler.GetStartSegment() - 1;
|
||||
if (pos < 0 || (styler.SafeGetCharAt(pos, '\0') != '.'))
|
||||
style = SCE_P_WORD2;
|
||||
} else {
|
||||
style = SCE_P_WORD2;
|
||||
}
|
||||
} else {
|
||||
int subStyle = classifierIdentifiers.ValueFor(s);
|
||||
if (subStyle >= 0) {
|
||||
style = subStyle;
|
||||
}
|
||||
}
|
||||
sc.ChangeState(style);
|
||||
sc.SetState(SCE_P_DEFAULT);
|
||||
@ -374,7 +544,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.SetState(SCE_P_NUMBER);
|
||||
} else if (sc.ch == '0' &&
|
||||
(sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) {
|
||||
if (base2or8Literals) {
|
||||
if (options.base2or8Literals) {
|
||||
base_n_number = true;
|
||||
sc.SetState(SCE_P_NUMBER);
|
||||
} else {
|
||||
@ -392,7 +562,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (sc.ch == '@') {
|
||||
sc.SetState(SCE_P_DECORATOR);
|
||||
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) {
|
||||
unsigned int nextIndex = 0;
|
||||
Sci_PositionU nextIndex = 0;
|
||||
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals));
|
||||
while (nextIndex > (sc.currentPos + 1) && sc.More()) {
|
||||
sc.Forward();
|
||||
@ -406,10 +576,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eol_pos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eol_pos; i++) {
|
||||
char ch = styler[i];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
@ -419,30 +589,28 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsQuoteLine(int line, Accessor &styler) {
|
||||
static bool IsQuoteLine(Sci_Position line, Accessor &styler) {
|
||||
int style = styler.StyleAt(styler.LineStart(line)) & 31;
|
||||
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
|
||||
}
|
||||
|
||||
|
||||
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
|
||||
WordList *[], Accessor &styler) {
|
||||
const int maxPos = startPos + length;
|
||||
const int maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line
|
||||
const int docLines = styler.GetLine(styler.Length()); // Available last line
|
||||
void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, IDocument *pAccess) {
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
// property fold.quotes.python
|
||||
// This option enables folding multi-line quoted strings when using the Python lexer.
|
||||
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python") != 0;
|
||||
Accessor styler(pAccess, NULL);
|
||||
|
||||
const bool foldCompact = styler.GetPropertyInt("fold.compact") != 0;
|
||||
const Sci_Position maxPos = startPos + length;
|
||||
const Sci_Position maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line
|
||||
const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line
|
||||
|
||||
// Backtrack to previous non-blank line so we can determine indent level
|
||||
// for any white space lines (needed esp. within triple quoted strings)
|
||||
// and so we can fix any preceding fold level (which is why we go back
|
||||
// at least one line in all cases)
|
||||
int spaceFlags = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
|
||||
while (lineCurrent > 0) {
|
||||
lineCurrent--;
|
||||
@ -459,7 +627,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
||||
int prev_state = SCE_P_DEFAULT & 31;
|
||||
if (lineCurrent >= 1)
|
||||
prev_state = styler.StyleAt(startPos - 1) & 31;
|
||||
int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
|
||||
int prevQuote = options.foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
|
||||
|
||||
// Process all characters to end of requested range or end of any triple quote
|
||||
//that hangs over the end of the range. Cap processing in all cases
|
||||
@ -468,15 +636,15 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
||||
|
||||
// Gather info
|
||||
int lev = indentCurrent;
|
||||
int lineNext = lineCurrent + 1;
|
||||
Sci_Position lineNext = lineCurrent + 1;
|
||||
int indentNext = indentCurrent;
|
||||
int quote = false;
|
||||
if (lineNext <= docLines) {
|
||||
// Information about next line is only available if not at end of document
|
||||
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||
int lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
|
||||
Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
|
||||
int style = styler.StyleAt(lookAtPos) & 31;
|
||||
quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
|
||||
quote = options.foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
|
||||
}
|
||||
const int quote_start = (quote && !prevQuote);
|
||||
const int quote_continue = (quote && prevQuote);
|
||||
@ -517,13 +685,13 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
||||
// which is indented more than the line after the end of
|
||||
// the comment-block, use the level of the block before
|
||||
|
||||
int skipLine = lineNext;
|
||||
Sci_Position skipLine = lineNext;
|
||||
int skipLevel = levelAfterComments;
|
||||
|
||||
while (--skipLine > lineCurrent) {
|
||||
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
|
||||
|
||||
if (foldCompact) {
|
||||
if (options.foldCompact) {
|
||||
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
|
||||
skipLevel = levelBeforeComments;
|
||||
|
||||
@ -550,7 +718,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
||||
prevQuote = quote;
|
||||
|
||||
// Set fold level for this line and move to next line
|
||||
styler.SetLevel(lineCurrent, foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG);
|
||||
styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG);
|
||||
indentCurrent = indentNext;
|
||||
lineCurrent = lineNext;
|
||||
}
|
||||
@ -560,12 +728,5 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
|
||||
//styler.SetLevel(lineCurrent, indentCurrent);
|
||||
}
|
||||
|
||||
static const char *const pythonWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Highlighted identifiers",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,
|
||||
LexerModule lmPython(SCLEX_PYTHON, LexerPython::LexerFactoryPython, "python",
|
||||
pythonWordListDesc);
|
||||
|
||||
|
@ -50,7 +50,7 @@ static inline bool IsAnOperator(const int ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
static void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
@ -146,13 +146,13 @@ static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, Word
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
static void FoldRDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
|
||||
Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
@ -160,7 +160,7 @@ static void FoldRDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -68,7 +68,7 @@ static inline bool IsBinaryStart(const int ch, const int ch2, const int ch3, con
|
||||
}
|
||||
|
||||
|
||||
static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
static void ColouriseRebolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
@ -79,7 +79,7 @@ static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList &keywords7 = *keywordlists[6];
|
||||
WordList &keywords8 = *keywordlists[7];
|
||||
|
||||
int currentLine = styler.GetLine(startPos);
|
||||
Sci_Position currentLine = styler.GetLine(startPos);
|
||||
// Initialize the braced string {.. { ... } ..} nesting level, if we are inside such a string.
|
||||
int stringLevel = 0;
|
||||
if (initStyle == SCE_REBOL_BRACEDSTRING || initStyle == SCE_REBOL_COMMENTBLOCK) {
|
||||
@ -273,16 +273,16 @@ static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
|
||||
|
||||
static void FoldRebolDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
|
||||
static void FoldRebolDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
|
||||
Accessor &styler) {
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
Sci_PositionU lengthDoc = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -65,8 +65,8 @@ class LexerRegistry : public ILexer {
|
||||
return (state == SCE_REG_ADDEDKEY || state == SCE_REG_DELETEDKEY);
|
||||
}
|
||||
|
||||
static bool AtValueType(LexAccessor &styler, int start) {
|
||||
int i = 0;
|
||||
static bool AtValueType(LexAccessor &styler, Sci_Position start) {
|
||||
Sci_Position i = 0;
|
||||
while (i < 10) {
|
||||
i++;
|
||||
char curr = styler.SafeGetCharAt(start+i, '\0');
|
||||
@ -79,8 +79,8 @@ class LexerRegistry : public ILexer {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsNextNonWhitespace(LexAccessor &styler, int start, char ch) {
|
||||
int i = 0;
|
||||
static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) {
|
||||
Sci_Position i = 0;
|
||||
while (i < 100) {
|
||||
i++;
|
||||
char curr = styler.SafeGetCharAt(start+i, '\0');
|
||||
@ -96,9 +96,9 @@ class LexerRegistry : public ILexer {
|
||||
}
|
||||
|
||||
// Looks for the equal sign at the end of the string
|
||||
static bool AtValueName(LexAccessor &styler, int start) {
|
||||
static bool AtValueName(LexAccessor &styler, Sci_Position start) {
|
||||
bool atEOL = false;
|
||||
int i = 0;
|
||||
Sci_Position i = 0;
|
||||
bool escaped = false;
|
||||
while (!atEOL) {
|
||||
i++;
|
||||
@ -119,9 +119,9 @@ class LexerRegistry : public ILexer {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool AtKeyPathEnd(LexAccessor &styler, int start) {
|
||||
static bool AtKeyPathEnd(LexAccessor &styler, Sci_Position start) {
|
||||
bool atEOL = false;
|
||||
int i = 0;
|
||||
Sci_Position i = 0;
|
||||
while (!atEOL) {
|
||||
i++;
|
||||
char curr = styler.SafeGetCharAt(start+i, '\0');
|
||||
@ -135,7 +135,7 @@ class LexerRegistry : public ILexer {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool AtGUID(LexAccessor &styler, int start) {
|
||||
static bool AtGUID(LexAccessor &styler, Sci_Position start) {
|
||||
int count = 8;
|
||||
int portion = 0;
|
||||
int offset = 1;
|
||||
@ -179,13 +179,13 @@ public:
|
||||
virtual const char *SCI_METHOD DescribeProperty(const char *name) {
|
||||
return optSetRegistry.DescribeProperty(name);
|
||||
}
|
||||
virtual int SCI_METHOD PropertySet(const char *key, const char *val) {
|
||||
virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) {
|
||||
if (optSetRegistry.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
virtual int SCI_METHOD WordListSet(int, const char *) {
|
||||
virtual Sci_Position SCI_METHOD WordListSet(int, const char *) {
|
||||
return -1;
|
||||
}
|
||||
virtual void *SCI_METHOD PrivateCall(int, void *) {
|
||||
@ -197,18 +197,18 @@ public:
|
||||
virtual const char *SCI_METHOD DescribeWordListSets() {
|
||||
return optSetRegistry.DescribeWordListSets();
|
||||
}
|
||||
virtual void SCI_METHOD Lex(unsigned startPos,
|
||||
int length,
|
||||
virtual void SCI_METHOD Lex(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
IDocument *pAccess);
|
||||
virtual void SCI_METHOD Fold(unsigned startPos,
|
||||
int length,
|
||||
virtual void SCI_METHOD Fold(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
IDocument *pAccess);
|
||||
};
|
||||
|
||||
void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
int length,
|
||||
void SCI_METHOD LexerRegistry::Lex(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int initStyle,
|
||||
IDocument *pAccess) {
|
||||
int beforeGUID = SCE_REG_DEFAULT;
|
||||
@ -220,7 +220,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
bool afterEqualSign = false;
|
||||
while (context.More()) {
|
||||
if (context.atLineStart) {
|
||||
int currPos = static_cast<int>(context.currentPos);
|
||||
Sci_Position currPos = static_cast<Sci_Position>(context.currentPos);
|
||||
bool continued = styler[currPos-3] == '\\';
|
||||
highlight = continued ? true : false;
|
||||
}
|
||||
@ -232,7 +232,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
break;
|
||||
case SCE_REG_VALUENAME:
|
||||
case SCE_REG_STRING: {
|
||||
int currPos = static_cast<int>(context.currentPos);
|
||||
Sci_Position currPos = static_cast<Sci_Position>(context.currentPos);
|
||||
if (context.ch == '"') {
|
||||
context.ForwardSetState(SCE_REG_DEFAULT);
|
||||
} else if (context.ch == '\\') {
|
||||
@ -270,7 +270,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
break;
|
||||
case SCE_REG_DELETEDKEY:
|
||||
case SCE_REG_ADDEDKEY: {
|
||||
int currPos = static_cast<int>(context.currentPos);
|
||||
Sci_Position currPos = static_cast<Sci_Position>(context.currentPos);
|
||||
if (context.ch == ']' && AtKeyPathEnd(styler, currPos)) {
|
||||
context.ForwardSetState(SCE_REG_DEFAULT);
|
||||
} else if (context.ch == '{') {
|
||||
@ -298,7 +298,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
context.ForwardSetState(beforeGUID);
|
||||
beforeGUID = SCE_REG_DEFAULT;
|
||||
}
|
||||
int currPos = static_cast<int>(context.currentPos);
|
||||
Sci_Position currPos = static_cast<Sci_Position>(context.currentPos);
|
||||
if (context.ch == '"' && IsStringState(context.state)) {
|
||||
context.ForwardSetState(SCE_REG_DEFAULT);
|
||||
} else if (context.ch == ']' &&
|
||||
@ -315,7 +315,7 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
}
|
||||
// Determine if a new state should be entered.
|
||||
if (context.state == SCE_REG_DEFAULT) {
|
||||
int currPos = static_cast<int>(context.currentPos);
|
||||
Sci_Position currPos = static_cast<Sci_Position>(context.currentPos);
|
||||
if (context.ch == ';') {
|
||||
context.SetState(SCE_REG_COMMENT);
|
||||
} else if (context.ch == '"') {
|
||||
@ -352,19 +352,19 @@ void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
|
||||
}
|
||||
|
||||
// Folding similar to that of FoldPropsDoc in LexOthers
|
||||
void SCI_METHOD LexerRegistry::Fold(unsigned startPos,
|
||||
int length,
|
||||
void SCI_METHOD LexerRegistry::Fold(Sci_PositionU startPos,
|
||||
Sci_Position length,
|
||||
int,
|
||||
IDocument *pAccess) {
|
||||
if (!options.fold) {
|
||||
return;
|
||||
}
|
||||
LexAccessor styler(pAccess);
|
||||
int currLine = styler.GetLine(startPos);
|
||||
Sci_Position currLine = styler.GetLine(startPos);
|
||||
int visibleChars = 0;
|
||||
unsigned endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
bool atKeyPath = false;
|
||||
for (unsigned i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
atKeyPath = IsKeyPathState(styler.StyleAt(i)) ? true : atKeyPath;
|
||||
char curr = styler.SafeGetCharAt(i);
|
||||
char next = styler.SafeGetCharAt(i+1);
|
||||
|
@ -68,7 +68,7 @@ static bool inline iswhitespace(char ch) {
|
||||
#define STYLE_MASK 63
|
||||
#define actual_style(style) (style & STYLE_MASK)
|
||||
|
||||
static bool followsDot(unsigned int pos, Accessor &styler) {
|
||||
static bool followsDot(Sci_PositionU pos, Accessor &styler) {
|
||||
styler.Flush();
|
||||
for (; pos >= 1; --pos) {
|
||||
int style = actual_style(styler.StyleAt(pos));
|
||||
@ -95,16 +95,16 @@ static bool followsDot(unsigned int pos, Accessor &styler) {
|
||||
|
||||
// Forward declarations
|
||||
static bool keywordIsAmbiguous(const char *prevWord);
|
||||
static bool keywordDoStartsLoop(int pos,
|
||||
static bool keywordDoStartsLoop(Sci_Position pos,
|
||||
Accessor &styler);
|
||||
static bool keywordIsModifier(const char *word,
|
||||
int pos,
|
||||
Sci_Position pos,
|
||||
Accessor &styler);
|
||||
|
||||
static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
|
||||
static int ClassifyWordRb(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord) {
|
||||
char s[MAX_KEYWORD_LENGTH];
|
||||
unsigned int i, j;
|
||||
unsigned int lim = end - start + 1; // num chars to copy
|
||||
Sci_PositionU i, j;
|
||||
Sci_PositionU lim = end - start + 1; // num chars to copy
|
||||
if (lim >= MAX_KEYWORD_LENGTH) {
|
||||
lim = MAX_KEYWORD_LENGTH - 1;
|
||||
}
|
||||
@ -149,7 +149,7 @@ static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywor
|
||||
|
||||
|
||||
//XXX Identical to Perl, put in common area
|
||||
static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
|
||||
static bool isMatch(Accessor &styler, Sci_Position lengthDoc, Sci_Position pos, const char *val) {
|
||||
if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) {
|
||||
return false;
|
||||
}
|
||||
@ -167,8 +167,8 @@ static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
|
||||
|
||||
// Precondition: the here-doc target can be indented
|
||||
static bool lookingAtHereDocDelim(Accessor &styler,
|
||||
int pos,
|
||||
int lengthDoc,
|
||||
Sci_Position pos,
|
||||
Sci_Position lengthDoc,
|
||||
const char *HereDocDelim)
|
||||
{
|
||||
if (!isMatch(styler, lengthDoc, pos, HereDocDelim)) {
|
||||
@ -201,7 +201,7 @@ static char opposite(char ch) {
|
||||
// Null transitions when we see we've reached the end
|
||||
// and need to relex the curr char.
|
||||
|
||||
static void redo_char(int &i, char &ch, char &chNext, char &chNext2,
|
||||
static void redo_char(Sci_Position &i, char &ch, char &chNext, char &chNext2,
|
||||
int &state) {
|
||||
i--;
|
||||
chNext2 = chNext;
|
||||
@ -209,19 +209,19 @@ static void redo_char(int &i, char &ch, char &chNext, char &chNext2,
|
||||
state = SCE_RB_DEFAULT;
|
||||
}
|
||||
|
||||
static void advance_char(int &i, char &ch, char &chNext, char &chNext2) {
|
||||
static void advance_char(Sci_Position &i, char &ch, char &chNext, char &chNext2) {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
}
|
||||
|
||||
// precondition: startPos points to one after the EOL char
|
||||
static bool currLineContainsHereDelims(int &startPos,
|
||||
static bool currLineContainsHereDelims(Sci_Position &startPos,
|
||||
Accessor &styler) {
|
||||
if (startPos <= 1)
|
||||
return false;
|
||||
|
||||
int pos;
|
||||
Sci_Position pos;
|
||||
for (pos = startPos - 1; pos > 0; pos--) {
|
||||
char ch = styler.SafeGetCharAt(pos);
|
||||
if (isEOLChar(ch)) {
|
||||
@ -314,10 +314,10 @@ static void exitInnerExpression(int *p_inner_string_types,
|
||||
curr_quote = p_inner_quotes[inner_string_count];
|
||||
}
|
||||
|
||||
static bool isEmptyLine(int pos,
|
||||
static bool isEmptyLine(Sci_Position pos,
|
||||
Accessor &styler) {
|
||||
int spaceFlags = 0;
|
||||
int lineCurrent = styler.GetLine(pos);
|
||||
Sci_Position lineCurrent = styler.GetLine(pos);
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
|
||||
return (indentCurrent & SC_FOLDLEVELWHITEFLAG) != 0;
|
||||
}
|
||||
@ -346,10 +346,10 @@ static bool RE_CanFollowKeyword(const char *keyword) {
|
||||
// Look at chars up to but not including endPos
|
||||
// Don't look at styles in case we're looking forward
|
||||
|
||||
static int skipWhitespace(int startPos,
|
||||
int endPos,
|
||||
static int skipWhitespace(Sci_Position startPos,
|
||||
Sci_Position endPos,
|
||||
Accessor &styler) {
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
for (Sci_Position i = startPos; i < endPos; i++) {
|
||||
if (!iswhitespace(styler[i])) {
|
||||
return i;
|
||||
}
|
||||
@ -363,19 +363,19 @@ static int skipWhitespace(int startPos,
|
||||
//
|
||||
// iPrev points to the start of <<
|
||||
|
||||
static bool sureThisIsHeredoc(int iPrev,
|
||||
static bool sureThisIsHeredoc(Sci_Position iPrev,
|
||||
Accessor &styler,
|
||||
char *prevWord) {
|
||||
|
||||
// Not so fast, since Ruby's so dynamic. Check the context
|
||||
// to make sure we're OK.
|
||||
int prevStyle;
|
||||
int lineStart = styler.GetLine(iPrev);
|
||||
int lineStartPosn = styler.LineStart(lineStart);
|
||||
Sci_Position lineStart = styler.GetLine(iPrev);
|
||||
Sci_Position lineStartPosn = styler.LineStart(lineStart);
|
||||
styler.Flush();
|
||||
|
||||
// Find the first word after some whitespace
|
||||
int firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler);
|
||||
Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler);
|
||||
if (firstWordPosn >= iPrev) {
|
||||
// Have something like {^ <<}
|
||||
//XXX Look at the first previous non-comment non-white line
|
||||
@ -391,7 +391,7 @@ static bool sureThisIsHeredoc(int iPrev,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int firstWordEndPosn = firstWordPosn;
|
||||
Sci_Position firstWordEndPosn = firstWordPosn;
|
||||
char *dst = prevWord;
|
||||
for (;;) {
|
||||
if (firstWordEndPosn >= iPrev ||
|
||||
@ -414,15 +414,15 @@ static bool sureThisIsHeredoc(int iPrev,
|
||||
|
||||
// Routine that saves us from allocating a buffer for the here-doc target
|
||||
// targetEndPos points one past the end of the current target
|
||||
static bool haveTargetMatch(int currPos,
|
||||
int lengthDoc,
|
||||
int targetStartPos,
|
||||
int targetEndPos,
|
||||
static bool haveTargetMatch(Sci_Position currPos,
|
||||
Sci_Position lengthDoc,
|
||||
Sci_Position targetStartPos,
|
||||
Sci_Position targetEndPos,
|
||||
Accessor &styler) {
|
||||
if (lengthDoc - currPos < targetEndPos - targetStartPos) {
|
||||
return false;
|
||||
}
|
||||
int i, j;
|
||||
Sci_Position i, j;
|
||||
for (i = targetStartPos, j = currPos;
|
||||
i < targetEndPos && j < lengthDoc;
|
||||
i++, j++) {
|
||||
@ -447,19 +447,19 @@ static bool haveTargetMatch(int currPos,
|
||||
|
||||
// return true == yes, we have no heredocs
|
||||
|
||||
static bool sureThisIsNotHeredoc(int lt2StartPos,
|
||||
static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos,
|
||||
Accessor &styler) {
|
||||
int prevStyle;
|
||||
// Use full document, not just part we're styling
|
||||
int lengthDoc = styler.Length();
|
||||
int lineStart = styler.GetLine(lt2StartPos);
|
||||
int lineStartPosn = styler.LineStart(lineStart);
|
||||
Sci_Position lengthDoc = styler.Length();
|
||||
Sci_Position lineStart = styler.GetLine(lt2StartPos);
|
||||
Sci_Position lineStartPosn = styler.LineStart(lineStart);
|
||||
styler.Flush();
|
||||
const bool definitely_not_a_here_doc = true;
|
||||
const bool looks_like_a_here_doc = false;
|
||||
|
||||
// Find the first word after some whitespace
|
||||
int firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);
|
||||
Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);
|
||||
if (firstWordPosn >= lt2StartPos) {
|
||||
return definitely_not_a_here_doc;
|
||||
}
|
||||
@ -508,12 +508,12 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,
|
||||
return definitely_not_a_here_doc;
|
||||
}
|
||||
// OK, now 'j' will point to the current spot moving ahead
|
||||
int j = firstWordPosn + 1;
|
||||
Sci_Position j = firstWordPosn + 1;
|
||||
if (styler.StyleAt(j) != SCE_RB_OPERATOR || styler[j] != '<') {
|
||||
// This shouldn't happen
|
||||
return definitely_not_a_here_doc;
|
||||
}
|
||||
int nextLineStartPosn = styler.LineStart(lineStart + 1);
|
||||
Sci_Position nextLineStartPosn = styler.LineStart(lineStart + 1);
|
||||
if (nextLineStartPosn >= lengthDoc) {
|
||||
return definitely_not_a_here_doc;
|
||||
}
|
||||
@ -522,7 +522,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,
|
||||
return definitely_not_a_here_doc;
|
||||
}
|
||||
bool allow_indent;
|
||||
int target_start, target_end;
|
||||
Sci_Position target_start, target_end;
|
||||
// From this point on no more styling, since we're looking ahead
|
||||
if (styler[j] == '-') {
|
||||
allow_indent = true;
|
||||
@ -580,12 +580,12 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,
|
||||
}
|
||||
|
||||
// Just look at the start of each line
|
||||
int last_line = styler.GetLine(lengthDoc - 1);
|
||||
Sci_Position last_line = styler.GetLine(lengthDoc - 1);
|
||||
// But don't go too far
|
||||
if (last_line > lineStart + 50) {
|
||||
last_line = lineStart + 50;
|
||||
}
|
||||
for (int line_num = lineStart + 1; line_num <= last_line; line_num++) {
|
||||
for (Sci_Position line_num = lineStart + 1; line_num <= last_line; line_num++) {
|
||||
if (allow_indent) {
|
||||
j = skipWhitespace(styler.LineStart(line_num), lengthDoc, styler);
|
||||
} else {
|
||||
@ -604,8 +604,8 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,
|
||||
// move to the start of the first line that is not in a
|
||||
// multi-line construct
|
||||
|
||||
static void synchronizeDocStart(unsigned int &startPos,
|
||||
int &length,
|
||||
static void synchronizeDocStart(Sci_PositionU &startPos,
|
||||
Sci_Position &length,
|
||||
int &initStyle,
|
||||
Accessor &styler,
|
||||
bool skipWhiteSpace=false) {
|
||||
@ -620,9 +620,9 @@ static void synchronizeDocStart(unsigned int &startPos,
|
||||
return;
|
||||
}
|
||||
|
||||
int pos = startPos;
|
||||
Sci_Position pos = startPos;
|
||||
// Quick way to characterize each line
|
||||
int lineStart;
|
||||
Sci_Position lineStart;
|
||||
for (lineStart = styler.GetLine(pos); lineStart > 0; lineStart--) {
|
||||
// Now look at the style before the previous line's EOL
|
||||
pos = styler.LineStart(lineStart) - 1;
|
||||
@ -654,7 +654,7 @@ static void synchronizeDocStart(unsigned int &startPos,
|
||||
initStyle = SCE_RB_DEFAULT;
|
||||
}
|
||||
|
||||
static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
// Lexer for Ruby often has to backtrack to start of current style to determine
|
||||
@ -695,7 +695,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
bool preferRE = true;
|
||||
int state = initStyle;
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
|
||||
char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero
|
||||
prevWord[0] = '\0';
|
||||
@ -743,7 +743,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
int inner_string_count = 0;
|
||||
int brace_counts = 0; // Number of #{ ... } things within an expression
|
||||
|
||||
int i;
|
||||
Sci_Position i;
|
||||
for (i = 0; i < INNER_STRINGS_MAX_COUNT; i++) {
|
||||
inner_string_types[i] = 0;
|
||||
inner_expn_brace_counts[i] = 0;
|
||||
@ -1103,7 +1103,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
// No need to handle this state -- we'll just move to the end
|
||||
preferRE = false;
|
||||
} else {
|
||||
int wordStartPos = styler.GetStartSegment();
|
||||
Sci_Position wordStartPos = styler.GetStartSegment();
|
||||
int word_style = ClassifyWordRb(wordStartPos, i - 1, keywords, styler, prevWord);
|
||||
switch (word_style) {
|
||||
case SCE_RB_WORD:
|
||||
@ -1445,12 +1445,12 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
// Helper functions for folding, disambiguation keywords
|
||||
// Assert that there are no high-bit chars
|
||||
|
||||
static void getPrevWord(int pos,
|
||||
static void getPrevWord(Sci_Position pos,
|
||||
char *prevWord,
|
||||
Accessor &styler,
|
||||
int word_state)
|
||||
{
|
||||
int i;
|
||||
Sci_Position i;
|
||||
styler.Flush();
|
||||
for (i = pos - 1; i > 0; i--) {
|
||||
if (actual_style(styler.StyleAt(i)) != word_state) {
|
||||
@ -1488,7 +1488,7 @@ static bool keywordIsAmbiguous(const char *prevWord)
|
||||
// do after a while or until, as a noise word (like then after if)
|
||||
|
||||
static bool keywordIsModifier(const char *word,
|
||||
int pos,
|
||||
Sci_Position pos,
|
||||
Accessor &styler)
|
||||
{
|
||||
if (word[0] == 'd' && word[1] == 'o' && !word[2]) {
|
||||
@ -1496,8 +1496,8 @@ static bool keywordIsModifier(const char *word,
|
||||
}
|
||||
char ch, chPrev, chPrev2;
|
||||
int style = SCE_RB_DEFAULT;
|
||||
int lineStart = styler.GetLine(pos);
|
||||
int lineStartPosn = styler.LineStart(lineStart);
|
||||
Sci_Position lineStart = styler.GetLine(pos);
|
||||
Sci_Position lineStartPosn = styler.LineStart(lineStart);
|
||||
// We want to step backwards until we don't care about the current
|
||||
// position. But first move lineStartPosn back behind any
|
||||
// continuations immediately above word.
|
||||
@ -1599,13 +1599,13 @@ static bool keywordIsModifier(const char *word,
|
||||
// Nothing fancy -- look to see if we follow a while/until somewhere
|
||||
// on the current line
|
||||
|
||||
static bool keywordDoStartsLoop(int pos,
|
||||
static bool keywordDoStartsLoop(Sci_Position pos,
|
||||
Accessor &styler)
|
||||
{
|
||||
char ch;
|
||||
int style;
|
||||
int lineStart = styler.GetLine(pos);
|
||||
int lineStartPosn = styler.LineStart(lineStart);
|
||||
Sci_Position lineStart = styler.GetLine(pos);
|
||||
Sci_Position lineStartPosn = styler.LineStart(lineStart);
|
||||
styler.Flush();
|
||||
while (--pos >= lineStartPosn) {
|
||||
style = actual_style(styler.StyleAt(pos));
|
||||
@ -1621,7 +1621,7 @@ static bool keywordDoStartsLoop(int pos,
|
||||
char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero
|
||||
char *dst = prevWord;
|
||||
int wordLen = 0;
|
||||
int start_word;
|
||||
Sci_Position start_word;
|
||||
for (start_word = pos;
|
||||
start_word >= lineStartPosn && actual_style(styler.StyleAt(start_word)) == SCE_RB_WORD;
|
||||
start_word--) {
|
||||
@ -1651,10 +1651,10 @@ static bool keywordDoStartsLoop(int pos,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i < eol_pos; i++) {
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i < eol_pos; i++) {
|
||||
char ch = styler[i];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
@ -1718,16 +1718,16 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
* Later offer to fold POD, here-docs, strings, and blocks of comments
|
||||
*/
|
||||
|
||||
static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
|
||||
synchronizeDocStart(startPos, length, initStyle, styler, // ref args
|
||||
false);
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = startPos == 0 ? 0 : (styler.LevelAt(lineCurrent)
|
||||
& SC_FOLDLEVELNUMBERMASK
|
||||
& ~SC_FOLDLEVELBASE);
|
||||
@ -1736,7 +1736,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int stylePrev = startPos <= 1 ? SCE_RB_DEFAULT : styler.StyleAt(startPos - 1);
|
||||
bool buffer_ends_with_eol = false;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styleNext;
|
||||
|
@ -138,13 +138,13 @@ public:
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osRust.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osRust.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
}
|
||||
@ -153,15 +153,15 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) {
|
||||
if (osRust.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerRust::WordListSet(int n, const char *wl) {
|
||||
int firstModification = -1;
|
||||
Sci_Position SCI_METHOD LexerRust::WordListSet(int n, const char *wl) {
|
||||
Sci_Position firstModification = -1;
|
||||
if (n < NUM_RUST_KEYWORD_LISTS) {
|
||||
WordList *wordListN = &keywords[n];
|
||||
WordList wlNew;
|
||||
@ -188,7 +188,7 @@ static bool IsIdentifierContinue(int ch) {
|
||||
return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch);
|
||||
}
|
||||
|
||||
static void ScanWhitespace(Accessor& styler, int& pos, int max) {
|
||||
static void ScanWhitespace(Accessor& styler, Sci_Position& pos, Sci_Position max) {
|
||||
while (IsWhitespace(styler.SafeGetCharAt(pos, '\0')) && pos < max) {
|
||||
if (pos == styler.LineEnd(styler.GetLine(pos)))
|
||||
styler.SetLineState(styler.GetLine(pos), 0);
|
||||
@ -197,14 +197,14 @@ static void ScanWhitespace(Accessor& styler, int& pos, int max) {
|
||||
styler.ColourTo(pos-1, SCE_RUST_DEFAULT);
|
||||
}
|
||||
|
||||
static void GrabString(char* s, Accessor& styler, int start, int len) {
|
||||
for (int ii = 0; ii < len; ii++)
|
||||
static void GrabString(char* s, Accessor& styler, Sci_Position start, Sci_Position len) {
|
||||
for (Sci_Position ii = 0; ii < len; ii++)
|
||||
s[ii] = styler[ii + start];
|
||||
s[len] = '\0';
|
||||
}
|
||||
|
||||
static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) {
|
||||
int start = pos;
|
||||
static void ScanIdentifier(Accessor& styler, Sci_Position& pos, WordList *keywords) {
|
||||
Sci_Position start = pos;
|
||||
while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0')))
|
||||
pos++;
|
||||
|
||||
@ -231,8 +231,8 @@ static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) {
|
||||
}
|
||||
|
||||
/* Scans a sequence of digits, returning true if it found any. */
|
||||
static bool ScanDigits(Accessor& styler, int& pos, int base) {
|
||||
int old_pos = pos;
|
||||
static bool ScanDigits(Accessor& styler, Sci_Position& pos, int base) {
|
||||
Sci_Position old_pos = pos;
|
||||
for (;;) {
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (IsADigit(c, base) || c == '_')
|
||||
@ -244,7 +244,7 @@ static bool ScanDigits(Accessor& styler, int& pos, int base) {
|
||||
}
|
||||
|
||||
/* Scans an integer and floating point literals. */
|
||||
static void ScanNumber(Accessor& styler, int& pos) {
|
||||
static void ScanNumber(Accessor& styler, Sci_Position& pos) {
|
||||
int base = 10;
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
int n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
@ -287,7 +287,7 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
} else if (!error) {
|
||||
/* If there's a period, it's a floating point literal unless it's
|
||||
* followed by an identifier (meaning this is a method call, e.g.
|
||||
* `1.foo()`) or another period, in which case it's a range (e.g. 1..2)
|
||||
* `1.foo()`) or another period, in which case it's a range (e.g. 1..2)
|
||||
*/
|
||||
n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
if (c == '.' && !(IsIdentifierStart(n) || n == '.')) {
|
||||
@ -308,7 +308,7 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
/* It is invalid to have no digits in the exponent. */
|
||||
error |= !ScanDigits(styler, pos, 10);
|
||||
}
|
||||
|
||||
|
||||
/* Scan the floating point suffix. */
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (c == 'f') {
|
||||
@ -369,7 +369,7 @@ static bool IsValidStringEscape(int c) {
|
||||
return IsValidCharacterEscape(c) || c == '\n' || c == '\r';
|
||||
}
|
||||
|
||||
static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool stop_asap) {
|
||||
static bool ScanNumericEscape(Accessor &styler, Sci_Position& pos, Sci_Position num_digits, bool stop_asap) {
|
||||
for (;;) {
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (!IsADigit(c, 16))
|
||||
@ -388,7 +388,7 @@ static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool s
|
||||
|
||||
/* This is overly permissive for character literals in order to accept UTF-8 encoded
|
||||
* character literals. */
|
||||
static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos, bool ascii_only) {
|
||||
static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos, bool ascii_only) {
|
||||
pos++;
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
int n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
@ -467,7 +467,7 @@ enum CommentState {
|
||||
* The rule for block-doc comments is as follows: /xxN and /x! (where x is an asterisk, N is a non-asterisk) start doc comments.
|
||||
* Otherwise it's a regular comment.
|
||||
*/
|
||||
static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState state, int level) {
|
||||
static void ResumeBlockComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state, int level) {
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
bool maybe_doc_comment = false;
|
||||
if (c == '*') {
|
||||
@ -522,7 +522,7 @@ static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState
|
||||
* The rule for line-doc comments is as follows... ///N and //! (where N is a non slash) start doc comments.
|
||||
* Otherwise it's a normal line comment.
|
||||
*/
|
||||
static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState state) {
|
||||
static void ResumeLineComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state) {
|
||||
bool maybe_doc_comment = false;
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (c == '/') {
|
||||
@ -550,7 +550,7 @@ static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState
|
||||
styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINE);
|
||||
}
|
||||
|
||||
static void ScanComments(Accessor &styler, int& pos, int max) {
|
||||
static void ScanComments(Accessor &styler, Sci_Position& pos, Sci_Position max) {
|
||||
pos++;
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
pos++;
|
||||
@ -560,7 +560,7 @@ static void ScanComments(Accessor &styler, int& pos, int max) {
|
||||
ResumeBlockComment(styler, pos, max, UnknownComment, 1);
|
||||
}
|
||||
|
||||
static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) {
|
||||
static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) {
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
bool error = false;
|
||||
while (c != '"' && !error) {
|
||||
@ -600,7 +600,7 @@ static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) {
|
||||
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING);
|
||||
}
|
||||
|
||||
static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, bool ascii_only) {
|
||||
static void ResumeRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, int num_hashes, bool ascii_only) {
|
||||
for (;;) {
|
||||
if (pos == styler.LineEnd(styler.GetLine(pos)))
|
||||
styler.SetLineState(styler.GetLine(pos), num_hashes);
|
||||
@ -620,7 +620,7 @@ static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes,
|
||||
} else if (pos >= max) {
|
||||
break;
|
||||
} else {
|
||||
if (ascii_only && !IsASCII((char)c))
|
||||
if (ascii_only && !IsASCII((char)c))
|
||||
break;
|
||||
pos++;
|
||||
}
|
||||
@ -628,7 +628,7 @@ static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes,
|
||||
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR);
|
||||
}
|
||||
|
||||
static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) {
|
||||
static void ScanRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) {
|
||||
pos++;
|
||||
int num_hashes = 0;
|
||||
while (styler.SafeGetCharAt(pos, '\0') == '#') {
|
||||
@ -643,11 +643,11 @@ static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only)
|
||||
}
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerRust::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
PropSetSimple props;
|
||||
Accessor styler(pAccess, &props);
|
||||
int pos = startPos;
|
||||
int max = pos + length;
|
||||
Sci_Position pos = startPos;
|
||||
Sci_Position max = pos + length;
|
||||
|
||||
styler.StartAt(pos);
|
||||
styler.StartSegment(pos);
|
||||
@ -716,28 +716,28 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
|
||||
styler.Flush();
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerRust::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerRust::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
bool inLineComment = false;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
unsigned int lineStartNext = styler.LineStart(lineCurrent+1);
|
||||
Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1);
|
||||
int levelMinCurrent = levelCurrent;
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
@ -803,7 +803,7 @@ void SCI_METHOD LexerRust::Fold(unsigned int startPos, int length, int initStyle
|
||||
lineStartNext = styler.LineStart(lineCurrent+1);
|
||||
levelCurrent = levelNext;
|
||||
levelMinCurrent = levelCurrent;
|
||||
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
|
||||
if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) {
|
||||
// There is an empty line at end of file so give it same level and empty
|
||||
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ inline int issmld(int c) {return isdigit(c) || c == '_';}
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
void ColouriseSMLDoc(
|
||||
unsigned int startPos, int length,
|
||||
static void ColouriseSMLDoc(
|
||||
Sci_PositionU startPos, Sci_Position length,
|
||||
int initStyle,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler)
|
||||
@ -46,7 +46,8 @@ void ColouriseSMLDoc(
|
||||
if (sc.state >= SCE_SML_COMMENT)
|
||||
nesting = (sc.state & 0x0f) - SCE_SML_COMMENT;
|
||||
|
||||
int chBase = 0, chToken = 0, chLit = 0;
|
||||
Sci_PositionU chToken = 0;
|
||||
int chBase = 0, chLit = 0;
|
||||
WordList& keywords = *keywordlists[0];
|
||||
WordList& keywords2 = *keywordlists[1];
|
||||
WordList& keywords3 = *keywordlists[2];
|
||||
@ -54,7 +55,7 @@ void ColouriseSMLDoc(
|
||||
|
||||
while (sc.More()) {
|
||||
int state2 = -1;
|
||||
int chColor = sc.currentPos - 1;
|
||||
Sci_Position chColor = sc.currentPos - 1;
|
||||
bool advance = true;
|
||||
|
||||
switch (sc.state & 0x0f) {
|
||||
@ -89,10 +90,10 @@ void ColouriseSMLDoc(
|
||||
|
||||
case SCE_SML_IDENTIFIER:
|
||||
if (!(issml(sc.ch) || sc.Match('\''))) {
|
||||
const int n = sc.currentPos - chToken;
|
||||
const Sci_Position n = sc.currentPos - chToken;
|
||||
if (n < 24) {
|
||||
char t[24];
|
||||
for (int i = -n; i < 0; i++)
|
||||
for (Sci_Position i = -n; i < 0; i++)
|
||||
t[n + i] = static_cast<char>(sc.GetRelative(i));
|
||||
t[n] = '\0';
|
||||
if ((n == 1 && sc.chPrev == '_') || keywords.InList(t))
|
||||
@ -204,8 +205,8 @@ void ColouriseSMLDoc(
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
void FoldSMLDoc(
|
||||
unsigned int, int,
|
||||
static void FoldSMLDoc(
|
||||
Sci_PositionU, Sci_Position,
|
||||
int,
|
||||
WordList *[],
|
||||
Accessor &)
|
||||
|
@ -66,7 +66,7 @@ typedef unsigned int sql_state_t;
|
||||
|
||||
class SQLStates {
|
||||
public :
|
||||
void Set(int lineNumber, unsigned short int sqlStatesLine) {
|
||||
void Set(Sci_Position lineNumber, unsigned short int sqlStatesLine) {
|
||||
sqlStatement.Set(lineNumber, sqlStatesLine);
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ public :
|
||||
return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0;
|
||||
}
|
||||
|
||||
sql_state_t ForLine(int lineNumber) {
|
||||
sql_state_t ForLine(Sci_Position lineNumber) {
|
||||
return sqlStatement.ValueAt(lineNumber);
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ public :
|
||||
return osSQL.DescribeProperty(name);
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val) {
|
||||
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) {
|
||||
if (osSQL.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
@ -339,9 +339,9 @@ public :
|
||||
return osSQL.DescribeWordListSets();
|
||||
}
|
||||
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex (unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
@ -372,10 +372,10 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
bool IsCommentLine (int line, LexAccessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
int eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (int i = pos; i + 1 < eol_pos; i++) {
|
||||
bool IsCommentLine (Sci_Position line, LexAccessor &styler) {
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
|
||||
for (Sci_Position i = pos; i + 1 < eol_pos; i++) {
|
||||
int style = styler.StyleAt(i);
|
||||
// MySQL needs -- comments to be followed by space or control char
|
||||
if (style == SCE_SQL_COMMENTLINE && styler.Match(i, "--"))
|
||||
@ -400,7 +400,7 @@ private:
|
||||
WordList kw_user4;
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
|
||||
Sci_Position SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
@ -427,7 +427,7 @@ int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
|
||||
case 7:
|
||||
wordListN = &kw_user4;
|
||||
}
|
||||
int firstModification = -1;
|
||||
Sci_Position firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
@ -439,11 +439,11 @@ int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
|
||||
int offset = 0;
|
||||
Sci_Position offset = 0;
|
||||
|
||||
for (; sc.More(); sc.Forward(), offset++) {
|
||||
// Determine if the current state should terminate.
|
||||
@ -561,14 +561,14 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// Locate the unique Q operator character
|
||||
sc.Complete();
|
||||
char qOperator = 0x00;
|
||||
for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
|
||||
for (Sci_Position styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
|
||||
if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) {
|
||||
qOperator = styler.SafeGetCharAt(styleStartPos + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char qComplement = 0x00;
|
||||
|
||||
char qComplement = 0x00;
|
||||
|
||||
if (qOperator == '<') {
|
||||
qComplement = '>';
|
||||
@ -580,8 +580,8 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
|
||||
qComplement = ']';
|
||||
} else {
|
||||
qComplement = qOperator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sc.Match(qComplement, '\'')) {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_SQL_DEFAULT);
|
||||
@ -592,7 +592,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_SQL_DEFAULT) {
|
||||
if (sc.Match('q', '\'') || sc.Match('Q', '\'')) {
|
||||
sc.SetState(SCE_SQL_QOPERATOR);
|
||||
sc.SetState(SCE_SQL_QOPERATOR);
|
||||
sc.Forward();
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) ||
|
||||
((sc.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) {
|
||||
@ -628,18 +628,18 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
void SCI_METHOD LexerSQL::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
|
||||
if (!options.fold)
|
||||
return;
|
||||
LexAccessor styler(pAccess);
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
|
||||
if (lineCurrent > 0) {
|
||||
// Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--').
|
||||
int lastNLPos = -1;
|
||||
Sci_Position lastNLPos = -1;
|
||||
// And keep going back until we find an operator ';' followed
|
||||
// by white-space and/or comments. This will improve folding.
|
||||
while (--startPos > 0) {
|
||||
@ -649,7 +649,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
|
||||
} else if (ch == ';' &&
|
||||
styler.StyleAt(startPos) == SCE_SQL_OPERATOR) {
|
||||
bool isAllClear = true;
|
||||
for (int tempPos = startPos + 1;
|
||||
for (Sci_Position tempPos = startPos + 1;
|
||||
tempPos < lastNLPos;
|
||||
++tempPos) {
|
||||
int tempStyle = styler.StyleAt(tempPos);
|
||||
@ -672,7 +672,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
|
||||
// And because folding ends at ';', keep going until we find one
|
||||
// Otherwise if create ... view ... as is split over multiple
|
||||
// lines the folding won't always update immediately.
|
||||
unsigned int docLength = styler.Length();
|
||||
Sci_PositionU docLength = styler.Length();
|
||||
for (; endPos < docLength; ++endPos) {
|
||||
if (styler.SafeGetCharAt(endPos) == ';') {
|
||||
break;
|
||||
@ -692,7 +692,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
|
||||
if (!options.foldOnlyBegin) {
|
||||
sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent);
|
||||
}
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
|
@ -60,7 +60,7 @@ static void ClassifySTTXTWord(WordList *keywordlists[], StyleContext &sc)
|
||||
sc.SetState(SCE_STTXT_DEFAULT);
|
||||
}
|
||||
|
||||
static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseSTTXTDoc (Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
@ -199,12 +199,12 @@ static const char * const STTXTWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler, bool type)
|
||||
static bool IsCommentLine(Sci_Position line, Accessor &styler, bool type)
|
||||
{
|
||||
int pos = styler.LineStart(line);
|
||||
int eolPos = styler.LineStart(line + 1) - 1;
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eolPos = styler.LineStart(line + 1) - 1;
|
||||
|
||||
for (int i = pos; i < eolPos; i++)
|
||||
for (Sci_Position i = pos; i < eolPos; i++)
|
||||
{
|
||||
char ch = styler[i];
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -221,7 +221,7 @@ static bool IsCommentLine(int line, Accessor &styler, bool type)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = eolPos-2; i>pos; i--)
|
||||
for (Sci_Position i = eolPos-2; i>pos; i--)
|
||||
{
|
||||
char ch = styler[i];
|
||||
char chPrev = styler.SafeGetCharAt(i-1);
|
||||
@ -236,12 +236,12 @@ static bool IsCommentLine(int line, Accessor &styler, bool type)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsPragmaLine(int line, Accessor &styler)
|
||||
static bool IsPragmaLine(Sci_Position line, Accessor &styler)
|
||||
{
|
||||
int pos = styler.LineStart(line);
|
||||
int eolPos = styler.LineStart(line+1) - 1;
|
||||
Sci_Position pos = styler.LineStart(line);
|
||||
Sci_Position eolPos = styler.LineStart(line+1) - 1;
|
||||
|
||||
for (int i = pos ; i < eolPos ; i++)
|
||||
for (Sci_Position i = pos ; i < eolPos ; i++)
|
||||
{
|
||||
char ch = styler[i];
|
||||
int style = styler.StyleAt(i);
|
||||
@ -254,9 +254,9 @@ static bool IsPragmaLine(int line, Accessor &styler)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void GetRangeUpper(unsigned int start,unsigned int end,Accessor &styler,char *s,unsigned int len)
|
||||
static void GetRangeUpper(Sci_PositionU start,Sci_PositionU end,Accessor &styler,char *s,Sci_PositionU len)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
Sci_PositionU i = 0;
|
||||
while ((i < end - start + 1) && (i < len-1)) {
|
||||
s[i] = static_cast<char>(toupper(styler[start + i]));
|
||||
i++;
|
||||
@ -264,8 +264,8 @@ static void GetRangeUpper(unsigned int start,unsigned int end,Accessor &styler,c
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
static void ClassifySTTXTWordFoldPoint(int &levelCurrent,unsigned int lastStart,
|
||||
unsigned int currentPos, Accessor &styler)
|
||||
static void ClassifySTTXTWordFoldPoint(int &levelCurrent,Sci_PositionU lastStart,
|
||||
Sci_PositionU currentPos, Accessor &styler)
|
||||
{
|
||||
char s[256];
|
||||
GetRangeUpper(lastStart, currentPos, styler, s, sizeof(s));
|
||||
@ -321,24 +321,24 @@ static void ClassifySTTXTWordFoldPoint(int &levelCurrent,unsigned int lastStart,
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldSTTXTDoc(unsigned int startPos, int length, int initStyle, WordList *[],Accessor &styler)
|
||||
static void FoldSTTXTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],Accessor &styler)
|
||||
{
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
Sci_PositionU endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
int lastStart = 0;
|
||||
Sci_Position lastStart = 0;
|
||||
|
||||
CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++)
|
||||
for (Sci_PositionU i = startPos; i < endPos; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
@ -25,11 +25,11 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
|
||||
static void ClassifyWordSol(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord)
|
||||
{
|
||||
char s[100] = "";
|
||||
bool wordIsNumber = isdigit(styler[start]) != 0;
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
|
||||
for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++)
|
||||
{
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
@ -38,7 +38,7 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw
|
||||
if (0 == strcmp(prevWord, "class")) chAttr = SCE_SCRIPTOL_CLASSNAME;
|
||||
else if (wordIsNumber) chAttr = SCE_SCRIPTOL_NUMBER;
|
||||
else if (keywords.InList(s)) chAttr = SCE_SCRIPTOL_KEYWORD;
|
||||
else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents
|
||||
else for (Sci_PositionU i = 0; i < end - start + 1; i++) // test dotted idents
|
||||
{
|
||||
if (styler[start + i] == '.')
|
||||
{
|
||||
@ -50,7 +50,7 @@ static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keyw
|
||||
strcpy(prevWord, s);
|
||||
}
|
||||
|
||||
static bool IsSolComment(Accessor &styler, int pos, int len)
|
||||
static bool IsSolComment(Accessor &styler, Sci_Position pos, Sci_Position len)
|
||||
{
|
||||
if(len > 0)
|
||||
{
|
||||
@ -81,7 +81,7 @@ static bool IsSolWordStart(char ch)
|
||||
}
|
||||
|
||||
|
||||
static int GetSolStringState(Accessor &styler, int i, int *nextIndex)
|
||||
static int GetSolStringState(Accessor &styler, Sci_Position i, Sci_Position *nextIndex)
|
||||
{
|
||||
char ch = styler.SafeGetCharAt(i);
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -109,16 +109,16 @@ static int GetSolStringState(Accessor &styler, int i, int *nextIndex)
|
||||
}
|
||||
|
||||
|
||||
static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void ColouriseSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
char stringType = '\"';
|
||||
|
||||
if (startPos > 0)
|
||||
{
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (lineCurrent > 0)
|
||||
{
|
||||
startPos = styler.LineStart(lineCurrent-1);
|
||||
@ -137,12 +137,12 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
int state = initStyle & 31;
|
||||
|
||||
int nextIndex = 0;
|
||||
Sci_Position nextIndex = 0;
|
||||
char chPrev = ' ';
|
||||
char chPrev2 = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
for (int i = startPos; i < lengthDoc; i++)
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++)
|
||||
{
|
||||
|
||||
char ch = chNext;
|
||||
@ -317,12 +317,12 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
static void FoldSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
|
||||
WordList *[], Accessor &styler)
|
||||
{
|
||||
int lengthDoc = startPos + length;
|
||||
Sci_Position lengthDoc = startPos + length;
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
Sci_Position lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0)
|
||||
{
|
||||
if (lineCurrent > 0)
|
||||
@ -341,7 +341,7 @@ static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (state == SCE_SCRIPTOL_TRIPLE)
|
||||
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < lengthDoc; i++)
|
||||
for (Sci_Position i = startPos; i < lengthDoc; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user