Skip to content

Commit ea4eed2

Browse files
add docs for HIGHLIGHT$
1 parent 1fe891a commit ea4eed2

File tree

3 files changed

+215
-0
lines changed

3 files changed

+215
-0
lines changed

docs/HIGHLIGHT.html

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5+
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6+
<meta name="generator" content="Doxygen 1.9.1"/>
7+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
8+
<title>Retro Rocket OS: HIGHLIGHT$ Function</title>
9+
<link href="tabs.css" rel="stylesheet" type="text/css"/>
10+
<script type="text/javascript" src="jquery.js"></script>
11+
<script type="text/javascript" src="dynsections.js"></script>
12+
<link href="navtree.css" rel="stylesheet" type="text/css"/>
13+
<script type="text/javascript" src="resize.js"></script>
14+
<script type="text/javascript" src="navtreedata.js"></script>
15+
<script type="text/javascript" src="navtree.js"></script>
16+
<link href="search/search.css" rel="stylesheet" type="text/css"/>
17+
<script type="text/javascript" src="search/searchdata.js"></script>
18+
<script type="text/javascript" src="search/search.js"></script>
19+
<link href="doxygen.css" rel="stylesheet" type="text/css" />
20+
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
21+
<link href="style.css" rel="stylesheet" type="text/css"/>
22+
</head>
23+
<body>
24+
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
25+
<div id="titlearea">
26+
<table cellspacing="0" cellpadding="0">
27+
<tbody>
28+
<tr style="height: 56px;">
29+
<td id="projectlogo"><img alt="Logo" src="rr.png"/></td>
30+
<td id="projectalign" style="padding-left: 0.5em;">
31+
<div id="projectname">Retro Rocket OS
32+
</div>
33+
<div id="projectbrief">BASIC-Powered Operating System</div>
34+
</td>
35+
</tr>
36+
</tbody>
37+
</table>
38+
</div>
39+
<!-- end header part -->
40+
<!-- Generated by Doxygen 1.9.1 -->
41+
<script type="text/javascript">
42+
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
43+
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
44+
/* @license-end */
45+
</script>
46+
<script type="text/javascript" src="menudata.js"></script>
47+
<script type="text/javascript" src="menu.js"></script>
48+
<script type="text/javascript">
49+
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
50+
$(function() {
51+
initMenu('',true,false,'search.php','Search');
52+
$(document).ready(function() { init_search(); });
53+
});
54+
/* @license-end */</script>
55+
<div id="main-nav"></div>
56+
</div><!-- top -->
57+
<div id="side-nav" class="ui-resizable side-nav-resizable">
58+
<div id="nav-tree">
59+
<div id="nav-tree-contents">
60+
<div id="nav-sync" class="sync"></div>
61+
</div>
62+
</div>
63+
<div id="splitbar" style="-moz-user-select:none;"
64+
class="ui-resizable-handle">
65+
</div>
66+
</div>
67+
<script type="text/javascript">
68+
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
69+
$(document).ready(function(){initNavTree('HIGHLIGHT.html',''); initResizable(); });
70+
/* @license-end */
71+
</script>
72+
<div id="doc-content">
73+
<!-- window showing the filter options -->
74+
<div id="MSearchSelectWindow"
75+
onmouseover="return searchBox.OnSearchSelectShow()"
76+
onmouseout="return searchBox.OnSearchSelectHide()"
77+
onkeydown="return searchBox.OnSearchSelectKey(event)">
78+
</div>
79+
80+
<!-- iframe showing the search results (closed by default) -->
81+
<div id="MSearchResultsWindow">
82+
<iframe src="javascript:void(0)" frameborder="0"
83+
name="MSearchResults" id="MSearchResults">
84+
</iframe>
85+
</div>
86+
87+
<div class="PageDoc"><div class="header">
88+
<div class="headertitle">
89+
<div class="title">HIGHLIGHT$ Function </div> </div>
90+
</div><!--header-->
91+
<div class="contents">
92+
<div class="textblock"><div class="fragment"><div class="line">HIGHLIGHT$(string-expression)</div>
93+
</div><!-- fragment --><p>Given a string containing BASIC source, returns a copy with ANSI SGR escape sequences applied for syntax highlighting. Intended for program listings, editors, and tools that render to an ANSI-capable terminal, producing a consistent look-and-feel.</p>
94+
<p><b>Notes</b></p>
95+
<ul>
96+
<li><b>Strings</b> — text between double quotes (<code>"..."</code>) is highlighted in <b>light yellow</b> from the opening quote to the closing quote. If a closing quote is missing, highlighting continues to the end of the input and is then reset.</li>
97+
<li><b>Comments</b><ul>
98+
<li>A single quote (') begins a comment that is highlighted in <b>dark green</b> until the end of the input.</li>
99+
<li>The keyword <code>REM</code> (when not inside a string) causes the <b>entire line</b> to be treated as a comment and highlighted in <b>dark green</b>.</li>
100+
</ul>
101+
</li>
102+
<li><b>Keywords / tokens</b> — recognised BASIC keywords are highlighted in <b>light blue</b> when they are not part of a longer identifier. Boundary detection prevents colouring inside names like <code>FORTH</code>. Exceptions: <code>PROC</code>, <code>FN</code>, and <code>=</code> may be adjacent to letters/digits/underscores and will still be highlighted.</li>
103+
<li><b>Built-in functions</b><ul>
104+
<li>Integer-returning built-ins are <b>light green</b>.</li>
105+
<li>String-returning built-ins are <b>light magenta</b>.</li>
106+
<li>Real/float-returning built-ins are <b>light cyan</b>.</li>
107+
</ul>
108+
</li>
109+
<li><b>Numeric literals</b> — digits (and a leading unary <code>+</code>/<code>-</code>) are highlighted in <b>orange</b>.</li>
110+
<li><b>Operators &amp; punctuation</b><code>() + - * / = &lt; &gt; , ;</code> are highlighted in <b>dark red</b>.</li>
111+
<li><b>Default text</b> — rendered in <b>white</b>. Colours are reset back to white after each coloured span, and a final reset is appended at the end of the result to prevent “colour leakage” in the caller’s terminal.</li>
112+
</ul>
113+
<p><b>Errors</b></p>
114+
<ul>
115+
<li>None</li>
116+
</ul>
117+
<p><b>Examples</b></p>
118+
<div class="fragment"><div class="line">&#39; Strings and a trailing comment</div>
119+
<div class="line">A$ = &quot;PRINT &quot; + CHR$(34) + &quot;hello world&quot; + CHR$(34) + &quot; &#39; This is an example&quot;</div>
120+
<div class="line">PRINT HIGHLIGHT$(A$)</div>
121+
<div class="line"> </div>
122+
<div class="line">&#39; Keywords, numbers, and operators</div>
123+
<div class="line">B$ = &quot;FOR I = 1 TO 10 + 8&quot;</div>
124+
<div class="line">PRINT HIGHLIGHT$(B$)</div>
125+
<div class="line"> </div>
126+
<div class="line">&#39; REM comment colours the whole line as a comment</div>
127+
<div class="line">D$ = &quot;REM this whole line is a comment&quot;</div>
128+
<div class="line">PRINT HIGHLIGHT$(D$)</div>
129+
</div><!-- fragment --><p><b>See also</b></p>
130+
<ul>
131+
<li><a class="el" href="PRINT.html">PRINT Keyword</a> - display output on the screen</li>
132+
<li><a class="el" href="edit.html">edit program</a> - Text editor </li>
133+
</ul>
134+
</div></div><!-- contents -->
135+
</div><!-- PageDoc -->
136+
</div><!-- doc-content -->
137+
<!-- start footer part -->
138+
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
139+
<ul>
140+
<li class="navelem"><a class="el" href="index.html">index</a></li><li class="navelem"><a class="el" href="basic-ref.html">BASIC Language Reference</a></li><li class="navelem"><a class="el" href="builtin-functions.html">Built-In Functions</a></li><li class="navelem"><a class="el" href="string-funcs.html">String Functions</a></li>
141+
<li class="footer">Generated on Wed Sep 10 2025 14:52:44 for Retro Rocket OS by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
142+
</ul>
143+
</div>
144+
</body>
145+
</html>

docs/xml/HIGHLIGHT.xml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
2+
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.1" xml:lang="en-US">
3+
<compounddef id="HIGHLIGHT" kind="page">
4+
<compoundname>HIGHLIGHT</compoundname>
5+
<title>HIGHLIGHT$ Function</title>
6+
<briefdescription>
7+
</briefdescription>
8+
<detaileddescription>
9+
<para><programlisting filename=".basic"><codeline><highlight class="normal">HIGHLIGHT$(string-expression)</highlight></codeline>
10+
</programlisting></para>
11+
<para>Given a string containing BASIC source, returns a copy with ANSI SGR escape sequences applied for syntax highlighting. Intended for program listings, editors, and tools that render to an ANSI-capable terminal, producing a consistent look-and-feel.</para>
12+
<para><bold>Notes</bold></para>
13+
<para><itemizedlist>
14+
<listitem><para><bold>Strings</bold> — text between double quotes (<computeroutput>&quot;...&quot;</computeroutput>) is highlighted in <bold>light yellow</bold> from the opening quote to the closing quote. If a closing quote is missing, highlighting continues to the end of the input and is then reset.</para>
15+
</listitem><listitem><para><bold>Comments</bold><itemizedlist>
16+
<listitem><para>A single quote (&apos;) begins a comment that is highlighted in <bold>dark green</bold> until the end of the input.</para>
17+
</listitem><listitem><para>The keyword <computeroutput>REM</computeroutput> (when not inside a string) causes the <bold>entire line</bold> to be treated as a comment and highlighted in <bold>dark green</bold>.</para>
18+
</listitem></itemizedlist>
19+
</para>
20+
</listitem><listitem><para><bold>Keywords / tokens</bold> — recognised BASIC keywords are highlighted in <bold>light blue</bold> when they are not part of a longer identifier. Boundary detection prevents colouring inside names like <computeroutput>FORTH</computeroutput>. Exceptions: <computeroutput>PROC</computeroutput>, <computeroutput>FN</computeroutput>, and <computeroutput>=</computeroutput> may be adjacent to letters/digits/underscores and will still be highlighted.</para>
21+
</listitem><listitem><para><bold>Built-in functions</bold><itemizedlist>
22+
<listitem><para>Integer-returning built-ins are <bold>light green</bold>.</para>
23+
</listitem><listitem><para>String-returning built-ins are <bold>light magenta</bold>.</para>
24+
</listitem><listitem><para>Real/float-returning built-ins are <bold>light cyan</bold>.</para>
25+
</listitem></itemizedlist>
26+
</para>
27+
</listitem><listitem><para><bold>Numeric literals</bold> — digits (and a leading unary <computeroutput>+</computeroutput>/<computeroutput>-</computeroutput>) are highlighted in <bold>orange</bold>.</para>
28+
</listitem><listitem><para><bold>Operators &amp; punctuation</bold> — <computeroutput>() + - * / = &lt; &gt; , ;</computeroutput> are highlighted in <bold>dark red</bold>.</para>
29+
</listitem><listitem><para><bold>Default text</bold> — rendered in <bold>white</bold>. Colours are reset back to white after each coloured span, and a final reset is appended at the end of the result to prevent “colour leakage” in the caller’s terminal.</para>
30+
</listitem></itemizedlist>
31+
</para>
32+
<para><bold>Errors</bold></para>
33+
<para><itemizedlist>
34+
<listitem><para>None</para>
35+
</listitem></itemizedlist>
36+
</para>
37+
<para><bold>Examples</bold></para>
38+
<para><programlisting filename=".basic"><codeline><highlight class="normal">&apos;<sp/>Strings<sp/>and<sp/>a<sp/>trailing<sp/>comment</highlight></codeline>
39+
<codeline><highlight class="normal">A$<sp/>=<sp/>&quot;PRINT<sp/>&quot;<sp/>+<sp/>CHR$(34)<sp/>+<sp/>&quot;hello<sp/>world&quot;<sp/>+<sp/>CHR$(34)<sp/>+<sp/>&quot;<sp/>&apos;<sp/>This<sp/>is<sp/>an<sp/>example&quot;</highlight></codeline>
40+
<codeline><highlight class="normal">PRINT<sp/>HIGHLIGHT$(A$)</highlight></codeline>
41+
<codeline></codeline>
42+
<codeline><highlight class="normal">&apos;<sp/>Keywords,<sp/>numbers,<sp/>and<sp/>operators</highlight></codeline>
43+
<codeline><highlight class="normal">B$<sp/>=<sp/>&quot;FOR<sp/>I<sp/>=<sp/>1<sp/>TO<sp/>10<sp/>+<sp/>8&quot;</highlight></codeline>
44+
<codeline><highlight class="normal">PRINT<sp/>HIGHLIGHT$(B$)</highlight></codeline>
45+
<codeline></codeline>
46+
<codeline><highlight class="normal">&apos;<sp/>REM<sp/>comment<sp/>colours<sp/>the<sp/>whole<sp/>line<sp/>as<sp/>a<sp/>comment</highlight></codeline>
47+
<codeline><highlight class="normal">D$<sp/>=<sp/>&quot;REM<sp/>this<sp/>whole<sp/>line<sp/>is<sp/>a<sp/>comment&quot;</highlight></codeline>
48+
<codeline><highlight class="normal">PRINT<sp/>HIGHLIGHT$(D$)</highlight></codeline>
49+
</programlisting></para>
50+
<para><bold>See also</bold></para>
51+
<para><itemizedlist>
52+
<listitem><para><ref refid="PRINT" kindref="compound">PRINT Keyword</ref> - display output on the screen</para>
53+
</listitem><listitem><para><ref refid="edit" kindref="compound">edit program</ref> - Text editor </para>
54+
</listitem></itemizedlist>
55+
</para>
56+
</detaileddescription>
57+
<location file="docpages/basic-language-reference/functions/string/HIGHLIGHT.md"/>
58+
</compounddef>
59+
</doxygen>

docs/xml/HIGHLIGHT_8md.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
2+
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.1" xml:lang="en-US">
3+
<compounddef id="HIGHLIGHT_8md" kind="file" language="Markdown">
4+
<compoundname>HIGHLIGHT.md</compoundname>
5+
<briefdescription>
6+
</briefdescription>
7+
<detaileddescription>
8+
</detaileddescription>
9+
<location file="docpages/basic-language-reference/functions/string/HIGHLIGHT.md"/>
10+
</compounddef>
11+
</doxygen>

0 commit comments

Comments
 (0)