First steps
Open a terminal shell in the installation directory, and
cd
to theutils
subdirectory. Run thehighlight.rex
program passingsample.html
as an argument:rexx highlight.rex ./sample.html
You should see output similar to the following (line breaks have been added for readability):
<!doctype html><html lang='en'> <head> <title>Test</title> <link rel='stylesheet' href='/rexx.parser/css/rexx-dark.css'> <head> <body> Sample text <div class="highlight-rexx-dark"> <pre> <span class="rx-kw">If</span><span class="rx-ws"> </span> <span class="rx-var">a</span><span class="rx-ws"> </span> <span class="rx-op">=</span><span class="rx-ws"> </span> <span class="rx-var">b</span><span class="rx-ws"> </span> <span class="rx-kw">Then</span><span class="rx-ws"> </span> <span class="rx-var">c</span> </pre> Last line </body> </html>
Now look at the source of
highlight.rex
and inspectsample.html
too. You have just seen the Rexx HTML highlighter in action!Now, in the same directory, run
elements.rex
with./hi.rex
as an argument.rexx elements ./hi.rex
You should see output similar to the following:
elements.rex run on 15 Feb 2025 at 10:54:37 Examining hi.rex... Elements marked '>' are inserted by the parser. Elements marked 'X' are ignorable. Compound symbol components are distinguished with a '->' mark. [ from : to ] >X 'value' (class) --------- --------- -- --------------------------- [ 1 1: 1 1] > ';' (a EL.END_OF_CLAUSE) [ 1 1: 1 4] 'SAY' (a EL.KEYWORD) [ 1 4: 1 5] X ' ' (a EL.WHITESPACE) [ 1 5: 1 9] 'Hi' (a EL.STRING) [ 1 9: 1 9] > ';' (a EL.END_OF_CLAUSE) [ 1 9: 1 9] > '' (a EL.IMPLICIT_EXIT) [ 1 9: 1 9] > ';' (a EL.END_OF_CLAUSE) [ 1 9: 1 9] > '' (a EL.END_OF_SOURCE) [ 1 9: 1 9] > ';' (a EL.END_OF_CLAUSE) Total: 9 elements and 0 compound symbol elements examined.
You can now browse the Rexx Highligther page, if you please, where you will find several new programs to run.
If you want to implement your own Rexx highlighter (recommended! :)), you will find a nice utility to do so in the Highligther page. You will also need some CSS files. The ones I am using in this site (which are fairly incomplete, specially the light background one!) can be found in the
css
subdirectory.Take a look at the HTML Highlighter page, and follow the links there, specially the features one.
For a beautiful highlighting example of a medium-sized (~750 lines) source program, see this program, which defines all the element categories, category sets and subcategories.
Take a look at the documentation about the Element API.
And, finally... please give feedback! Your feedback is important. Seriously! :) You can reach me at josep.maria.blasco@epbcn.com.