Пример #1
0
 def createTrigger(self, matcherString, text, parameter):
     if matcherString == "{LINE ":
         return LineNumberTrigger(int(parameter))
     elif matcherString == "{INTERNAL " and self.internalExpressions.has_key(parameter):
         return self.makeRegexTrigger(parameter)
     elif matcherString ==  "{MATCH ":
         return MatchNumberTrigger(text, int(parameter))
     else:
         return plugins.TextTrigger(text)
Пример #2
0
 def __init__(self, args):
     argDict = self.parseArguments(args, [
         "old", "new", "file", "regexp", "argsReplacement",
         "includeShortcuts"
     ])
     tryAsRegexp = "regexp" not in argDict or argDict["regexp"] == "1"
     self.argsReplacement = "argsReplacement" in argDict and argDict[
         "argsReplacement"] == "1"
     self.oldText = argDict["old"].replace("\\n", "\n")
     self.newText = argDict["new"].replace("\\n", "\n")
     if self.newText.endswith("\n") and self.oldText.endswith("\n"):
         self.oldText = self.oldText.rstrip()
     self.newText = self.newText.rstrip()
     self.trigger = plugins.MultilineTextTrigger(
         self.oldText, tryAsRegexp,
         False) if not self.argsReplacement else plugins.TextTrigger(
             self.oldText, tryAsRegexp, False)
     self.newMultiLineText = self.newText.split("\n")
     self.stems = []
     fileStr = argDict.get("file")
     if fileStr:
         self.stems = plugins.commasplit(fileStr)
     self.includeShortcuts = "includeShortcuts" in argDict and argDict[
         "includeShortcuts"] == "1"
Пример #3
0
 def makeRegexTrigger(self, parameter):
     expression = self.getInternalExpression(parameter)
     return plugins.TextTrigger(expression)