Переглянути джерело

update to use injection and add dependency

Karathan 6 роки тому
джерело
коміт
65b3ebc526
Підписано: Karathan <philipp@karathan.at> Ідентифікатор GPG ключа: C9A4764515931448
2 змінених файлів з 9 додано та 112 видалено
  1. 6
    10
      package.json
  2. 3
    102
      syntaxes/pokescript.json

+ 6
- 10
package.json Переглянути файл

@@ -3,30 +3,26 @@
3 3
     "displayName": "PokéScript",
4 4
     "description": "PokéScript Language Support",
5 5
     "version": "0.0.1",
6
-    "publisher": "SBird1337",
6
+    "publisher": "karathan",
7 7
     "engines": {
8 8
         "vscode": "^1.25.0"
9 9
     },
10 10
     "categories": [
11 11
         "Other"
12 12
     ],
13
+    "extensionDependencies": [
14
+        "dan-c-underwood.arm"
15
+    ],
13 16
     "activationEvents": [
14 17
         "onCommand:extension.sayHello"
15 18
     ],
16 19
     "main": "./out/extension",
17 20
     "contributes": {
18
-        "languages":[
19
-            {
20
-                "id": "pokescript",
21
-                "extensions": [".s", ".S", ".asm", ".rbc"],
22
-                "aliases": ["Pokéscript", "Pokescript", "pokescript"]
23
-            }
24
-        ],
25 21
         "grammars":[
26 22
             {
27
-                "language": "pokescript",
28 23
                 "scopeName": "source.arm.pokescript",
29
-                "path": "./syntaxes/pokescript.json"
24
+                "path": "./syntaxes/pokescript.json",
25
+                "injectTo": [ "source.arm" ]
30 26
             }
31 27
         ],
32 28
         "commands": [

+ 3
- 102
syntaxes/pokescript.json Переглянути файл

@@ -4,108 +4,9 @@
4 4
     "fileTypes": [
5 5
         ".s", ".S", ".asm", ".rbc"
6 6
     ],
7
+    "injectionSelector": "L:source",
7 8
     "patterns": [
8 9
         {
9
-            "match": "([;@]|//).*$",
10
-            "name": "comment.arm"
11
-        },
12
-        {
13
-            "name": "comment.arm",
14
-            "begin": "\\/\\*",
15
-            "beginCaptures": {
16
-            "0": {
17
-                    "name": "comment.begin.arm"
18
-                }
19
-            },
20
-            "endCaptures": {
21
-            "0": {
22
-                "name": "comment.end.arm"
23
-                }
24
-            },
25
-            "end": "\\*\\/"
26
-        },
27
-        {
28
-            "match": "^\\s*\\.?\\w+:\\s*(?=$|;)",
29
-            "name": "routine.arm"
30
-        },
31
-        {
32
-            "name": "invalid.illegal.string.arm",
33
-            "match": "\"[^\"]+$"
34
-        },
35
-        {
36
-            "name": "string.quoted.arm",
37
-            "begin": "\"",
38
-            "end": "\""
39
-        },
40
-        {
41
-            "match": "\\'\\S\\'",
42
-            "name": "string.char.arm"
43
-        },
44
-        {
45
-            "match": "#?[0-9]+\\b",
46
-            "name": "constant.numeric.dec.arm"
47
-        },
48
-        {
49
-            "match": "#-?[a-zA-Z_][0-9a-zA-Z_]*\\b",
50
-            "name": "variable.named.arm"
51
-        },
52
-        {
53
-            "match": "#?-?(0x|&)[0-9a-fA-F_]+\\b",
54
-            "name": "constant.numeric.hex.arm"
55
-        },
56
-        {
57
-            "match": "\\b(?i)([rcp]([0-9]|1[0-5])|[xw]([0-9]|1[0-5]|2[0-5]|30)|wzr|xzr|wsp|fpsr|fpcr|a[1-4]|v[1-8]|sl|sb|fp|ip|sp|lr|(c|s)psr(_c)?|pc|[sd]3[0-1]|[sd][12][0-9]|[sd][0-9]|fpsid|fpscr|fpexc|q3[0-1]|q2[0-9]|q1[0-9]|q[0-9]|APSR_nzcv|sy)(?-i)(!|\\b)",
58
-            "name": "storage.other.register.arm"
59
-        },
60
-        {
61
-            "name": "storage.memaddress.arm",
62
-            "begin": "\\[",
63
-            "end": "\\]",
64
-            "patterns": [
65
-            {
66
-                "include": "$base"
67
-            }
68
-            ]
69
-        },
70
-        {
71
-            "name": "storage.stack.arm",
72
-            "begin": "\\{",
73
-            "end": "\\}\\^?",
74
-            "patterns": [
75
-            {
76
-                "include": "$base"
77
-            }
78
-            ]
79
-        },
80
-        {
81
-            "match": "\\b(?i)(v?(add|cvt|sub|mov|trn|cmp|div|qdmulh|mrs|mul|ld1|qadd|qshrun|st[1234]|addw|mull|mlal|rshrn|swp|qmovunand|m(rs|sr)|eor|sub|rsb|adc|sbc|rsc|and|tst|teq|cmp|cmn|orr|mov|bic|mvn|neg|lsr|lsl|ror|asr)s?|mul|mla|mull|smlabb|mov(w|t)|rev(8|16)?|pld|adr|adrl|vswp)(ne|eq|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|lt|le|gt|ge|al)?(?-i)\\b",
82
-            "name": "support.mnemonic.arithmetic.arm"
83
-        },
84
-        {
85
-            "match": "\\b(?i)(swi|svc|wfi|dmb|clrex|dsb|isb|v(ldr|str|push|pop)|push|pop|b(l|l?x|l?r)?|(i|e)?ret|(st|ld)(p|r(ex|s?(h|b)|d)?|m((f|e)(d|a)|(d|i)(b|a))?))(ne|eq|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|lt|le|gt|ge|al)?(?-i)\\b",
86
-            "name": "support.mnemonic.memory.arm"
87
-        },
88
-        {
89
-            "match": "\\b(?i)(def(b|w|s)|equ|align\\s.+\\.s)(?-i)\\b",
90
-            "name": "keyword.control.define.arm"
91
-        },
92
-        {
93
-            "name": "keyword.control.directive.arm",
94
-            "match": "\\.(?i)(globl|global|macro|endm|purgem|if|elseif|else|endif|section|text|data|bss|arm|align|balign|irp|rept|endr|req|unreq|error|short|func|endfunc|hidden|type|fpu|arch|code|altmacro|object_arch|word|int|string)(?-i)\\b"
95
-        },
96
-        {
97
-            "name": "keyword.other.preprocessor.arm",
98
-            "match": "^\\s*\\.?(define|defined|elif|else|if|ifdef|ifndef|line|include|get|pragma|undef|endif)\\b"
99
-        },
100
-        {
101
-            "match": "\\b\\=",
102
-            "name": "keyword.control.evaluation"
103
-        },
104
-        {
105
-            "match": "\\b(?i)(nop(ne|eq|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|lt|le|gt|ge|al)?)(?-i)\\b",
106
-            "name": "comment.nop.arm"
107
-        },
108
-        {
109 10
             "match": "\\b(?i)(nop|nop1)(?-i)\\b",
110 11
             "name": "comment.nop.arm.pokescript"
111 12
         },
@@ -115,11 +16,11 @@
115 16
         },
116 17
 
117 18
         {
118
-            "match":"\\b(?i)(batchmaptilefromto||batchmaptiletofrom|sethiddenflags|seteffect|setecutscene|clearcutscene|pokemsg|beben|lookbattle|gymbattle|betweenbattle|scriptbattle|doublebattle|doublegymbattle|winlosebattle|spotscript|giveitem|giteitem2|wildbattle|wildbattle2|wildbattlemusic|customtrainerbattlemusic|colorflicker|mugmsg|mugrival|transparenzon|transparenzoff|battlescreen|cameramove|walkingscript|walingscripton|walkingscripton|writemusikon|writemusikoff|msgbox)(?-i)\\b",
19
+            "match":"\\b(?i)(batchmaptilefromto|batchmaptiletofrom|sethiddenflags|seteffect|setecutscene|clearcutscene|pokemsg|beben|lookbattle|gymbattle|betweenbattle|scriptbattle|doublebattle|doublegymbattle|winlosebattle|spotscript|giveitem|giteitem2|wildbattle|wildbattle2|wildbattlemusic|customtrainerbattlemusic|colorflicker|mugmsg|mugrival|transparenzon|transparenzoff|battlescreen|cameramove|walkingscript|walingscripton|walkingscripton|writemusikon|writemusikoff|msgbox)(?-i)\\b",
119 20
             "name": "keyword.other.preprocessor.arm.pokescript"
120 21
         },
121 22
         {
122
-            "match":"\\b(?i)(end|return)?(?-i)\\b",
23
+            "match":"\\b(?i)(end|return)(?-i)\\b",
123 24
             "name": "keyword.control.arm.pokescript"
124 25
         }
125 26
     ]