mirror of
https://github.com/reactos/CMake.git
synced 2025-02-19 02:57:51 +00:00
cmCommandArgumentParser: remove the variable tokens from the class
Make them local constants in the lexer file.
This commit is contained in:
parent
98cb9f3ee9
commit
576c079faa
@ -674,6 +674,13 @@ Modify cmCommandArgumentLexer.cxx:
|
|||||||
/* Include the set of tokens from the parser. */
|
/* Include the set of tokens from the parser. */
|
||||||
#include "cmCommandArgumentParserTokens.h"
|
#include "cmCommandArgumentParserTokens.h"
|
||||||
|
|
||||||
|
static const char *DCURLYVariable = "${";
|
||||||
|
static const char *RCURLYVariable = "}";
|
||||||
|
static const char *ATVariable = "@";
|
||||||
|
static const char *DOLLARVariable = "$";
|
||||||
|
static const char *LCURLYVariable = "{";
|
||||||
|
static const char *BSLASHVariable = "\\";
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define INITIAL 0
|
#define INITIAL 0
|
||||||
@ -1011,7 +1018,7 @@ YY_RULE_SETUP
|
|||||||
{
|
{
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->DCURLYVariable;
|
yylvalp->str = DCURLYVariable;
|
||||||
return cal_DCURLY;
|
return cal_DCURLY;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
@ -1020,7 +1027,7 @@ YY_RULE_SETUP
|
|||||||
{
|
{
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->RCURLYVariable;
|
yylvalp->str = RCURLYVariable;
|
||||||
return cal_RCURLY;
|
return cal_RCURLY;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
@ -1029,7 +1036,7 @@ YY_RULE_SETUP
|
|||||||
{
|
{
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->ATVariable;
|
yylvalp->str = ATVariable;
|
||||||
return cal_AT;
|
return cal_AT;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
@ -1064,7 +1071,7 @@ case 10:
|
|||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
{
|
{
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->DOLLARVariable;
|
yylvalp->str = DOLLARVariable;
|
||||||
return cal_DOLLAR;
|
return cal_DOLLAR;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
@ -1072,7 +1079,7 @@ case 11:
|
|||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
{
|
{
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->LCURLYVariable;
|
yylvalp->str = LCURLYVariable;
|
||||||
return cal_LCURLY;
|
return cal_LCURLY;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
@ -1080,7 +1087,7 @@ case 12:
|
|||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
{
|
{
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->BSLASHVariable;
|
yylvalp->str = BSLASHVariable;
|
||||||
return cal_BSLASH;
|
return cal_BSLASH;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
@ -1088,7 +1095,7 @@ case 13:
|
|||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
{
|
{
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->BSLASHVariable;
|
yylvalp->str = BSLASHVariable;
|
||||||
return cal_SYMBOL;
|
return cal_SYMBOL;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
|
@ -28,6 +28,13 @@ Modify cmCommandArgumentLexer.cxx:
|
|||||||
/* Include the set of tokens from the parser. */
|
/* Include the set of tokens from the parser. */
|
||||||
#include "cmCommandArgumentParserTokens.h"
|
#include "cmCommandArgumentParserTokens.h"
|
||||||
|
|
||||||
|
static const char *DCURLYVariable = "${";
|
||||||
|
static const char *RCURLYVariable = "}";
|
||||||
|
static const char *ATVariable = "@";
|
||||||
|
static const char *DOLLARVariable = "$";
|
||||||
|
static const char *LCURLYVariable = "{";
|
||||||
|
static const char *BSLASHVariable = "\\";
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@ -63,21 +70,21 @@ Modify cmCommandArgumentLexer.cxx:
|
|||||||
"${" {
|
"${" {
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->DCURLYVariable;
|
yylvalp->str = DCURLYVariable;
|
||||||
return cal_DCURLY;
|
return cal_DCURLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
"}" {
|
"}" {
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->RCURLYVariable;
|
yylvalp->str = RCURLYVariable;
|
||||||
return cal_RCURLY;
|
return cal_RCURLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
"@" {
|
"@" {
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->ATVariable;
|
yylvalp->str = ATVariable;
|
||||||
return cal_AT;
|
return cal_AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,25 +110,25 @@ Modify cmCommandArgumentLexer.cxx:
|
|||||||
|
|
||||||
"$" {
|
"$" {
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->DOLLARVariable;
|
yylvalp->str = DOLLARVariable;
|
||||||
return cal_DOLLAR;
|
return cal_DOLLAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
"{" {
|
"{" {
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->LCURLYVariable;
|
yylvalp->str = LCURLYVariable;
|
||||||
return cal_LCURLY;
|
return cal_LCURLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
<ESCAPES>"\\" {
|
<ESCAPES>"\\" {
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->BSLASHVariable;
|
yylvalp->str = BSLASHVariable;
|
||||||
return cal_BSLASH;
|
return cal_BSLASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
<NOESCAPES>"\\" {
|
<NOESCAPES>"\\" {
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
||||||
yylvalp->str = yyextra->BSLASHVariable;
|
yylvalp->str = BSLASHVariable;
|
||||||
return cal_SYMBOL;
|
return cal_SYMBOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,6 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
|
|||||||
this->FileLine = -1;
|
this->FileLine = -1;
|
||||||
this->FileName = nullptr;
|
this->FileName = nullptr;
|
||||||
this->RemoveEmpty = true;
|
this->RemoveEmpty = true;
|
||||||
this->EmptyVariable[0] = 0;
|
|
||||||
strcpy(this->DCURLYVariable, "${");
|
|
||||||
strcpy(this->RCURLYVariable, "}");
|
|
||||||
strcpy(this->ATVariable, "@");
|
|
||||||
strcpy(this->DOLLARVariable, "$");
|
|
||||||
strcpy(this->LCURLYVariable, "{");
|
|
||||||
strcpy(this->BSLASHVariable, "\\");
|
|
||||||
|
|
||||||
this->NoEscapeMode = false;
|
this->NoEscapeMode = false;
|
||||||
this->ReplaceAtSyntax = false;
|
this->ReplaceAtSyntax = false;
|
||||||
@ -47,7 +40,7 @@ void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file)
|
|||||||
const char* cmCommandArgumentParserHelper::AddString(const std::string& str)
|
const char* cmCommandArgumentParserHelper::AddString(const std::string& str)
|
||||||
{
|
{
|
||||||
if (str.empty()) {
|
if (str.empty()) {
|
||||||
return this->EmptyVariable;
|
return "";
|
||||||
}
|
}
|
||||||
char* stVal = new char[str.size() + 1];
|
char* stVal = new char[str.size() + 1];
|
||||||
strcpy(stVal, str.c_str());
|
strcpy(stVal, str.c_str());
|
||||||
@ -62,7 +55,7 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
|
|||||||
return this->ExpandVariable(var);
|
return this->ExpandVariable(var);
|
||||||
}
|
}
|
||||||
if (!var) {
|
if (!var) {
|
||||||
return this->EmptyVariable;
|
return "";
|
||||||
}
|
}
|
||||||
if (strcmp(key, "ENV") == 0) {
|
if (strcmp(key, "ENV") == 0) {
|
||||||
std::string str;
|
std::string str;
|
||||||
@ -72,7 +65,7 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
|
|||||||
}
|
}
|
||||||
return this->AddString(str);
|
return this->AddString(str);
|
||||||
}
|
}
|
||||||
return this->EmptyVariable;
|
return "";
|
||||||
}
|
}
|
||||||
if (strcmp(key, "CACHE") == 0) {
|
if (strcmp(key, "CACHE") == 0) {
|
||||||
if (const char* c =
|
if (const char* c =
|
||||||
@ -82,7 +75,7 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
|
|||||||
}
|
}
|
||||||
return this->AddString(c);
|
return this->AddString(c);
|
||||||
}
|
}
|
||||||
return this->EmptyVariable;
|
return "";
|
||||||
}
|
}
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "Syntax $" << key << "{} is not supported. "
|
e << "Syntax $" << key << "{} is not supported. "
|
||||||
|
@ -53,13 +53,6 @@ public:
|
|||||||
void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
|
void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
|
||||||
|
|
||||||
const char* GetError() { return this->ErrorString.c_str(); }
|
const char* GetError() { return this->ErrorString.c_str(); }
|
||||||
char EmptyVariable[1];
|
|
||||||
char DCURLYVariable[3];
|
|
||||||
char RCURLYVariable[3];
|
|
||||||
char ATVariable[3];
|
|
||||||
char DOLLARVariable[3];
|
|
||||||
char LCURLYVariable[3];
|
|
||||||
char BSLASHVariable[3];
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string::size_type InputBufferPos;
|
std::string::size_type InputBufferPos;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user