diff options
Diffstat (limited to 'scintilla/include')
-rw-r--r-- | scintilla/include/Face.py | 114 | ||||
-rw-r--r-- | scintilla/include/HFacer.py | 81 | ||||
-rw-r--r-- | scintilla/include/ILexer.h | 2 | ||||
-rw-r--r-- | scintilla/include/Platform.h | 6 |
4 files changed, 8 insertions, 195 deletions
diff --git a/scintilla/include/Face.py b/scintilla/include/Face.py deleted file mode 100644 index 2cf4b89..0000000 --- a/scintilla/include/Face.py +++ /dev/null @@ -1,114 +0,0 @@ -# Module for reading and parsing Scintilla.iface file
-
-def sanitiseLine(line):
- if line[-1:] == '\n': line = line[:-1]
- if line.find("##") != -1:
- line = line[:line.find("##")]
- line = line.strip()
- return line
-
-def decodeFunction(featureVal):
- retType, rest = featureVal.split(" ", 1)
- nameIdent, params = rest.split("(")
- name, value = nameIdent.split("=")
- params, rest = params.split(")")
- param1, param2 = params.split(",")
- return retType, name, value, param1, param2
-
-def decodeEvent(featureVal):
- retType, rest = featureVal.split(" ", 1)
- nameIdent, params = rest.split("(")
- name, value = nameIdent.split("=")
- return retType, name, value
-
-def decodeParam(p):
- param = p.strip()
- type = ""
- name = ""
- value = ""
- if " " in param:
- type, nv = param.split(" ")
- if "=" in nv:
- name, value = nv.split("=")
- else:
- name = nv
- return type, name, value
-
-class Face:
-
- def __init__(self):
- self.order = []
- self.features = {}
- self.values = {}
- self.events = {}
-
- def ReadFromFile(self, name):
- currentCategory = ""
- currentComment = []
- currentCommentFinished = 0
- file = open(name)
- for line in file.readlines():
- line = sanitiseLine(line)
- if line:
- if line[0] == "#":
- if line[1] == " ":
- if currentCommentFinished:
- currentComment = []
- currentCommentFinished = 0
- currentComment.append(line[2:])
- else:
- currentCommentFinished = 1
- featureType, featureVal = line.split(" ", 1)
- if featureType in ["fun", "get", "set"]:
- try:
- retType, name, value, param1, param2 = decodeFunction(featureVal)
- except ValueError:
- print("Failed to decode %s" % line)
- raise
- p1 = decodeParam(param1)
- p2 = decodeParam(param2)
- self.features[name] = {
- "FeatureType": featureType,
- "ReturnType": retType,
- "Value": value,
- "Param1Type": p1[0], "Param1Name": p1[1], "Param1Value": p1[2],
- "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2],
- "Category": currentCategory, "Comment": currentComment
- }
- if value in self.values:
- raise Exception("Duplicate value " + value + " " + name)
- self.values[value] = 1
- self.order.append(name)
- elif featureType == "evt":
- retType, name, value = decodeEvent(featureVal)
- self.features[name] = {
- "FeatureType": featureType,
- "ReturnType": retType,
- "Value": value,
- "Category": currentCategory, "Comment": currentComment
- }
- if value in self.events:
- raise Exception("Duplicate event " + value + " " + name)
- self.events[value] = 1
- self.order.append(name)
- elif featureType == "cat":
- currentCategory = featureVal
- elif featureType == "val":
- try:
- name, value = featureVal.split("=", 1)
- except ValueError:
- print("Failure %s" % featureVal)
- raise Exception()
- self.features[name] = {
- "FeatureType": featureType,
- "Category": currentCategory,
- "Value": value }
- self.order.append(name)
- elif featureType == "enu" or featureType == "lex":
- name, value = featureVal.split("=", 1)
- self.features[name] = {
- "FeatureType": featureType,
- "Category": currentCategory,
- "Value": value }
- self.order.append(name)
-
diff --git a/scintilla/include/HFacer.py b/scintilla/include/HFacer.py deleted file mode 100644 index 911b703..0000000 --- a/scintilla/include/HFacer.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python
-# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface
-# definition file.
-# The header files are copied to a temporary file apart from the section between a /* ++Autogenerated*/
-# comment and a /* --Autogenerated*/ comment which is generated by the printHFile and printLexHFile
-# functions. After the temporary file is created, it is copied back to the original file name.
-
-import sys
-import os
-import Face
-
-def Contains(s,sub):
- return s.find(sub) != -1
-
-def printLexHFile(f,out):
- for name in f.order:
- v = f.features[name]
- if v["FeatureType"] in ["val"]:
- if Contains(name, "SCE_") or Contains(name, "SCLEX_"):
- out.write("#define " + name + " " + v["Value"] + "\n")
-
-def printHFile(f,out):
- previousCategory = ""
- for name in f.order:
- v = f.features[name]
- if v["Category"] != "Deprecated":
- if v["Category"] == "Provisional" and previousCategory != "Provisional":
- out.write("#ifndef SCI_DISABLE_PROVISIONAL\n")
- previousCategory = v["Category"]
- if v["FeatureType"] in ["fun", "get", "set"]:
- featureDefineName = "SCI_" + name.upper()
- out.write("#define " + featureDefineName + " " + v["Value"] + "\n")
- elif v["FeatureType"] in ["evt"]:
- featureDefineName = "SCN_" + name.upper()
- out.write("#define " + featureDefineName + " " + v["Value"] + "\n")
- elif v["FeatureType"] in ["val"]:
- if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")):
- out.write("#define " + name + " " + v["Value"] + "\n")
- out.write("#endif\n")
-
-def CopyWithInsertion(input, output, genfn, definition):
- copying = 1
- for line in input.readlines():
- if copying:
- output.write(line)
- if Contains(line, "/* ++Autogenerated"):
- copying = 0
- genfn(definition, output)
- if Contains(line, "/* --Autogenerated"):
- copying = 1
- output.write(line)
-
-def contents(filename):
- f = open(filename)
- t = f.read()
- f.close()
- return t
-
-def Regenerate(filename, genfn, definition):
- inText = contents(filename)
- tempname = "HFacer.tmp"
- out = open(tempname,"w")
- hfile = open(filename)
- CopyWithInsertion(hfile, out, genfn, definition)
- out.close()
- hfile.close()
- outText = contents(tempname)
- if inText == outText:
- os.unlink(tempname)
- else:
- os.unlink(filename)
- os.rename(tempname, filename)
-
-f = Face.Face()
-try:
- f.ReadFromFile("Scintilla.iface")
- Regenerate("Scintilla.h", printHFile, f)
- Regenerate("SciLexer.h", printLexHFile, f)
- print("Maximum ID is %s" % max([x for x in f.values if int(x) < 3000]))
-except:
- raise
diff --git a/scintilla/include/ILexer.h b/scintilla/include/ILexer.h index 795a7d7..5b6ed6f 100644 --- a/scintilla/include/ILexer.h +++ b/scintilla/include/ILexer.h @@ -48,6 +48,8 @@ public: 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;
};
enum { lvOriginal=0, lvSubStyles=1 };
diff --git a/scintilla/include/Platform.h b/scintilla/include/Platform.h index 2769a9f..6103301 100644 --- a/scintilla/include/Platform.h +++ b/scintilla/include/Platform.h @@ -13,6 +13,7 @@ // PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32
// PLAT_WIN = Win32 API on Win32 OS
// PLAT_WX is wxWindows on any supported platform
+// PLAT_TK = Tcl/TK on Linux or Win32
#define PLAT_GTK 0
#define PLAT_GTK_WIN32 0
@@ -23,6 +24,7 @@ #define PLAT_QT 0
#define PLAT_FOX 0
#define PLAT_CURSES 0
+#define PLAT_TK 0
#if defined(FOX)
#undef PLAT_FOX
@@ -40,6 +42,10 @@ #undef PLAT_QT
#define PLAT_QT 1
+#elif defined(TK)
+#undef PLAT_TK
+#define PLAT_TK 1
+
#elif defined(GTK)
#undef PLAT_GTK
#define PLAT_GTK 1
|