1 package a
2
3 import (
4 . "github.com/alecthomas/chroma"
5 "github.com/alecthomas/chroma/lexers/internal"
6 )
7
8
9 var Apl = internal.Register(MustNewLazyLexer(
10 &Config{
11 Name: "APL",
12 Aliases: []string{"apl"},
13 Filenames: []string{"*.apl"},
14 MimeTypes: []string{},
15 },
16 aplRules,
17 ))
18
19 func aplRules() Rules {
20 return Rules{
21 "root": {
22 {`\s+`, Text, nil},
23 {`[⍝#].*$`, CommentSingle, nil},
24 {`\'((\'\')|[^\'])*\'`, LiteralStringSingle, nil},
25 {`"(("")|[^"])*"`, LiteralStringDouble, nil},
26 {`[⋄◇()]`, Punctuation, nil},
27 {`[\[\];]`, LiteralStringRegex, nil},
28 {`⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameFunction, nil},
29 {`[A-Za-zΔ∆⍙_][A-Za-zΔ∆⍙_¯0-9]*`, NameVariable, nil},
30 {`¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?`, LiteralNumber, nil},
31 {`[\.\\/⌿⍀¨⍣⍨⍠⍤∘⍥@⌺⌶⍢]`, NameAttribute, nil},
32 {`[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗⊆⍸]`, Operator, nil},
33 {`⍬`, NameConstant, nil},
34 {`[⎕⍞]`, NameVariableGlobal, nil},
35 {`[←→]`, KeywordDeclaration, nil},
36 {`[⍺⍵⍶⍹∇:]`, NameBuiltinPseudo, nil},
37 {`[{}]`, KeywordType, nil},
38 },
39 }
40 }
41
View as plain text