diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-02-10 21:18:04 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-02-16 20:34:27 (GMT) |
commit | 761ea20518081de976a40e590577056f23188fbd (patch) | |
tree | 1d31c2a3a986aa1208563a1ded30d7f6ea0feaf6 | |
parent | 1728b9c076a34ef017f10499e5b637d025b2afd8 (diff) | |
download | CMake-761ea20518081de976a40e590577056f23188fbd.zip CMake-761ea20518081de976a40e590577056f23188fbd.tar.gz CMake-761ea20518081de976a40e590577056f23188fbd.tar.bz2 |
cmCommandArgumentParser: reformat grammar
-rw-r--r-- | Source/cmCommandArgumentParser.cxx | 173 | ||||
-rw-r--r-- | Source/cmCommandArgumentParser.y | 180 |
2 files changed, 156 insertions, 197 deletions
diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index 8bd3082..75191c8 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -496,9 +496,9 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 94, 94, 101, 106, 112, 116, 122, 127, 133, - 138, 143, 148, 153, 158, 164, 170, 176, 182, 188, - 193, 199, 203, 209, 214 + 0, 94, 94, 100, 103, 108, 111, 116, 119, 124, + 127, 130, 133, 136, 139, 144, 147, 150, 153, 158, + 161, 166, 169, 174, 177 }; #endif @@ -1295,195 +1295,192 @@ yyreduce: switch (yyn) { case 2: -#line 95 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 94 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = 0; - yyGetParser->SetResult((yyvsp[0].str)); -} + (yyval.str) = 0; + yyGetParser->SetResult((yyvsp[0].str)); + } #line 1304 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 102 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 100 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1312 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 107 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 103 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); -} + (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + } #line 1320 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 112 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 108 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = 0; -} + (yyval.str) = 0; + } #line 1328 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 117 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 111 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); -} + (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + } #line 1336 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 123 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 116 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1344 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 128 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 119 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1352 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 134 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 124 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1360 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 139 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 127 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1368 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 144 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 130 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1376 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 133 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1384 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 154 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 136 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1392 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 159 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 139 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} + (yyval.str) = (yyvsp[0].str); + } #line 1400 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 165 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 144 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str),(yyvsp[-1].str)); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -#line 1409 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); + } +#line 1408 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 147 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str),(yyvsp[-1].str)); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -#line 1418 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); + } +#line 1416 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 177 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 150 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str)); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -#line 1427 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str)); + } +#line 1424 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 183 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 153 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); -} -#line 1435 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); + } +#line 1432 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 189 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 158 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} -#line 1443 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = (yyvsp[0].str); + } +#line 1440 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 194 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 161 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[-1].str); -} -#line 1451 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = (yyvsp[-1].str); + } +#line 1448 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 199 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 166 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = 0; -} -#line 1459 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = 0; + } +#line 1456 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 204 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 169 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); -} -#line 1467 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + } +#line 1464 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 210 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 174 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} -#line 1475 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = (yyvsp[0].str); + } +#line 1472 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 215 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 177 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[0].str); -} -#line 1483 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ + (yyval.str) = (yyvsp[0].str); + } +#line 1480 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; -#line 1487 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1484 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1713,7 +1710,7 @@ yyreturn: #endif return yyresult; } -#line 220 "cmCommandArgumentParser.y" /* yacc.c:1906 */ +#line 182 "cmCommandArgumentParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y index 9a9ba10..cfd76d1 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/cmCommandArgumentParser.y @@ -91,131 +91,93 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message); Start: -GoalWithOptionalBackSlash -{ - $<str>$ = 0; - yyGetParser->SetResult($<str>1); -} + GoalWithOptionalBackSlash { + $<str>$ = 0; + yyGetParser->SetResult($<str>1); + } GoalWithOptionalBackSlash: -Goal -{ - $<str>$ = $<str>1; -} -| -Goal cal_BSLASH -{ - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} + Goal { + $<str>$ = $<str>1; + } +| Goal cal_BSLASH { + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); + } Goal: -{ - $<str>$ = 0; -} -| -String Goal -{ - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} + { + $<str>$ = 0; + } +| String Goal { + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); + } String: -OuterText -{ - $<str>$ = $<str>1; -} -| -Variable -{ - $<str>$ = $<str>1; -} + OuterText { + $<str>$ = $<str>1; + } +| Variable { + $<str>$ = $<str>1; + } OuterText: -cal_NAME -{ - $<str>$ = $<str>1; -} -| -cal_AT -{ - $<str>$ = $<str>1; -} -| -cal_DOLLAR -{ - $<str>$ = $<str>1; -} -| -cal_LCURLY -{ - $<str>$ = $<str>1; -} -| -cal_RCURLY -{ - $<str>$ = $<str>1; -} -| -cal_SYMBOL -{ - $<str>$ = $<str>1; -} + cal_NAME { + $<str>$ = $<str>1; + } +| cal_AT { + $<str>$ = $<str>1; + } +| cal_DOLLAR { + $<str>$ = $<str>1; + } +| cal_LCURLY { + $<str>$ = $<str>1; + } +| cal_RCURLY { + $<str>$ = $<str>1; + } +| cal_SYMBOL { + $<str>$ = $<str>1; + } Variable: -cal_ENVCURLY EnvVarName cal_RCURLY -{ - $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -| -cal_NCURLY MultipleIds cal_RCURLY -{ - $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -| -cal_DCURLY MultipleIds cal_RCURLY -{ - $<str>$ = yyGetParser->ExpandVariable($<str>2); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -| -cal_ATNAME -{ - $<str>$ = yyGetParser->ExpandVariableForAt($<str>1); -} + cal_ENVCURLY EnvVarName cal_RCURLY { + $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1, $<str>2); + } +| cal_NCURLY MultipleIds cal_RCURLY { + $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1, $<str>2); + } +| cal_DCURLY MultipleIds cal_RCURLY { + $<str>$ = yyGetParser->ExpandVariable($<str>2); + } +| cal_ATNAME { + $<str>$ = yyGetParser->ExpandVariableForAt($<str>1); + } EnvVarName: -MultipleIds -{ - $<str>$ = $<str>1; -} -| -cal_SYMBOL EnvVarName -{ - $<str>$ = $<str>1; -} + MultipleIds { + $<str>$ = $<str>1; + } +| cal_SYMBOL EnvVarName { + $<str>$ = $<str>1; + } MultipleIds: -{ - $<str>$ = 0; -} -| -ID MultipleIds -{ - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} + { + $<str>$ = 0; + } +| ID MultipleIds { + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); + } ID: -cal_NAME -{ - $<str>$ = $<str>1; -} -| -Variable -{ - $<str>$ = $<str>1; -} - + cal_NAME { + $<str>$ = $<str>1; + } +| Variable { + $<str>$ = $<str>1; + } +; %% /* End of grammar */ |