aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/StyleContext.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-09-02 04:30:33 +0000
committernyamatongwe <unknown>2001-09-02 04:30:33 +0000
commitee01fdd6af5c9c020841a8853dcf79dedc05536f (patch)
treed4f8d789ad3caa8a1102a09ea421d4c9b1d3c20f /src/StyleContext.cxx
parent0d238afb884e070519d07c203dcec786bf4b848f (diff)
downloadscintilla-mirror-ee01fdd6af5c9c020841a8853dcf79dedc05536f.tar.gz
Moved StyleContext (previously called ColouriseContext) from LexCPP and
LexEiffel into own files.
Diffstat (limited to 'src/StyleContext.cxx')
-rw-r--r--src/StyleContext.cxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/StyleContext.cxx b/src/StyleContext.cxx
new file mode 100644
index 000000000..bdae28196
--- /dev/null
+++ b/src/StyleContext.cxx
@@ -0,0 +1,51 @@
+// Scintilla source code edit control
+/** @file StyleContext.cxx
+ ** Lexer infrastructure.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
+// This file is in the public domain.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+
+static void getRange(unsigned int start,
+ unsigned int end,
+ Accessor &styler,
+ char *s,
+ unsigned int len) {
+ unsigned int i = 0;
+ while ((i < end - start + 1) && (i < len-1)) {
+ s[i] = styler[start + i];
+ i++;
+ }
+ s[i] = '\0';
+}
+
+void StyleContext::GetCurrent(char *s, int len) {
+ getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+}
+
+static void getRangeLowered(unsigned int start,
+ unsigned int end,
+ Accessor &styler,
+ char *s,
+ unsigned int len) {
+ unsigned int i = 0;
+ while ((i < end - start + 1) && (i < len-1)) {
+ s[i] = static_cast<char>(tolower(styler[start + i]));
+ i++;
+ }
+ s[i] = '\0';
+}
+
+void StyleContext::GetCurrentLowered(char *s, int len) {
+ getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+}