-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many added mnemonics and fixes #5
base: master
Are you sure you want to change the base?
Changes from all commits
780471d
41faf66
ce26e4d
5b70bb2
8bbb463
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,106 +2,89 @@ | |
"name": "AVR ASM", | ||
"scopeName": "source.asm", | ||
"fileTypes": ["asm", "inc"], | ||
"patterns": [ | ||
|
||
"patterns": | ||
[ | ||
{ | ||
"match": "(?i)\\br(0|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)\\b", | ||
"match": "(?i)\\bR(0|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)\\b", | ||
"name": "storage.type.asm", | ||
"comment": "General perpose register set" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(xl|xh|yl|yh|zl|zh)\\b", | ||
"match": "(?i)\\b(XL|XH|YL|YH|ZL|ZH)\\b", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as previous comment. |
||
"name": "storage.type.asm", | ||
"comment": "General perpose register set (16-bit pointers)" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(add|adc|sub|subi|sbc|sbci|sbiw|and|andi|or|ori|eor|com|neg|sbr|cbr|inc|dec|tst|clr|ser)\\b", | ||
"match": "(?i)\\b(add|adc|sub|subi|sbc|sbci|sbiw|and|andi|or|ori|eor|com|neg|sbr|cbr|inc|dec|tst|clr|ser|adiw|mul|muls|mulsu|fmul|fmuls|fmulsu)\\b", | ||
"name": "keyword.operator.asm", | ||
"comment": "Arithmetic and logic instruction mnemonics" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(rjmp|ijmp|rcall|ret|reti|cpse|cp|cpc|cpi|sbrc|sbrs|sbic|sbis|brbs|brbc|breq|brne|brcs|brcc|brsh|brlo|brmi|brpl|brge|brlt|brhs|brhc|brts|brtc|brvs|brvc|brie|brid)\\b", | ||
"match": "(?i)\\b(rjmp|ijmp|eijmp|jmp|rcall|icall|eicall|call|ret|reti|cpse|cp|cpc|cpi|sbrc|sbrs|sbic|sbis|brbs|brbc|breq|brne|brcs|brcc|brsh|brlo|brmi|brpl|brge|brlt|brhs|brhc|brts|brtc|brvs|brvc|brie|brid)\\b", | ||
"name": "keyword.operator.asm", | ||
"comment": "Branch instruction mnemonics" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(sbi|cbi|lsl|lsr|rol|ror|asr|swap|bset|bclr|bst|bld|sec|clc|sen|cln|sez|clz|sei|cli|ses|cls|sev|clv|set|clt|seh|clh)\\b", | ||
"name": "keyword.operator.asm", | ||
"comment": "Bit and bit-test instruction mnemonics" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(mov|movw|ldi|ld|ldd|lds|st|std|sts|lpm|spm|in|out|push|pop)\\b", | ||
"match": "(?i)\\b(mov|movw|ldi|ld|ldd|lds|st|std|sts|lpm|elpm|spm|espm|in|out|push|pop)\\b", | ||
"name": "keyword.operator.asm", | ||
"comment": "Data transfer instruction mnemonics" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(nop|sleep|wdr|break)\\b", | ||
"name": "keyword.coperator.asm", | ||
"comment": "MCU control instruction mnemonics" | ||
}, | ||
|
||
{ | ||
"match": "(?i)(^|\\s)\\.(byte|cseg|csegsize|db|dd|def|device|dq|dseg|dw|elif|else|endif|endm|endmacro|equ|error|eseg|exit|if|ifdef|ifndef|include|list|listmac|macro|message|nolist|org|set|undef)", | ||
"match": "(?i)(^|\\s)\\.(byte|csegsize|cseg|db|dd|def|device|dq|dseg|dw|elseif|elif|else|endif|endmacro|endm|equ|error|eseg|exit|ifdef|ifndef|if|include|listmac|list|macro|message|nolist|org|set|undef|word|warning)", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess you're trying to fix problem with partial highlighting of several directives. Proper fix is to wrap this match with \b regex anchor like this was done with mnemonics. |
||
"name": "constant.character.asm", | ||
"comment": "AVR ASM 1.0 directives" | ||
}, | ||
|
||
{ | ||
"match": "(\/\/|;)(\\s|\\S)*", | ||
"name": "comment.line.asm", | ||
"comment": "Comment line" | ||
}, | ||
|
||
{ | ||
"begin": "(\/\\*)", | ||
"end": "(\\*\/)", | ||
"name": "comment.block.asm", | ||
"comment": "C-style comment block (AVR ASM 2.0 only)" | ||
}, | ||
|
||
{ | ||
"match": "(^|\\s)\"[\\w\\s\\W]*\"($|\\s)", | ||
"name": "string.asm", | ||
"comment": "Single-line string" | ||
}, | ||
|
||
{ | ||
"match": "(^|\\s)\\'[\\w\\s\\W]*\\'($|\\s)", | ||
"name": "string.asm", | ||
"comment": "Single-line string" | ||
}, | ||
|
||
{ | ||
"match": "(?i)\\b(0x(\\d|[A-F])+)\\b", | ||
"name": "constant.numeric.asm", | ||
"comment": "Hex number constant" | ||
}, | ||
|
||
{ | ||
"match": "\\b(0[0-7]+)\\b", | ||
"name": "constant.numeric.asm", | ||
"comment": "Oct number constant" | ||
}, | ||
|
||
{ | ||
"match": "\\b(0b(0|1)+)\\b", | ||
"name": "constant.numeric.asm", | ||
"comment": "Bin number constant" | ||
}, | ||
|
||
{ | ||
"match": "\\b(0|[1-9]\\d+)\\b", | ||
"name": "constant.numeric.asm", | ||
"comment": "Dec number constant" | ||
} | ||
|
||
], | ||
|
||
"uuid": "97b6acae-cfc1-4c14-b572-c51987e1e023" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,35 +11,50 @@ | |
<string>AVR ASM</string> | ||
<key>patterns</key> | ||
<array> | ||
<dict> | ||
<key>match</key> | ||
<string>(rjmp|ijmp|eijmp|jmp|rcall|icall|eicall|call|ret|reti|cpse|cp|cpc|cpi|sbrc|sbrs|sbic|sbis|brbs|brbc|breq|brne|brcs|brcc|brsh|brlo|brmi|brpl|brge|brlt|brhs|brhc|brts|brtc|brvs|brvc|brie|brid)\s+(\w+)</string> | ||
<key>captures</key> | ||
<dict> | ||
<key>1</key> | ||
<dict> | ||
<key>name</key> | ||
<string>keyword.operator.asm</string> | ||
</dict> | ||
<key>2</key> | ||
<dict> | ||
<key>name</key> | ||
<string>entity.name.function</string> | ||
</dict> | ||
</dict> | ||
</dict> | ||
<dict> | ||
<key>comment</key> | ||
<string>General purpose register set</string> | ||
<key>match</key> | ||
<string>(?i)\br(0|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)\b</string> | ||
<string>(?i)\bR(0|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)\b</string> | ||
<key>name</key> | ||
<string>storage.type.asm</string> | ||
</dict> | ||
<dict> | ||
<key>comment</key> | ||
<string>General purpose register set (16-bit pointers)</string> | ||
<key>match</key> | ||
<string>(?i)\b(xl|xh|yl|yh|zl|zh)\b</string> | ||
<string>(?i)\b(X|Y|Z|XL|XH|YL|YH|ZL|ZH|PC|ZERO)\b</string> | ||
<key>name</key> | ||
<string>storage.type.asm</string> | ||
</dict> | ||
<dict> | ||
<key>comment</key> | ||
<string>Arithmetic and logic instruction mnemonics</string> | ||
<key>match</key> | ||
<string>(?i)\b(add|adc|sub|subi|sbc|sbci|sbiw|and|andi|or|ori|eor|com|neg|sbr|cbr|inc|dec|tst|clr|ser)\b</string> | ||
<string>(?i)\b(add|adc|sub|subi|sbc|sbci|sbiw|and|andi|or|ori|eor|com|neg|sbr|cbr|inc|dec|tst|clr|ser|adiw|mul|muls|mulsu|fmul|fmuls|fmulsu)\b</string> | ||
<key>name</key> | ||
<string>keyword.operator.asm</string> | ||
</dict> | ||
<dict> | ||
<key>comment</key> | ||
<string>Branch instruction mnemonics</string> | ||
<key>match</key> | ||
<string>(?i)\b(rjmp|ijmp|rcall|ret|reti|cpse|cp|cpc|cpi|sbrc|sbrs|sbic|sbis|brbs|brbc|breq|brne|brcs|brcc|brsh|brlo|brmi|brpl|brge|brlt|brhs|brhc|brts|brtc|brvs|brvc|brie|brid)\b</string> | ||
<string>(?i)\b(rjmp|ijmp|eijmp|jmp|rcall|icall|eicall|call|ret|reti|cpse|cp|cpc|cpi|sbrc|sbrs|sbic|sbis|brbs|brbc|breq|brne|brcs|brcc|brsh|brlo|brmi|brpl|brge|brlt|brhs|brhc|brts|brtc|brvs|brvc|brie|brid)\b</string> | ||
<key>name</key> | ||
<string>keyword.operator.asm</string> | ||
</dict> | ||
|
@@ -55,7 +70,7 @@ | |
<key>comment</key> | ||
<string>Data transfer instruction mnemonics</string> | ||
<key>match</key> | ||
<string>(?i)\b(mov|movw|ldi|ld|ldd|lds|st|std|sts|lpm|spm|in|out|push|pop)\b</string> | ||
<string>(?i)\b(mov|movw|ldi|ld|ldd|lds|st|std|sts|lpm|elpm|spm|espm|in|out|push|pop)\b</string> | ||
<key>name</key> | ||
<string>keyword.operator.asm</string> | ||
</dict> | ||
|
@@ -71,7 +86,23 @@ | |
<key>comment</key> | ||
<string>AVR ASM 1.0 directives</string> | ||
<key>match</key> | ||
<string>(?i)(^|\s)\.(byte|cseg|csegsize|db|dd|def|device|dq|dseg|dw|elif|else|endif|endm|endmacro|equ|error|eseg|exit|if|ifdef|ifndef|include|list|listmac|macro|message|nolist|org|set|undef)</string> | ||
<string>(?i)(^|\s)\.(byte|csegsize|cseg|db|dd|def|device|dq|dseg|dw|elseif|elif|else|endif|endmacro|endm|equ|error|eseg|exit|ifdef|ifndef|if|include|listmac|list|macro|message|nolist|org|set|undef|word|warning)</string> | ||
<key>name</key> | ||
<string>constant.character.asm</string> | ||
</dict> | ||
<dict> | ||
<key>comment</key> | ||
<string>AVR ASM 1.0 directives</string> | ||
<key>match</key> | ||
<string>(?i)\#(define|undef|ifdef|ifndef|if|elif|else|endif|error|warning|message|include|pragma)</string> | ||
<key>name</key> | ||
<string>constant.character.asm</string> | ||
</dict> | ||
<dict> | ||
<key>comment</key> | ||
<string>AVR ASM 1.0 directives</string> | ||
<key>match</key> | ||
<string>(?i)(low|high|byte2|byte3|byte4|lwrd|hwrd|page|exp2|log2)</string> | ||
<key>name</key> | ||
<string>constant.character.asm</string> | ||
</dict> | ||
|
@@ -137,7 +168,7 @@ | |
<key>comment</key> | ||
<string>Dec number constant</string> | ||
<key>match</key> | ||
<string>\b(0|[1-9]\d+)\b</string> | ||
<string>\-?\b(\d+)\b</string> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't try to directly edit *.tmLanguage file. Your changes will be lost since the file is generated from *.JSON-tmLanguage one. |
||
<key>name</key> | ||
<string>constant.numeric.asm</string> | ||
</dict> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you make uppercase for general purpose registers? This does not take effect because regex is configured with ?i (case insensitive mode).