2 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
3 file Copyright.txt or https://cmake.org/licensing for details. */
6 This file must be translated to C and modified to build everywhere.
10 bison --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
14 #include "cmConfigure.h" // IWYU pragma: keep
18 #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
20 /* Make sure malloc and free are available on QNX. */
25 /* Make sure the parser uses standard memory allocation. The default
26 generated parser malloc/free declarations do not work on all
29 #define YYMALLOC malloc
32 /*-------------------------------------------------------------------------*/
33 #include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
34 #include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
36 /* Forward declare the lexer entry point. */
39 /* Helper function to forward error callback from parser. */
40 static void cmCommandArgument_yyerror
(yyscan_t yyscanner
, const char* message
);
42 /* Configure the parser to support large input. */
43 #define YYMAXDEPTH 100000
44 #define YYINITDEPTH 10000
46 /* Disable some warnings in the generated code. */
48 # pragma warning (disable: 4102) /* Unused goto label. */
49 # pragma warning (disable: 4065) /* Switch statement contains default but no
51 # pragma warning (disable: 4244) /* loss of precision */
52 # pragma warning (disable: 4702) /* unreachable code */
54 #if defined(__GNUC__) && __GNUC__ >= 8
55 # pragma GCC diagnostic ignored "-Wconversion"
56 # pragma GCC diagnostic ignored "-Wfree-nonheap-object"
58 #if defined(__clang__) && defined(__has_warning)
59 # if __has_warning("-Wunused-but-set-variable")
60 # pragma clang diagnostic ignored "-Wunused-but-set-variable"
65 /* Generate a reentrant parser object. */
68 /* Configure the parser to use a lexer object. */
69 %lex
-param
{yyscan_t yyscanner
}
70 %parse
-param
{yyscan_t yyscanner
}
72 %define parse.
error verbose
80 /*-------------------------------------------------------------------------*/
89 %token cal_BSLASH
"\\"
95 /*-------------------------------------------------------------------------*/
101 GoalWithOptionalBackSlash
{
103 yyGetParser
->SetResult
($
<str
>1);
106 GoalWithOptionalBackSlash:
111 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
119 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
151 cal_ENVCURLY EnvVarName cal_RCURLY
{
152 $
<str
>$
= yyGetParser
->ExpandSpecialVariable
($
<str
>1, $
<str
>2);
154 | cal_NCURLY MultipleIds cal_RCURLY
{
155 $
<str
>$
= yyGetParser
->ExpandSpecialVariable
($
<str
>1, $
<str
>2);
157 | cal_DCURLY MultipleIds cal_RCURLY
{
158 $
<str
>$
= yyGetParser
->ExpandVariable
($
<str
>2);
161 $
<str
>$
= yyGetParser
->ExpandVariableForAt
($
<str
>1);
168 | cal_SYMBOL EnvVarName
{
177 $
<str
>$
= yyGetParser
->CombineUnions
($
<str
>1, $
<str
>2);
192 /*--------------------------------------------------------------------------*/
193 void cmCommandArgument_yyerror
(yyscan_t yyscanner
, const char* message
)
195 yyGetParser
->Error
(message
);