From 2b0fc3c3a84b525557c012562786828371f71abc Mon Sep 17 00:00:00 2001
From: John Maddock ";
const char* footer_text = "
\n\n\n";
diff --git a/template_class_ref.htm b/template_class_ref.htm
index 6eeb2e54..86ad2ded 100644
--- a/template_class_ref.htm
+++ b/template_class_ref.htm
@@ -2053,7 +2053,7 @@ follows:
takes C/C++ source code as input, and outputs syntax highlighted
HTML code.
#include <iostream> +#include <fstream> #include <sstream> #include <string> @@ -2082,8 +2082,8 @@ boost::regex e1, e2; while(is.get(c)) { if(s.capacity() == s.size()) - s.reserve(s.capacity() * 3); - s.append(1, c); + s.reserve(s.capacity() * 3); + s.append(1, c); } } @@ -2105,12 +2105,12 @@ color="#0000FF">".htm")); // temporary string stream std::ostringstream t(std::ios::out | std::ios::binary); std::ostream_iterator<char, char> oi(t); - regex_merge(oi, in.begin(), in.end(), e2, pre_format); + boost::regex_merge(oi, in.begin(), in.end(), e2, pre_format); // then output to final output stream // adding syntax highlighting: std::string s(t.str()); std::ostream_iterator<char, char> out(os); - regex_merge(out, s.begin(), s.end(), e1, format_string); + boost::regex_merge(out, s.begin(), s.end(), e1, format_string); os << footer_text; } return 0; @@ -2123,14 +2123,14 @@ color="#0000FF">"(?1<)(?2>)"; const char* expression_text = // preprocessor directives: index 1 - "(^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*)|" - // comment: index 3 - "(//[^\\n]*|/\\*([^*]|\\*+[^*/])*\\*+/)|" - // literals: index 5 - "\\<([+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(8|16|32|64))|L)?)\\>|" - // string literals: index 14 - "('([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\")|" - // keywords: index 17 + "(^[[:blank:]]*#(?:[^\\\\\\n]|\\\\[^\\n[:punct:][:word:]]*[\\n[:punct:][:word:]])*)|" + // comment: index 2 + "(//[^\\n]*|/\\*.*?\\*/)|" + // literals: index 3 + "\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|" + // string literals: index 4 + "('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|" + // keywords: index 5 "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import" "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall" "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool" @@ -2143,16 +2143,16 @@ color="#0000FF">"(?1<)(?2>)"; ; const char* format_string = "(?1<font color=\"#008040\">$&</font>)" - "(?3<I><font color=\"#000080\">$&</font></I>)" - "(?5<font color=\"#0000A0\">$&</font>)" - "(?14<font color=\"#0000FF\">$&</font>)" - "(?17<B>$&</B>)"; + "(?2<I><font color=\"#000080\">$&</font></I>)" + "(?3<font color=\"#0000A0\">$&</font>)" + "(?4<font color=\"#0000FF\">$&</font>)" + "(?5<B>$&</B>)"; const char* header_text = "<HTML>\n<HEAD>\n" "<TITLE>Auto-generated html formated source</TITLE>\n" "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n" "</HEAD>\n" - "<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffff99\">\n" + "<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffffff\">\n" "<P> </P>\n<PRE>"; const char* footer_text = "</PRE>\n</BODY>\n\n";