diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-13 13:59:48 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-13 13:59:48 (GMT) |
commit | 1a1e78be6f34655eafc0ef4dfc222d260c3b8733 (patch) | |
tree | fb135893f16615f3acf6fb1c576b890a6b4d4776 | |
parent | c9cc368a9db33273ad6287ea94fc285e90c4901f (diff) | |
download | CMake-1a1e78be6f34655eafc0ef4dfc222d260c3b8733.zip CMake-1a1e78be6f34655eafc0ef4dfc222d260c3b8733.tar.gz CMake-1a1e78be6f34655eafc0ef4dfc222d260c3b8733.tar.bz2 |
ENH: Rearange and cleanup
-rw-r--r-- | Source/cmCommandArgumentParser.y | 90 |
1 files changed, 50 insertions, 40 deletions
diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y index dc1b9ee..edcb190 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/cmCommandArgumentParser.y @@ -49,7 +49,8 @@ YY_DECL; static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); #define YYDEBUG 1 -#define YYMAXDEPTH 10000000 +//#define YYMAXDEPTH 100000 +//#define YYINITDEPTH 10000 #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_RCURLY %token cal_NAME +%token cal_BSLASH %token cal_SYMBOL %token cal_AT %token cal_ERROR @@ -92,7 +94,7 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); Start: -Goal +GoalWithOptionalBackSlash { calElementStart(1); calCheckEmpty(1); @@ -100,50 +102,37 @@ Goal yyGetParser->SetResult($<str>1); } -Goal: -{ - calElementStart(0); - calCheckEmpty(0); - $<str>$ = 0; -} -| -String Goal -{ - calElementStart(2); - calCheckEmpty(2); - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} - -String: -TextWithRCurly +GoalWithOptionalBackSlash: +Goal { calElementStart(1); calCheckEmpty(1); $<str>$ = $<str>1; } | -Variable +Goal cal_BSLASH { - calElementStart(1); - calCheckEmpty(1); - $<str>$ = $<str>1; + calElementStart(2); + calCheckEmpty(2); + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); } -MultipleIds: +Goal: { calElementStart(0); calCheckEmpty(0); + $<str>$ = 0; } | -ID MultipleIds +String Goal { calElementStart(2); calCheckEmpty(2); $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); } -ID: -Text +String: +OuterText { calElementStart(1); calCheckEmpty(1); @@ -157,7 +146,7 @@ Variable $<str>$ = $<str>1; } -Text: +OuterText: cal_NAME { calElementStart(1); @@ -165,43 +154,35 @@ cal_NAME $<str>$ = $<str>1; } | -cal_SYMBOL -{ - calElementStart(1); - calCheckEmpty(1); - $<str>$ = $<str>1; -} - -TextWithRCurly: -Text +cal_AT { calElementStart(1); calCheckEmpty(1); $<str>$ = $<str>1; } | -cal_AT +cal_DOLLAR { calElementStart(1); calCheckEmpty(1); $<str>$ = $<str>1; } | -cal_DOLLAR +cal_LCURLY { calElementStart(1); calCheckEmpty(1); $<str>$ = $<str>1; } | -cal_LCURLY +cal_RCURLY { calElementStart(1); calCheckEmpty(1); $<str>$ = $<str>1; } | -cal_RCURLY +cal_SYMBOL { calElementStart(1); calCheckEmpty(1); @@ -232,6 +213,35 @@ cal_ATNAME $<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 */ |