コード例 #1
0
ファイル: Python.py プロジェクト: sboosali/mandimus
from rules.emacs.Keywords import KeywordRule

import keyword

_mapping = {
    "align hash": Cmd("(align-dict)"),
    "align list": Cmd("(align-list)"),
    "mark block": Cmd("(er/mark-python-block)"),
    "mark state": Cmd("(er/mark-python-statement)"),
    "send funk": Key("ca-x"),
    "send buff": Key("c-c,c-c"),
    "send region": Key("c-c,c-r"),
    "interpreter": Key("c-c,c-z"),
}

PythonRule = makeContextualRule("Python", _mapping, emacsExtras, emacsDefaults)
PythonRule.context.addRequirement(IsEmacs)
PythonRule.context.addRequirement(
    ModeRequirement(modes=["python-mode", "inferior-python-mode"]))

keywords = [
    "True", "False", "set", "list", "dict", "None", "self", "print", "object",
    "len", "reversed", "enumerate", "range", ["__init__", "init"], "help",
    "type", ["__name__", "name"], ["str", "stir"],
    "unicode", "dir", "all", "any", ["isinstance", "is instance"],
    ["int", "integer"], "bool", "float", "nonlocal"
] + keyword.kwlist

PythonKeywordRule = KeywordRule(["python-mode", "inferior-python-mode"],
                                keywords)
コード例 #2
0
    ["uint64_t", "unsigned 64"],
    ["__PRETTY_FUNCTION__", "pretty"],
    ["__LINE__", "line"],
    ["cout", "see out"],
    ["cerr", "see air"],
    "iterator",
    "const_iterator",
    ["std::size_t", "size T"],
    ["#else", "pound else"],
    "NULL",

    # boost
    ["bxxst", "boost"],
    "optional",
]

types = [
    "deque"
    "map",
    "multimap",
    "pair",
    "set",
    ["unique_ptr", "unique pointer"],
    ["unordered_map", "unordered map"],
    "vector",
]

# not sure why but having the modes be a list without naming the rule
# causes Dragon to stop being able to recognize anything as soon as I enter a C/C++ buffer!
CppKeywordRule = KeywordRule(["c++-mode", "c-mode"], keywords + types, "c_common")
コード例 #3
0
ファイル: Shell.py プロジェクト: sboosali/mandimus
    "unsetopt",
    ["/usr/bin/", "user bin"],
    "up",
    "valgrind",
    "wait",
    ["wc", "word count"],
    "which",
    "while",
    ["xargs", "X args"],
    ["zsh", "Z shell"],
    "crontab",
    "sleep",
    "time",
    [">", "stood out"],
    ["2>", "stood err"],
    ["&>", "stood both"],
]

ShellKeywordRule = KeywordRule(["shell-mode", "sh-mode"], _keywords)

_mapping = {
    "back [<i>]": Key("b,enter") * Repeat(extra="i"),
    "forward [<i>]": Key("f,enter") * Repeat(extra="i"),
    "surface [<i>]": (EmacsText("up") + Key("enter")) * Repeat(extra="i"),
}

ShellRule = makeContextualRule("Shell", _mapping, emacsExtras, emacsDefaults)
ShellRule.context.addRequirement(IsEmacs)
ShellRule.context.addRequirement(
    ModeRequirement(modes=["shell-mode", "sh-mode"]))
コード例 #4
0
ファイル: Rust.py プロジェクト: jgarvin/mandimus
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd
from rules.emacs.Keywords import KeywordRule

keywords = [["fn", "function"], ["println!",
                                 "print"], ["std",
                                            "stood"], "as", "break", "const",
            "continue", "crate", "dyn", "else", "enum", "extern", "false",
            "for", "if", "impl", "in", "let", "loop", "match", "mod", "move",
            "mut", "pub", "ref", "return", "self", "static", "struct", "super",
            "trait", "true", "type", "unsafe", "use", "where", "while",
            ["i8", "signed 8"], ["i16", "signed 16"], ["i32", "signed 32"],
            ["i64", "signed 64"], ["isize",
                                   "signed size"], ["u8", "unsigned 8"],
            ["u16", "unsigned 16"], ["u32", "unsigned 32"],
            ["u64", "unsigned 64"], ["usize",
                                     "unsigned size"], ["f32", "float 32"],
            ["f64",
             "float 64"], "bool", "true", "false", "char", ["Cell", "cell"],
            ["RefCell",
             "ref cell"], "Arc", "Weak", ["Rc",
                                          "R C"], ["HashMap", "hash map"],
            ["HashSet", "hash set"], "Vec", "Box", "Default", "Debug", "Clone",
            "Send", "Sync", "Sized", "ident", "pat", ["expr", "exper"],
            ["stmt", "statement"], "Mutex", "Pin", "Unpin", "String",
            ["str", "stir"], ["panic!",
                              "panic"], ["Ok", "O K"], "Err", "Some", "None"]

RustKeywordRule = KeywordRule("rust-mode", keywords)
コード例 #5
0
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd
from rules.emacs.Keywords import KeywordRule

keywords = [
    "always", "end", "ifnone", "or", "rpmos", "tranif1", "and", "endcase",
    "initial", "output", "rtran", "tri", "assign", "endmodule", "inout",
    "parameter", "rtranif0", "tri0", "begin", "endfunction", "input", "pmos",
    "rtranif1", "tri1", "buf", "endprimitive", "integer", "posedge",
    "scalared", "triand", "bufif0", "endspecify", "join", "primitive", "small",
    "trior", "bufif1", "endtable", "large", "pull0", "specify", "trireg",
    "case", "endtask", "macromodule", "pull1", "specparam", "vectored",
    "casex", "event", "medium", "pullup", "strong0", "wait", "casez", "for",
    "module", "pulldown", "strong1", "wand", "cmos", "force", "nand", "rcmos",
    "supply0", "weak0", "deassign", "forever", "negedge", "real", "supply1",
    "weak1", "default", "for", "nmos", "realtime", "table", "while",
    "defparam", "function", "nor", "reg", "task", "wire", "disable", "highz0",
    "not", "release", "time", "wor", "edge", "highz1", "notif0", "repeat",
    "tran", "xnor", "else", "if", "notif1", "rnmos", "tranif0", "xor"
]
#
VerilogKeywordRule = KeywordRule(["verilog-mode"], keywords)

_mapping = {}

VerilogRule = makeContextualRule("verilog", _mapping, emacsExtras,
                                 emacsDefaults)
VerilogRule.context.addRequirement(IsEmacs)
VerilogRule.context.addRequirement(ModeRequirement(modes=["verilog-mode"]))
コード例 #6
0
ファイル: Eshell.py プロジェクト: sboosali/mandimus
    "up",
    "valgrind",
    "wait",
    ["wc", "word count"],
    "which",
    "while",
    ["xargs", "X args"],
    ["zsh", "Z shell"],
    "crontab",
    "sleep",
    [">", "stood out"],
    ["2>", "stood err"],
    ["&>", "stood both"],
]

EShellKeywordRule = KeywordRule(["eshell-mode"], _keywords)

_mapping = {
    "back [<i>]": Key("b,enter") * Repeat(extra="i"),
    "forward [<i>]": Key("f,enter") * Repeat(extra="i"),
    "surface [<i>]": (EmacsText("up") + Key("enter")) * Repeat(extra="i"),
    "history": Key("a-r"),
    "interrupt": Key("c-c,c-c"),
    "prompt up [<n>]": Key("c-c,c-p:%(n)d"),
    "prompt down [<n>]": Key("c-c,c-n:%(n)d"),
}

EShellRule = makeContextualRule("Shell", _mapping, emacsExtras, emacsDefaults)
EShellRule.context.addRequirement(IsEmacs)
EShellRule.context.addRequirement(ModeRequirement(modes=["eshell-mode"]))
コード例 #7
0
    "save-restriction",
    "set",
    "setcar",
    "set-window-point",
    "set-marker",
    ["setf", "set F"],
    ["setq", "set Q"],
    ["setq-default", "set Q default"],
    "split-string",
    ["string=", "string equal"],
    "string-match",
    "sort",
    "subseq",
    "thing-at-point",
    "time-add",
    "throw",
    "track-mouse",
    "unless",
    "unwind-protect",
    "user-error",
    "window-start",
    "window-end",
    "with-current-buffer",
    "with-selected-frame",
    "with-selected-window",
    "when",
    "while",
]

LispKeywordRule = KeywordRule(["emacs-lisp-mode", "eshell-mode"], keywords)
コード例 #8
0
from Actions import Key
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd
from rules.emacs.Keywords import KeywordRule

keywords = [
    "say", "Any", "Cool", ["Str", "stir"], ["Int", "integer"],
    ["Rat", "rational"], "bool", "True", "False", "Nil", "if",
    ["elsif", "else if"], "else", "my", "unless", "with", "without", "for",
    "given", "when", "default", "proceed", "loop", "print", "get", "prompt",
    "run", "shell", "slurp", "spurt", "role", "sub", "put", "note",
    ["dd", "Dee Dee"], "open", "multi", "return", "class", "has", "method",
    ["readonly", "read only"], "is", "submethod", "does", "CATCH", "WHAT",
    "HOW", "try", "die", "regex", "await", "race", "hyper", "start", "so",
    "copy", "next", "redo", "last", ["eq", "E Q"], ["nq", "N Q"],
    ["eqv", "equivalent"], ["$_", "topic"], "do", "gather", "where", "BUILD",
    "CONTROL", "module", "unit", "grammar", "our", "constant", "state",
    ["BEGIN", "begin"], ["CHECK", "check"], ["INIT", "init"], ["END", "end"],
    ["PRE", "pre"], ["POST", "post"], ["COMPOSE", "compose"], ["KEEP", "keep"],
    ["UNDO", "undo"], "take", "eager", "sink", "prefix", "postfix", "infix",
    "circumfix", "postcircumfix", "leg", "before", "after", "set", "augment",
    "but", "supersede", "temp", "let", ["SetHash", "set hash"], "dir",
    ["chdir", "change dir"], "use", "self", "also"
]

P6KeywordRule = KeywordRule("perl6-mode", keywords)
コード例 #9
0
ファイル: Sql.py プロジェクト: sboosali/mandimus
keywords = [
    ["SELECT", "select"],
    ["FROM", "from"],
    ["ORDER BY", "order by"],
    ["DESC", "descending"],
    ["ASC", "ascending"],
    ["GROUP BY", "group by"],
    ["LIMIT", "limit"],
    ["WHERE", "where"],
    ["JOIN", "join"],
    ["MERGE", "merge"],
    ["COUNT", "count"],
    ["INSERT", "insert"],
    ["INTO", "INTO"],
    ["DISTINCT", "distinct"],
]

SqlKeywordRule = KeywordRule(["sql-mode", "sql-interactive-mode"], keywords)

_mapping = {
    "history": Key("a-r"),
    "interrupt": Key("c-c,c-c"),
    "exit": Key("c-d"),
    "prompt up [<n>]": Key("c-c,c-p:%(n)d"),
    "prompt down [<n>]": Key("c-c,c-n:%(n)d"),
}

SqlRule = makeContextualRule("Sql", _mapping, emacsExtras, emacsDefaults)
SqlRule.context.addRequirement(IsEmacs)
SqlRule.context.addRequirement(ModeRequirement(modes="sql-interactive-mode"))
コード例 #10
0
ファイル: Vhdl.py プロジェクト: jgarvin/mandimus
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd
from rules.emacs.Keywords import KeywordRule

keywords = [
    "abs", "access", "after", "alias", "all", "and", "architecture", "array",
    "assert", "attribute", "begin", "block", "body", "buffer", "bus", "case",
    "component", "configuration", "constant", "disconnect", "downto", "else",
    "elsif", "end", "entity", "exit", "file", "for", "function", "generate",
    "generic", "group", "guarded", "if", "impure", "in", "inertial", "inout",
    "is", "label", "library", "linkage", "literal", "loop", "map", "mod",
    "nand", "new", "next", "nor", "not", "null", "of", "on", "open", "or",
    "others", "out", "package", "port", "postponed", "procedure", "process",
    "pure", "range", "record", "register", "reject", "rem", "report", "return",
    "rol", "ror", "select", "severity", "signal", "shared", "sla", "sll",
    "sra", "srl", "subtype", "then", "to", "transport", "type", "unaffected",
    "units", "until", "use", "variable", "wait", "when", "while", "with",
    "xnor", "xor", ["std_logic", "stood logic"],
    ["std_logic_vector", "stood logic vector"], "unsigned"
]
#
VhdlKeywordRule = KeywordRule(["vhdl-mode"], keywords)

_mapping = {}

VhdlRule = makeContextualRule("vhdl", _mapping, emacsExtras, emacsDefaults)
VhdlRule.context.addRequirement(IsEmacs)
VhdlRule.context.addRequirement(ModeRequirement(modes=["vhdl-mode"]))
コード例 #11
0
ファイル: GnuDebugger.py プロジェクト: sboosali/mandimus
    "stop",
    "thread apply all",
    "thread apply",
    "thread",
    "until",
    "watch",
    "where",
    ["awatch", "access watch"],
    ["nexti", "next instruction"],
    ["nopass", "no pass"],
    ["noprint", "no print"],
    ["nostop", "no stop"],
    ["rbreak", "regex break"],
    ["rwatch", "read watch"],
    ["stepi", "step instruction"],
    ["tbreak", "one-shot break"],
]

IsDebugWindow = VarRequirement(
    r'(string-match-p "\\*\\(gud\\|gdb\\).*" (buffer-name))',
    0,
    useFocus=True,
    useTimer=False)
IsDebugTrackWindow = VarRequirement(r'realgud-track-mode',
                                    't',
                                    useFocus=True,
                                    useTimer=False)
#GnuDebuggerKeywordRule = KeywordRule([OrRequirement([IsDebugWindow, IsDebugTrackWindow])], keywords, "GnuDebuggerKeyword")
GnuDebuggerKeywordRule = KeywordRule([IsDebugTrackWindow], keywords,
                                     "GnuDebuggerKeyword")
コード例 #12
0
ファイル: Racket.py プロジェクト: sboosali/mandimus
    "when",
    ["add1", "add one"],
    ["cdr", "could-er"],
    ["let*", "let star"],
    ["let*-values", "let star values"],
    ["require/typed", "typed require"],
    ["set!", "set"],
    "raise",
    "String",
    "unless",
    ["s-exp", "sexp"],
    ["#%%module-begin", "module begin"],
    "this",
]

RacketKeywordRule = KeywordRule(["racket-mode", "racket-repl-mode"], keywords)

_mapping = {
    "send buff": Key("c-c,c-c"),
    "send region": Key("c-c,c-r"),
    "interpreter": Key("c-c,c-z"),
    "help racket": Key("c-c,c-d"),
    "macro expand": Key("c-c,c-e,e"),
    "macro again": Key("c-c,c-e,a"),
    "macro region": Key("c-c,c-e,r"),
    "macro definition": Key("c-c,c-e,x"),
}

RacketRule = makeContextualRule("Racket", _mapping, emacsExtras, emacsDefaults)
RacketRule.context.addRequirement(IsEmacs)
RacketRule.context.addRequirement(
コード例 #13
0
JuliaRule.context.addRequirement(IsEmacs)
JuliaRule.context.addRequirement(
    ModeRequirement(modes=["julia-mode", "inferior-julia-mode"]))

keywords = [
    "if", "else", "elseif", "while", "for", "begin", "end", "quote", "try",
    "catch", "return", "local", "function", "macro", "ccall", "finally",
    "break", "continue", "global", "where", "module", "using", "import",
    "export", "const", "let", "do", "in", "baremodule", "importall",
    "immutable", "type", "bitstype", "abstract", "typealias", "primitive ",
    "struct", "mutable", "Number", "Real", "BigInt", "Integer", "UInt",
    "UInt8", "UInt16", "UInt32", "UInt64", "UInt128", "Int", "Int8", "Int16",
    "Int32", "Int64", "Int128", "BigFloat", "AbstractFloat", "Float16",
    "Float32", "Float64", "Complex128", "Complex64", "Bool", "Cuchar",
    "Cshort", "Cushort", "Cint", "Cuint", "Clonglong", "Culonglong",
    "Cintmax_t", "Cuintmax_t", "Cfloat", "Cdouble", "Cptrdiff_t", "Cssize_t",
    "Csize_t", "Cchar", "Clong", "Culong", "Cwchar_t", "Char", "String",
    "SubString", "Array", "DArray", "AbstractArray", "AbstractVector",
    "AbstractMatrix", "AbstractSparseMatrix", "SubArray", "StridedArray",
    "StridedVector", "StridedMatrix", "VecOrMat", "StridedVecOrMat",
    "DenseArray", "SparseMatrixCSC", "BitArray", "Range", "OrdinalRange",
    "StepRange", "UnitRange", "FloatRange", "Tuple", "NTuple", "Vararg",
    "DataType", "Symbol", "Function", "Vector", "Matrix", "Union", "Type",
    "Any", "Complex", "AbstractString", "Ptr", "Void", "Exception", "Task",
    "Signed", "Unsigned", "Associative", "Dict", "IO", "IOStream", "Rational",
    "Regex", "RegexMatch", "Set", "IntSet", "Expr", "WeakRef", "ObjectIdDict",
    "AbstractRNG", "MersenneTwister"
]

JuliaKeywordRule = KeywordRule(["julia-mode", "inferior-julia-mode"], keywords)