aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib/StyleContext.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-07-13 21:19:35 +1000
committernyamatongwe <unknown>2010-07-13 21:19:35 +1000
commit27a22f2c85e3aa0f540c61a0a245a0d759e706a9 (patch)
treee69648f44945cb552d86607c4899b9d1566155bb /lexlib/StyleContext.cxx
parentfd7c21165bbc5200aa24ef89560a8bb40fd37255 (diff)
downloadscintilla-mirror-27a22f2c85e3aa0f540c61a0a245a0d759e706a9.tar.gz
Creating lexlib with lexer support files.
Diffstat (limited to 'lexlib/StyleContext.cxx')
-rw-r--r--lexlib/StyleContext.cxx55
1 files changed, 55 insertions, 0 deletions
diff --git a/lexlib/StyleContext.cxx b/lexlib/StyleContext.cxx
new file mode 100644
index 000000000..4a1f71622
--- /dev/null
+++ b/lexlib/StyleContext.cxx
@@ -0,0 +1,55 @@
+// Scintilla source code edit control
+/** @file StyleContext.cxx
+ ** Lexer infrastructure.
+ **/
+// Copyright 1998-2004 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"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+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, unsigned 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, unsigned int len) {
+ getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+}