ENH: Rearange and cleanup

This commit is contained in:
Andy Cedilnik 2005-06-13 09:59:48 -04:00
parent c9cc368a9d
commit 1a1e78be6f
1 changed files with 57 additions and 47 deletions

View File

@ -49,7 +49,8 @@ YY_DECL;
static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
#define YYDEBUG 1 #define YYDEBUG 1
#define YYMAXDEPTH 10000000 //#define YYMAXDEPTH 100000
//#define YYINITDEPTH 10000
#define calCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp); #define calCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp);
@ -81,6 +82,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
%token cal_LCURLY %token cal_LCURLY
%token cal_RCURLY %token cal_RCURLY
%token cal_NAME %token cal_NAME
%token cal_BSLASH
%token cal_SYMBOL %token cal_SYMBOL
%token cal_AT %token cal_AT
%token cal_ERROR %token cal_ERROR
@ -92,7 +94,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
Start: Start:
Goal GoalWithOptionalBackSlash
{ {
calElementStart(1); calElementStart(1);
calCheckEmpty(1); calCheckEmpty(1);
@ -100,6 +102,21 @@ Goal
yyGetParser->SetResult($<str>1); yyGetParser->SetResult($<str>1);
} }
GoalWithOptionalBackSlash:
Goal
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
|
Goal cal_BSLASH
{
calElementStart(2);
calCheckEmpty(2);
$<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
}
Goal: Goal:
{ {
calElementStart(0); calElementStart(0);
@ -115,7 +132,7 @@ String Goal
} }
String: String:
TextWithRCurly OuterText
{ {
calElementStart(1); calElementStart(1);
calCheckEmpty(1); calCheckEmpty(1);
@ -129,35 +146,7 @@ Variable
$<str>$ = $<str>1; $<str>$ = $<str>1;
} }
MultipleIds: OuterText:
{
calElementStart(0);
calCheckEmpty(0);
}
|
ID MultipleIds
{
calElementStart(2);
calCheckEmpty(2);
$<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
}
ID:
Text
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
|
Variable
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
Text:
cal_NAME cal_NAME
{ {
calElementStart(1); calElementStart(1);
@ -165,21 +154,6 @@ cal_NAME
$<str>$ = $<str>1; $<str>$ = $<str>1;
} }
| |
cal_SYMBOL
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
TextWithRCurly:
Text
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
|
cal_AT cal_AT
{ {
calElementStart(1); calElementStart(1);
@ -207,6 +181,13 @@ cal_RCURLY
calCheckEmpty(1); calCheckEmpty(1);
$<str>$ = $<str>1; $<str>$ = $<str>1;
} }
|
cal_SYMBOL
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
Variable: Variable:
cal_NCURLY MultipleIds cal_RCURLY cal_NCURLY MultipleIds cal_RCURLY
@ -232,6 +213,35 @@ cal_ATNAME
$<str>$ = yyGetParser->ExpandVariable($<str>1); $<str>$ = yyGetParser->ExpandVariable($<str>1);
} }
MultipleIds:
{
calElementStart(0);
calCheckEmpty(0);
}
|
ID MultipleIds
{
calElementStart(2);
calCheckEmpty(2);
$<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
}
ID:
cal_NAME
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
|
Variable
{
calElementStart(1);
calCheckEmpty(1);
$<str>$ = $<str>1;
}
%% %%
/* End of grammar */ /* End of grammar */