? syntax highlighter (debugger version) (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Migrating to a new website for SmileBASIC 4

This is the development website, where we test out new features. This isn't the place you're looking for! Go here

syntax highlighter (debugger version)

  • #1 ✎ 256 Y____ Head Admin Gardening I like to garden! Hobbies Reading I like to read books! Hobbies Drawing I like to draw! Hobbies 'initialize keywords list DIM KEYWORDS$[47] COPY KEYWORDS$,@KEYWORDS @KEYWORDS DATA "AND","BREAK","CALL","COMMON","CONTINUE","DATA","DEC","DEF","DIM","DIV","ELSE","ELSEIF","END","ENDIF","EXEC","FALSE","FOR","GOSUB","GOTO","IF","INC","INPUT","LINPUT","MOD","NEXT","NOT","ON","OR","OUT","PRINT","READ","REM","REPEAT","RESTORE","RETURN","STEP","STOP","SWAP","THEN","TO","TRUE","UNTIL","USE","VAR","WEND","WHILE","XOR" 'initialize functions list DIM FUNCTIONS$[243] COPY FUNCTIONS$,@FUNCTIONS @FUNCTIONS DATA "ABS","ACCEL","ACLS","ACOS","ARYOP","ASC","ASIN","ATAN","ATTR","BACKCOLOR","BACKTRACE","BEEP","BGANIM","BGCHK","BGCLIP","BGCLR","BGCOLOR","BGCOORD","BGCOPY","BGFILL","BGFUNC","BGGET","BGHIDE","BGHOME","BGLOAD","BGMCHK","BGMCLEAR","BGMCONT","BGMPAUSE","BGMPLAY","BGMPRG","BGMPRGA","BGMSET","BGMSETD","BGMSTOP","BGMVAR","BGMVOL","BGOFS","BGPAGE","BGPUT","BGROT","BGSAVE","BGSCALE","BGSCREEN","BGSHOW","BGSTART","BGSTOP","BGVAR","BIN$","BIQUAD","BQPARAM","BREPEAT","BUTTON","CALLIDX","CEIL","CHKCALL","CHKCHR","CHKFILE","CHKLABEL","CHKVAR","CHR$","CLASSIFY","CLIPBOARD","CLS","COLOR","COPY","COS","COSH","CSRX","CSRY","CSRZ","DATE$","DEG","DELETE","DIALOG","DISPLAY","DLCOPEN","DTREAD","EFCOFF","EFCON","EFCSET","EFCWET","ERRLINE","ERRNUM","ERRPRG","EXP","EXTFEATURE","FADE","FADECHK","FFT","FFTWFN","FILES","FILL","FLOOR","FONTDEF","FORMAT$","FREEMEM","GBOX","GCIRCLE","GCLIP","GCLS","GCOLOR","GCOPY","GFILL","GLINE","GLOAD","GOFS","GPAGE","GPAINT","GPRIO","GPSET","GPUTCHR","GSAVE","GSPOIT","GTRI","GYROA","GYROSYNC","GYROV","HARDWARE","HEX$","IFFT","INKEY$","INSTR","KEY","LEFT$","LEN","LOAD","LOCATE","LOG","MAINCNT","MAX","MICDATA","MICPOS","MICSAVE","MICSIZE","MICSTART","MICSTOP","MID$","MILLISEC","MIN","MPCOUNT","MPEND","MPGET","MPHOST","MPLOCAL","MPNAME$","MPRECV","MPSEND","MPSET","MPSTART","MPSTAT","OPTION","PCMCONT","PCMPOS","PCMSTOP","PCMSTREAM","PCMVOL","POP","POW","PRGDEL","PRGEDIT","PRGGET$","PRGINS","PRGNAME$","PRGSET","PRGSIZE","PRGSLOT","PROJECT","PUSH","RAD","RANDOMIZE","RENAME","RESULT","RGB","RGBREAD","RIGHT$","RINGCOPY","RND","RNDF","ROUND","RSORT","SAVE","SCROLL","SGN","SHIFT","SIN","SINH","SNDSTOP","SORT","SPANIM","SPCHK","SPCHR","SPCLIP","SPCLR","SPCOL","SPCOLOR","SPCOLVEC","SPDEF","SPFUNC","SPHIDE","SPHITINFO","SPHITRC","SPHITSP","SPHOME","SPLINK","SPOFS","SPPAGE","SPROT","SPSCALE","SPSET","SPSHOW","SPSTART","SPSTOP","SPUNLINK","SPUSED","SPVAR","SQR","STICK","STICKEX","STR$","SUBST$","SYSBEEP","TABSTEP","TALK","TALKCHK","TALKSTOP","TAN","TANH","TIME$","TMREAD","TOUCH","UNSHIFT","VAL","VERSION","VISIBLE","VSYNC","WAIT","WAVSET","WAVSETA","WIDTH","XOFF","XON","XSCREEN" DEF _is_space(char$) return char$ == " " || char$ == Chr$(9) END DEF _is_alpha(char$) VAR a% = ASC(char$) return (a% > 64 && a% < 91) || (a% > 96 && a% < 123) END DEF _is_alphanum(char$) return _is_alpha(char$) || (char$ >= "0" && char$ <= "9") END DEF _is_digit(char$) return (char$ >= "0" && char$ <= "9") END DEF _is_typesuffix(char$) return char$ == "%" || char$ == "$" || char$ == "#" END DEF _is_hexchar(char$) return _is_digit(char$) || char$ >= "A" && char$ <= "F" || char$ >= "a" && char$ <= "f" END DIM TOK_IDENTIFIER = -1, TOK_KEYWORD = -2 DIM TOK_SEPARATOR = -3, TOK_OPERATOR = -4, TOK_UNARY = -5, TOK_ASSIGN = -12 DIM TOK_LSH_OP = -13, TOK_RSH_OP = -14, TOK_BAND_OP = -15, TOK_BOR_OP = -16, TOK_XOR_OP = -17, TOK_BNOT_OP = -18 DIM TOK_ADD_OP = -19, TOK_SUB_OP = -20, TOK_MUL_OP = -21, TOK_DIV_OP = -22, TOK_MOD_OP = -23 DIM TOK_EQ_OP = -29, TOK_LT_OP = -24, TOK_GT_OP = -25, TOK_LE_OP = -26, TOK_GE_OP = -27, TOK_NEQ_OP = -28 DIM TOK_AND_OP = -30, TOK_OR_OP = -31 DIM TOK_NEGATIVE_OP = -32, TOK_NEGATION_OP = -33 DIM TOK_NUMBER = -6, TOK_STRING = -7, TOK_LABEL = -8, TOK_CONSTANT = -9, DIM TOK_INVALID = -10, TOK_COMMENT = -11, TOK_FUNCTION = -40, TOK_IDIV_OP = -34, TOK_TRUE = -35, TOK_FALSE = -36 DIM TOK_STMT_META = -41,TOK_HIDDEN_META = -42 DIM TOKEN = 0, VALUE = 1, INDEX = 2, LENGTH = 3 DIM QUOTE$ = Chr$(34), EOL$ = Chr$(10), CR$ = Chr$(13) VAR fgcolor% = #TWHITE, bgcolor% = 0, prevfgcolor% = #TWHITE, prevbgcolor% = 0 DEF SETCOLOR1 fg prevfgcolor% = fgcolor% fgcolor% = fg COLOR fgcolor%, bgcolor% END DEF SETCOLOR2 fg, bg prevfgcolor% = fgcolor% prevbgcolor% = bgcolor% fgcolor% = fg bgcolor% = bg COLOR fgcolor%, bgcolor% END DEF RESTORECOLOR fgcolor% = prevfgcolor% bgcolor% = prevbgcolor% COLOR fgcolor%, bgcolor% END DEF _log string$ SETCOLOR1 #TYELLOW print "("+str$(pos%)+")"+string$ RESTORECOLOR END ' Boolean <= _b_search(target string, search array) DEF _b_search(target$, T$) VAR low%, high% = Len(T$)-1 REPEAT VAR mid% = (low% + high%) >> 1 IF T$[mid%]<target$ THEN low% = mid% + 1 ELSEIF T$[mid%]>target$ THEN high% = mid% - 1 ELSE return True ENDIF UNTIL low% > high% return False END ' transform string S$ to uppercase DEF _upper$ S$ VAR i% FOR i%=Len(S$)-1 TO 0 STEP -1 VAR a%=Asc(S$[i%]) IF a%>=97 && a%<=122 THEN S$[i%]=Chr$(a%-32) NEXT END DEF _new_token(token, value$, pos%, length%) DIM separator$="`"+QUOTE$+"`" return _token_to_string(token) + separator$ + value$ + separator$ + str$(pos%) + separator$ + chr$(length%) END DEF _read_token_obj token$ OUT tokentype%, value$, pos%, length% DIM separator$="`"+QUOTE$+"`" f1 = instr(0, token$, separator$) if(f1 < 0) then _log "malformed token obj: " + token$ stop endif f2 = instr(f1+3, token$, separator$) - f1 - 3 f3 = instr(f2+3, token$, separator$) - f2 - 3 tokentype% = VAR(MID$(token$, 0,f1)) value$ = MID$(token$,f1+3,f2) pos% = VAL(MID$(token$,f2+3,f3)) length% = ASC(MID$(token$,f3+3,1)) END VAR pos% = 0 VAR line% = 0 DEF _get_token(S$) VAR char$ = S$[pos%] VAR type% pos% = pos% + 1 VAR value$ = "" VAR start%, start2% if(_is_alpha(char$)||char$=="_") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(_is_alphanum(char$)||char$=="_") inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend if(_is_typesuffix(char$)) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 endif 'word type 'decide subtype _upper$ value$ if(value$=="DIV") then type% = TOK_IDIV_OP elseif(value$=="MOD") then type% = TOK_MOD_OP elseif(value$=="AND") then type% = TOK_BAND_OP elseif(value$=="OR") then type% = TOK_BOR_OP elseif(value$=="XOR") then type% = TOK_XOR_OP elseif(value$=="NOT") then type% = TOK_BNOT_OP elseif(value$=="TRUE") then type% = TOK_TRUE elseif(value$=="FALSE") then type% = TOK_FALSE elseif(_b_search(value$, KEYWORDS$)) then type% = TOK_KEYWORD 'control flow words 'if(value$=="DEF"||value$=="GOTO"||value$=="GOSUB"||value$=="POS%=POS%-1:RETURN"||value$=="ON"||value$=="IF"||value$=="THEN"||value$=="ELSE"||value$=="ELSEIF"||value$=="ENDIF"||value$=="FOR"||value$=="NEXT"||value$=="WHILE"||value$=="WEND"||value$=="REPEAT"||value$=="UNTIL"||value$=="CONTINUE"||value$=="BREAK"||value$=="END"||value$=="CALL") then 'endif elseif(_b_search(value$, FUNCTIONS$)) then type% = TOK_FUNCTION else type% = TOK_IDENTIFIER endif pos%=pos%-1:return _new_token(type%,value$,pos%-len(value$),len(value$)) elseif(char$=="?") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_KEYWORD,value$,pos%-len(value$),len(value$)) elseif(_is_digit(char$)||char$==".") then 'numbers while(_is_digit(char$)) inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend 'decimal point? if(char$==".") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 'read following digits if(_is_digit(char$)) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(_is_digit(char$)) inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend else GOTO @skip_E endif endif 'E notation if(char$=="E"||char$=="e") then start2% = pos% inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 '+/i if(char$=="+"||char$=="-") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 endif if(_is_digit(char$)) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(_is_digit(char$)) inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend else pos% = start2% pos%=pos%-1:return _new_token(TOK_INVALID, value$, pos%-len(value$), len(value$)) endif endif @skip_E if(char$=="#") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 endif pos%=pos%-1:return _new_token(TOK_NUMBER,value$,pos%-len(value$),len(value$)) elseif(char$==QUOTE$) then 'strings inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(char$!=QUOTE$ && char$!=EOL$ && char$!=CR$) inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend 'endquote if (char$ == QUOTE$) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 endif pos%=pos%-1:return _new_token(TOK_STRING,value$,pos% - len(value$),len(value$)) elseif(char$=="'") then 'comments inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(pos%<len(S$) && char$!=EOL$ && char$!=CR$) inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend pos%=pos%-1:return _new_token(TOK_COMMENT,value$,pos% - len(value$),len(value$)) elseif(char$=="&") then '&&,hex,bin inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="&") then '&& inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_AND_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="H"||char$=="h") then 'hex start2% = pos% inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(_is_hexchar(char$)) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(_is_hexchar(char$)) inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend pos%=pos%-1:return _new_token(TOK_NUMBER,value$,pos% - len(value$),len(value$)) else pos% = start2% pos%=pos%-1:return _new_token(TOK_INVALID,value$,pos% - len(value$),len(value$)) endif elseif(char$=="B"||char$=="B") then 'binary start2% = pos% inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="0"||char$=="1") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(char$=="0"||char$=="1") inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend pos%=pos%-1:return _new_token(TOK_NUMBER,value$,pos% - len(value$),len(value$)) else pos% = start2% pos%=pos%-1:return _new_token(TOK_INVALID,value$,pos% - len(value$),len(value$)) endif else 'invalid & pos%=pos%-1:return _new_token(TOK_INVALID,value$,pos% - len(value$),len(value$)) endif elseif(char$=="@") then 'labels inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(_is_alphanum(char$)||char$=="_") inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend pos%=pos%-1:return _new_token(TOK_LABEL,value$,pos% - len(value$),len(value$)) elseif(char$=="#") then 'constants inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(_is_alphanum(char$)||char$=="_") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 while(_is_alphanum(char$)||char$=="_") inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 wend pos%=pos%-1:return _new_token(TOK_NUMBER,value$,pos% - len(value$),len(value$)) else pos%=pos%-1:return _new_token(TOK_INVALID,value$,pos% - len(value$),len(value$)) endif elseif(char$=="|") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="|") then '|| inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_OR_OP,value$,pos% - len(value$),len(value$)) else pos%=pos%-1:return _new_token(TOK_INVALID,value$,pos% - len(value$),len(value$)) endif elseif(char$=="<") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="=") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_LE_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="<") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_LSH_OP,value$,pos% - len(value$),len(value$)) endif pos%=pos%-1:return _new_token(TOK_LT_OP,value$,pos% - len(value$),len(value$)) elseif(char$==">") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="=") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_GE_OP,value$,pos% - len(value$),len(value$)) elseif(char$==">") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_RSH_OP,value$,pos% - len(value$),len(value$)) endif pos%=pos%-1:return _new_token(TOK_GT_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="=") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="=") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_EQ_OP,value$,pos% - len(value$),len(value$)) endif pos%=pos%-1:return _new_token(TOK_ASSIGN,value$,pos% - len(value$),len(value$)) elseif(char$=="!") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 if(char$=="=") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_NEQ_OP,value$,pos% - len(value$),len(value$)) endif pos%=pos%-1:return _new_token(TOK_NEGATION_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="+") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_ADD_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="-") then 'possibly use lookbehind here inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_SUB_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="*") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_MUL_OP,value$,pos% - len(value$),len(value$)) elseif(char$=="/") then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_DIV_OP,value$,pos% - len(value$),len(value$)) elseif(char$==EOL$) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1 inc line% 'count line numbers return _new_token(TOK_SEPARATOR,value$,pos% - len(value$),len(value$)) elseif(char$==","||char$==":"||char$==";"||char$=="("||char$==")"||char$=="["||char$=="]"||char$==" "||char$==CR$) then inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 pos%=pos%-1:return _new_token(TOK_SEPARATOR,value$,pos% - len(value$),len(value$)) else 'invalid? inc value$, char$ char$ = S$[pos%] pos% = pos% + 1 return _new_token(TOK_INVALID,value$,pos% - len(value$),len(value$)) endif end DEF _token_to_string(tok%) if (tok% == TOK_IDENTIFIER) then return "TOK_IDENTIFIER" elseif (tok% == TOK_KEYWORD) then return "TOK_KEYWORD" elseif (tok% == TOK_FUNCTION) then return "TOK_FUNCTION" elseif (tok% == TOK_SEPARATOR) then return "TOK_SEPARATOR" elseif (tok% == TOK_OPERATOR) then return "TOK_OPERATOR" elseif (tok% == TOK_UNARY) then return "TOK_UNARY" elseif (tok% == TOK_ASSIGN) then return "TOK_ASSIGN" elseif (tok% == TOK_LSH_OP) then return "TOK_LSH_OP" elseif (tok% == TOK_RSH_OP) then return "TOK_RSH_OP" elseif (tok% == TOK_BAND_OP) then return "TOK_BAND_OP" elseif (tok% == TOK_BOR_OP) then return "TOK_BOR_OP" elseif (tok% == TOK_XOR_OP) then return "TOK_XOR_OP" elseif (tok% == TOK_BNOT_OP) then return "TOK_BNOT_OP" elseif (tok% == TOK_ADD_OP) then return "TOK_ADD_OP" elseif (tok% == TOK_SUB_OP) then return "TOK_SUB_OP" elseif (tok% == TOK_MUL_OP) then return "TOK_MUL_OP" elseif (tok% == TOK_DIV_OP) then return "TOK_DIV_OP" elseif (tok% == TOK_IDIV_OP) then return "TOK_IDIV_OP" elseif (tok% == TOK_MOD_OP) then return "TOK_MOD_OP" elseif (tok% == TOK_EQ_OP) then return "TOK_EQ_OP" elseif (tok% == TOK_LT_OP) then return "TOK_LT_OP" elseif (tok% == TOK_GT_OP) then return "TOK_GT_OP" elseif (tok% == TOK_LE_OP) then return "TOK_LE_OP" elseif (tok% == TOK_GE_OP) then return "TOK_GE_OP" elseif (tok% == TOK_NEQ_OP) then return "TOK_NEQ_OP" elseif (tok% == TOK_AND_OP) then return "TOK_AND_OP" elseif (tok% == TOK_OR_OP) then return "TOK_OR_OP" elseif (tok% == TOK_NEGATIVE_OP) then return "TOK_NEGATIVE_OP" elseif (tok% == TOK_NEGATION_OP) then return "TOK_NEGATION_OP" elseif (tok% == TOK_NUMBER) then return "TOK_NUMBER" elseif (tok% == TOK_STRING) then return "TOK_STRING" elseif (tok% == TOK_LABEL) then return "TOK_LABEL" elseif (tok% == TOK_CONSTANT) then return "TOK_CONSTANT" elseif (tok% == TOK_TRUE) then return "TOK_TRUE" elseif (tok% == TOK_FALSE) then return "TOK_FALSE" elseif (tok% == TOK_INVALID) then return "TOK_INVALID" elseif (tok% == TOK_COMMENT) then return "TOK_COMMENT" elseif (tok% == TOK_STMT_META) then return "TOK_STMT_META" elseif (tok% == TOK_HIDDEN_META) then return "TOK_HIDDEN_META" else return "TOK_UNKNOWN" endif END DIM _callbacks$[0] DEF _register_callback fn$ push _callbacks$, fn$ END DEF _do_callbacks tokenstream$, top% var i% for i%=0 to len(_callbacks$) - 1 'callbacks return TRUE if they modify the token stream '(in a non-hidden way) 'if so, we re-evaluate any callbacks ahead of them if(call(_callbacks$[i%], tokenstream$, top%)) then top% = len(tokenstream$)-1 i% = -1 endif next END DEF _tokenize(program$) DIM tokens$[0] if(version <= &h3030200) then 'older versions destroy LOAD() trailing newline 'and we need a buffer token inc program$, EOL$ endif VAR ret$, token%, value$, offset%, length% 'VAR tokenp% = TOK_INVALID, valuep$="", offsetp%=-1, lengthp%=0 pos% = 0 while(pos% < len(program$) - 1) ret$ = _get_token(program$) '_read_token_obj ret$ out token%, value$, offset%, length% push tokens$, ret$ _do_callbacks tokens$, len(tokens$)-1 wend return tokens$ end VAR _debugger_tokenized$[0] VAR ctoken%,cvalue$,ofs%,len% VAR PROGRAM$ = LOAD("TXT:LOOP",0) + EOL$ _debugger_tokenized$ = _tokenize(PROGRAM$) _prg$ = "" dim _prgline$[0], cline$ FOR I%=0 TO LEN(_debugger_tokenized$) - 1 _read_token_obj _debugger_tokenized$[I%] out ctoken%,cvalue$,ofs%,len% if ctoken%==TOK_KEYWORD then SETCOLOR1 #TCYAN elseif ctoken%==TOK_FUNCTION then SETCOLOR1 #TLIME elseif ctoken%==TOK_HIDDEN_META then SETCOLOR1 #TGRAY elseif ctoken%==TOK_COMMENT then SETCOLOR1 #TRED elseif ctoken%==TOK_NUMBER then SETCOLOR1 #TTEAL elseif ctoken%==TOK_STRING then SETCOLOR1 #TGREEN elseif ctoken%==TOK_LABEL then SETCOLOR1 #TMAGENTA else SETCOLOR1 #TWHITE endif 'if ctoken%==TOK_STMT_META then SETCOLOR1 #TGRAY:?"<>"; ?cvalue$; inc _prg$,cvalue$ if ctoken%==TOK_STMT_META then elseif cvalue$==EOL$ then push _prgline$,cline$ else inc cline$, cvalue$ endif NEXT scanner based on highlighter js written by 12Me21 years ago. Posted Edited by Y____