Skip to content

Commit 554ff32

Browse files
Added support for ARM Assembly (#3376)
1 parent a134066 commit 554ff32

20 files changed

+715
-3
lines changed

components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

+5
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@
139139
"title": "ARFF",
140140
"owner": "Golmote"
141141
},
142+
"armasm": {
143+
"title": "ARM Assembly",
144+
"alias": "arm-asm",
145+
"owner": "RunDevelopment"
146+
},
142147
"asciidoc": {
143148
"alias": "adoc",
144149
"title": "AsciiDoc",

components/prism-armasm.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Prism.languages.armasm = {
2+
'comment': {
3+
pattern: /;.*/,
4+
greedy: true
5+
},
6+
'string': {
7+
pattern: /"(?:[^"\r\n]|"")*"/,
8+
greedy: true,
9+
inside: {
10+
'variable': {
11+
pattern: /((?:^|[^$])(?:\${2})*)\$\w+/,
12+
lookbehind: true
13+
}
14+
}
15+
},
16+
'char': {
17+
pattern: /'(?:[^'\r\n]{0,4}|'')'/,
18+
greedy: true
19+
},
20+
'version-symbol': {
21+
pattern: /\|[\w@]+\|/,
22+
greedy: true,
23+
alias: 'property'
24+
},
25+
26+
'boolean': /\b(?:FALSE|TRUE)\b/,
27+
'directive': {
28+
pattern: /\b(?:ALIAS|ALIGN|AREA|ARM|ASSERT|ATTR|CN|CODE|CODE16|CODE32|COMMON|CP|DATA|DCB|DCD|DCDO|DCDU|DCFD|DCFDU|DCI|DCQ|DCQU|DCW|DCWU|DN|ELIF|ELSE|END|ENDFUNC|ENDIF|ENDP|ENTRY|EQU|EXPORT|EXPORTAS|EXTERN|FIELD|FILL|FN|FUNCTION|GBLA|GBLL|GBLS|GET|GLOBAL|IF|IMPORT|INCBIN|INCLUDE|INFO|KEEP|LCLA|LCLL|LCLS|LTORG|MACRO|MAP|MEND|MEXIT|NOFP|OPT|PRESERVE8|PROC|QN|READONLY|RELOC|REQUIRE|REQUIRE8|RLIST|ROUT|SETA|SETL|SETS|SN|SPACE|SUBT|THUMB|THUMBX|TTL|WEND|WHILE)\b/,
29+
alias: 'property'
30+
},
31+
'instruction': {
32+
pattern: /((?:^|(?:^|[^\\])(?:\r\n?|\n))[ \t]*(?:(?:[A-Z][A-Z0-9_]*[a-z]\w*|[a-z]\w*|\d+)[ \t]+)?)\b[A-Z.]+\b/,
33+
lookbehind: true,
34+
alias: 'keyword'
35+
},
36+
'variable': /\$\w+/,
37+
38+
'number': /(?:\b[2-9]_\d+|(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e-?\d+)?|\b0(?:[fd]_|x)[0-9a-f]+|&[0-9a-f]+)\b/i,
39+
40+
'register': {
41+
pattern: /\b(?:r\d|lr)\b/,
42+
alias: 'symbol'
43+
},
44+
45+
'operator': /<>|<<|>>|&&|\|\||[=!<>/]=?|[+\-*%#?&|^]|:[A-Z]+:/,
46+
'punctuation': /[()[\],]/
47+
};
48+
49+
Prism.languages['arm-asm'] = Prism.languages.armasm;

components/prism-armasm.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-armasm.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<h2>Full example</h2>
2+
<pre><code>; Source: https://developer.arm.com/documentation/dui0473/c/writing-arm-assembly-language/subroutines-calls
3+
AREA subrout, CODE, READONLY ; Name this block of code
4+
ENTRY ; Mark first instruction to execute
5+
start MOV r0, #10 ; Set up parameters
6+
MOV r1, #3
7+
BL doadd ; Call subroutine
8+
stop MOV r0, #0x18 ; angel_SWIreason_ReportException
9+
LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit
10+
SVC #0x123456 ; ARM semihosting (formerly SWI)
11+
doadd ADD r0, r0, r1 ; Subroutine code
12+
BX lr ; Return from subroutine
13+
END ; Mark end of file</code></pre>

plugins/autoloader/prism-autoloader.js

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
"js": "javascript",
177177
"g4": "antlr4",
178178
"ino": "arduino",
179+
"arm-asm": "armasm",
179180
"adoc": "asciidoc",
180181
"avs": "avisynth",
181182
"avdl": "avro-idl",

plugins/autoloader/prism-autoloader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"aql": "AQL",
3939
"ino": "Arduino",
4040
"arff": "ARFF",
41+
"armasm": "ARM Assembly",
42+
"arm-asm": "ARM Assembly",
4143
"asciidoc": "AsciiDoc",
4244
"adoc": "AsciiDoc",
4345
"aspnet": "ASP.NET (C#)",

0 commit comments

Comments
 (0)