Example #1
0
class JavaNon(MappingRule):
    mapping = {
        "try catch":
        R(Text("try{}catch(Exception e){}"), rdescript="Java: Try Catch"),
        "deco override":
        R(Text("@Override"), rdescript="Java: Override Decorator"),
        "iterate and remove":
        R(Paste(
            "for (Iterator<TOKEN> iterator = TOKEN.iterator(); iterator.hasNext();) {\n\tString string = iterator.next();\nif (CONDITION) {\niterator.remove();\n}\n}"
        ),
          rdescript="Java: Iterate And Remove"),
        "string builder":
        R(Paste(
            "StringBuilder builder = new StringBuilder(); builder.append(orgStr); builder.deleteCharAt(orgStr.length()-1);"
        ),
          rdescript="Java: String Builder"),
    }

    ncextras = []
    ncdefaults = {}
Example #2
0
class EclipseCCR(MergeRule):
    pronunciation = "eclipse jump"

    mapping = {
        #Line Ops
        "configure":
        R(
            Paste(ec_con.analysis_chars) +
            Key("left:2/5, c-f/20, backslash, rbracket, enter") +
            Function(ec_con.analyze_for_configure)),
        "jump in [<n>]":
        R(
            Key("c-f, a-o") + Paste(r"[\(\[\{\<]") +
            Function(ec_con.regex_on) + Key("enter:%(n)d/5, escape, right")),
        "jump out [<n>]":
        R(
            Key("c-f, a-o") + Paste(r"[\)\] \}\>]") +
            Function(ec_con.regex_on) + Key("enter:%(n)d/5, escape, right")),
        "jump back [<n>]":
        R(
            Key("c-f/5, a-b") + Paste(r"[\)\]\}\>]") +
            Function(ec_con.regex_on) + Key("enter:%(n)d/5, escape, left")),
        "[go to] line <n>":
        R(
            Key("c-l") + Pause("50") + Text("%(n)d") + Key("enter") +
            Pause("50")),
        "shackle <n> [<back>]":
        R(
            Key("c-l") + Key("right, cs-left") +
            Function(ec_con.lines_relative)),
    }
    extras = [
        Dictation("text"),
        IntegerRefST("n", 1, 1000),
        Boolean("back"),
    ]
    defaults = {"n": 1, "back": False}
Example #3
0
File: dev.py Project: mrob95/caster
class Experimental(MappingRule):

    mapping = {
        # experimental/incomplete commands
        "experiment": Function(experiment),
        "short talk number <n2>": Text("%(n2)d"),
        #     "dredge [<id> <text>]":         Function(dredge),
        "test dragonfly paste": Paste("some text"),
    }
    extras = [
        Dictation("text"),
        Dictation("text2"),
        IntegerRefST("n2", 1, 100)
    ]
    defaults = {"text": "", "text2": ""}
Example #4
0
 def _process_recognition(self, node, extras):
     target = extras["target"]
     self._log.debug("%s: pasting target %s." % (self, target))
     Paste(target.target).execute()