aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/KeyWords.h23
-rw-r--r--include/PropSet.h89
-rw-r--r--include/WindowAccessor.h5
3 files changed, 31 insertions, 86 deletions
diff --git a/include/KeyWords.h b/include/KeyWords.h
index 6abae5945..5593b7d09 100644
--- a/include/KeyWords.h
+++ b/include/KeyWords.h
@@ -9,6 +9,29 @@
namespace Scintilla {
#endif
+/**
+ */
+class WordList {
+public:
+ // Each word contains at least one character - a empty word acts as sentinel at the end.
+ char **words;
+ char *list;
+ int len;
+ bool onlyLineEnds; ///< Delimited by any white space or only line ends
+ bool sorted;
+ int starts[256];
+ WordList(bool onlyLineEnds_ = false) :
+ words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
+ sorted(false)
+ {}
+ ~WordList() { Clear(); }
+ operator bool() { return len ? true : false; }
+ void Clear();
+ void Set(const char *s);
+ bool InList(const char *s);
+ bool InListAbbreviated(const char *s, const char marker);
+};
+
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
diff --git a/include/PropSet.h b/include/PropSet.h
index 91bc7072b..bb24e2ac4 100644
--- a/include/PropSet.h
+++ b/include/PropSet.h
@@ -1,104 +1,25 @@
// Scintilla source code edit control
/** @file PropSet.h
- ** A Java style properties file module.
+ ** An interface to the methods needed for access to property sets inside lexers.
**/
-// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
+// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PROPSET_H
#define PROPSET_H
-#include "SString.h"
-
-bool EqualCaseInsensitive(const char *a, const char *b);
-
-bool isprefix(const char *target, const char *prefix);
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
-struct Property {
- unsigned int hash;
- char *key;
- char *val;
- Property *next;
- Property() : hash(0), key(0), val(0), next(0) {}
-};
-
-/**
- */
-class PropSet {
-protected:
- enum { hashRoots=31 };
- Property *props[hashRoots];
- Property *enumnext;
- int enumhash;
- static unsigned int HashString(const char *s, size_t len) {
- unsigned int ret = 0;
- while (len--) {
- ret <<= 4;
- ret ^= *s;
- s++;
- }
- return ret;
- }
-
+class PropertyGet {
public:
- PropSet *superPS;
- PropSet();
- ~PropSet();
- void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1);
- void Set(const char *keyVal);
- void Unset(const char *key, int lenKey=-1);
- void SetMultiple(const char *s);
- SString Get(const char *key) const;
- SString GetExpanded(const char *key) const;
- SString Expand(const char *withVars, int maxExpands=100) const;
- int GetInt(const char *key, int defaultValue=0) const;
- void Clear();
- char *ToString() const; // Caller must delete[] the return value
-
-private:
- // copy-value semantics not implemented
- PropSet(const PropSet &copy);
- void operator=(const PropSet &assign);
+ virtual char *ToString() const=0; // Caller must delete[] the return value
+ virtual int GetInt(const char *key, int defaultValue=0) const=0;
};
-/**
- */
-class WordList {
-public:
- // Each word contains at least one character - a empty word acts as sentinel at the end.
- char **words;
- char *list;
- int len;
- bool onlyLineEnds; ///< Delimited by any white space or only line ends
- bool sorted;
- int starts[256];
- WordList(bool onlyLineEnds_ = false) :
- words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
- sorted(false)
- {}
- ~WordList() { Clear(); }
- operator bool() { return len ? true : false; }
- void Clear();
- void Set(const char *s);
- bool InList(const char *s);
- bool InListAbbreviated(const char *s, const char marker);
-};
-
-inline bool IsAlphabetic(unsigned int ch) {
- return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
-}
-
#ifdef SCI_NAMESPACE
}
#endif
-#ifdef _MSC_VER
-// Visual C++ doesn't like the private copy idiom for disabling
-// the default copy constructor and operator=, but it's fine.
-#pragma warning(disable: 4511 4512)
-#endif
-
#endif
diff --git a/include/WindowAccessor.h b/include/WindowAccessor.h
index e107a0659..6f265f658 100644
--- a/include/WindowAccessor.h
+++ b/include/WindowAccessor.h
@@ -12,13 +12,14 @@ namespace Scintilla {
/**
*/
+
class WindowAccessor : public Accessor {
// Private so WindowAccessor objects can not be copied
WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
WindowAccessor &operator=(const WindowAccessor &) { return *this; }
protected:
WindowID id;
- PropSet &props;
+ PropertyGet &props;
int lenDoc;
char styleBuf[bufferSize];
@@ -30,7 +31,7 @@ protected:
bool InternalIsLeadByte(char ch);
void Fill(int position);
public:
- WindowAccessor(WindowID id_, PropSet &props_) :
+ WindowAccessor(WindowID id_, PropertyGet &props_) :
Accessor(), id(id_), props(props_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
}