aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-04-13 04:55:04 +0000
committernyamatongwe <unknown>2001-04-13 04:55:04 +0000
commit3e36fa6f3ea27bb64ce42bdd1a5b50b52dc6bb04 (patch)
tree72f9058f86ae76bf8d6131a4e80d87549b4770ad /include
parentc9925ce492d3ea61e692769c2733d69eed133993 (diff)
downloadscintilla-mirror-3e36fa6f3ea27bb64ce42bdd1a5b50b52dc6bb04.tar.gz
Start of new lexer infrastructure.
Lexers can have a fold function as well as a lexer function. They can be identified by string name as well as an integer ID and may ask to be automatically assigned that ID.
Diffstat (limited to 'include')
-rw-r--r--include/KeyWords.h23
-rw-r--r--include/SciLexer.h1
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface6
4 files changed, 26 insertions, 5 deletions
diff --git a/include/KeyWords.h b/include/KeyWords.h
index d589d1228..43de26fe6 100644
--- a/include/KeyWords.h
+++ b/include/KeyWords.h
@@ -9,17 +9,30 @@ typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyl
WordList *keywordlists[], Accessor &styler);
/**
+ * A LexerModule is responsible for lexing and folding a particular language.
+ * The class maintains a list of LexerModules which can be searched to find a
+ * module appropriate to a particular language.
*/
class LexerModule {
- static LexerModule *base;
LexerModule *next;
int language;
- LexerFunction fn;
+ const char *languageName;
+ LexerFunction fnLexer;
+ LexerFunction fnFolder;
+
+ static LexerModule *base;
+ static int nextLanguage;
public:
- LexerModule(int language_, LexerFunction fn_);
- static void Colourise(unsigned int startPos, int lengthDoc, int initStyle,
- int language, WordList *keywordlists[], Accessor &styler);
+ LexerModule(int language_, LexerFunction fnLexer_,
+ const char *languageName_=0, LexerFunction fnFolder_=0);
+ int GetLanguage() { return language; }
+ void Lex(unsigned int startPos, int lengthDoc, int initStyle,
+ WordList *keywordlists[], Accessor &styler);
+ void Fold(unsigned int startPos, int lengthDoc, int initStyle,
+ WordList *keywordlists[], Accessor &styler);
+ static LexerModule *Find(int language);
+ static LexerModule *Find(const char *languageName);
};
/**
diff --git a/include/SciLexer.h b/include/SciLexer.h
index 88e8b954b..9274b31de 100644
--- a/include/SciLexer.h
+++ b/include/SciLexer.h
@@ -35,6 +35,7 @@
#define SCLEX_PASCAL 18
#define SCLEX_AVE 19
#define SCLEX_ADA 20
+#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
diff --git a/include/Scintilla.h b/include/Scintilla.h
index fa1003ab4..54c02de47 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -411,6 +411,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_COLOURISE 4003
#define SCI_SETPROPERTY 4004
#define SCI_SETKEYWORDS 4005
+#define SCI_SETLEXERLANGUAGE 4006
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 97f183ffc..be9468184 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -1102,6 +1102,9 @@ set void SetProperty=4004(string key, string value)
# Set up the key words used by the lexer.
set void SetKeyWords=4005(int keywordSet, string keyWords)
+# Set the lexing language of the document based on string name.
+set void SetLexerLanguage=4006(, string language)
+
# Notifications
# Type of modification and the action which caused the modification
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
@@ -1174,6 +1177,9 @@ val SCLEX_CONF=17
val SCLEX_PASCAL=18
val SCLEX_AVE=19
val SCLEX_ADA=20
+# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
+# value assigned in sequence from SCLEX_AUTOMATIC+1.
+val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1