aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_c7.lua
blob: 2c3e2fccc5675e8a0667fffd13b0b1290cbf2802 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
-- mod-version:3
local syntax = require "core.syntax"

syntax.add {
  name = "cel7",
  files = "%.c7$",
  comment = ";",
  patterns = {
    { pattern = ";.*",                type = "comment"  },
    { pattern = { '"', '"', '\\' },   type = "string"   },
    { pattern = "0x4000",             type = "literal"  },
    { pattern = "0x4040",             type = "literal"  },
    { pattern = "0x52a0",             type = "literal"  },
    { pattern = "0x[%da-fA-F]+",      type = "number"   },
    { pattern = "-?%d+[%d%.]*",       type = "number"   },
    { pattern = "-?%.?%d+",           type = "number"   },
    { pattern = "'",                  type = "symbol"   },
    { pattern = "=",                  type = "symbol"   },
    { pattern = "<=?",                type = "symbol"   },
    { pattern = "[%+-%*/]",           type = "symbol"   },
    { pattern = "//",                 type = "keyword2" },
    { pattern = "%%",                 type = "keyword2" },
    { pattern = "%f[^(][^()'%s\"]+",  type = "function" },
    { pattern = "[^()'%s\"]+",        type = "symbol"   },
  },
  symbols = {
    ["let"]    = "keyword",
    ["="]      = "operator",
    ["if"]     = "keyword",
    ["fn"]     = "keyword",
    ["mac"]    = "keyword",
    ["while"]  = "keyword",
    ["quote"]  = "keyword",
    ["'"]      = "keyword",
    ["and"]    = "keyword",
    ["or"]     = "keyword",
    ["do"]     = "keyword",
    ["cons"]   = "keyword",
    ["car"]    = "keyword",
    ["cdr"]    = "keyword",
    ["setcar"] = "keyword",
    ["setcdr"] = "keyword",
    ["list"]   = "keyword",
    ["not"]    = "keyword",
    ["is"]     = "keyword",
    ["atom"]   = "keyword",
    ["print"]  = "keyword",
    ["<"]      = "operator",
    ["<="]     = "operator",
    ["="]      = "operator",
    ["+"]      = "operator",
    ["-"]      = "operator",
    ["*"]      = "operator",
    ["/"]      = "operator",
    ["nil"]    = "literal",
    ["t"]      = "literal",

    -- reserved variables (config)
    ["title"]  = "keyword2",
    ["width"]  = "keyword2",
    ["height"] = "keyword2",
    ["debug"]  = "keyword2",

    -- callbacks
    ["init"]    = "keyword2",
    ["step"]    = "keyword2",
    ["keydown"] = "keyword2",
    ["keyup"]   = "keyword2",

    -- built-in functions
    ["quit"]  = "keyword2",
    ["rand"]  = "keyword2",
    ["poke"]  = "keyword2",
    ["peek"]  = "keyword2",
    ["color"] = "keyword2",
    ["put"]   = "keyword2",
    ["get"]   = "keyword2",
    ["fill"]  = "keyword2",
  }
}