Source-highlight Library
|
C++ class: doctemplate.h. More...
Classes | |
class | BufferedOutput |
The main class for writing into the output. More... | |
class | CharTranslator |
Translates specific character sequences into corresponding ones; it can also use regular expression for the characters to be translated. More... | |
class | ColorMap |
Simple map for colors (maps a color constant string to the corresponding color of the output format) More... | |
class | CTagsCollector |
Collects the tags information generated by the ctags program for a given word. More... | |
class | CTagsFormatter |
Formatter for information gathered from ctags. More... | |
struct | CTagsFormatterResults |
Stores the result of the CTagsFormatter. More... | |
struct | CTagsInfo |
Information about a tag. More... | |
class | CTagsManager |
Takes care of running ctags and to generate a CTagsFormmatter. More... | |
class | DebugListener |
Implementation of highlight events that prints debug information. More... | |
class | DelimitedLangElem |
class | DocGenerator |
Given a DocTemplate it generates the start of the document and the end, using variables such as title, file_name, header, etc. More... | |
class | DocTemplate |
class | EventGenerator |
A generic event generator, for listeners of type EventListener and events of type EventType. More... | |
struct | FileInfo |
Information about the file we are processing. More... | |
class | Formatter |
The base abstract class for formatting strings. More... | |
class | FormatterFactory |
The generic abstract factory to create Formatter objects, during the parsing of style files. More... | |
class | FormatterManager |
Associates to an element name the corresponding formatter. More... | |
struct | FormatterParams |
Additional parameters that can be passed to a formatter. More... | |
struct | HighlightBuilderException |
struct | HighlightEvent |
Event concerning an highlighting operation (e.g., formatting, entering a new state, exiting a state, etc.) More... | |
class | HighlightEventListener |
Base class for listeners of HighlightEvent. More... | |
class | HighlightRule |
Base class for highlight rules. More... | |
class | HighlightRuleFactory |
Abstract factory for highlighting rules. More... | |
class | HighlightState |
Represents a state during the highlighting (e.g., comment state, string state, etc.) More... | |
class | HighlightStateBuilder |
Builds an HighlightState from the language definition file collected structures. More... | |
class | HighlightStatePrinter |
Prints an HighlightState (and all its rules) More... | |
struct | HighlightToken |
Token containing information for performing the highlight. More... | |
class | Instances |
This class contains static and singleton instances for some utility classes for LangDefManagers, LangMap, etc. More... | |
struct | IOException |
Exception representing an error in an input/output operation. More... | |
class | LangDefManager |
Handles langdef language definition files. More... | |
class | LangElem |
class | LangElems |
collection of LangElem objects More... | |
class | LangElemsPrinter |
Prints all the language elements. More... | |
class | LangMap |
A map stored in a file with the format key = elem. More... | |
class | LanguageInfer |
Tries to infer the language by inspecting the input file. More... | |
class | LineBuffer |
A buffer for a line to be generated. More... | |
class | LineNumGenerator |
Generates line numbers in the output. More... | |
class | LineRanges |
Functionalities for detecting whether a line is in one of the stored line ranges (or in the context of a range). More... | |
struct | MatchingParameters |
Structure for passing parameters to the matching algorithm, for instance, "not beginning of line", etc. More... | |
class | NamedSubExpsLangElem |
An element with subparts (subexpressions), each with a possible different name. More... | |
struct | ParserException |
Represents an exception during parsing, for instance, syntax errors. More... | |
struct | ParserInfo |
Stores information about the file name and the line number of a generic element created during parsing. More... | |
struct | ParseStruct |
class | PreFormatter |
Preformats text to be generated. More... | |
struct | RefEntry |
internal struct to store information about references More... | |
class | RegexHighlightRule |
An implementation of HighlightRule using Boost regex library. More... | |
class | RegexPreProcessor |
preprocess a regular expression, e.g., transform "()" into "(?:)" More... | |
class | RegexRanges |
Stores possible separators implemented as regular expressions and provides functionalities to search for such occurrences in lines. More... | |
class | RegexRuleFactory |
Implementation of the abstract factory, creating highlighting rules based on boost::regex regular expressions. More... | |
class | Settings |
Handles the settings for source-highlight (and its library). More... | |
class | SourceFileHighlighter |
Highlights the contents of a file relying on a SourceHighlighter. More... | |
class | SourceHighlight |
The main class performing highlighting of an input file generating an output file. More... | |
class | SourceHighlighter |
The main class performing the highlighting of a single line. More... | |
class | SourceHighlightUtils |
Class with some utility static methods. More... | |
class | StateLangElem |
a language element that introduces a new state pattern Composite More... | |
class | StateStartLangElem |
A language element that may start a new state/environment. More... | |
class | StopWatch |
Records elapsed time. More... | |
class | StringDef |
represent a string for a language definition file's element More... | |
class | StringDefs |
A collection (list) of StringDef's. More... | |
class | StringListLangElem |
A language element consisting of a list of strings. More... | |
class | StringTable |
Stores dynamically allocated strings (used by the scanners), so that, later on, we can easily free all the memory for these strings. More... | |
class | StyleFileParser |
A utility class with static methods to parse style files. More... | |
struct | subexpressions_info |
class | TextStyle |
Represents a formatting template where there can be some variables (starting with $, e.g., $style, $text, etc.) that will be replaced with specific elements, e.g., the actual style for the formatting, the text to format, etc. More... | |
class | TextStyleBuilder |
Given TextStyle objects build a new one, adding a starting part, and ending part, and separating them. More... | |
class | TextStyleFormatter |
An implementation of Formatter, based on source-highlight TextStyle. More... | |
class | TextStyleFormatterFactory |
Generates TextStyleFormatters based on TextStyles. More... | |
struct | TextStyles |
Contains TextStyle objects for all formats (e.g., bold, italics, etc), and other templates (e.g., for the document header, etc.); it also contains the color map and the char translator. More... | |
struct | ToLower |
struct | ToUpper |
class | Untabifier |
PerFormratter to convert tabs to spaces before generation. More... | |
class | Utils |
generic utils functions (e.g., string manipulation) More... | |
class | VarDefinitions |
store definitions of strings and regular expressions representing language elements More... | |
class | Verbosity |
Utility class to output messages in case of verbose option is requested. More... | |
class | Versions |
Utility functions for version numbers. More... | |
class | WordTokenizer |
Tokenizes a paragraph separating words from spaces. More... | |
Typedefs | |
typedef std::set< std::string > | PostContents |
the contents to be put after a line or after the document | |
typedef boost::shared_ptr < CharTranslator > | CharTranslatorPtr |
typedef boost::shared_ptr < ColorMap > | ColorMapPtr |
shared pointer for ColorMap | |
typedef std::list< CTagsInfo > | CTagsInfos |
The collection of information about a tag. | |
typedef std::list< std::string > | postResults |
collection of strings to be written after (post) a line or a doc | |
typedef boost::shared_ptr < Formatter > | FormatterPtr |
shared pointer for Formatter | |
typedef std::list< StyleConstant > | StyleConstants |
collection of StyleConstant objects | |
typedef boost::shared_ptr < StyleConstants > | StyleConstantsPtr |
shared pointer for StyleConstants | |
typedef StyleConstants::const_iterator | StyleConstantsIterator |
iterator for StyleConstants | |
typedef std::map< std::string, FormatterPtr > | FormatterMap |
the map for formatters | |
typedef std::deque< std::string > | ElemList |
list representing the names of parts of a program | |
typedef std::list< std::string > | WordList |
typedef std::list< std::string > | ElemNameList |
typedef boost::shared_ptr < HighlightRule > | HighlightRulePtr |
Shared pointer for HighlightRule. More... | |
typedef std::deque < HighlightRulePtr > | RuleList |
List of rules. | |
typedef std::vector< std::string > | ReplacementList |
the values for replacing references (it should contain 9 possibly empty elements, because 9 is usually the limit for backreferences in regular expressions) | |
typedef boost::shared_ptr < HighlightState > | HighlightStatePtr |
the reference to an HighlightState | |
typedef std::set< int > | StateIdSet |
typedef std::list< std::pair < std::string, std::string > > | MatchedElements |
The matched element information by a rule. More... | |
typedef std::vector< std::string > | MatchedSubExps |
The matched subexpressions (if the original rule had subexpressions) | |
typedef std::map< std::string, HighlightStatePtr > | HighlightStateCache |
store already generated HighlightState specific to a given file name | |
typedef list< LangElem * > | LangElemsBase |
the base class for LangElems | |
typedef boost::shared_ptr < LineBuffer > | LineBufferPtr |
shared pointer for LineBuffer | |
typedef std::list< std::string > | ElementNames |
collection of element names | |
typedef boost::shared_ptr < ParseStruct > | ParseStructPtr |
typedef boost::shared_ptr < PreFormatter > | PreFormatterPtr |
shared pointer for PreFormatter | |
typedef std::list< std::string > | subexpressions_strings |
all the marked subexpressions in a list | |
typedef std::pair< int, int > | backreference_info |
Information about backreferences; the first elem contains the number of backreferences and the second one contains the highest backreference info. | |
typedef std::vector< std::string > | backreference_replacements |
What to replace to backreferences in a regular expression. | |
typedef boost::match_results < std::string::const_iterator > | regex_match_results |
The result of boost::regex_search. | |
typedef std::stack < HighlightStatePtr > | HighlightStateStack |
typedef boost::shared_ptr < HighlightStateStack > | HighlightStateStackPtr |
typedef std::set< std::string > | StringSet |
a set of strings | |
typedef std::list< StringDef * > | StringDefsBase |
typedef string | KeyType |
typedef list< KeyType > | KeyList |
typedef std::map< std::string, std::string > | SubstitutionMapping |
map for substitutions | |
typedef std::list < TextStyleFormatter * > | TextStyleFormatterCollection |
Collection of TextStyleFormatter objects. | |
typedef boost::shared_ptr < TextStyles > | TextStylesPtr |
shared pointer | |
Enumerations | |
enum | StyleConstant { ISBOLD = 1, ISITALIC, ISUNDERLINE, ISFIXED, ISNOTFIXED, ISNOREF } |
constants indicating boldface, italics, etc. More... | |
enum | RangeError { NO_ERROR = 0, INVALID_RANGE_NUMBER } |
a possible error in specifying a range | |
enum | RangeResult { NOT_IN_RANGE = 0, CONTEXT_RANGE, IN_RANGE } |
result for a check whether a number is in a range (or in a context) | |
enum | RefPosition { NONE = 0, INLINE = 1, POSTLINE, POSTDOC } |
where a reference must be put More... | |
enum | SettingError { NO_SETTING_ERROR = 0, CANT_CREATE_DIR, CANT_CREATE_FILE } |
an error dealing with setting configuration file | |
enum | load_line_ret { FOUND_EOF = 0, FOUND_NL, FOUND_END } |
enum | FileHighlighterDebug { NO_DEBUG = 0, DEBUG, DEBUG_INTERACTIVE } |
debugging policy | |
Functions | |
void | set_file_util_verbose (bool b) |
string | readFile (const string &fileName) throw (IOException) |
Reads the contents of the file into a string and returns it. More... | |
string | createOutputFileName (const string &inputFileName, const string &outputDir, const string &ext) |
Creates the output file name as outputDir + input file name + ext. More... | |
unsigned int | get_line_count (istream &input) |
string | get_file_extension (const string &filename) |
FILE * | open_file_stream (const string &input_file_name) |
istream * | open_file_istream (const string &input_file_name) |
istream * | open_file_istream_or_error (const string &input_file_name) |
istream * | _open_data_file_istream (const string &path, const string &input_file_name) |
istream * | open_data_file_istream (const string &path, const string &input_file_name, const string &start) |
FILE * | _open_data_file_stream (const string &path, const string &input_file_name) |
FILE * | open_data_file_stream (const string &path, const string &input_file_name, const string &start) |
bool | read_line (istream *in, string &line) |
string | get_file_path (const string &s) |
bool | contains_path (const string &s) |
string | strip_file_path (const string &s) |
string | get_input_file_name (const string &file_name) |
std::ostream & | operator<< (std::ostream &os, const HighlightBuilderException &entry) |
std::ostream & | operator<< (std::ostream &os, const IOException &entry) |
LangElems * | parse_lang_def () |
LangElems * | parse_lang_def (const char *path, const char *name) |
void | open_file_to_scan (const string &path, const string &name) |
void | clear_langdefscanner () |
Releases resources allocated by the scanner. | |
void | close_langdefinputfile () |
Closes the input file. More... | |
boost::regex | assoc_exp ("[[:blank:]]*([^[:blank:]]+)[[:blank:]]*=[[:blank:]]*([^[:blank:]\\r]+)[[:blank:]\\r]*|([[:space:]]+)|([[:space:]]*#.*)") |
the regular expression for the map file syntax | |
const string | guessEmacsMode (const string &modeline) |
TextStylesPtr | parse_outlang_def () |
TextStylesPtr | parse_outlang_def (const char *path, const char *name) |
void | open_outlang_file_to_scan (const string &path, const string &name) |
void | clear_outlangdefscanner () |
Releases resources allocated by the scanner. | |
void | close_outlangdefinputfile () |
Closes the input file. More... | |
std::ostream & | operator<< (std::ostream &os, const ParserException &entry) |
void | parseStyles (const std::string &path, const std::string &name, FormatterFactory *formatterFactory, std::string &bodyBgColor) |
Parses the specified style file, and creates the corresponding formatters, using the passed FormatterFactory. More... | |
void | parseStyles (const std::string &name, FormatterFactory *formatterFactory, std::string &bodyBgColor) |
Parses the specified style file, and creates the corresponding formatters, using the passed FormatterFactory. More... | |
void | parseStyleError (const std::string &error) |
void | parseCssStyles (const std::string &path, const std::string &name, FormatterFactory *formatterFactory, std::string &bodyBgColor) |
for css style files | |
const boost::regex | char_set_exp ("\\[([^\\|]*)\\]") |
matches character sets in a regular expression | |
const boost::regex | from ("(\\\\\\()|(\\((?!\\?))") |
substitute a "(" with "(?:" if it's not followed by a ? and not preceeded by \ char | |
const boost::regex | paren ("(?<!\\\\)\\((?!\\?)") |
found actual marking parenthesis, i.e., not preceeded by \ and not followed by ? | |
const boost::regex | backreference ("(\\\\([[:digit:]]))|(\\(\\?\\(([[:digit:]]))") |
regular expression matching a backreference, e.g., \1 or inside a conditional (?(1)...) | |
boost::regex | datadir_exp ("[[:blank:]]*(datadir)[[:blank:]]*=[[:blank:]]*\"([^[:blank:]\\r]+)\"[[:blank:]\\r]*|([[:space:]]+)|([[:space:]]*#.*)") |
the regular expression for the conf file syntax | |
const boost::regex | tabexp ("[\\t]") |
string | subst (const boost::regex &e, const string &s, const string &sub) |
template<class T > | |
const std::string | toStringCollection (const T *collection, char sep= ' ') |
Converts a collection of objects with method toString into a string, using the passed separator to separate the elements. More... | |
template<class T > | |
const std::string | toStringCollection (const T &collection, char sep= ' ') |
Converts a collection of objects into a string (relying on its stream representation), using the passed separator to separate the elements. More... | |
template<class T > | |
const std::string | toStringOriginalCollection (const T *collection, char sep= ' ') |
Converts a collection of objects with method toStringOriginal into a string, using the passed separator to separate the elements. More... | |
template<class T > | |
const std::string | collectionToString (const T *collection, char sep= ' ') |
Converts a collection of objects into a string, using the passed separator to separate the elements. More... | |
template<class T > | |
const std::string | collectionRefToString (const T &collection, char sep= ' ') |
Converts a collection of objects into a string, using the passed separator to separate the elements. More... | |
Variables | |
std::string | start_path |
const string | into = "(?1\\\\\\()(?2\\(\\?\\:)" |
substitute a "(" with "(?:" if it's not followed by a ? and not preceeded by \ char | |
string | globalDataDir = "" |
if set (i.e., not empty), retrieveDataDir() always returns this value | |
const string | special_char_escape = "(?1\\\\\\1)" |
...with its escaped version | |
const boost::regex | reference_exp ("(?<!\\\\)@\\{([[:digit:]])\\}") |
regular expression matching a reference, e.g.,digit} the $ must not be preceeded by an escape char | |
const boost::regex | special_char ("(\\.|\\[|\\]|\\{|\\}|\\(|\\)|\\\\|\\*|\\+|\\?|\\||\\^|\\$)") |
substitute a special char (i.e., .[{()*+?|^$)... | |
const string | _make_nonsensitive (const string &s) |
C++ class: doctemplate.h.
C++ class: textstyles.h.
C++ class: textstyleformatter.h.
Author: Lorenzo Bettini http://www.lorenzobettini.it, (C) 2005 Copyright: See COPYING file that comes with this distribution.
C++ function: substfun.h.
Description: The template for a document containing the output of highlighting
Author: Lorenzo Bettini http://www.lorenzobettini.it, (C) 2005-2007 Copyright: See COPYING file that comes with this distribution
Description: substitutes a string to a $var into a text.
Author: Lorenzo Bettini http://www.lorenzobettini.it, (C) 2005 Copyright: See COPYING file that comes with this distribution
Author: Lorenzo Bettini http://www.lorenzobettini.it, (C) 2005-2008 Copyright: See COPYING file that comes with this distribution
Author: Lorenzo Bettini http://www.lorenzobettini.it, (C) 2005-2009 Copyright: See COPYING file that comes with this distribution
typedef boost::shared_ptr<HighlightRule> srchilite::HighlightRulePtr |
Shared pointer for HighlightRule.
We need to use shared pointers because if we need to substitute some variables in a rule, we need to create a brand new copy of it, while we keep on using the same rules that do not need substitutions. Using shared pointers will automatically keep track of those that need to be removed.
typedef std::list<std::pair<std::string, std::string> > srchilite::MatchedElements |
The matched element information by a rule.
Each element of the collection is: first = the element name, second = the actual program string
void srchilite::close_langdefinputfile | ( | ) |
Closes the input file.
This is required only in case of errors during parsing (otherwise the file is closed automatically when the scanner reaches the end of file).
void srchilite::close_outlangdefinputfile | ( | ) |
Closes the input file.
This is required only in case of errors during parsing (otherwise the file is closed automatically when the scanner reaches the end of file).
const std::string srchilite::collectionRefToString | ( | const T & | collection, |
char | sep = ' ' |
||
) |
Converts a collection of objects into a string, using the passed separator to separate the elements.
collection | |
sep |
const std::string srchilite::collectionToString | ( | const T * | collection, |
char | sep = ' ' |
||
) |
Converts a collection of objects into a string, using the passed separator to separate the elements.
collection | |
sep |
string srchilite::createOutputFileName | ( | const string & | inputFileName, |
const string & | outputDir, | ||
const string & | ext | ||
) |
Creates the output file name as outputDir + input file name + ext.
inputFileName | |
outputDir | |
ext |
string srchilite::get_file_extension | ( | const string & | filename | ) |
filename |
unsigned int srchilite::get_line_count | ( | istream & | input | ) |
input |
void srchilite::parseStyles | ( | const std::string & | path, |
const std::string & | name, | ||
FormatterFactory * | formatterFactory, | ||
std::string & | bodyBgColor | ||
) |
Parses the specified style file, and creates the corresponding formatters, using the passed FormatterFactory.
path | the path for searching for style files |
name | the style file name |
formatterFactory | |
bodyBgColor | the background color for the document (can be an empty string) |
void srchilite::parseStyles | ( | const std::string & | name, |
FormatterFactory * | formatterFactory, | ||
std::string & | bodyBgColor | ||
) |
Parses the specified style file, and creates the corresponding formatters, using the passed FormatterFactory.
(For the default searching path, it uses the hardcoded data dir).
name | the style file name |
formatterFactory | |
bodyBgColor | the background color for the document (output parameter) |
string srchilite::readFile | ( | const string & | fileName | ) | |
throw | ( | IOException | |||
) |
Reads the contents of the file into a string and returns it.
fileName |
IOException |
const std::string srchilite::toStringCollection | ( | const T * | collection, |
char | sep = ' ' |
||
) |
Converts a collection of objects with method toString into a string, using the passed separator to separate the elements.
collection | |
sep |
const std::string srchilite::toStringCollection | ( | const T & | collection, |
char | sep = ' ' |
||
) |
Converts a collection of objects into a string (relying on its stream representation), using the passed separator to separate the elements.
collection | |
sep |
const std::string srchilite::toStringOriginalCollection | ( | const T * | collection, |
char | sep = ' ' |
||
) |
Converts a collection of objects with method toStringOriginal into a string, using the passed separator to separate the elements.
collection | |
sep |