MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
mxvm::PasHTMLGen Class Reference

Generates syntax-highlighted HTML output from Pascal (.pas) source code. More...

#include <html_gen.hpp>

Public Member Functions

 PasHTMLGen (const std::string &src)
 Construct from Pascal source text.
void output (std::ostream &out, const std::string &filename, const std::string &cssHref="mxvm-highlight.css")
 Write generated HTML to an output stream.

Static Public Member Functions

static std::string defaultCss ()
 Return the default stylesheet text.

Private Attributes

std::string source

Detailed Description

Generates syntax-highlighted HTML output from Pascal (.pas) source code.

Supports all keywords, types, and built-ins recognised by the MXVM Pascal compiler (from both the parser and validator keyword sets), plus Pascal comment styles ({ }, (* *), //), single-quoted string literals with '' escape, hex literals ($FF), and char literals (#65 / #$41).

The generated HTML links to an external stylesheet instead of embedding styles inline, so colours and fonts can be customised by editing that file. Call defaultCss() to obtain the bundled default stylesheet text.

Definition at line 46 of file html_gen.hpp.

Constructor & Destructor Documentation

◆ PasHTMLGen()

mxvm::PasHTMLGen::PasHTMLGen ( const std::string & src)
explicit

Construct from Pascal source text.

Definition at line 324 of file html_gen.cpp.

References source.

Member Function Documentation

◆ defaultCss()

std::string mxvm::PasHTMLGen::defaultCss ( )
static

Return the default stylesheet text.

Covers all span classes used by both HTMLGen (.mxvm) and PasHTMLGen (.pas) output. Write this string to mxvm-highlight.css alongside the HTML files and edit it freely to change the colour scheme.

Definition at line 326 of file html_gen.cpp.

Referenced by ensureCss(), and output().

◆ output()

void mxvm::PasHTMLGen::output ( std::ostream & out,
const std::string & filename,
const std::string & cssHref = "mxvm-highlight.css" )

Write generated HTML to an output stream.

Parameters
outOutput stream
filenameSource filename (used in the HTML <title>)
cssHrefhref for the linked stylesheet (default: "mxvm-highlight.css")

Definition at line 378 of file html_gen.cpp.

References defaultCss(), and source.

Referenced by writeHtml().

Member Data Documentation

◆ source

std::string mxvm::PasHTMLGen::source
private

Definition at line 70 of file html_gen.hpp.

Referenced by PasHTMLGen(), and output().


The documentation for this class was generated from the following files: