Added tal syntax highlight for nano

This commit is contained in:
neauoire 2021-11-26 08:11:18 -08:00
parent b4ddde5d4e
commit b873f04789
3 changed files with 51 additions and 2 deletions

View File

@ -0,0 +1,51 @@
# include this file in your ~/.nanorc:
# include "path/to/uxntal.nanorc"
syntax "uxntal" "\.tal$"
# numbers
color lightblue "[0-9a-f]{2}(\s|$)"
color lightblue "[0-9a-f]{4}(\s|$)"
# literal hex
color cyan "#[0-9a-f]{2}(\s|$)"
color cyan "#[0-9a-f]{4}(\s|$)"
# absolute pad
color bold,blue "\|[0-9a-f]{2}"
color bold,blue "\|[0-9a-f]{4}"
# labels
# label define
color green "@\S+"
# sub-label define
color green "&\S+"
# literal addr absolute
color magenta ";\S+"
# literal addr relative
color magenta ",\S+"
# literal addr zero page
color lightmagenta "\.\S+"
# raw
# character
color lightred "'\S"
# string
color lightred ""\S+"
# addr
color lightyellow ":\S+"
# include
color lightcyan "~\S+"
# macros definition
color yellow "\%\S+"
color yellow "[{}]"
# instructions
color bold,cyan "(BRK|LIT|INC|POP|DUP|NIP|SWP|OVR|ROT|EQU|NEQ|GTH|LTH|JMP|JCN|JSR|STH|LDZ|STZ|LDR|STR|LDA|STA|DEI|DEO|ADD|SUB|MUL|DIV|AND|ORA|EOR|SFT)[2kr]{,3}(\s|$)"
# comments
comment "( | )"
color blue start="\(" end="\)"

View File

@ -282,8 +282,6 @@ parsetoken(char *w)
pushbyte((Uint8)w[1], 0);
return 1;
} else if(w[0] == '#') { /* immediate */
if(slen(w + 1) == 1)
pushbyte((Uint8)w[1], 1);
if(sihx(w + 1) && slen(w + 1) == 2)
pushbyte(shex(w + 1), 1);
else if(sihx(w + 1) && slen(w + 1) == 4)