-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for ARM Assembly (#3376)
- Loading branch information
1 parent
a134066
commit 554ff32
Showing
20 changed files
with
715 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Prism.languages.armasm = { | ||
'comment': { | ||
pattern: /;.*/, | ||
greedy: true | ||
}, | ||
'string': { | ||
pattern: /"(?:[^"\r\n]|"")*"/, | ||
greedy: true, | ||
inside: { | ||
'variable': { | ||
pattern: /((?:^|[^$])(?:\${2})*)\$\w+/, | ||
lookbehind: true | ||
} | ||
} | ||
}, | ||
'char': { | ||
pattern: /'(?:[^'\r\n]{0,4}|'')'/, | ||
greedy: true | ||
}, | ||
'version-symbol': { | ||
pattern: /\|[\w@]+\|/, | ||
greedy: true, | ||
alias: 'property' | ||
}, | ||
|
||
'boolean': /\b(?:FALSE|TRUE)\b/, | ||
'directive': { | ||
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/, | ||
alias: 'property' | ||
}, | ||
'instruction': { | ||
pattern: /((?:^|(?:^|[^\\])(?:\r\n?|\n))[ \t]*(?:(?:[A-Z][A-Z0-9_]*[a-z]\w*|[a-z]\w*|\d+)[ \t]+)?)\b[A-Z.]+\b/, | ||
lookbehind: true, | ||
alias: 'keyword' | ||
}, | ||
'variable': /\$\w+/, | ||
|
||
'number': /(?:\b[2-9]_\d+|(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e-?\d+)?|\b0(?:[fd]_|x)[0-9a-f]+|&[0-9a-f]+)\b/i, | ||
|
||
'register': { | ||
pattern: /\b(?:r\d|lr)\b/, | ||
alias: 'symbol' | ||
}, | ||
|
||
'operator': /<>|<<|>>|&&|\|\||[=!<>/]=?|[+\-*%#?&|^]|:[A-Z]+:/, | ||
'punctuation': /[()[\],]/ | ||
}; | ||
|
||
Prism.languages['arm-asm'] = Prism.languages.armasm; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h2>Full example</h2> | ||
<pre><code>; Source: https://developer.arm.com/documentation/dui0473/c/writing-arm-assembly-language/subroutines-calls | ||
AREA subrout, CODE, READONLY ; Name this block of code | ||
ENTRY ; Mark first instruction to execute | ||
start MOV r0, #10 ; Set up parameters | ||
MOV r1, #3 | ||
BL doadd ; Call subroutine | ||
stop MOV r0, #0x18 ; angel_SWIreason_ReportException | ||
LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit | ||
SVC #0x123456 ; ARM semihosting (formerly SWI) | ||
doadd ADD r0, r0, r1 ; Subroutine code | ||
BX lr ; Return from subroutine | ||
END ; Mark end of file</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.