mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-17 12:40:40 -06:00
Source: Remove unused cmCommandArgument{Lexer,Parser}
These were used only for the CMP0053 OLD behavior, which has now been removed.
This commit is contained in:
@@ -62,12 +62,6 @@ add_library(ManifestLib INTERFACE)
|
|||||||
add_library(
|
add_library(
|
||||||
CMakeLib
|
CMakeLib
|
||||||
# Lexers/Parsers
|
# Lexers/Parsers
|
||||||
LexerParser/cmCommandArgumentLexer.cxx
|
|
||||||
LexerParser/cmCommandArgumentLexer.h
|
|
||||||
LexerParser/cmCommandArgumentLexer.in.l
|
|
||||||
LexerParser/cmCommandArgumentParser.cxx
|
|
||||||
LexerParser/cmCommandArgumentParserTokens.h
|
|
||||||
LexerParser/cmCommandArgumentParser.y
|
|
||||||
LexerParser/cmDependsJavaLexer.cxx
|
LexerParser/cmDependsJavaLexer.cxx
|
||||||
LexerParser/cmDependsJavaLexer.h
|
LexerParser/cmDependsJavaLexer.h
|
||||||
LexerParser/cmDependsJavaLexer.in.l
|
LexerParser/cmDependsJavaLexer.in.l
|
||||||
@@ -141,7 +135,6 @@ add_library(
|
|||||||
cmCMakePresetsGraphReadJSONPackagePresets.cxx
|
cmCMakePresetsGraphReadJSONPackagePresets.cxx
|
||||||
cmCMakePresetsGraphReadJSONTestPresets.cxx
|
cmCMakePresetsGraphReadJSONTestPresets.cxx
|
||||||
cmCMakePresetsGraphReadJSONWorkflowPresets.cxx
|
cmCMakePresetsGraphReadJSONWorkflowPresets.cxx
|
||||||
cmCommandArgumentParserHelper.cxx
|
|
||||||
cmCommandLineArgument.h
|
cmCommandLineArgument.h
|
||||||
cmCommonTargetGenerator.cxx
|
cmCommonTargetGenerator.cxx
|
||||||
cmCommonTargetGenerator.h
|
cmCommonTargetGenerator.h
|
||||||
@@ -1018,7 +1011,6 @@ if(CMake_BUILD_PCH)
|
|||||||
set_source_files_properties("LexerParser/cmFortranParser.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
set_source_files_properties("LexerParser/cmFortranParser.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||||
else()
|
else()
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
"LexerParser/cmCommandArgumentLexer.cxx"
|
|
||||||
"LexerParser/cmGccDepfileLexer.cxx"
|
"LexerParser/cmGccDepfileLexer.cxx"
|
||||||
"LexerParser/cmExprLexer.cxx"
|
"LexerParser/cmExprLexer.cxx"
|
||||||
"LexerParser/cmDependsJavaLexer.cxx"
|
"LexerParser/cmDependsJavaLexer.cxx"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,689 +0,0 @@
|
|||||||
#ifndef cmCommandArgument_yyHEADER_H
|
|
||||||
#define cmCommandArgument_yyHEADER_H 1
|
|
||||||
#define cmCommandArgument_yyIN_HEADER 1
|
|
||||||
|
|
||||||
#define FLEXINT_H 1
|
|
||||||
#define YY_INT_ALIGNED short int
|
|
||||||
|
|
||||||
/* A lexical scanner generated by flex */
|
|
||||||
|
|
||||||
#define FLEX_SCANNER
|
|
||||||
#define YY_FLEX_MAJOR_VERSION 2
|
|
||||||
#define YY_FLEX_MINOR_VERSION 6
|
|
||||||
#define YY_FLEX_SUBMINOR_VERSION 4
|
|
||||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
|
||||||
#define FLEX_BETA
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_create_buffer
|
|
||||||
#define cmCommandArgument_yy_create_buffer_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_create_buffer cmCommandArgument_yy_create_buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_delete_buffer
|
|
||||||
#define cmCommandArgument_yy_delete_buffer_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_delete_buffer cmCommandArgument_yy_delete_buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_scan_buffer
|
|
||||||
#define cmCommandArgument_yy_scan_buffer_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_scan_buffer cmCommandArgument_yy_scan_buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_scan_string
|
|
||||||
#define cmCommandArgument_yy_scan_string_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_scan_string cmCommandArgument_yy_scan_string
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_scan_bytes
|
|
||||||
#define cmCommandArgument_yy_scan_bytes_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_scan_bytes cmCommandArgument_yy_scan_bytes
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_init_buffer
|
|
||||||
#define cmCommandArgument_yy_init_buffer_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_init_buffer cmCommandArgument_yy_init_buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_flush_buffer
|
|
||||||
#define cmCommandArgument_yy_flush_buffer_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_flush_buffer cmCommandArgument_yy_flush_buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_load_buffer_state
|
|
||||||
#define cmCommandArgument_yy_load_buffer_state_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_load_buffer_state cmCommandArgument_yy_load_buffer_state
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yy_switch_to_buffer
|
|
||||||
#define cmCommandArgument_yy_switch_to_buffer_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yy_switch_to_buffer cmCommandArgument_yy_switch_to_buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yypush_buffer_state
|
|
||||||
#define cmCommandArgument_yypush_buffer_state_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yypush_buffer_state cmCommandArgument_yypush_buffer_state
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yypop_buffer_state
|
|
||||||
#define cmCommandArgument_yypop_buffer_state_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yypop_buffer_state cmCommandArgument_yypop_buffer_state
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyensure_buffer_stack
|
|
||||||
#define cmCommandArgument_yyensure_buffer_stack_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyensure_buffer_stack cmCommandArgument_yyensure_buffer_stack
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yylex
|
|
||||||
#define cmCommandArgument_yylex_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yylex cmCommandArgument_yylex
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyrestart
|
|
||||||
#define cmCommandArgument_yyrestart_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyrestart cmCommandArgument_yyrestart
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yylex_init
|
|
||||||
#define cmCommandArgument_yylex_init_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yylex_init cmCommandArgument_yylex_init
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yylex_init_extra
|
|
||||||
#define cmCommandArgument_yylex_init_extra_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yylex_init_extra cmCommandArgument_yylex_init_extra
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yylex_destroy
|
|
||||||
#define cmCommandArgument_yylex_destroy_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yylex_destroy cmCommandArgument_yylex_destroy
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_debug
|
|
||||||
#define cmCommandArgument_yyget_debug_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_debug cmCommandArgument_yyget_debug
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyset_debug
|
|
||||||
#define cmCommandArgument_yyset_debug_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyset_debug cmCommandArgument_yyset_debug
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_extra
|
|
||||||
#define cmCommandArgument_yyget_extra_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_extra cmCommandArgument_yyget_extra
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyset_extra
|
|
||||||
#define cmCommandArgument_yyset_extra_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyset_extra cmCommandArgument_yyset_extra
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_in
|
|
||||||
#define cmCommandArgument_yyget_in_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_in cmCommandArgument_yyget_in
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyset_in
|
|
||||||
#define cmCommandArgument_yyset_in_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyset_in cmCommandArgument_yyset_in
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_out
|
|
||||||
#define cmCommandArgument_yyget_out_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_out cmCommandArgument_yyget_out
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyset_out
|
|
||||||
#define cmCommandArgument_yyset_out_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyset_out cmCommandArgument_yyset_out
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_leng
|
|
||||||
#define cmCommandArgument_yyget_leng_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_leng cmCommandArgument_yyget_leng
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_text
|
|
||||||
#define cmCommandArgument_yyget_text_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_text cmCommandArgument_yyget_text
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_lineno
|
|
||||||
#define cmCommandArgument_yyget_lineno_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_lineno cmCommandArgument_yyget_lineno
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyset_lineno
|
|
||||||
#define cmCommandArgument_yyset_lineno_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyset_lineno cmCommandArgument_yyset_lineno
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyget_column
|
|
||||||
#define cmCommandArgument_yyget_column_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyget_column cmCommandArgument_yyget_column
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyset_column
|
|
||||||
#define cmCommandArgument_yyset_column_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyset_column cmCommandArgument_yyset_column
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yywrap
|
|
||||||
#define cmCommandArgument_yywrap_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yywrap cmCommandArgument_yywrap
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyalloc
|
|
||||||
#define cmCommandArgument_yyalloc_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyalloc cmCommandArgument_yyalloc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyrealloc
|
|
||||||
#define cmCommandArgument_yyrealloc_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyrealloc cmCommandArgument_yyrealloc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef yyfree
|
|
||||||
#define cmCommandArgument_yyfree_ALREADY_DEFINED
|
|
||||||
#else
|
|
||||||
#define yyfree cmCommandArgument_yyfree
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
|
||||||
|
|
||||||
/* begin standard C headers. */
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* end standard C headers. */
|
|
||||||
|
|
||||||
/* flex integer type definitions */
|
|
||||||
|
|
||||||
#ifndef FLEXINT_H
|
|
||||||
#define FLEXINT_H
|
|
||||||
|
|
||||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
|
||||||
|
|
||||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
||||||
|
|
||||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
|
||||||
* if you want the limit (max/min) macros for int types.
|
|
||||||
*/
|
|
||||||
#ifndef __STDC_LIMIT_MACROS
|
|
||||||
#define __STDC_LIMIT_MACROS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
typedef int8_t flex_int8_t;
|
|
||||||
typedef uint8_t flex_uint8_t;
|
|
||||||
typedef int16_t flex_int16_t;
|
|
||||||
typedef uint16_t flex_uint16_t;
|
|
||||||
typedef int32_t flex_int32_t;
|
|
||||||
typedef uint32_t flex_uint32_t;
|
|
||||||
#else
|
|
||||||
typedef signed char flex_int8_t;
|
|
||||||
typedef short int flex_int16_t;
|
|
||||||
typedef int flex_int32_t;
|
|
||||||
typedef unsigned char flex_uint8_t;
|
|
||||||
typedef unsigned short int flex_uint16_t;
|
|
||||||
typedef unsigned int flex_uint32_t;
|
|
||||||
|
|
||||||
/* Limits of integral types. */
|
|
||||||
#ifndef INT8_MIN
|
|
||||||
#define INT8_MIN (-128)
|
|
||||||
#endif
|
|
||||||
#ifndef INT16_MIN
|
|
||||||
#define INT16_MIN (-32767-1)
|
|
||||||
#endif
|
|
||||||
#ifndef INT32_MIN
|
|
||||||
#define INT32_MIN (-2147483647-1)
|
|
||||||
#endif
|
|
||||||
#ifndef INT8_MAX
|
|
||||||
#define INT8_MAX (127)
|
|
||||||
#endif
|
|
||||||
#ifndef INT16_MAX
|
|
||||||
#define INT16_MAX (32767)
|
|
||||||
#endif
|
|
||||||
#ifndef INT32_MAX
|
|
||||||
#define INT32_MAX (2147483647)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT8_MAX
|
|
||||||
#define UINT8_MAX (255U)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT16_MAX
|
|
||||||
#define UINT16_MAX (65535U)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT32_MAX
|
|
||||||
#define UINT32_MAX (4294967295U)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIZE_MAX
|
|
||||||
#define SIZE_MAX (~(size_t)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ! C99 */
|
|
||||||
|
|
||||||
#endif /* ! FLEXINT_H */
|
|
||||||
|
|
||||||
/* begin standard C++ headers. */
|
|
||||||
|
|
||||||
/* TODO: this is always defined, so inline it */
|
|
||||||
#define yyconst const
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
|
||||||
#define yynoreturn __attribute__((__noreturn__))
|
|
||||||
#else
|
|
||||||
#define yynoreturn
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* An opaque pointer. */
|
|
||||||
#ifndef YY_TYPEDEF_YY_SCANNER_T
|
|
||||||
#define YY_TYPEDEF_YY_SCANNER_T
|
|
||||||
typedef void* yyscan_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* For convenience, these vars (plus the bison vars far below)
|
|
||||||
are macros in the reentrant scanner. */
|
|
||||||
#define yyin yyg->yyin_r
|
|
||||||
#define yyout yyg->yyout_r
|
|
||||||
#define yyextra yyg->yyextra_r
|
|
||||||
#define yyleng yyg->yyleng_r
|
|
||||||
#define yytext yyg->yytext_r
|
|
||||||
#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
|
|
||||||
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
|
|
||||||
#define yy_flex_debug yyg->yy_flex_debug_r
|
|
||||||
|
|
||||||
/* Size of default input buffer. */
|
|
||||||
#ifndef YY_BUF_SIZE
|
|
||||||
#ifdef __ia64__
|
|
||||||
/* On IA-64, the buffer size is 16k, not 8k.
|
|
||||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
|
||||||
* Ditto for the __ia64__ case accordingly.
|
|
||||||
*/
|
|
||||||
#define YY_BUF_SIZE 32768
|
|
||||||
#else
|
|
||||||
#define YY_BUF_SIZE 16384
|
|
||||||
#endif /* __ia64__ */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
|
||||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
|
||||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
|
||||||
#define YY_TYPEDEF_YY_SIZE_T
|
|
||||||
typedef size_t yy_size_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
|
||||||
#define YY_STRUCT_YY_BUFFER_STATE
|
|
||||||
struct yy_buffer_state
|
|
||||||
{
|
|
||||||
FILE *yy_input_file;
|
|
||||||
|
|
||||||
char *yy_ch_buf; /* input buffer */
|
|
||||||
char *yy_buf_pos; /* current position in input buffer */
|
|
||||||
|
|
||||||
/* Size of input buffer in bytes, not including room for EOB
|
|
||||||
* characters.
|
|
||||||
*/
|
|
||||||
int yy_buf_size;
|
|
||||||
|
|
||||||
/* Number of characters read into yy_ch_buf, not including EOB
|
|
||||||
* characters.
|
|
||||||
*/
|
|
||||||
int yy_n_chars;
|
|
||||||
|
|
||||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
|
||||||
* and can realloc() it to grow it, and should free() it to
|
|
||||||
* delete it.
|
|
||||||
*/
|
|
||||||
int yy_is_our_buffer;
|
|
||||||
|
|
||||||
/* Whether this is an "interactive" input source; if so, and
|
|
||||||
* if we're using stdio for input, then we want to use getc()
|
|
||||||
* instead of fread(), to make sure we stop fetching input after
|
|
||||||
* each newline.
|
|
||||||
*/
|
|
||||||
int yy_is_interactive;
|
|
||||||
|
|
||||||
/* Whether we're considered to be at the beginning of a line.
|
|
||||||
* If so, '^' rules will be active on the next match, otherwise
|
|
||||||
* not.
|
|
||||||
*/
|
|
||||||
int yy_at_bol;
|
|
||||||
|
|
||||||
int yy_bs_lineno; /**< The line count. */
|
|
||||||
int yy_bs_column; /**< The column count. */
|
|
||||||
|
|
||||||
/* Whether to try to fill the input buffer when we reach the
|
|
||||||
* end of it.
|
|
||||||
*/
|
|
||||||
int yy_fill_buffer;
|
|
||||||
|
|
||||||
int yy_buffer_status;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
|
||||||
|
|
||||||
void yyrestart ( FILE *input_file , yyscan_t yyscanner );
|
|
||||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
|
|
||||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
|
|
||||||
void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
|
|
||||||
void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
|
|
||||||
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
|
|
||||||
void yypop_buffer_state ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
|
|
||||||
YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
|
|
||||||
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void *yyalloc ( yy_size_t , yyscan_t yyscanner );
|
|
||||||
void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
|
|
||||||
void yyfree ( void * , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
/* Begin user sect3 */
|
|
||||||
|
|
||||||
#define cmCommandArgument_yywrap(yyscanner) (/*CONSTCOND*/1)
|
|
||||||
#define YY_SKIP_YYWRAP
|
|
||||||
|
|
||||||
#define yytext_ptr yytext_r
|
|
||||||
|
|
||||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
|
||||||
#define INITIAL 0
|
|
||||||
#define ESCAPES 1
|
|
||||||
#define NOESCAPES 2
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_EXTRA_TYPE
|
|
||||||
#define YY_EXTRA_TYPE void *
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int yylex_init (yyscan_t* scanner);
|
|
||||||
|
|
||||||
int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
|
|
||||||
|
|
||||||
/* Accessor methods to globals.
|
|
||||||
These are made visible to non-reentrant scanners for convenience. */
|
|
||||||
|
|
||||||
int yylex_destroy ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
int yyget_debug ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void yyset_debug ( int debug_flag , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
FILE *yyget_in ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
FILE *yyget_out ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
int yyget_leng ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
char *yyget_text ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
int yyget_lineno ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void yyset_lineno ( int _line_number , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
int yyget_column ( yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void yyset_column ( int _column_no , yyscan_t yyscanner );
|
|
||||||
|
|
||||||
/* Macros after this point can all be overridden by user definitions in
|
|
||||||
* section 1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef YY_SKIP_YYWRAP
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" int yywrap ( yyscan_t yyscanner );
|
|
||||||
#else
|
|
||||||
extern int yywrap ( yyscan_t yyscanner );
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef yytext_ptr
|
|
||||||
static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef YY_NEED_STRLEN
|
|
||||||
static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_NO_INPUT
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Amount of stuff to slurp up with each read. */
|
|
||||||
#ifndef YY_READ_BUF_SIZE
|
|
||||||
#ifdef __ia64__
|
|
||||||
/* On IA-64, the buffer size is 16k, not 8k */
|
|
||||||
#define YY_READ_BUF_SIZE 16384
|
|
||||||
#else
|
|
||||||
#define YY_READ_BUF_SIZE 8192
|
|
||||||
#endif /* __ia64__ */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Number of entries by which start-condition stack grows. */
|
|
||||||
#ifndef YY_START_STACK_INCR
|
|
||||||
#define YY_START_STACK_INCR 25
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Default declaration of generated scanner - a define so the user can
|
|
||||||
* easily add parameters.
|
|
||||||
*/
|
|
||||||
#ifndef YY_DECL
|
|
||||||
#define YY_DECL_IS_OURS 1
|
|
||||||
|
|
||||||
extern int yylex (yyscan_t yyscanner);
|
|
||||||
|
|
||||||
#define YY_DECL int yylex (yyscan_t yyscanner)
|
|
||||||
#endif /* !YY_DECL */
|
|
||||||
|
|
||||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
|
||||||
|
|
||||||
#undef YY_NEW_FILE
|
|
||||||
#undef YY_FLUSH_BUFFER
|
|
||||||
#undef yy_set_bol
|
|
||||||
#undef yy_new_buffer
|
|
||||||
#undef yy_set_interactive
|
|
||||||
#undef YY_DO_BEFORE_ACTION
|
|
||||||
|
|
||||||
#ifdef YY_DECL_IS_OURS
|
|
||||||
#undef YY_DECL_IS_OURS
|
|
||||||
#undef YY_DECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef cmCommandArgument_yy_create_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_create_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_delete_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_delete_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_scan_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_scan_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_scan_string_ALREADY_DEFINED
|
|
||||||
#undef yy_scan_string
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_scan_bytes_ALREADY_DEFINED
|
|
||||||
#undef yy_scan_bytes
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_init_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_init_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_flush_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_flush_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_load_buffer_state_ALREADY_DEFINED
|
|
||||||
#undef yy_load_buffer_state
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_switch_to_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_switch_to_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yypush_buffer_state_ALREADY_DEFINED
|
|
||||||
#undef yypush_buffer_state
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yypop_buffer_state_ALREADY_DEFINED
|
|
||||||
#undef yypop_buffer_state
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyensure_buffer_stack_ALREADY_DEFINED
|
|
||||||
#undef yyensure_buffer_stack
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yylex_ALREADY_DEFINED
|
|
||||||
#undef yylex
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyrestart_ALREADY_DEFINED
|
|
||||||
#undef yyrestart
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yylex_init_ALREADY_DEFINED
|
|
||||||
#undef yylex_init
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yylex_init_extra_ALREADY_DEFINED
|
|
||||||
#undef yylex_init_extra
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yylex_destroy_ALREADY_DEFINED
|
|
||||||
#undef yylex_destroy
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_debug_ALREADY_DEFINED
|
|
||||||
#undef yyget_debug
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_debug_ALREADY_DEFINED
|
|
||||||
#undef yyset_debug
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_extra_ALREADY_DEFINED
|
|
||||||
#undef yyget_extra
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_extra_ALREADY_DEFINED
|
|
||||||
#undef yyset_extra
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_in_ALREADY_DEFINED
|
|
||||||
#undef yyget_in
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_in_ALREADY_DEFINED
|
|
||||||
#undef yyset_in
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_out_ALREADY_DEFINED
|
|
||||||
#undef yyget_out
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_out_ALREADY_DEFINED
|
|
||||||
#undef yyset_out
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_leng_ALREADY_DEFINED
|
|
||||||
#undef yyget_leng
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_text_ALREADY_DEFINED
|
|
||||||
#undef yyget_text
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_lineno_ALREADY_DEFINED
|
|
||||||
#undef yyget_lineno
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_lineno_ALREADY_DEFINED
|
|
||||||
#undef yyset_lineno
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_column_ALREADY_DEFINED
|
|
||||||
#undef yyget_column
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_column_ALREADY_DEFINED
|
|
||||||
#undef yyset_column
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yywrap_ALREADY_DEFINED
|
|
||||||
#undef yywrap
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_lval_ALREADY_DEFINED
|
|
||||||
#undef yyget_lval
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_lval_ALREADY_DEFINED
|
|
||||||
#undef yyset_lval
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyget_lloc_ALREADY_DEFINED
|
|
||||||
#undef yyget_lloc
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyset_lloc_ALREADY_DEFINED
|
|
||||||
#undef yyset_lloc
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyalloc_ALREADY_DEFINED
|
|
||||||
#undef yyalloc
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyrealloc_ALREADY_DEFINED
|
|
||||||
#undef yyrealloc
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyfree_ALREADY_DEFINED
|
|
||||||
#undef yyfree
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yytext_ALREADY_DEFINED
|
|
||||||
#undef yytext
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyleng_ALREADY_DEFINED
|
|
||||||
#undef yyleng
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyin_ALREADY_DEFINED
|
|
||||||
#undef yyin
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyout_ALREADY_DEFINED
|
|
||||||
#undef yyout
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yy_flex_debug_ALREADY_DEFINED
|
|
||||||
#undef yy_flex_debug
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yylineno_ALREADY_DEFINED
|
|
||||||
#undef yylineno
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yytables_fload_ALREADY_DEFINED
|
|
||||||
#undef yytables_fload
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yytables_destroy_ALREADY_DEFINED
|
|
||||||
#undef yytables_destroy
|
|
||||||
#endif
|
|
||||||
#ifndef cmCommandArgument_yyTABLES_NAME_ALREADY_DEFINED
|
|
||||||
#undef yyTABLES_NAME
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef cmCommandArgument_yyIN_HEADER
|
|
||||||
#endif /* cmCommandArgument_yyHEADER_H */
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
%{
|
|
||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
||||||
/*
|
|
||||||
|
|
||||||
This file must be translated to C++ and modified to build everywhere.
|
|
||||||
|
|
||||||
Run flex >= 2.6 like this:
|
|
||||||
|
|
||||||
flex --nounistd --never-interactive --batch -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
|
|
||||||
|
|
||||||
Modify cmCommandArgumentLexer.cxx:
|
|
||||||
- remove trailing whitespace: sed -i 's/\s*$//' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
|
|
||||||
- remove blank lines at end of file: sed -i '${/^$/d;}' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
|
|
||||||
- #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmCommandArgumentLexer.cxx
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* IWYU pragma: no_forward_declare yyguts_t */
|
|
||||||
|
|
||||||
#ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
|
|
||||||
|
|
||||||
#include "cmCommandArgumentParserHelper.h"
|
|
||||||
|
|
||||||
#define YY_USER_ACTION yyextra->UpdateInputPosition(yyleng);
|
|
||||||
|
|
||||||
/* Include the set of tokens from the parser. */
|
|
||||||
#include "cmCommandArgumentParserTokens.h"
|
|
||||||
|
|
||||||
static const char *DCURLYVariable = "${";
|
|
||||||
static const char *RCURLYVariable = "}";
|
|
||||||
static const char *ATVariable = "@";
|
|
||||||
static const char *DOLLARVariable = "$";
|
|
||||||
static const char *LCURLYVariable = "{";
|
|
||||||
static const char *BSLASHVariable = "\\";
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
%}
|
|
||||||
|
|
||||||
%option prefix="cmCommandArgument_yy"
|
|
||||||
|
|
||||||
%option reentrant
|
|
||||||
%option noyywrap
|
|
||||||
%option nounput
|
|
||||||
%pointer
|
|
||||||
%s ESCAPES
|
|
||||||
%s NOESCAPES
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
\$ENV\{ {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
|
|
||||||
return cal_ENVCURLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
\$[A-Za-z0-9/_.+-]+\{ {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
|
|
||||||
return cal_NCURLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@[A-Za-z0-9/_.+-]+@ {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
|
|
||||||
return cal_ATNAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
"${" {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = DCURLYVariable;
|
|
||||||
return cal_DCURLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
"}" {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = RCURLYVariable;
|
|
||||||
return cal_RCURLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
"@" {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = ATVariable;
|
|
||||||
return cal_AT;
|
|
||||||
}
|
|
||||||
|
|
||||||
[A-Za-z0-9/_.+-]+ {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
return cal_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
<ESCAPES>\\. {
|
|
||||||
if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
|
|
||||||
{
|
|
||||||
return cal_ERROR;
|
|
||||||
}
|
|
||||||
return cal_SYMBOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
[^\${}\\@]+ {
|
|
||||||
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
|
|
||||||
yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
return cal_SYMBOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
"$" {
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = DOLLARVariable;
|
|
||||||
return cal_DOLLAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
"{" {
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = LCURLYVariable;
|
|
||||||
return cal_LCURLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
<ESCAPES>"\\" {
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = BSLASHVariable;
|
|
||||||
return cal_BSLASH;
|
|
||||||
}
|
|
||||||
|
|
||||||
<NOESCAPES>"\\" {
|
|
||||||
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
|
|
||||||
yylvalp->str = BSLASHVariable;
|
|
||||||
return cal_SYMBOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes)
|
|
||||||
{
|
|
||||||
/* Hack into the internal flex-generated scanner to set the state. */
|
|
||||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
||||||
if(noEscapes) {
|
|
||||||
BEGIN(NOESCAPES);
|
|
||||||
} else {
|
|
||||||
BEGIN(ESCAPES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __clang_analyzer__ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,196 +0,0 @@
|
|||||||
%{
|
|
||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
||||||
/*
|
|
||||||
|
|
||||||
This file must be translated to C and modified to build everywhere.
|
|
||||||
|
|
||||||
Run bison like this:
|
|
||||||
|
|
||||||
bison --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
|
|
||||||
|
|
||||||
/* Make sure malloc and free are available on QNX. */
|
|
||||||
#ifdef __QNX__
|
|
||||||
# include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make sure the parser uses standard memory allocation. The default
|
|
||||||
generated parser malloc/free declarations do not work on all
|
|
||||||
platforms. */
|
|
||||||
#include <stdlib.h>
|
|
||||||
#define YYMALLOC malloc
|
|
||||||
#define YYFREE free
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
#include "cmCommandArgumentParserHelper.h" /* Interface to parser object. */
|
|
||||||
#include "cmCommandArgumentLexer.h" /* Interface to lexer object. */
|
|
||||||
|
|
||||||
/* Forward declare the lexer entry point. */
|
|
||||||
YY_DECL;
|
|
||||||
|
|
||||||
/* Helper function to forward error callback from parser. */
|
|
||||||
static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
|
|
||||||
|
|
||||||
/* Configure the parser to support large input. */
|
|
||||||
#define YYMAXDEPTH 100000
|
|
||||||
#define YYINITDEPTH 10000
|
|
||||||
|
|
||||||
/* Disable some warnings in the generated code. */
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
# pragma warning (disable: 4102) /* Unused goto label. */
|
|
||||||
# pragma warning (disable: 4065) /* Switch statement contains default but no
|
|
||||||
case. */
|
|
||||||
# pragma warning (disable: 4244) /* loss of precision */
|
|
||||||
# pragma warning (disable: 4702) /* unreachable code */
|
|
||||||
#endif
|
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 8
|
|
||||||
# pragma GCC diagnostic ignored "-Wconversion"
|
|
||||||
# pragma GCC diagnostic ignored "-Wfree-nonheap-object"
|
|
||||||
#endif
|
|
||||||
#if defined(__clang__) && defined(__has_warning)
|
|
||||||
# if __has_warning("-Wunused-but-set-variable")
|
|
||||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
/* Generate a reentrant parser object. */
|
|
||||||
%define api.pure
|
|
||||||
|
|
||||||
/* Configure the parser to use a lexer object. */
|
|
||||||
%lex-param {yyscan_t yyscanner}
|
|
||||||
%parse-param {yyscan_t yyscanner}
|
|
||||||
|
|
||||||
%define parse.error verbose
|
|
||||||
|
|
||||||
/*
|
|
||||||
%union {
|
|
||||||
char* string;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
/* Tokens */
|
|
||||||
%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
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
/* grammar */
|
|
||||||
%%
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
%%
|
|
||||||
/* End of grammar */
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message)
|
|
||||||
{
|
|
||||||
yyGetParser->Error(message);
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.8.2. */
|
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
|
||||||
under terms of your choice, so long as that work isn't itself a
|
|
||||||
parser generator using the skeleton or a modified version thereof
|
|
||||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
|
||||||
the parser skeleton itself, you may (at your option) remove this
|
|
||||||
special exception, which will cause the skeleton and the resulting
|
|
||||||
Bison output files to be licensed under the GNU General Public
|
|
||||||
License without this special exception.
|
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
|
||||||
version 2.2 of Bison. */
|
|
||||||
|
|
||||||
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
|
||||||
especially those whose name start with YY_ or yy_. They are
|
|
||||||
private implementation details that can be changed or removed. */
|
|
||||||
|
|
||||||
#ifndef YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED
|
|
||||||
# define YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED
|
|
||||||
/* Debug traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG 0
|
|
||||||
#endif
|
|
||||||
#if YYDEBUG
|
|
||||||
extern int cmCommandArgument_yydebug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Token kinds. */
|
|
||||||
#ifndef YYTOKENTYPE
|
|
||||||
# define YYTOKENTYPE
|
|
||||||
enum yytokentype
|
|
||||||
{
|
|
||||||
YYEMPTY = -2,
|
|
||||||
YYEOF = 0, /* "end of file" */
|
|
||||||
YYerror = 256, /* error */
|
|
||||||
YYUNDEF = 257, /* "invalid token" */
|
|
||||||
cal_ENVCURLY = 258, /* cal_ENVCURLY */
|
|
||||||
cal_NCURLY = 259, /* cal_NCURLY */
|
|
||||||
cal_DCURLY = 260, /* cal_DCURLY */
|
|
||||||
cal_DOLLAR = 261, /* "$" */
|
|
||||||
cal_LCURLY = 262, /* "{" */
|
|
||||||
cal_RCURLY = 263, /* "}" */
|
|
||||||
cal_NAME = 264, /* cal_NAME */
|
|
||||||
cal_BSLASH = 265, /* "\\" */
|
|
||||||
cal_SYMBOL = 266, /* cal_SYMBOL */
|
|
||||||
cal_AT = 267, /* "@" */
|
|
||||||
cal_ERROR = 268, /* cal_ERROR */
|
|
||||||
cal_ATNAME = 269 /* cal_ATNAME */
|
|
||||||
};
|
|
||||||
typedef enum yytokentype yytoken_kind_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Value type. */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cmCommandArgument_yyparse (yyscan_t yyscanner);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED */
|
|
||||||
@@ -1,296 +0,0 @@
|
|||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
||||||
#include "cmCommandArgumentParserHelper.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <cm/memory>
|
|
||||||
#include <cm/optional>
|
|
||||||
#include <cmext/string_view>
|
|
||||||
|
|
||||||
#include "cmCommandArgumentLexer.h"
|
|
||||||
#include "cmListFileCache.h"
|
|
||||||
#include "cmMakefile.h"
|
|
||||||
#include "cmState.h"
|
|
||||||
#include "cmStringAlgorithms.h"
|
|
||||||
#include "cmSystemTools.h"
|
|
||||||
#include "cmValue.h"
|
|
||||||
|
|
||||||
int cmCommandArgument_yyparse(yyscan_t yyscanner);
|
|
||||||
//
|
|
||||||
cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
|
|
||||||
{
|
|
||||||
this->FileLine = -1;
|
|
||||||
this->FileName = nullptr;
|
|
||||||
this->RemoveEmpty = true;
|
|
||||||
|
|
||||||
this->NoEscapeMode = false;
|
|
||||||
this->ReplaceAtSyntax = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmCommandArgumentParserHelper::~cmCommandArgumentParserHelper()
|
|
||||||
{
|
|
||||||
this->CleanupParser();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file)
|
|
||||||
{
|
|
||||||
this->FileLine = line;
|
|
||||||
this->FileName = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cmCommandArgumentParserHelper::AddString(const std::string& str)
|
|
||||||
{
|
|
||||||
if (str.empty()) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
auto stVal = cm::make_unique<char[]>(str.size() + 1);
|
|
||||||
strcpy(stVal.get(), str.c_str());
|
|
||||||
this->Variables.push_back(std::move(stVal));
|
|
||||||
return this->Variables.back().get();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
|
|
||||||
const char* key, const char* var)
|
|
||||||
{
|
|
||||||
if (!key) {
|
|
||||||
return this->ExpandVariable(var);
|
|
||||||
}
|
|
||||||
if (!var) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (strcmp(key, "ENV") == 0) {
|
|
||||||
std::string str;
|
|
||||||
if (cmSystemTools::GetEnv(var, str)) {
|
|
||||||
if (this->EscapeQuotes) {
|
|
||||||
return this->AddString(cmEscapeQuotes(str));
|
|
||||||
}
|
|
||||||
return this->AddString(str);
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (strcmp(key, "CACHE") == 0) {
|
|
||||||
if (cmValue c =
|
|
||||||
this->Makefile->GetState()->GetInitializedCacheValue(var)) {
|
|
||||||
if (this->EscapeQuotes) {
|
|
||||||
return this->AddString(cmEscapeQuotes(*c));
|
|
||||||
}
|
|
||||||
return this->AddString(*c);
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "Syntax $" << key << "{} is not supported. "
|
|
||||||
<< "Only ${}, $ENV{}, and $CACHE{} are allowed.";
|
|
||||||
this->SetError(e.str());
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
|
|
||||||
{
|
|
||||||
if (!var) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
|
|
||||||
std::string line;
|
|
||||||
cmListFileBacktrace bt = this->Makefile->GetBacktrace();
|
|
||||||
cmListFileContext const& top = bt.Top();
|
|
||||||
if (top.DeferId) {
|
|
||||||
line = cmStrCat("DEFERRED:"_s, *top.DeferId);
|
|
||||||
} else {
|
|
||||||
line = std::to_string(this->FileLine);
|
|
||||||
}
|
|
||||||
return this->AddString(line);
|
|
||||||
}
|
|
||||||
cmValue value = this->Makefile->GetDefinition(var);
|
|
||||||
if (!value) {
|
|
||||||
this->Makefile->MaybeWarnUninitialized(var, this->FileName);
|
|
||||||
if (!this->RemoveEmpty) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this->EscapeQuotes && value) {
|
|
||||||
return this->AddString(cmEscapeQuotes(*value));
|
|
||||||
}
|
|
||||||
return this->AddString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
|
|
||||||
{
|
|
||||||
if (this->ReplaceAtSyntax) {
|
|
||||||
// try to expand the variable
|
|
||||||
const char* ret = this->ExpandVariable(var);
|
|
||||||
// if the return was 0 and we want to replace empty strings
|
|
||||||
// then return an empty string
|
|
||||||
if (!ret && this->RemoveEmpty) {
|
|
||||||
return this->AddString("");
|
|
||||||
}
|
|
||||||
// if the ret was not 0, then return it
|
|
||||||
if (ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// at this point we want to put it back because of one of these cases:
|
|
||||||
// - this->ReplaceAtSyntax is false
|
|
||||||
// - this->ReplaceAtSyntax is true, but this->RemoveEmpty is false,
|
|
||||||
// and the variable was not defined
|
|
||||||
std::string ref = cmStrCat('@', var, '@');
|
|
||||||
return this->AddString(ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cmCommandArgumentParserHelper::CombineUnions(const char* in1,
|
|
||||||
const char* in2)
|
|
||||||
{
|
|
||||||
if (!in1) {
|
|
||||||
return in2;
|
|
||||||
}
|
|
||||||
if (!in2) {
|
|
||||||
return in1;
|
|
||||||
}
|
|
||||||
size_t len = strlen(in1) + strlen(in2) + 1;
|
|
||||||
auto out = cm::make_unique<char[]>(len);
|
|
||||||
strcpy(out.get(), in1);
|
|
||||||
strcat(out.get(), in2);
|
|
||||||
this->Variables.push_back(std::move(out));
|
|
||||||
return this->Variables.back().get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::AllocateParserType(
|
|
||||||
cmCommandArgumentParserHelper::ParserType* pt, const char* str, int len)
|
|
||||||
{
|
|
||||||
pt->str = nullptr;
|
|
||||||
if (len == 0) {
|
|
||||||
len = static_cast<int>(strlen(str));
|
|
||||||
}
|
|
||||||
if (len == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto out = cm::make_unique<char[]>(len + 1);
|
|
||||||
memcpy(out.get(), str, len);
|
|
||||||
out.get()[len] = 0;
|
|
||||||
pt->str = out.get();
|
|
||||||
this->Variables.push_back(std::move(out));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cmCommandArgumentParserHelper::HandleEscapeSymbol(
|
|
||||||
cmCommandArgumentParserHelper::ParserType* pt, char symbol)
|
|
||||||
{
|
|
||||||
switch (symbol) {
|
|
||||||
case '\\':
|
|
||||||
case '"':
|
|
||||||
case ' ':
|
|
||||||
case '#':
|
|
||||||
case '(':
|
|
||||||
case ')':
|
|
||||||
case '$':
|
|
||||||
case '@':
|
|
||||||
case '^':
|
|
||||||
this->AllocateParserType(pt, &symbol, 1);
|
|
||||||
break;
|
|
||||||
case ';':
|
|
||||||
this->AllocateParserType(pt, "\\;", 2);
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
this->AllocateParserType(pt, "\t", 1);
|
|
||||||
break;
|
|
||||||
case 'n':
|
|
||||||
this->AllocateParserType(pt, "\n", 1);
|
|
||||||
break;
|
|
||||||
case 'r':
|
|
||||||
this->AllocateParserType(pt, "\r", 1);
|
|
||||||
break;
|
|
||||||
case '0':
|
|
||||||
this->AllocateParserType(pt, "\0", 1);
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "Invalid escape sequence \\" << symbol;
|
|
||||||
this->SetError(e.str());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes);
|
|
||||||
|
|
||||||
int cmCommandArgumentParserHelper::ParseString(std::string const& str,
|
|
||||||
int verb)
|
|
||||||
{
|
|
||||||
if (str.empty()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
this->InputSize = str.size();
|
|
||||||
this->Verbose = verb;
|
|
||||||
|
|
||||||
this->Result.clear();
|
|
||||||
|
|
||||||
yyscan_t yyscanner;
|
|
||||||
cmCommandArgument_yylex_init(&yyscanner);
|
|
||||||
auto* scanBuf = cmCommandArgument_yy_scan_string(str.c_str(), yyscanner);
|
|
||||||
cmCommandArgument_yyset_extra(this, yyscanner);
|
|
||||||
cmCommandArgument_SetupEscapes(yyscanner, this->NoEscapeMode);
|
|
||||||
int res = cmCommandArgument_yyparse(yyscanner);
|
|
||||||
cmCommandArgument_yy_delete_buffer(scanBuf, yyscanner);
|
|
||||||
cmCommandArgument_yylex_destroy(yyscanner);
|
|
||||||
if (res != 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->CleanupParser();
|
|
||||||
|
|
||||||
if (this->Verbose) {
|
|
||||||
std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::CleanupParser()
|
|
||||||
{
|
|
||||||
this->Variables.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::Error(const char* str)
|
|
||||||
{
|
|
||||||
auto pos = this->InputBufferPos;
|
|
||||||
auto const isEof = (this->InputSize < this->InputBufferPos);
|
|
||||||
if (!isEof) {
|
|
||||||
pos -= this->LastTokenLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << str << " (" << pos << ")";
|
|
||||||
this->SetError(ostr.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf)
|
|
||||||
{
|
|
||||||
this->Makefile = mf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::SetResult(const char* value)
|
|
||||||
{
|
|
||||||
if (!value) {
|
|
||||||
this->Result.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->Result = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::SetError(std::string const& msg)
|
|
||||||
{
|
|
||||||
// Keep only the first error.
|
|
||||||
if (this->ErrorString.empty()) {
|
|
||||||
this->ErrorString = msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::UpdateInputPosition(int const tokenLength)
|
|
||||||
{
|
|
||||||
this->InputBufferPos += tokenLength;
|
|
||||||
this->LastTokenLength = tokenLength;
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class cmMakefile;
|
|
||||||
|
|
||||||
class cmCommandArgumentParserHelper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct ParserType
|
|
||||||
{
|
|
||||||
const char* str;
|
|
||||||
};
|
|
||||||
|
|
||||||
cmCommandArgumentParserHelper();
|
|
||||||
~cmCommandArgumentParserHelper();
|
|
||||||
|
|
||||||
cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&) = delete;
|
|
||||||
cmCommandArgumentParserHelper& operator=(
|
|
||||||
cmCommandArgumentParserHelper const&) = delete;
|
|
||||||
|
|
||||||
int ParseString(std::string const& str, int verb);
|
|
||||||
|
|
||||||
// For the lexer:
|
|
||||||
void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
|
|
||||||
const char* str, int len = 0);
|
|
||||||
bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
|
|
||||||
char symbol);
|
|
||||||
|
|
||||||
void Error(const char* str);
|
|
||||||
|
|
||||||
// For yacc
|
|
||||||
const char* CombineUnions(const char* in1, const char* in2);
|
|
||||||
|
|
||||||
const char* ExpandSpecialVariable(const char* key, const char* var);
|
|
||||||
const char* ExpandVariable(const char* var);
|
|
||||||
const char* ExpandVariableForAt(const char* var);
|
|
||||||
void SetResult(const char* value);
|
|
||||||
|
|
||||||
void SetMakefile(const cmMakefile* mf);
|
|
||||||
|
|
||||||
void UpdateInputPosition(int tokenLength);
|
|
||||||
|
|
||||||
std::string& GetResult() { return this->Result; }
|
|
||||||
|
|
||||||
void SetLineFile(long line, const char* file);
|
|
||||||
void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
|
|
||||||
void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
|
|
||||||
void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
|
|
||||||
void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
|
|
||||||
|
|
||||||
const char* GetError() { return this->ErrorString.c_str(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string::size_type InputBufferPos{ 1 };
|
|
||||||
std::string::size_type LastTokenLength{};
|
|
||||||
std::string::size_type InputSize{};
|
|
||||||
std::vector<char> OutputBuffer;
|
|
||||||
|
|
||||||
void Print(const char* place, const char* str);
|
|
||||||
void SafePrintMissing(const char* str, int line, int cnt);
|
|
||||||
|
|
||||||
const char* AddString(const std::string& str);
|
|
||||||
|
|
||||||
void CleanupParser();
|
|
||||||
void SetError(std::string const& msg);
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<char[]>> Variables;
|
|
||||||
const cmMakefile* Makefile;
|
|
||||||
std::string Result;
|
|
||||||
std::string ErrorString;
|
|
||||||
const char* FileName;
|
|
||||||
long FileLine;
|
|
||||||
int Verbose;
|
|
||||||
bool EscapeQuotes;
|
|
||||||
bool NoEscapeMode;
|
|
||||||
bool ReplaceAtSyntax;
|
|
||||||
bool RemoveEmpty;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define YYSTYPE cmCommandArgumentParserHelper::ParserType
|
|
||||||
#define YYSTYPE_IS_DECLARED
|
|
||||||
#define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
|
|
||||||
#define YY_DECL \
|
|
||||||
int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
|
|
||||||
@@ -315,7 +315,6 @@ CMAKE_CXX_SOURCES="\
|
|||||||
cmCMakePolicyCommand \
|
cmCMakePolicyCommand \
|
||||||
cmCPackPropertiesGenerator \
|
cmCPackPropertiesGenerator \
|
||||||
cmCacheManager \
|
cmCacheManager \
|
||||||
cmCommandArgumentParserHelper \
|
|
||||||
cmCommands \
|
cmCommands \
|
||||||
cmCommonTargetGenerator \
|
cmCommonTargetGenerator \
|
||||||
cmComputeComponentGraph \
|
cmComputeComponentGraph \
|
||||||
@@ -556,8 +555,6 @@ CMAKE_STD_CXX_SOURCES="\
|
|||||||
"
|
"
|
||||||
|
|
||||||
LexerParser_CXX_SOURCES="\
|
LexerParser_CXX_SOURCES="\
|
||||||
cmCommandArgumentLexer \
|
|
||||||
cmCommandArgumentParser \
|
|
||||||
cmExprLexer \
|
cmExprLexer \
|
||||||
cmExprParser \
|
cmExprParser \
|
||||||
cmGccDepfileLexer \
|
cmGccDepfileLexer \
|
||||||
|
|||||||
Reference in New Issue
Block a user