NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class contains all needed keywords to highlight their occurences correspondingly. It will pass them to the NumeReEditor instances. For the terminal, this class acts as lexer. It will also provide autocompletion lists to be used by both, the NumeReEditor instances and the terminal. More...
#include <syntax.hpp>
Public Types | |
enum | SyntaxColors { SYNTAX_COMMAND = 1 , SYNTAX_OPTION , SYNTAX_FUNCTION , SYNTAX_CONSTANT , SYNTAX_SPECIALVAL , SYNTAX_STRING , SYNTAX_STD , SYNTAX_OPERATOR , SYNTAX_PROCEDURE , SYNTAX_NUMBER , SYNTAX_NPRC_COMMAND , SYNTAX_METHODS , SYNTAX_COMMENT , SYNTAX_CLUSTER , SYNTAX_TABLE } |
Public Member Functions | |
NumeReSyntax () | |
Default constructor. More... | |
NumeReSyntax (const std::string &_sPath) | |
Specialized constructor. Delegates to the default constructor and will also load the syntax definitions. More... | |
NumeReSyntax (const std::string &_sPath, const std::vector< std::string > &vPlugins) | |
Specialized constructor. Delegates to the default constructor and will also load the syntax definitions. Afterwards, the plugin commands are added to the list of known commands. More... | |
void | loadSyntax (const std::string &_sPath="") |
Member function for loading the syntax element definitions. More... | |
void | addPlugins (const std::vector< std::string > &vPlugins) |
Add the plugin definitions to the command strings. Will reload the standard settings in advance to restore the default state. More... | |
void | setProcedureTree (const std::vector< std::string > &vTree) |
Set the procedure tree (used for autocompleting). More... | |
std::string | getCommands () const |
std::string | getNPRCCommands () const |
std::string | getOptions () const |
std::string | getFunctions () const |
std::string | getMethods () const |
std::string | getConstants () const |
std::string | getSpecial () const |
std::string | getOperators () const |
std::string | getDocKeyWords () const |
std::string | getBlockDefs () const |
Returns all block definitions as a folding string for the lexers. More... | |
std::string | getMatlab () const |
std::string | getMatlabFunctions () const |
std::string | getCpp () const |
std::string | getCppFunctions () const |
std::string | getAutoCompList (std::string sFirstChars, bool useSmartSense=false) |
This function returns the autocompletion list for the editor. More... | |
std::string | getAutoCompListMATLAB (std::string sFirstChars) |
The same as above but specialized for MATLAB commands. More... | |
std::string | getAutoCompListCPP (std::string sFirstChars) |
The same as above but specialized for C++ Commands. More... | |
std::string | getAutoCompListTeX (std::string sFirstChars) |
The same as above but specialized for LaTeX Commands. More... | |
std::string | getProcAutoCompList (std::string sFirstChars, std::string sBaseNameSpace, std::string sSelectedNameSpace) |
This function will return the autocompletion list for the procedures based upon the provided procedure tree. More... | |
std::string | getNameSpaceAutoCompList (std::string sFirstChars) |
This function returns the autocompletion list for the namespaces. More... | |
std::string | highlightLine (const std::string &sCommandLine) |
This function applies the highlighting colors to the command line (only used in the terminal). More... | |
std::string | highlightError (const std::string &sCommandLine) |
Highlight an error message. We simply use the color of the operators (which is red as default). More... | |
std::string | highlightWarning (const std::string &sCommandLine) |
Highlight a warning message. We simply use the color of numbers (which is orange as default). More... | |
std::vector< SyntaxBlockDefinition > | getFullBlockDefs () const |
Private Member Functions | |
std::string | constructString (const std::vector< std::string > &vVector) const |
This member function concatenates the passed vector elements to a whitespace- separated single string. More... | |
std::vector< std::string > | splitString (std::string sString) |
This function splits the passed string up into single string tokens. More... | |
std::vector< SyntaxBlockDefinition > | splitDefs (std::string sDefString) |
Converts a block def string into actual syntax block definitions. More... | |
bool | matchItem (const std::vector< std::string > &vVector, const std::string &sString) |
This function searches for a match of the passed string in the passed vector. More... | |
Private Attributes | |
std::vector< std::string > | vNSCRCommands |
std::vector< std::string > | vNPRCCommands |
std::vector< std::string > | vOptions |
std::vector< std::string > | vFunctions |
std::vector< std::string > | vMethods |
std::vector< std::string > | vMethodsArgs |
std::vector< std::string > | vConstants |
std::vector< std::string > | vSpecialValues |
std::vector< std::string > | vOperators |
std::vector< std::string > | vDocKeyWords |
std::vector< SyntaxBlockDefinition > | vBlockDefs |
std::vector< std::string > | vMatlabKeyWords |
std::vector< std::string > | vMatlabFunctions |
std::vector< std::string > | vCppKeyWords |
std::vector< std::string > | vCppFunctions |
std::vector< std::string > | vTeXKeyWords |
std::vector< std::string > | vProcedureTree |
std::string | sSingleOperators |
std::map< std::string, std::pair< std::string, int > > | mAutoCompList |
std::map< std::string, int > | mAutoCompListMATLAB |
std::map< std::string, int > | mAutoCompListCPP |
std::map< std::string, int > | mAutoCompListTeX |
std::string | sPath |
This class contains all needed keywords to highlight their occurences correspondingly. It will pass them to the NumeReEditor instances. For the terminal, this class acts as lexer. It will also provide autocompletion lists to be used by both, the NumeReEditor instances and the terminal.
Definition at line 54 of file syntax.hpp.
Definition at line 89 of file syntax.hpp.
NumeReSyntax::NumeReSyntax | ( | ) |
Default constructor.
Definition at line 27 of file syntax.cpp.
References sSingleOperators, vConstants, vCppFunctions, vCppKeyWords, vDocKeyWords, vFunctions, vMatlabFunctions, vMatlabKeyWords, vMethods, vMethodsArgs, vNPRCCommands, vNSCRCommands, vOperators, vOptions, vSpecialValues, and vTeXKeyWords.
NumeReSyntax::NumeReSyntax | ( | const std::string & | _sPath | ) |
Specialized constructor. Delegates to the default constructor and will also load the syntax definitions.
_sPath | const std::string& |
Definition at line 58 of file syntax.cpp.
References loadSyntax().
NumeReSyntax::NumeReSyntax | ( | const std::string & | _sPath, |
const std::vector< std::string > & | vPlugins | ||
) |
Specialized constructor. Delegates to the default constructor and will also load the syntax definitions. Afterwards, the plugin commands are added to the list of known commands.
_sPath | const std::string& |
vPlugins | const std::vector<std::string>& |
Definition at line 75 of file syntax.cpp.
References vNSCRCommands.
void NumeReSyntax::addPlugins | ( | const std::vector< std::string > & | vPlugins | ) |
Add the plugin definitions to the command strings. Will reload the standard settings in advance to restore the default state.
vPlugins | const std::vector<std::string>& |
Definition at line 165 of file syntax.cpp.
References loadSyntax(), mAutoCompList, and vNSCRCommands.
Referenced by NumeReTerminal::OnThreadUpdate().
|
private |
This member function concatenates the passed vector elements to a whitespace- separated single string.
vVector | const std::vector<std::string>& |
Definition at line 234 of file syntax.cpp.
Referenced by getCommands(), getConstants(), getCpp(), getCppFunctions(), getDocKeyWords(), getFunctions(), getMatlab(), getMatlabFunctions(), getMethods(), getNPRCCommands(), getOperators(), getOptions(), and getSpecial().
std::string NumeReSyntax::getAutoCompList | ( | std::string | sFirstChars, |
bool | useSmartSense = false |
||
) |
This function returns the autocompletion list for the editor.
sFirstChars | std::string |
useSmartSense | bool |
Definition at line 670 of file syntax.cpp.
References mAutoCompList, SYNTAX_COMMAND, SYNTAX_CONSTANT, SYNTAX_FUNCTION, SYNTAX_METHODS, SYNTAX_OPERATOR, SYNTAX_OPTION, SYNTAX_SPECIALVAL, toLowerCase(), toString(), vConstants, vFunctions, vMethods, vMethodsArgs, vNPRCCommands, vNSCRCommands, vOperators, vOptions, and vSpecialValues.
Referenced by NumeReEditor::OnChar(), and GenericTerminal::tab().
std::string NumeReSyntax::getAutoCompListCPP | ( | std::string | sFirstChars | ) |
The same as above but specialized for C++ Commands.
sFirstChars | std::string |
Definition at line 802 of file syntax.cpp.
References mAutoCompListCPP, SYNTAX_COMMAND, SYNTAX_FUNCTION, toLowerCase(), toString(), vCppFunctions, and vCppKeyWords.
Referenced by NumeReEditor::OnChar().
std::string NumeReSyntax::getAutoCompListMATLAB | ( | std::string | sFirstChars | ) |
The same as above but specialized for MATLAB commands.
sFirstChars | std::string |
Definition at line 764 of file syntax.cpp.
References mAutoCompListMATLAB, SYNTAX_COMMAND, SYNTAX_FUNCTION, toLowerCase(), toString(), vMatlabFunctions, and vMatlabKeyWords.
Referenced by NumeReEditor::OnChar().
std::string NumeReSyntax::getAutoCompListTeX | ( | std::string | sFirstChars | ) |
The same as above but specialized for LaTeX Commands.
sFirstChars | std::string |
Definition at line 840 of file syntax.cpp.
References mAutoCompListTeX, SYNTAX_COMMAND, toLowerCase(), toString(), and vTeXKeyWords.
Referenced by NumeReEditor::OnChar().
std::string NumeReSyntax::getBlockDefs | ( | ) | const |
Returns all block definitions as a folding string for the lexers.
Definition at line 210 of file syntax.cpp.
References vBlockDefs.
Referenced by NumeReEditor::UpdateSyntaxHighlighting().
|
inline |
Definition at line 115 of file syntax.hpp.
References constructString(), and vNSCRCommands.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
|
inline |
Definition at line 125 of file syntax.hpp.
References constructString(), and vConstants.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
|
inline |
Definition at line 138 of file syntax.hpp.
References constructString(), and vCppKeyWords.
Referenced by NumeReEditor::UpdateSyntaxHighlighting().
|
inline |
Definition at line 140 of file syntax.hpp.
References constructString(), and vCppFunctions.
Referenced by NumeReEditor::UpdateSyntaxHighlighting().
|
inline |
Definition at line 131 of file syntax.hpp.
References constructString(), and vDocKeyWords.
Referenced by NumeReEditor::UpdateSyntaxHighlighting().
|
inline |
Definition at line 153 of file syntax.hpp.
References vBlockDefs.
Referenced by NumeReEditor::NumeReEditor().
|
inline |
Definition at line 121 of file syntax.hpp.
References constructString(), and vFunctions.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
|
inline |
Definition at line 134 of file syntax.hpp.
References constructString(), and vMatlabKeyWords.
Referenced by NumeReEditor::UpdateSyntaxHighlighting().
|
inline |
Definition at line 136 of file syntax.hpp.
References constructString(), and vMatlabFunctions.
Referenced by NumeReEditor::UpdateSyntaxHighlighting().
|
inline |
Definition at line 123 of file syntax.hpp.
References constructString(), vMethods, and vMethodsArgs.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
std::string NumeReSyntax::getNameSpaceAutoCompList | ( | std::string | sFirstChars | ) |
This function returns the autocompletion list for the namespaces.
sFirstChars | std::string |
Definition at line 974 of file syntax.cpp.
References SYNTAX_PROCEDURE, toString(), and vProcedureTree.
Referenced by SearchController::FindProceduresInCurrentFile().
|
inline |
Definition at line 117 of file syntax.hpp.
References constructString(), and vNPRCCommands.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
|
inline |
Definition at line 129 of file syntax.hpp.
References constructString(), and vOperators.
Referenced by NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
|
inline |
Definition at line 119 of file syntax.hpp.
References constructString(), and vOptions.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
std::string NumeReSyntax::getProcAutoCompList | ( | std::string | sFirstChars, |
std::string | sBaseNameSpace, | ||
std::string | sSelectedNameSpace | ||
) |
This function will return the autocompletion list for the procedures based upon the provided procedure tree.
sFirstChars | std::string |
sBaseNameSpace | std::string |
sSelectedNameSpace | std::string |
Definition at line 878 of file syntax.cpp.
References SYNTAX_PROCEDURE, toLowerCase(), toString(), and vProcedureTree.
Referenced by NumeReEditor::OnChar(), and GenericTerminal::tab().
|
inline |
Definition at line 127 of file syntax.hpp.
References constructString(), and vSpecialValues.
Referenced by DocumentationGenerator::createStyleFile(), NumeReEditor::UpdateSyntaxHighlighting(), and NumeReHistory::UpdateSyntaxHighlighting().
std::string NumeReSyntax::highlightError | ( | const std::string & | sCommandLine | ) |
Highlight an error message. We simply use the color of the operators (which is red as default).
sCommandLine | const std::string& |
Definition at line 636 of file syntax.cpp.
References SYNTAX_OPERATOR.
Referenced by highlightLine(), and TextManager::updateColors().
std::string NumeReSyntax::highlightLine | ( | const std::string & | sCommandLine | ) |
This function applies the highlighting colors to the command line (only used in the terminal).
sCommandLine | const std::string& |
Definition at line 363 of file syntax.cpp.
References highlightError(), highlightWarning(), matchItem(), sSingleOperators, SYNTAX_COMMAND, SYNTAX_COMMENT, SYNTAX_CONSTANT, SYNTAX_FUNCTION, SYNTAX_METHODS, SYNTAX_NUMBER, SYNTAX_OPERATOR, SYNTAX_OPTION, SYNTAX_PROCEDURE, SYNTAX_SPECIALVAL, SYNTAX_STD, SYNTAX_STRING, vConstants, vFunctions, vMethods, vMethodsArgs, vNPRCCommands, vNSCRCommands, vOptions, and vSpecialValues.
Referenced by applySyntaxHighlighting(), DebugViewer::setExpression(), and TextManager::updateColors().
std::string NumeReSyntax::highlightWarning | ( | const std::string & | sCommandLine | ) |
Highlight a warning message. We simply use the color of numbers (which is orange as default).
sCommandLine | const std::string& |
Definition at line 653 of file syntax.cpp.
References SYNTAX_NUMBER.
Referenced by highlightLine().
void NumeReSyntax::loadSyntax | ( | const std::string & | _sPath = "" | ) |
Member function for loading the syntax element definitions.
_sPath | const std::string& |
Definition at line 89 of file syntax.cpp.
References sPath, splitDefs(), splitString(), vBlockDefs, vConstants, vCppFunctions, vCppKeyWords, vDocKeyWords, vFunctions, vMatlabFunctions, vMatlabKeyWords, vMethods, vMethodsArgs, vNPRCCommands, vNSCRCommands, vOperators, vOptions, vSpecialValues, and vTeXKeyWords.
Referenced by addPlugins(), GenericTerminal::GenericTerminal(), and NumeReSyntax().
|
private |
This function searches for a match of the passed string in the passed vector.
vVector | const std::vector<std::string>& |
sString | const std::string& |
Definition at line 340 of file syntax.cpp.
Referenced by highlightLine().
void NumeReSyntax::setProcedureTree | ( | const std::vector< std::string > & | vTree | ) |
Set the procedure tree (used for autocompleting).
vTree | const std::vector<std::string>& |
Definition at line 182 of file syntax.cpp.
References vProcedureTree.
Referenced by NumeReWindow::CreateProcedureTree().
|
private |
Converts a block def string into actual syntax block definitions.
sDefString | std::string |
Definition at line 300 of file syntax.cpp.
References SyntaxBlockDefinition::endWord, getAllSemiColonSeparatedTokens(), SyntaxBlockDefinition::middleWord1, SyntaxBlockDefinition::middleWord2, splitString(), and SyntaxBlockDefinition::startWord.
Referenced by loadSyntax().
|
private |
This function splits the passed string up into single string tokens.
sString | std::string |
Definition at line 256 of file syntax.cpp.
Referenced by loadSyntax(), and splitDefs().
|
private |
Definition at line 77 of file syntax.hpp.
Referenced by addPlugins(), and getAutoCompList().
|
private |
Definition at line 79 of file syntax.hpp.
Referenced by getAutoCompListCPP().
|
private |
Definition at line 78 of file syntax.hpp.
Referenced by getAutoCompListMATLAB().
|
private |
Definition at line 80 of file syntax.hpp.
Referenced by getAutoCompListTeX().
|
private |
Definition at line 82 of file syntax.hpp.
Referenced by loadSyntax().
|
private |
Definition at line 76 of file syntax.hpp.
Referenced by highlightLine(), and NumeReSyntax().
|
private |
Definition at line 67 of file syntax.hpp.
Referenced by getBlockDefs(), getFullBlockDefs(), and loadSyntax().
|
private |
Definition at line 63 of file syntax.hpp.
Referenced by getAutoCompList(), getConstants(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 71 of file syntax.hpp.
Referenced by getAutoCompListCPP(), getCppFunctions(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 70 of file syntax.hpp.
Referenced by getAutoCompListCPP(), getCpp(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 66 of file syntax.hpp.
Referenced by getDocKeyWords(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 60 of file syntax.hpp.
Referenced by getAutoCompList(), getFunctions(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 69 of file syntax.hpp.
Referenced by getAutoCompListMATLAB(), getMatlabFunctions(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 68 of file syntax.hpp.
Referenced by getAutoCompListMATLAB(), getMatlab(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 61 of file syntax.hpp.
Referenced by getAutoCompList(), getMethods(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 62 of file syntax.hpp.
Referenced by getAutoCompList(), getMethods(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 58 of file syntax.hpp.
Referenced by getAutoCompList(), getNPRCCommands(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 57 of file syntax.hpp.
Referenced by addPlugins(), getAutoCompList(), getCommands(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 65 of file syntax.hpp.
Referenced by getAutoCompList(), getOperators(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 59 of file syntax.hpp.
Referenced by getAutoCompList(), getOptions(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 74 of file syntax.hpp.
Referenced by getNameSpaceAutoCompList(), getProcAutoCompList(), and setProcedureTree().
|
private |
Definition at line 64 of file syntax.hpp.
Referenced by getAutoCompList(), getSpecial(), highlightLine(), loadSyntax(), and NumeReSyntax().
|
private |
Definition at line 72 of file syntax.hpp.
Referenced by getAutoCompListTeX(), loadSyntax(), and NumeReSyntax().