[cmake-commits] hoffman committed cmCommandArgumentLexer.cxx 1.4.2.2 1.4.2.3 cmCommandArgumentLexer.h 1.2.2.1 1.2.2.2 cmCommandArgumentLexer.in.l 1.5.6.1 1.5.6.2 cmCommandArgumentParserHelper.cxx 1.12.2.5 1.12.2.6

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Jun 5 09:30:56 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv20428/Source

Modified Files:
      Tag: CMake-2-4
	cmCommandArgumentLexer.cxx cmCommandArgumentLexer.h 
	cmCommandArgumentLexer.in.l cmCommandArgumentParserHelper.cxx 
Log Message:
ENH: merge in changes from main tree that fix at only parsing


Index: cmCommandArgumentLexer.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentLexer.h,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -d -r1.2.2.1 -r1.2.2.2
--- cmCommandArgumentLexer.h	13 Oct 2006 14:52:02 -0000	1.2.2.1
+++ cmCommandArgumentLexer.h	5 Jun 2007 13:30:54 -0000	1.2.2.2
@@ -2,10 +2,6 @@
 #define cmCommandArgument_yyHEADER_H 1
 #define cmCommandArgument_yyIN_HEADER 1
 
-
-
-
-
 #define  YY_INT_ALIGNED short int
 
 /* A lexical scanner generated by flex */
@@ -35,7 +31,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#if __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. 
@@ -96,7 +92,7 @@
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
-#else  /* ! __cplusplus */
+#else   /* ! __cplusplus */
 
 #if __STDC__
 
@@ -148,73 +144,65 @@
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
-  {
-  FILE *yy_input_file;
+        {
+        FILE *yy_input_file;
 
-  char *yy_ch_buf;    /* input buffer */
-  char *yy_buf_pos;    /* current position in input buffer */
+        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.
-   */
-  yy_size_t yy_buf_size;
+        /* Size of input buffer in bytes, not including room for EOB
+         * characters.
+         */
+        yy_size_t yy_buf_size;
 
-  /* Number of characters read into yy_ch_buf, not including EOB
-   * characters.
-   */
-  int yy_n_chars;
+        /* 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 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 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;
+        /* 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;
+        /* Whether to try to fill the input buffer when we reach the
+         * end of it.
+         */
+        int yy_fill_buffer;
 
-  int yy_buffer_status;
+        int yy_buffer_status;
 
-  };
+        };
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
 void cmCommandArgument_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void cmCommandArgument_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,
-                                            yyscan_t yyscanner );
-YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE *file,int size ,
-                                                    yyscan_t yyscanner );
-void cmCommandArgument_yy_delete_buffer (YY_BUFFER_STATE b ,
-                                         yyscan_t yyscanner );
-void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b ,
-                                        yyscan_t yyscanner );
-void cmCommandArgument_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,
-                                            yyscan_t yyscanner );
+void cmCommandArgument_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void cmCommandArgument_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void cmCommandArgument_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
 void cmCommandArgument_yypop_buffer_state (yyscan_t yyscanner );
 
-YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char *base,yy_size_t size ,
-                                                  yyscan_t yyscanner );
-YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char *yy_str ,
-                                                  yyscan_t yyscanner );
-YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char *bytes,int len ,
-                                                 yyscan_t yyscanner );
+YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
 
 void *cmCommandArgument_yyalloc (yy_size_t ,yyscan_t yyscanner );
 void *cmCommandArgument_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
@@ -229,6 +217,8 @@
 
 #ifdef YY_HEADER_EXPORT_START_CONDITIONS
 #define INITIAL 0
+#define ESCAPES 1
+#define NOESCAPES 2
 
 #endif
 
@@ -247,8 +237,7 @@
 
 YY_EXTRA_TYPE cmCommandArgument_yyget_extra (yyscan_t yyscanner );
 
-void cmCommandArgument_yyset_extra (YY_EXTRA_TYPE user_defined ,
-                                    yyscan_t yyscanner );
+void cmCommandArgument_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
 
 FILE *cmCommandArgument_yyget_in (yyscan_t yyscanner );
 
@@ -311,15 +300,13 @@
 #define YY_DECL int cmCommandArgument_yylex (yyscan_t yyscanner)
 #endif /* !YY_DECL */
 
-/* yy_get_previous_state - get the state just before 
-   the EOB char was reached */
+/* 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 yytext_ptr
 #undef YY_DO_BEFORE_ACTION
 
 #ifdef YY_DECL_IS_OURS
@@ -327,8 +314,5 @@
 #undef YY_DECL
 #endif
 
-
-
-
 #undef cmCommandArgument_yyIN_HEADER
 #endif /* cmCommandArgument_yyHEADER_H */

Index: cmCommandArgumentLexer.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentLexer.cxx,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -d -r1.4.2.2 -r1.4.2.3
--- cmCommandArgumentLexer.cxx	13 Oct 2006 14:52:02 -0000	1.4.2.2
+++ cmCommandArgumentLexer.cxx	5 Jun 2007 13:30:53 -0000	1.4.2.3
@@ -94,7 +94,7 @@
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
-#else  /* ! __cplusplus */
+#else   /* ! __cplusplus */
 
 #if __STDC__
 
@@ -181,17 +181,17 @@
     
 /* Return all but the first "n" matched characters back to the input stream. */
[...1876 lines suppressed...]
-#line 133 "cmCommandArgumentLexer.in.l"
+#line 141 "cmCommandArgumentLexer.in.l"
 
 
 
+/*--------------------------------------------------------------------------*/
+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);
+    }
+}
+

Index: cmCommandArgumentLexer.in.l
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentLexer.in.l,v
retrieving revision 1.5.6.1
retrieving revision 1.5.6.2
diff -u -d -r1.5.6.1 -r1.5.6.2
--- cmCommandArgumentLexer.in.l	13 Oct 2006 14:52:02 -0000	1.5.6.1
+++ cmCommandArgumentLexer.in.l	5 Jun 2007 13:30:54 -0000	1.5.6.2
@@ -24,6 +24,7 @@
   flex --prefix=cmCommandArgument_yy --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
 
 Modify cmCommandArgumentLexer.cxx:
+  - add #include "cmStandardIncludes.h" to top of file
   - remove TABs
   - remove "yyscanner" argument from these methods:
       yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree
@@ -56,6 +57,8 @@
 %option reentrant
 %option noyywrap
 %pointer
+%s ESCAPES
+%s NOESCAPES
 
 %%
 
@@ -98,7 +101,7 @@
   return cal_NAME; 
 }
 
-\\. {
+<ESCAPES>\\. {
   if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
     {
     return cal_ERROR;
@@ -124,10 +127,31 @@
   return cal_LCURLY; 
 }
 
-"\\" {
+<ESCAPES>"\\" {
   //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); 
   yylvalp->str = yyextra->BSLASHVariable;
   return cal_BSLASH; 
 }
 
+<NOESCAPES>"\\" {
+  //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
+  yylvalp->str = yyextra->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);
+    }
+}

Index: cmCommandArgumentParserHelper.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentParserHelper.cxx,v
retrieving revision 1.12.2.5
retrieving revision 1.12.2.6
diff -u -d -r1.12.2.5 -r1.12.2.6
--- cmCommandArgumentParserHelper.cxx	15 Feb 2007 18:36:08 -0000	1.12.2.5
+++ cmCommandArgumentParserHelper.cxx	5 Jun 2007 13:30:54 -0000	1.12.2.6
@@ -213,15 +213,6 @@
 bool cmCommandArgumentParserHelper::HandleEscapeSymbol
 (cmCommandArgumentParserHelper::ParserType* pt, char symbol)
 {
-  if ( this->NoEscapeMode )
-    {
-    char buffer[3];
-    buffer[0] = '\\';
-    buffer[1] = symbol;
-    buffer[2] = 0;
-    this->AllocateParserType(pt, buffer, 2);
-    return true;
-    }
   switch ( symbol )
     {
   case '\\':
@@ -260,6 +251,8 @@
   return true;
 }
 
+void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes);
+
 int cmCommandArgumentParserHelper::ParseString(const char* str, int verb)
 {
   if ( !str)
@@ -276,6 +269,7 @@
   yyscan_t yyscanner;
   cmCommandArgument_yylex_init(&yyscanner);
   cmCommandArgument_yyset_extra(this, yyscanner);
+  cmCommandArgument_SetupEscapes(yyscanner, this->NoEscapeMode);
   int res = cmCommandArgument_yyparse(yyscanner);
   cmCommandArgument_yylex_destroy(yyscanner);
   if ( res != 0 )



More information about the Cmake-commits mailing list