cleanup parser code at least

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24323 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-04-18 12:26:21 +00:00
parent 108bac9798
commit a77cd8c0c6
2 changed files with 18 additions and 7 deletions

View File

@ -307,7 +307,7 @@ string Parser::getFullOpt()
Arg arg = getFullArg('[', ']');
if (arg.first)
return '[' + arg.second + ']';
return arg.second;
return string();
}
@ -317,14 +317,16 @@ string Parser::getOpt()
return res.empty() ? string() : '[' + res + ']';
}
string Parser::getFullParentheseArg()
{
Arg arg = getFullArg('(', ')');
if (arg.first)
return '(' + arg.second + ')';
return arg.second;
return string();
}
string const Parser::verbatimEnvironment(string const & name)
{
if (!good())

View File

@ -148,20 +148,29 @@ public:
std::string getArg(char left, char right);
/*!
* \returns getFullArg('[', ']') including the brackets or the
* empty string if no argument was found.
* empty string if there is no such argument.
*/
std::string getFullOpt();
/// \returns getArg('[', ']') including the brackets
/*!
* \returns getArg('[', ']') including the brackets or the
* empty string if there is no such argument.
*/
std::string getOpt();
/*!
* \returns getFullArg('(', ')') including the parentheses or the
* empty string if there is no such argument.
*/
std::string getFullParentheseArg();
/*!
* \returns the contents of the environment \p name.
* <tt>\begin{name}</tt> must be parsed already, <tt>\end{name}</tt>
* is parsed but not returned.
*/
std::string getFullParentheseArg();
/// \returns getArg('(', ')') including the parentheses
std::string const verbatimEnvironment(std::string const & name);
/// Returns the character of the current token and increments the token position.
/*!
* Returns the character of the current token and increments
* the token position.
*/
char getChar();
///
void error(std::string const & msg);