|
| 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&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&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&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 & punctuation</b> — <code>() + - * / = < > , ;</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">' Strings and a trailing comment</div> |
| 119 | +<div class="line">A$ = "PRINT " + CHR$(34) + "hello world" + CHR$(34) + " ' This is an example"</div> |
| 120 | +<div class="line">PRINT HIGHLIGHT$(A$)</div> |
| 121 | +<div class="line"> </div> |
| 122 | +<div class="line">' Keywords, numbers, and operators</div> |
| 123 | +<div class="line">B$ = "FOR I = 1 TO 10 + 8"</div> |
| 124 | +<div class="line">PRINT HIGHLIGHT$(B$)</div> |
| 125 | +<div class="line"> </div> |
| 126 | +<div class="line">' REM comment colours the whole line as a comment</div> |
| 127 | +<div class="line">D$ = "REM this whole line is a comment"</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> |
0 commit comments