aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_perl.lua
blob: 283a3fa3b38e9f82c17216daeaa950dc0c511817 (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
-- lite-xl 1.16
local syntax = require "core.syntax"

syntax.add {
  files = { "%.pm$", "%.pl$" },
  headers = "^#!.*[ /]perl",
  comment = "#",
  patterns = {
    { pattern = "%#.-\n",                 type = "comment"  },
    { pattern = { '"', '"', '\\' },       type = "string"   },
    { pattern = { "'", "'", '\\' },       type = "string"   },
    { pattern = { '/', '/', '\\' },       type = "string"   },
    { pattern = "%\\x[%da-fA-F]+",        type = "number"   },
    { pattern = "-?%d+[%d%.eE]*",         type = "number"   },
    { pattern = "-?%.?%d+",               type = "number"   },
    { pattern = "[%a_][%w_]*%f[(]",       type = "function" },
    { pattern = "[%@%$%*]+[%a_][%w_]*",   type = "keyword2" },
    { pattern = "[%a_][%w_]*",            type = "symbol"   },
  },
  symbols = {
    ["return"] = "keyword",
    ["if"] = "keyword",
    ["unless"] = "keyword",
    ["else"] = "keyword",
    ["elsif"] = "keyword",
    ["do"] = "keyword",
    ["for"] = "keyword",
    ["foreach"] = "keyword",
    ["while"] = "keyword",
    ["next"] = "keyword",
    ["last"] = "keyword",
    ["exit"] = "keyword",
    ["goto"] = "keyword",
    ["eval"] = "keyword",
    ["delete"] = "keyword",    
    ["exists"] = "keyword",
    
    ["use"] = "keyword",
    ["die"] = "keyword",
    ["require"] = "keyword",
    ["require_once"] = "keyword",
    ["new"] = "keyword",
    ["our"] = "keyword",
    ["my"] = "keyword",
    ["sub"] = "keyword",
    ["sub"] = "keyword",
    ["clone"] = "keyword",

    ["undef"] = "literal",
  },
}