About[]
I created a simple syntax highlighting definition for gedit. This lets you edit or view PTC programs in gedit with nicer highlighting than none.
Get[]
Copy the following text into your favorite text editor, and save it as something like "smilebasic2.lang" or "ptc.lang". Then move it to the language-specs directory, likely located at /usr/share/gtksourceview-4/language-specs
.
<?xml version="1.0" encoding="UTF-8"?>
<language id="smilebasic2" name="SmileBASIC v2" version="2.0" _section="Source">
<metadata>
<property name="mimetypes">text/plain</property>
<property name="globs">*.ptc;*.PTC</property>
</metadata>
<styles>
<style id="comment" name="Comment" map-to="def:comment"/>
<style id="string" name="String" map-to="def:string"/>
<style id="number" name="Number" map-to="def:number"/>
<style id="command" name="Command" map-to="def:keyword"/>
<style id="function" name="Function" map-to="def:function"/>
<style id="operator" name="Operator" map-to="def:operator"/>
<style id="sysvar" name="System Variable" map-to="def:builtin"/>
<style id="label" name="Label" map-to="def:heading"/>
</styles>
<default-regex-options case-sensitive="false"/>
<definitions>
<context id="smilebasic2">
<include>
<context id="comment" style-ref="comment">
<start>'|REM</start>
<end>$</end>
</context>
<context id="string" end-at-line-end="true" style-ref="string">
<start>"</start>
<end>"|\r</end>
</context>
<context id="number" style-ref="number">
<match>(&H[0-9A-Fa-f]*)|(&B[01]*)|(([0-9]*\.)?[0-9]*)</match>
</context>
<context id="commands" style-ref="command">
<keyword>ACLS</keyword>
<keyword>APPEND</keyword>
<keyword>BEEP</keyword>
<keyword>BGCLIP</keyword>
<keyword>BGCLR</keyword>
<keyword>BGCOPY</keyword>
<keyword>BGFILL</keyword>
<keyword>BGMCLEAR</keyword>
<keyword>BGMPLAY</keyword>
<keyword>BGMPRG</keyword>
<keyword>BGMSET</keyword>
<keyword>BGMSETD</keyword>
<keyword>BGMSETV</keyword>
<keyword>BGMSTOP</keyword>
<keyword>BGMVOL</keyword>
<keyword>BGOFS</keyword>
<keyword>BGPAGE</keyword>
<keyword>BGPUT</keyword>
<keyword>BGREAD</keyword>
<keyword>BREPEAT</keyword>
<keyword>CHRINIT</keyword>
<keyword>CHRREAD</keyword>
<keyword>CHRSET</keyword>
<keyword>CLEAR</keyword>
<keyword>CLS</keyword>
<keyword>COLINIT</keyword>
<keyword>COLOR</keyword>
<keyword>COLREAD</keyword>
<keyword>COLSET</keyword>
<keyword>CONT</keyword>
<keyword>DATA</keyword>
<keyword>DELETE</keyword>
<keyword>DIM</keyword>
<keyword>DTREAD</keyword>
<keyword>ELSE</keyword>
<keyword>END</keyword>
<keyword>EXEC</keyword>
<keyword>FOR</keyword>
<keyword>GBOX</keyword>
<keyword>GCIRCLE</keyword>
<keyword>GCLS</keyword>
<keyword>GCOLOR</keyword>
<keyword>GCOPY</keyword>
<keyword>GDRAWMD</keyword>
<keyword>GFILL</keyword>
<keyword>GLINE</keyword>
<keyword>GOSUB</keyword>
<keyword>GOTO</keyword>
<keyword>GPAGE</keyword>
<keyword>GPAINT</keyword>
<keyword>GPSET</keyword>
<keyword>GPRIO</keyword>
<keyword>GPUTCHR</keyword>
<keyword>ICONCLR</keyword>
<keyword>ICONSET</keyword>
<keyword>IF</keyword>
<keyword>INPUT</keyword>
<keyword>KEY</keyword>
<keyword>LINPUT</keyword>
<keyword>LIST</keyword>
<keyword>LOAD</keyword>
<keyword>LOCATE</keyword>
<keyword>NEW</keyword>
<keyword>NEXT</keyword>
<keyword>NOT</keyword>
<keyword>ON</keyword>
<keyword>PNLSTR</keyword>
<keyword>PNLTYPE</keyword>
<keyword>PRINT</keyword>
<keyword>READ</keyword>
<keyword>REBOOT</keyword>
<keyword>RECVFILE</keyword>
<keyword>REM</keyword>
<keyword>RENAME</keyword>
<keyword>RESTORE</keyword>
<keyword>RETURN</keyword>
<keyword>RSORT</keyword>
<keyword>RUN</keyword>
<keyword>SAVE</keyword>
<keyword>SENDFILE</keyword>
<keyword>SORT</keyword>
<keyword>SPANGLE</keyword>
<keyword>SPANIM</keyword>
<keyword>SPCHR</keyword>
<keyword>SPCLR</keyword>
<keyword>SPCOL</keyword>
<keyword>SPCOLVEC</keyword>
<keyword>SPHOME</keyword>
<keyword>SPOFS</keyword>
<keyword>SPPAGE</keyword>
<keyword>SPREAD</keyword>
<keyword>SPSCALE</keyword>
<keyword>SPSET</keyword>
<keyword>SPSETV</keyword>
<keyword>STEP</keyword>
<keyword>STOP</keyword>
<keyword>SWAP</keyword>
<keyword>THEN</keyword>
<keyword>TMREAD</keyword>
<keyword>TO</keyword>
<keyword>VISIBLE</keyword>
<keyword>VSYNC</keyword>
<keyword>WAIT</keyword>
</context>
<context id="functions" style-ref="function">
<keyword>ABS</keyword>
<keyword>ASC</keyword>
<keyword>ATAN</keyword>
<keyword>BGCHK</keyword>
<keyword>BGMCHK</keyword>
<keyword>BGMGETV</keyword>
<keyword>BTRIG</keyword>
<keyword>BUTTON</keyword>
<keyword>CHKCHR</keyword>
<keyword>COS</keyword>
<keyword>DEG</keyword>
<keyword>EXP</keyword>
<keyword>FLOOR</keyword>
<keyword>GSPOIT</keyword>
<keyword>ICONCHK</keyword>
<keyword>INSTR</keyword>
<keyword>LEN</keyword>
<keyword>LOG</keyword>
<keyword>MID$</keyword>
<keyword>PI</keyword>
<keyword>POW</keyword>
<keyword>RAD</keyword>
<keyword>RND</keyword>
<keyword>SGN</keyword>
<keyword>SIN</keyword>
<keyword>SPCHK</keyword>
<keyword>SPGETV</keyword>
<keyword>SPHIT</keyword>
<keyword>SPHITRC</keyword>
<keyword>SPHITSP</keyword>
<keyword>SQR</keyword>
<keyword>TAN</keyword>
<keyword>VAL</keyword>
</context>
<context id="stringfunctions" style-ref="function">
<match>(CHR|HEX|INKEY|LEFT|MID|RIGHT|STR|SUBST)\$</match>
</context>
<context id="numericsysvar" style-ref="sysvar">
<keyword>CSRX</keyword>
<keyword>CSRY</keyword>
<keyword>FREEMEM</keyword>
<keyword>VERSION</keyword>
<keyword>ERR</keyword>
<keyword>ERL</keyword>
<keyword>RESULT</keyword>
<keyword>TCHX</keyword>
<keyword>TCHY</keyword>
<keyword>TCHST</keyword>
<keyword>TCHTIME</keyword>
<keyword>MAINCNTL</keyword>
<keyword>MAINCNTH</keyword>
<keyword>TABSTEP</keyword>
<keyword>TRUE</keyword>
<keyword>FALSE</keyword>
<keyword>CANCEL</keyword>
<keyword>ICONPUSE</keyword>
<keyword>ICONPAGE</keyword>
<keyword>ICONPMAX</keyword>
<keyword>FUNCNO</keyword>
<keyword>FREEVAR</keyword>
<keyword>SYSBEEP</keyword>
<keyword>KEYBOARD</keyword>
<keyword>SPHITNO</keyword>
<keyword>SPHITX</keyword>
<keyword>SPHITY</keyword>
<keyword>SPHITT</keyword>
</context>
<context id="stringsysvar" style-ref="sysvar">
<match>(TIME|DATE|MEM|PRGNAME|PACKAGE)\$</match>
</context>
<context id="label" style-ref="label">
<match>\@[A-Z0-9_]+</match>
</context>
</include>
</context>
</definitions>
</language>
The PTC language definition.