123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- %{
- #include "cmConfigure.h" // IWYU pragma: keep
- #include <string.h>
- #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
- #ifdef __QNX__
- # include <malloc.h>
- #endif
- #include <stdlib.h>
- #define YYMALLOC malloc
- #define YYFREE free
- #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
- #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
- #include "cmCommandArgumentParserTokens.h" /* Need YYSTYPE for YY_DECL. */
- YY_DECL;
- static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
- #define YYMAXDEPTH 100000
- #define YYINITDEPTH 10000
- #ifdef _MSC_VER
- # pragma warning (disable: 4102)
- # pragma warning (disable: 4065)
- # pragma warning (disable: 4244)
- # pragma warning (disable: 4702)
- #endif
- %}
- %define api.pure
- %lex-param {yyscan_t yyscanner}
- %parse-param {yyscan_t yyscanner}
- %define parse.error verbose
- %token cal_ENVCURLY
- %token cal_NCURLY
- %token cal_DCURLY
- %token cal_DOLLAR "$"
- %token cal_LCURLY "{"
- %token cal_RCURLY "}"
- %token cal_NAME
- %token cal_BSLASH "\\"
- %token cal_SYMBOL
- %token cal_AT "@"
- %token cal_ERROR
- %token cal_ATNAME
- %%
- Start:
- GoalWithOptionalBackSlash {
- $<str>$ = 0;
- yyGetParser->SetResult($<str>1);
- }
- GoalWithOptionalBackSlash:
- 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);
- }
- String:
- 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;
- }
- Variable:
- 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>$ = 0;
- }
- | ID MultipleIds {
- $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
- }
- ID:
- cal_NAME {
- $<str>$ = $<str>1;
- }
- | Variable {
- $<str>$ = $<str>1;
- }
- ;
- %%
- void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
- {
- yyGetParser->Error(message);
- }
|