[Cmake-commits] CMake branch, next, updated. v2.8.11.2-3798-g4cd5fdf

Brad King brad.king at kitware.com
Thu Aug 8 13:38:56 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  4cd5fdf10894e1a0165bf3a062e426bbfd4ab02a (commit)
       via  b93982fb640b7a7f4ebf53d19a44f615dd547636 (commit)
       via  6aa0c214054252d1fc94e5b8e6b6ffc3eae4c08b (commit)
       via  b86e37c84f9691cc122e838b653ae0f441c4d1e2 (commit)
       via  f9bb20fe2bf1d9154a3244579ea84400912473b4 (commit)
       via  05dad99f5a1ee781da52df0ccc61b236087bcd2d (commit)
       via  00ce12a3347d1fef25badff00c5abc3dc715f207 (commit)
       via  34b397e8dec04c55b415ee0e5f9172f624156d36 (commit)
       via  e43e207c7bbde2a9e0948da0d1e79879ccd5ce45 (commit)
       via  0d6acb1df8c20bb21f4d328cf2c35d0cbb6d7ea3 (commit)
       via  fc7c3b4dc8522ad489a6fb67ac6030f302c65df3 (commit)
       via  c50f7ede200e2a7cd02d59117ac93543b602885c (commit)
       via  bf73264694234c4e82b31689b64b8a33d61552a9 (commit)
       via  58e524165d44e672e391cca261d9f7dd723d2c70 (commit)
       via  e75b69f55bcdc6ee524dfd0cab568644379fbacb (commit)
       via  e945949d141c196df7f6232a7839c1de94f935ec (commit)
       via  0546484e4b7856c417f30a5b8ff6af6a5a080f0d (commit)
       via  28685ade7a8f60e8519b6bf8a824e6a01365c181 (commit)
       via  1eafa3edaf34569cb6fa7eb449a9825049fe6270 (commit)
       via  f3155cd62ab669afc9d21bc877d5eb452ed94a7d (commit)
      from  1e59b42460197f70f8c64e4e64d9d50b752e18ad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4cd5fdf10894e1a0165bf3a062e426bbfd4ab02a
commit 4cd5fdf10894e1a0165bf3a062e426bbfd4ab02a
Merge: 1e59b42 b93982f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Aug 8 13:38:51 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Aug 8 13:38:51 2013 -0400

    Merge topic 'cmake-syntax' into next
    
    b93982f Merge branch 'dev/fix-variable-watch-crash' into cmake-syntax
    6aa0c21 variable_watch: Add test for watching a variable multiple times
    b86e37c variable_watch: Check newValue for NULL
    f9bb20f variable_watch: Don't share memory for callbacks
    05dad99 variable_watch: Fix a typo in the error message
    00ce12a variable_watch: Prevent making extra entries in the watch map
    34b397e variable_watch: Allow specifying the data to match in RemoveWatch
    e43e207 variable_watch: Match client_data when finding duplicates
    0d6acb1 variable_watch: Add a deleter for the client data
    fc7c3b4 variable_watch: Store client data as pointers
    c50f7ed cmListFileLexer: Modify flex output to avoid Borland warning
    bf73264 Warn about unquoted arguments that look like long brackets
    58e5241 Warn about arguments not separated by whitespace
    e75b69f cmListFileCache: Convert CMake language parser to class
    e945949 Add RunCMake.Syntax test cases for command invocation styles
    0546484 cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum
    ...


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b93982fb640b7a7f4ebf53d19a44f615dd547636
commit b93982fb640b7a7f4ebf53d19a44f615dd547636
Merge: c50f7ed 6aa0c21
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Aug 8 13:35:15 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:35:15 2013 -0400

    Merge branch 'dev/fix-variable-watch-crash' into cmake-syntax
    
    Resolve conflict in Source/cmVariableWatchCommand.cxx by integrating the
    changes from both sides.

diff --cc Source/cmVariableWatchCommand.cxx
index 70c6524,4eff19e..33e159b
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@@ -80,27 -44,20 +44,25 @@@ static void cmVariableWatchCommandVaria
    cmMakefile* makefile = const_cast<cmMakefile*>(mf);
  
    std::string stack = makefile->GetProperty("LISTFILE_STACK");
-   for ( it = handler->Commands.begin(); it != handler->Commands.end();
-     ++ it )
+   if ( !data->Command.empty() )
      {
-     std::string command = *it;
      newLFF.Arguments.clear();
      newLFF.Arguments.push_back(
 -      cmListFileArgument(variable, true, "unknown", 9999));
 +      cmListFileArgument(variable, cmListFileArgument::Quoted,
 +                         "unknown", 9999));
      newLFF.Arguments.push_back(
 -      cmListFileArgument(accessString, true, "unknown", 9999));
 +      cmListFileArgument(accessString, cmListFileArgument::Quoted,
 +                         "unknown", 9999));
      newLFF.Arguments.push_back(
 -      cmListFileArgument(newValue?newValue:"", true, "unknown", 9999));
 +      cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted,
 +                         "unknown", 9999));
      newLFF.Arguments.push_back(
 -      cmListFileArgument(currentListFile, true, "unknown", 9999));
 +      cmListFileArgument(currentListFile, cmListFileArgument::Quoted,
 +                         "unknown", 9999));
      newLFF.Arguments.push_back(
 -      cmListFileArgument(stack, true, "unknown", 9999));
 +      cmListFileArgument(stack, cmListFileArgument::Quoted,
 +                         "unknown", 9999));
-     newLFF.Name = command;
+     newLFF.Name = data->Command;
      newLFF.FilePath = "Some weird path";
      newLFF.Line = 9999;
      cmExecutionStatus status;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6aa0c214054252d1fc94e5b8e6b6ffc3eae4c08b
commit 6aa0c214054252d1fc94e5b8e6b6ffc3eae4c08b
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Tue Aug 6 14:31:28 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:10 2013 -0400

    variable_watch: Add test for watching a variable multiple times

diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
index 8d20476..9becb4c 100644
--- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
+++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
@@ -2,3 +2,4 @@ include(RunCMake)
 
 run_cmake(ModifiedAccess)
 run_cmake(NoWatcher)
+run_cmake(WatchTwice)
diff --git a/Tests/RunCMake/variable_watch/WatchTwice-stderr.txt b/Tests/RunCMake/variable_watch/WatchTwice-stderr.txt
new file mode 100644
index 0000000..fa7d347
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/WatchTwice-stderr.txt
@@ -0,0 +1,2 @@
+From watch1
+From watch2
diff --git a/Tests/RunCMake/variable_watch/WatchTwice.cmake b/Tests/RunCMake/variable_watch/WatchTwice.cmake
new file mode 100644
index 0000000..540cfc1
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/WatchTwice.cmake
@@ -0,0 +1,11 @@
+function (watch1)
+    message("From watch1")
+endfunction ()
+
+function (watch2)
+    message("From watch2")
+endfunction ()
+
+variable_watch(watched watch1)
+variable_watch(watched watch2)
+set(access "${watched}")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b86e37c84f9691cc122e838b653ae0f441c4d1e2
commit b86e37c84f9691cc122e838b653ae0f441c4d1e2
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Tue Aug 6 14:32:19 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:10 2013 -0400

    variable_watch: Check newValue for NULL
    
    On read access, newValue can be NULL since there is no new value, so use
    the empty string instead.

diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 3b75ade..4eff19e 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -80,7 +80,7 @@ static void cmVariableWatchCommandVariableAccessed(
     {
     cmOStringStream msg;
     msg << "Variable \"" << variable.c_str() << "\" was accessed using "
-        << accessString << " with value \"" << newValue << "\".";
+        << accessString << " with value \"" << (newValue?newValue:"") << "\".";
     makefile->IssueMessage(cmake::LOG, msg.str());
     }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9bb20fe2bf1d9154a3244579ea84400912473b4
commit f9bb20fe2bf1d9154a3244579ea84400912473b4
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Fri Aug 2 15:41:45 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:10 2013 -0400

    variable_watch: Don't share memory for callbacks
    
    The command itself is owned by the cmMakefile class, but the
    cmVariableWatch which holds a pointer to the cmVariableWatchCommand via
    the client_data for the callback outlives the cmMakefile class in the Qt
    GUI. This means that when the cmMakefile is destroyed, the variable
    watch is still in effect, but with a stale pointer.
    
    To fix this, each callback is now a separate entity completely and
    doesn't rely on the command which spawned it at all.
    
    An example CMakeLists.txt which demonstrates the issue (only displayed
    in cmake-gui, so no tests can be written for it):
    
        set(var 0)
        variable_watch(var)

diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 2b81d79..3b75ade 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -14,63 +14,27 @@
 #include "cmVariableWatch.h"
 
 //----------------------------------------------------------------------------
-static void cmVariableWatchCommandVariableAccessed(
-  const std::string& variable, int access_type, void* client_data,
-  const char* newValue, const cmMakefile* mf)
+struct cmVariableWatchCallbackData
 {
-  cmVariableWatchCommand* command
-    = static_cast<cmVariableWatchCommand*>(client_data);
-  command->VariableAccessed(variable, access_type, newValue, mf);
-}
+  bool InCallback;
+  std::string Command;
+};
 
 //----------------------------------------------------------------------------
-cmVariableWatchCommand::cmVariableWatchCommand()
+static void cmVariableWatchCommandVariableAccessed(
+  const std::string& variable, int access_type, void* client_data,
+  const char* newValue, const cmMakefile* mf)
 {
-  this->InCallback = false;
-}
+  cmVariableWatchCallbackData* data
+    = static_cast<cmVariableWatchCallbackData*>(client_data);
 
-//----------------------------------------------------------------------------
-bool cmVariableWatchCommand
-::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
-{
-  if ( args.size() < 1 )
-    {
-    this->SetError("must be called with at least one argument.");
-    return false;
-    }
-  std::string variable = args[0];
-  if ( args.size() > 1 )
-    {
-    std::string command = args[1];
-    this->Handlers[variable].Commands.push_back(args[1]);
-    }
-  if ( variable == "CMAKE_CURRENT_LIST_FILE" )
-    {
-    cmOStringStream ostr;
-    ostr << "cannot be set on the variable: " << variable.c_str();
-    this->SetError(ostr.str().c_str());
-    return false;
-    }
-
-  this->Makefile->GetCMakeInstance()->GetVariableWatch()->AddWatch(
-    variable, cmVariableWatchCommandVariableAccessed, this);
-
-  return true;
-}
-
-//----------------------------------------------------------------------------
-void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
-  int access_type, const char* newValue, const cmMakefile* mf)
-{
-  if ( this->InCallback )
+  if ( data->InCallback )
     {
     return;
     }
-  this->InCallback = true;
+  data->InCallback = true;
 
   cmListFileFunction newLFF;
-  cmVariableWatchCommandHandler *handler = &this->Handlers[variable];
-  cmVariableWatchCommandHandler::VectorOfCommands::iterator it;
   cmListFileArgument arg;
   bool processed = false;
   const char* accessString = cmVariableWatch::GetAccessAsString(access_type);
@@ -80,10 +44,8 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
   cmMakefile* makefile = const_cast<cmMakefile*>(mf);
 
   std::string stack = makefile->GetProperty("LISTFILE_STACK");
-  for ( it = handler->Commands.begin(); it != handler->Commands.end();
-    ++ it )
+  if ( !data->Command.empty() )
     {
-    std::string command = *it;
     newLFF.Arguments.clear();
     newLFF.Arguments.push_back(
       cmListFileArgument(variable, true, "unknown", 9999));
@@ -95,7 +57,7 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
       cmListFileArgument(currentListFile, true, "unknown", 9999));
     newLFF.Arguments.push_back(
       cmListFileArgument(stack, true, "unknown", 9999));
-    newLFF.Name = command;
+    newLFF.Name = data->Command;
     newLFF.FilePath = "Some weird path";
     newLFF.Line = 9999;
     cmExecutionStatus status;
@@ -107,9 +69,9 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
       error << "Error in cmake code at\n"
         << arg.FilePath << ":" << arg.Line << ":\n"
         << "A command failed during the invocation of callback \""
-        << command << "\".";
+        << data->Command << "\".";
       cmSystemTools::Error(error.str().c_str());
-      this->InCallback = false;
+      data->InCallback = false;
       return;
       }
     processed = true;
@@ -121,5 +83,72 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
         << accessString << " with value \"" << newValue << "\".";
     makefile->IssueMessage(cmake::LOG, msg.str());
     }
-  this->InCallback = false;
+
+  data->InCallback = false;
+}
+
+//----------------------------------------------------------------------------
+static void deleteVariableWatchCallbackData(void* client_data)
+{
+  cmVariableWatchCallbackData* data
+    = static_cast<cmVariableWatchCallbackData*>(client_data);
+  delete data;
+}
+
+//----------------------------------------------------------------------------
+cmVariableWatchCommand::cmVariableWatchCommand()
+{
+}
+
+//----------------------------------------------------------------------------
+cmVariableWatchCommand::~cmVariableWatchCommand()
+{
+  std::set<std::string>::const_iterator it;
+  for ( it = this->WatchedVariables.begin();
+        it != this->WatchedVariables.end();
+        ++it )
+    {
+    this->Makefile->GetCMakeInstance()->GetVariableWatch()->RemoveWatch(
+      *it, cmVariableWatchCommandVariableAccessed);
+    }
+}
+
+//----------------------------------------------------------------------------
+bool cmVariableWatchCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
+{
+  if ( args.size() < 1 )
+    {
+    this->SetError("must be called with at least one argument.");
+    return false;
+    }
+  std::string variable = args[0];
+  std::string command;
+  if ( args.size() > 1 )
+    {
+    command = args[1];
+    }
+  if ( variable == "CMAKE_CURRENT_LIST_FILE" )
+    {
+    cmOStringStream ostr;
+    ostr << "cannot be set on the variable: " << variable.c_str();
+    this->SetError(ostr.str().c_str());
+    return false;
+    }
+
+  cmVariableWatchCallbackData* data = new cmVariableWatchCallbackData;
+
+  data->InCallback = false;
+  data->Command = command;
+
+  this->WatchedVariables.insert(variable);
+  if ( !this->Makefile->GetCMakeInstance()->GetVariableWatch()->AddWatch(
+          variable, cmVariableWatchCommandVariableAccessed,
+          data, deleteVariableWatchCallbackData) )
+    {
+    deleteVariableWatchCallbackData(data);
+    return false;
+    }
+
+  return true;
 }
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 3abc088..545535c 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -14,13 +14,6 @@
 
 #include "cmCommand.h"
 
-class cmVariableWatchCommandHandler
-{
-public:
-  typedef std::vector<std::string> VectorOfCommands;
-  VectorOfCommands Commands;
-};
-
 /** \class cmVariableWatchCommand
  * \brief Watch when the variable changes and invoke command
  *
@@ -39,6 +32,9 @@ public:
   //! Default constructor
   cmVariableWatchCommand();
 
+  //! Destructor.
+  ~cmVariableWatchCommand();
+
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
@@ -83,13 +79,8 @@ public:
 
   cmTypeMacro(cmVariableWatchCommand, cmCommand);
 
-  void VariableAccessed(const std::string& variable, int access_type,
-    const char* newValue, const cmMakefile* mf);
-
 protected:
-  std::map<std::string, cmVariableWatchCommandHandler> Handlers;
-
-  bool InCallback;
+  std::set<std::string> WatchedVariables;
 };
 
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05dad99f5a1ee781da52df0ccc61b236087bcd2d
commit 05dad99f5a1ee781da52df0ccc61b236087bcd2d
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Fri Aug 2 15:49:50 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:10 2013 -0400

    variable_watch: Fix a typo in the error message
    
    There was no space between "callback" and the quoted command name.

diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 297a92b..2b81d79 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -106,7 +106,7 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
       cmOStringStream error;
       error << "Error in cmake code at\n"
         << arg.FilePath << ":" << arg.Line << ":\n"
-        << "A command failed during the invocation of callback\""
+        << "A command failed during the invocation of callback \""
         << command << "\".";
       cmSystemTools::Error(error.str().c_str());
       this->InCallback = false;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00ce12a3347d1fef25badff00c5abc3dc715f207
commit 00ce12a3347d1fef25badff00c5abc3dc715f207
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Fri Aug 2 15:49:28 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:09 2013 -0400

    variable_watch: Prevent making extra entries in the watch map
    
    When removing a watch on a variable, using the operator [] on the
    internal map will create an empty watch if the variable doesn't have any
    existing watches. Rather than creating this empty structure in the map,
    return if there isn't a watch on the variable already.

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index d049cdd..8ad6fce 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -80,6 +80,10 @@ void cmVariableWatch::RemoveWatch(const std::string& variable,
                                   WatchMethod method,
                                   void* client_data /*=0*/)
 {
+  if ( !this->WatchMap.count(variable) )
+    {
+    return;
+    }
   cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable];
   cmVariableWatch::VectorOfPairs::iterator it;
   for ( it = vp->begin(); it != vp->end(); ++it )

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34b397e8dec04c55b415ee0e5f9172f624156d36
commit 34b397e8dec04c55b415ee0e5f9172f624156d36
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Tue Aug 6 14:12:54 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:09 2013 -0400

    variable_watch: Allow specifying the data to match in RemoveWatch
    
    Now that watches are dependent on their client_data when adding, it also
    makes sense to allow matching the data for removal.

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index c2a899d..d049cdd 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -77,13 +77,17 @@ bool cmVariableWatch::AddWatch(const std::string& variable,
 }
 
 void cmVariableWatch::RemoveWatch(const std::string& variable,
-                                  WatchMethod method)
+                                  WatchMethod method,
+                                  void* client_data /*=0*/)
 {
   cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable];
   cmVariableWatch::VectorOfPairs::iterator it;
   for ( it = vp->begin(); it != vp->end(); ++it )
     {
-    if ( (*it)->Method == method )
+    if ( (*it)->Method == method &&
+         // If client_data is NULL, we want to disconnect all watches against
+         // the given method; otherwise match ClientData as well.
+         (!client_data || (client_data == (*it)->ClientData)))
       {
       delete *it;
       vp->erase(it);
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 3b6cafd..790c75a 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -36,7 +36,8 @@ public:
    */
   bool AddWatch(const std::string& variable, WatchMethod method,
                 void* client_data=0, DeleteData delete_data=0);
-  void RemoveWatch(const std::string& variable, WatchMethod method);
+  void RemoveWatch(const std::string& variable, WatchMethod method,
+                   void* client_data=0);
 
   /**
    * This method is called when variable is accessed

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e43e207c7bbde2a9e0948da0d1e79879ccd5ce45
commit e43e207c7bbde2a9e0948da0d1e79879ccd5ce45
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Tue Aug 6 14:08:57 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:09 2013 -0400

    variable_watch: Match client_data when finding duplicates
    
    If a callback has the same data as another call, we don't want to delete
    the old callback. This is because if the client_data is the same, it
    might get deleted causing the new client_data to be bogus. Now, AddWatch
    will return true if it will use the watch, false otherwise. Callers
    should check the return value to know whether client_data was adopted by
    the watch or not.

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 21acd3b..c2a899d 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -52,7 +52,7 @@ cmVariableWatch::~cmVariableWatch()
     }
 }
 
-void cmVariableWatch::AddWatch(const std::string& variable,
+bool cmVariableWatch::AddWatch(const std::string& variable,
                                WatchMethod method, void* client_data /*=0*/,
                                DeleteData delete_data /*=0*/)
 {
@@ -65,14 +65,15 @@ void cmVariableWatch::AddWatch(const std::string& variable,
   for ( cc = 0; cc < vp->size(); cc ++ )
     {
     cmVariableWatch::Pair* pair = (*vp)[cc];
-    if ( pair->Method == method )
+    if ( pair->Method == method &&
+         client_data && client_data == pair->ClientData)
       {
-      delete pair;
-      (*vp)[cc] = p;
-      return;
+      // Callback already exists
+      return false;
       }
     }
   vp->push_back(p);
+  return true;
 }
 
 void cmVariableWatch::RemoveWatch(const std::string& variable,
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index d666815..3b6cafd 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -34,7 +34,7 @@ public:
   /**
    * Add watch to the variable
    */
-  void AddWatch(const std::string& variable, WatchMethod method,
+  bool AddWatch(const std::string& variable, WatchMethod method,
                 void* client_data=0, DeleteData delete_data=0);
   void RemoveWatch(const std::string& variable, WatchMethod method);
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d6acb1df8c20bb21f4d328cf2c35d0cbb6d7ea3
commit 0d6acb1df8c20bb21f4d328cf2c35d0cbb6d7ea3
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Fri Aug 2 15:44:15 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:09 2013 -0400

    variable_watch: Add a deleter for the client data
    
    The client data is arbitrary and the callback may be called an
    unspecified number of times, so the cmVariableWatch must be the one to
    delete the client data in the end (if it is needed at all).

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 21b910d..21acd3b 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -53,11 +53,13 @@ cmVariableWatch::~cmVariableWatch()
 }
 
 void cmVariableWatch::AddWatch(const std::string& variable,
-                               WatchMethod method, void* client_data /*=0*/)
+                               WatchMethod method, void* client_data /*=0*/,
+                               DeleteData delete_data /*=0*/)
 {
   cmVariableWatch::Pair* p = new cmVariableWatch::Pair;
   p->Method = method;
   p->ClientData = client_data;
+  p->DeleteDataCall = delete_data;
   cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable];
   cmVariableWatch::VectorOfPairs::size_type cc;
   for ( cc = 0; cc < vp->size(); cc ++ )
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 45273e5..d666815 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -26,6 +26,7 @@ class cmVariableWatch
 public:
   typedef void (*WatchMethod)(const std::string& variable, int access_type,
     void* client_data, const char* newValue, const cmMakefile* mf);
+  typedef void (*DeleteData)(void* client_data);
 
   cmVariableWatch();
   ~cmVariableWatch();
@@ -34,7 +35,7 @@ public:
    * Add watch to the variable
    */
   void AddWatch(const std::string& variable, WatchMethod method,
-                void* client_data=0);
+                void* client_data=0, DeleteData delete_data=0);
   void RemoveWatch(const std::string& variable, WatchMethod method);
 
   /**
@@ -67,7 +68,15 @@ protected:
   {
     WatchMethod Method;
     void*        ClientData;
-    Pair() : Method(0), ClientData(0) {}
+    DeleteData   DeleteDataCall;
+    Pair() : Method(0), ClientData(0), DeleteDataCall(0) {}
+    ~Pair()
+      {
+      if (this->DeleteDataCall && this->ClientData)
+        {
+        this->DeleteDataCall(this->ClientData);
+        }
+      }
   };
 
   typedef std::vector< Pair* > VectorOfPairs;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc7c3b4dc8522ad489a6fb67ac6030f302c65df3
commit fc7c3b4dc8522ad489a6fb67ac6030f302c65df3
Author:     Ben Boeckel <mathstuf at gmail.com>
AuthorDate: Fri Aug 2 15:43:15 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:31:09 2013 -0400

    variable_watch: Store client data as pointers
    
    The STL containers create extra copies which makes keeping track of the
    owner of the client data much messier.

diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index 3905e9b..21b910d 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -37,21 +37,35 @@ cmVariableWatch::cmVariableWatch()
 
 cmVariableWatch::~cmVariableWatch()
 {
+  cmVariableWatch::StringToVectorOfPairs::iterator svp_it;
+
+  for ( svp_it = this->WatchMap.begin();
+        svp_it != this->WatchMap.end(); ++svp_it )
+    {
+    cmVariableWatch::VectorOfPairs::iterator p_it;
+
+    for ( p_it = svp_it->second.begin();
+          p_it != svp_it->second.end(); ++p_it )
+      {
+      delete *p_it;
+      }
+    }
 }
 
 void cmVariableWatch::AddWatch(const std::string& variable,
                                WatchMethod method, void* client_data /*=0*/)
 {
-  cmVariableWatch::Pair p;
-  p.Method = method;
-  p.ClientData = client_data;
+  cmVariableWatch::Pair* p = new cmVariableWatch::Pair;
+  p->Method = method;
+  p->ClientData = client_data;
   cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable];
   cmVariableWatch::VectorOfPairs::size_type cc;
   for ( cc = 0; cc < vp->size(); cc ++ )
     {
-    cmVariableWatch::Pair* pair = &(*vp)[cc];
+    cmVariableWatch::Pair* pair = (*vp)[cc];
     if ( pair->Method == method )
       {
+      delete pair;
       (*vp)[cc] = p;
       return;
       }
@@ -66,8 +80,9 @@ void cmVariableWatch::RemoveWatch(const std::string& variable,
   cmVariableWatch::VectorOfPairs::iterator it;
   for ( it = vp->begin(); it != vp->end(); ++it )
     {
-    if ( it->Method == method )
+    if ( (*it)->Method == method )
       {
+      delete *it;
       vp->erase(it);
       return;
       }
@@ -87,7 +102,7 @@ void  cmVariableWatch::VariableAccessed(const std::string& variable,
     cmVariableWatch::VectorOfPairs::const_iterator it;
     for ( it = vp->begin(); it != vp->end(); it ++ )
       {
-      it->Method(variable, access_type, it->ClientData,
+      (*it)->Method(variable, access_type, (*it)->ClientData,
         newValue, mf);
       }
     }
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 7dd4ac5..45273e5 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -70,7 +70,7 @@ protected:
     Pair() : Method(0), ClientData(0) {}
   };
 
-  typedef std::vector< Pair > VectorOfPairs;
+  typedef std::vector< Pair* > VectorOfPairs;
   typedef std::map<cmStdString, VectorOfPairs > StringToVectorOfPairs;
 
   StringToVectorOfPairs WatchMap;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c50f7ede200e2a7cd02d59117ac93543b602885c
commit c50f7ede200e2a7cd02d59117ac93543b602885c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Aug 7 08:07:39 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:28 2013 -0400

    cmListFileLexer: Modify flex output to avoid Borland warning
    
    Remove the "yyscanner = NULL" assignment from the end of the
    yylex_destroy function because Borland warns that the value is never
    used.

diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index 09dd011..2841fe5 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -520,6 +520,7 @@ Modify cmListFileLexer.c:
   - remove the yyunput function
   - add a statement "(void)yyscanner;" to the top of these methods:
       yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
+  - remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
   - remove all YY_BREAK lines occurring right after return statements
   - remove the isatty forward declaration
 
@@ -563,7 +564,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
 
 /*--------------------------------------------------------------------------*/
 
-#line 569 "cmListFileLexer.c"
+#line 570 "cmListFileLexer.c"
 
 #define INITIAL 0
 #define STRING 1
@@ -792,10 +793,10 @@ YY_DECL
         int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 81 "cmListFileLexer.in.l"
+#line 82 "cmListFileLexer.in.l"
 
 
-#line 803 "cmListFileLexer.c"
+#line 804 "cmListFileLexer.c"
 
         if ( !yyg->yy_init )
                 {
@@ -893,7 +894,7 @@ do_action:      /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 83 "cmListFileLexer.in.l"
+#line 84 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Newline;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -903,14 +904,14 @@ YY_RULE_SETUP
 }
 case 2:
 YY_RULE_SETUP
-#line 91 "cmListFileLexer.in.l"
+#line 92 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
 }
         YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 95 "cmListFileLexer.in.l"
+#line 96 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ParenLeft;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -919,7 +920,7 @@ YY_RULE_SETUP
 }
 case 4:
 YY_RULE_SETUP
-#line 102 "cmListFileLexer.in.l"
+#line 103 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ParenRight;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -928,7 +929,7 @@ YY_RULE_SETUP
 }
 case 5:
 YY_RULE_SETUP
-#line 109 "cmListFileLexer.in.l"
+#line 110 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Identifier;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -937,7 +938,7 @@ YY_RULE_SETUP
 }
 case 6:
 YY_RULE_SETUP
-#line 116 "cmListFileLexer.in.l"
+#line 117 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -946,7 +947,7 @@ YY_RULE_SETUP
 }
 case 7:
 YY_RULE_SETUP
-#line 123 "cmListFileLexer.in.l"
+#line 124 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -955,7 +956,7 @@ YY_RULE_SETUP
 }
 case 8:
 YY_RULE_SETUP
-#line 130 "cmListFileLexer.in.l"
+#line 131 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
   cmListFileLexerSetToken(lexer, "", 0);
@@ -965,7 +966,7 @@ YY_RULE_SETUP
         YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 137 "cmListFileLexer.in.l"
+#line 138 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
@@ -974,7 +975,7 @@ YY_RULE_SETUP
 case 10:
 /* rule 10 can match eol */
 YY_RULE_SETUP
-#line 142 "cmListFileLexer.in.l"
+#line 143 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
@@ -984,7 +985,7 @@ YY_RULE_SETUP
 case 11:
 /* rule 11 can match eol */
 YY_RULE_SETUP
-#line 148 "cmListFileLexer.in.l"
+#line 149 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
@@ -993,7 +994,7 @@ YY_RULE_SETUP
         YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 154 "cmListFileLexer.in.l"
+#line 155 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
   BEGIN(INITIAL);
@@ -1001,14 +1002,14 @@ YY_RULE_SETUP
 }
 case 13:
 YY_RULE_SETUP
-#line 160 "cmListFileLexer.in.l"
+#line 161 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
         YY_BREAK
 case YY_STATE_EOF(STRING):
-#line 165 "cmListFileLexer.in.l"
+#line 166 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadString;
   BEGIN(INITIAL);
@@ -1016,7 +1017,7 @@ case YY_STATE_EOF(STRING):
 }
 case 14:
 YY_RULE_SETUP
-#line 171 "cmListFileLexer.in.l"
+#line 172 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Space;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1025,7 +1026,7 @@ YY_RULE_SETUP
 }
 case 15:
 YY_RULE_SETUP
-#line 178 "cmListFileLexer.in.l"
+#line 179 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadCharacter;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1033,7 +1034,7 @@ YY_RULE_SETUP
   return 1;
 }
 case YY_STATE_EOF(INITIAL):
-#line 185 "cmListFileLexer.in.l"
+#line 186 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_None;
   cmListFileLexerSetToken(lexer, 0, 0);
@@ -1041,10 +1042,10 @@ case YY_STATE_EOF(INITIAL):
 }
 case 16:
 YY_RULE_SETUP
-#line 191 "cmListFileLexer.in.l"
+#line 192 "cmListFileLexer.in.l"
 ECHO;
         YY_BREAK
-#line 1063 "cmListFileLexer.c"
+#line 1064 "cmListFileLexer.c"
 
         case YY_END_OF_BUFFER:
                 {
@@ -2111,7 +2112,6 @@ int cmListFileLexer_yylex_destroy  (yyscan_t yyscanner)
 
     /* Destroy the main struct (reentrant only). */
     cmListFileLexer_yyfree ( yyscanner , yyscanner );
-    yyscanner = NULL;
     return 0;
 }
 
@@ -2166,7 +2166,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 191 "cmListFileLexer.in.l"
+#line 192 "cmListFileLexer.in.l"
 
 
 
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index e5ddb9e..12b53ee 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -24,6 +24,7 @@ Modify cmListFileLexer.c:
   - remove the yyunput function
   - add a statement "(void)yyscanner;" to the top of these methods:
       yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
+  - remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
   - remove all YY_BREAK lines occurring right after return statements
   - remove the isatty forward declaration
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf73264694234c4e82b31689b64b8a33d61552a9
commit bf73264694234c4e82b31689b64b8a33d61552a9
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Aug 6 15:48:28 2013 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:28 2013 -0400

    Warn about unquoted arguments that look like long brackets
    
    In the future CMake will introduce Lua-style long bracket syntax.
    Warn about unquoted arguments that in the future will be treated
    as opening long brackets.
    
    Teach the RunCMake.Syntax test to cover such cases and ensure that the
    warning appears.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index c499b6f..c02866c 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -343,6 +343,27 @@ void cmListFileParser::AddArgument(cmListFileLexer_Token* token,
 {
   cmListFileArgument a(token->text, delim, this->FileName, token->line);
   this->Function.Arguments.push_back(a);
+  if(delim == cmListFileArgument::Unquoted)
+    {
+    // Warn about a future behavior change.
+    const char* c = a.Value.c_str();
+    if(*c++ == '[')
+      {
+      while(*c == '=')
+        { ++c; }
+      if(*c == '[')
+        {
+        cmOStringStream m;
+        m << "Syntax Warning in cmake code at\n"
+          << "  " << this->FileName << ":" << token->line << ":"
+          << token->column << "\n"
+          << "A future version of CMake may treat unquoted argument:\n"
+          << "  " << a.Value << "\n"
+          << "as an opening long bracket.  Double-quote the argument.";
+        this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str().c_str());
+        }
+      }
+    }
   if(this->Separation == SeparationOkay)
     {
     return;
diff --git a/Tests/RunCMake/Syntax/BracketWarn-stderr.txt b/Tests/RunCMake/Syntax/BracketWarn-stderr.txt
new file mode 100644
index 0000000..4a9cca6
--- /dev/null
+++ b/Tests/RunCMake/Syntax/BracketWarn-stderr.txt
@@ -0,0 +1,35 @@
+CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+  Syntax Warning in cmake code at
+
+    .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:16
+
+  A future version of CMake may treat unquoted argument:
+
+    \[\[
+
+  as an opening long bracket.  Double-quote the argument.
+This warning is for project developers.  Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+  Syntax Warning in cmake code at
+
+    .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:19
+
+  A future version of CMake may treat unquoted argument:
+
+    \[=\[
+
+  as an opening long bracket.  Double-quote the argument.
+This warning is for project developers.  Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+  Syntax Warning in cmake code at
+
+    .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:27
+
+  A future version of CMake may treat unquoted argument:
+
+    \[==\[x
+
+  as an opening long bracket.  Double-quote the argument.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/Syntax/BracketWarn-stdout.txt b/Tests/RunCMake/Syntax/BracketWarn-stdout.txt
new file mode 100644
index 0000000..01b2caa
--- /dev/null
+++ b/Tests/RunCMake/Syntax/BracketWarn-stdout.txt
@@ -0,0 +1 @@
+-- \[\[\[=\[\[=x\[==\[x
diff --git a/Tests/RunCMake/Syntax/BracketWarn.cmake b/Tests/RunCMake/Syntax/BracketWarn.cmake
new file mode 100644
index 0000000..8f33946
--- /dev/null
+++ b/Tests/RunCMake/Syntax/BracketWarn.cmake
@@ -0,0 +1 @@
+message(STATUS [[ [=[ [=x [==[x)
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index b1eeff9..8975b25 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -14,3 +14,4 @@ run_cmake(Unquoted1)
 run_cmake(UnterminatedCall1)
 run_cmake(UnterminatedCall2)
 run_cmake(UnterminatedString)
+run_cmake(BracketWarn)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58e524165d44e672e391cca261d9f7dd723d2c70
commit 58e524165d44e672e391cca261d9f7dd723d2c70
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sat Feb 16 20:41:47 2013 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:27 2013 -0400

    Warn about arguments not separated by whitespace
    
    Teach the lexer to return tokens for whitespace.  Teach the parser to
    tolerate the space tokens where whitespace is allowed.  Also teach the
    parser to diagnose and warn about cases of quoted arguments followed
    immediately by another argument.  This was accidentally allowed
    previously, so we only warn.
    
    Update the RunCMake.Syntax test case StringNoSpace expected stderr to
    include the warnings.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index f57ca22..c499b6f 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -36,6 +36,7 @@ struct cmListFileParser
   const char* FileName;
   cmListFileLexer* Lexer;
   cmListFileFunction Function;
+  enum { SeparationOkay, SeparationWarning } Separation;
 };
 
 //----------------------------------------------------------------------------
@@ -69,7 +70,10 @@ bool cmListFileParser::ParseFile()
   while(cmListFileLexer_Token* token =
         cmListFileLexer_Scan(this->Lexer))
     {
-    if(token->type == cmListFileLexer_Token_Newline)
+    if(token->type == cmListFileLexer_Token_Space)
+      {
+      }
+    else if(token->type == cmListFileLexer_Token_Newline)
       {
       haveNewline = true;
       }
@@ -244,7 +248,9 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
 
   // Command name has already been parsed.  Read the left paren.
   cmListFileLexer_Token* token;
-  if(!(token = cmListFileLexer_Scan(this->Lexer)))
+  while((token = cmListFileLexer_Scan(this->Lexer)) &&
+        token->type == cmListFileLexer_Token_Space) {}
+  if(!token)
     {
     cmOStringStream error;
     error << "Error in cmake code at\n" << this->FileName << ":"
@@ -266,14 +272,23 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
     }
 
   // Arguments.
-  unsigned long lastLine = cmListFileLexer_GetCurrentLine(this->Lexer);
+  unsigned long lastLine;
   unsigned long parenDepth = 0;
-  while((token = cmListFileLexer_Scan(this->Lexer)))
+  this->Separation = SeparationOkay;
+  while((lastLine = cmListFileLexer_GetCurrentLine(this->Lexer),
+         token = cmListFileLexer_Scan(this->Lexer)))
     {
+    if(token->type == cmListFileLexer_Token_Space ||
+       token->type == cmListFileLexer_Token_Newline)
+      {
+      this->Separation = SeparationOkay;
+      continue;
+      }
     if(token->type == cmListFileLexer_Token_ParenLeft)
       {
       parenDepth++;
       this->AddArgument(token, cmListFileArgument::Unquoted);
+      this->Separation = SeparationOkay;
       }
     else if(token->type == cmListFileLexer_Token_ParenRight)
       {
@@ -282,18 +297,22 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
         return true;
         }
       parenDepth--;
+      this->Separation = SeparationOkay;
       this->AddArgument(token, cmListFileArgument::Unquoted);
+      this->Separation = SeparationWarning;
       }
     else if(token->type == cmListFileLexer_Token_Identifier ||
             token->type == cmListFileLexer_Token_ArgumentUnquoted)
       {
       this->AddArgument(token, cmListFileArgument::Unquoted);
+      this->Separation = SeparationWarning;
       }
     else if(token->type == cmListFileLexer_Token_ArgumentQuoted)
       {
       this->AddArgument(token, cmListFileArgument::Quoted);
+      this->Separation = SeparationWarning;
       }
-    else if(token->type != cmListFileLexer_Token_Newline)
+    else
       {
       // Error.
       cmOStringStream error;
@@ -306,7 +325,6 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
       cmSystemTools::Error(error.str().c_str());
       return false;
       }
-    lastLine = cmListFileLexer_GetCurrentLine(this->Lexer);
     }
 
   cmOStringStream error;
@@ -325,6 +343,16 @@ void cmListFileParser::AddArgument(cmListFileLexer_Token* token,
 {
   cmListFileArgument a(token->text, delim, this->FileName, token->line);
   this->Function.Arguments.push_back(a);
+  if(this->Separation == SeparationOkay)
+    {
+    return;
+    }
+  cmOStringStream m;
+  m << "Syntax Warning in cmake code at\n"
+    << "  " << this->FileName << ":" << token->line << ":"
+    << token->column << "\n"
+    << "Argument not separated from preceding token by whitespace.";
+  this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str().c_str());
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index a256b9b..09dd011 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -378,13 +378,13 @@ struct yy_trans_info
         flex_int32_t yy_verify;
         flex_int32_t yy_nxt;
         };
-static yyconst flex_int16_t yy_accept[44] =
+static yyconst flex_int16_t yy_accept[45] =
     {   0,
         0,    0,    0,    0,   17,    6,   14,    1,    8,    2,
         6,    3,    4,    6,   15,    9,   11,   12,   13,    6,
-        0,    6,    0,    2,    0,    5,    6,    9,    0,   10,
-        0,    7,    0,    0,    0,    7,    0,    7,    0,    0,
-        0,    0,    0
+        0,    6,    0,   14,    2,    0,    5,    6,    9,    0,
+       10,    0,    7,    0,    0,    0,    7,    0,    7,    0,
+        0,    0,    0,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -421,62 +421,64 @@ static yyconst flex_int32_t yy_ec[256] =
 
 static yyconst flex_int32_t yy_meta[13] =
     {   0,
-        1,    1,    2,    1,    3,    1,    1,    1,    4,    4,
-        4,    1
+        1,    2,    3,    2,    4,    1,    1,    1,    5,    5,
+        5,    1
     } ;
 
-static yyconst flex_int16_t yy_base[54] =
+static yyconst flex_int16_t yy_base[56] =
     {   0,
-        0,    0,   10,   20,   36,   32,  102,  102,  102,    0,
-       27,  102,  102,   35,    0,   22,  102,  102,   44,    0,
-       49,   23,    0,    0,   21,    0,    0,   17,   23,  102,
-        0,   61,   19,    0,   17,    0,   15,   13,    0,   11,
-       10,    9,  102,   73,   77,   81,   85,   89,   13,   93,
-       12,   97,   10
+        0,    0,   10,   20,   38,   32,    0,  109,  109,    0,
+       28,  109,  109,   35,    0,   23,  109,  109,   44,    0,
+       49,   26,    0,    0,    0,   22,    0,    0,   18,   24,
+      109,    0,   61,   20,    0,   18,    0,   17,   16,    0,
+       12,   11,   10,  109,   73,   16,   78,   83,   88,   93,
+       12,   98,   11,  103,    9
     } ;
 
-static yyconst flex_int16_t yy_def[54] =
+static yyconst flex_int16_t yy_def[56] =
     {   0,
-       43,    1,   44,   44,   43,   43,   43,   43,   43,   45,
-        6,   43,   43,    6,   46,   47,   43,   43,   47,    6,
-       43,    6,   48,   45,   49,   14,    6,   47,   47,   43,
-       21,   43,   21,   50,   51,   32,   49,   32,   52,   53,
-       51,   53,    0,   43,   43,   43,   43,   43,   43,   43,
-       43,   43,   43
+       44,    1,   45,   45,   44,   44,   46,   44,   44,   47,
+        6,   44,   44,    6,   48,   49,   44,   44,   49,    6,
+       44,    6,   50,   46,   47,   51,   14,    6,   49,   49,
+       44,   21,   44,   21,   52,   53,   33,   51,   33,   54,
+       55,   53,   55,    0,   44,   44,   44,   44,   44,   44,
+       44,   44,   44,   44,   44
     } ;
 
-static yyconst flex_int16_t yy_nxt[115] =
+static yyconst flex_int16_t yy_nxt[122] =
     {   0,
         6,    7,    8,    7,    9,   10,   11,   12,   13,    6,
-       14,   15,   17,   42,   18,   41,   37,   31,   32,   31,
-       35,   19,   17,   36,   18,   32,   40,   28,   29,   36,
-       35,   19,   20,   29,   25,   43,   21,   43,   22,   43,
-       43,   20,   20,   23,   26,   26,   30,   43,   28,   31,
-       31,   43,   43,   32,   43,   33,   43,   43,   31,   31,
-       34,   32,   43,   43,   43,   21,   43,   38,   43,   43,
-       32,   32,   39,   16,   16,   16,   16,   24,   43,   24,
-       24,   27,   43,   27,   27,   28,   43,   43,   28,   20,
-       43,   20,   20,   31,   43,   31,   31,   32,   43,   32,
-
-       32,    5,   43,   43,   43,   43,   43,   43,   43,   43,
-       43,   43,   43,   43
+       14,   15,   17,   43,   18,   42,   38,   24,   32,   33,
+       32,   19,   17,   36,   18,   37,   33,   41,   29,   30,
+       37,   19,   20,   36,   30,   26,   21,   44,   22,   44,
+       44,   20,   20,   23,   27,   27,   31,   44,   29,   32,
+       32,   44,   44,   33,   44,   34,   44,   44,   32,   32,
+       35,   33,   44,   44,   44,   21,   44,   39,   44,   44,
+       33,   33,   40,   16,   16,   16,   16,   16,   25,   25,
+       44,   25,   25,   28,   28,   44,   28,   28,   29,   29,
+       44,   44,   29,   20,   20,   44,   20,   20,   32,   32,
+
+       44,   32,   32,   33,   33,   44,   33,   33,    5,   44,
+       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
+       44
     } ;
 
-static yyconst flex_int16_t yy_chk[115] =
+static yyconst flex_int16_t yy_chk[122] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    3,   53,    3,   51,   49,   42,   41,   40,
-       38,    3,    4,   37,    4,   35,   33,   29,   28,   25,
-       22,    4,    6,   16,   11,    5,    6,    0,    6,    0,
+        1,    1,    3,   55,    3,   53,   51,   46,   43,   42,
+       41,    3,    4,   39,    4,   38,   36,   34,   30,   29,
+       26,    4,    6,   22,   16,   11,    6,    5,    6,    0,
         0,    6,    6,    6,   14,   14,   19,    0,   19,   21,
        21,    0,    0,   21,    0,   21,    0,    0,   21,   21,
-       21,   32,    0,    0,    0,   32,    0,   32,    0,    0,
-       32,   32,   32,   44,   44,   44,   44,   45,    0,   45,
-       45,   46,    0,   46,   46,   47,    0,    0,   47,   48,
-        0,   48,   48,   50,    0,   50,   50,   52,    0,   52,
-
-       52,   43,   43,   43,   43,   43,   43,   43,   43,   43,
-       43,   43,   43,   43
+       21,   33,    0,    0,    0,   33,    0,   33,    0,    0,
+       33,   33,   33,   45,   45,   45,   45,   45,   47,   47,
+        0,   47,   47,   48,   48,    0,   48,   48,   49,   49,
+        0,    0,   49,   50,   50,    0,   50,   50,   52,   52,
+
+        0,   52,   52,   54,   54,    0,   54,   54,   44,   44,
+       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
+       44
     } ;
 
 /* Table of booleans, true if rule could match eol. */
@@ -561,7 +563,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
 
 /*--------------------------------------------------------------------------*/
 
-#line 567 "cmListFileLexer.c"
+#line 569 "cmListFileLexer.c"
 
 #define INITIAL 0
 #define STRING 1
@@ -793,7 +795,7 @@ YY_DECL
 #line 81 "cmListFileLexer.in.l"
 
 
-#line 801 "cmListFileLexer.c"
+#line 803 "cmListFileLexer.c"
 
         if ( !yyg->yy_init )
                 {
@@ -846,13 +848,13 @@ yy_match:
                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                 {
                                 yy_current_state = (int) yy_def[yy_current_state];
-                                if ( yy_current_state >= 44 )
+                                if ( yy_current_state >= 45 )
                                         yy_c = yy_meta[(unsigned int) yy_c];
                                 }
                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                         ++yy_cp;
                         }
-                while ( yy_base[yy_current_state] != 102 );
+                while ( yy_base[yy_current_state] != 109 );
 
 yy_find_action:
                 yy_act = yy_accept[yy_current_state];
@@ -1016,12 +1018,14 @@ case 14:
 YY_RULE_SETUP
 #line 171 "cmListFileLexer.in.l"
 {
+  lexer->token.type = cmListFileLexer_Token_Space;
+  cmListFileLexerSetToken(lexer, yytext, yyleng);
   lexer->column += yyleng;
+  return 1;
 }
-        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 175 "cmListFileLexer.in.l"
+#line 178 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadCharacter;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1029,7 +1033,7 @@ YY_RULE_SETUP
   return 1;
 }
 case YY_STATE_EOF(INITIAL):
-#line 182 "cmListFileLexer.in.l"
+#line 185 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_None;
   cmListFileLexerSetToken(lexer, 0, 0);
@@ -1037,10 +1041,10 @@ case YY_STATE_EOF(INITIAL):
 }
 case 16:
 YY_RULE_SETUP
-#line 188 "cmListFileLexer.in.l"
+#line 191 "cmListFileLexer.in.l"
 ECHO;
         YY_BREAK
-#line 1058 "cmListFileLexer.c"
+#line 1063 "cmListFileLexer.c"
 
         case YY_END_OF_BUFFER:
                 {
@@ -1332,7 +1336,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                         {
                         yy_current_state = (int) yy_def[yy_current_state];
-                        if ( yy_current_state >= 44 )
+                        if ( yy_current_state >= 45 )
                                 yy_c = yy_meta[(unsigned int) yy_c];
                         }
                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1361,11 +1365,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                 {
                 yy_current_state = (int) yy_def[yy_current_state];
-                if ( yy_current_state >= 44 )
+                if ( yy_current_state >= 45 )
                         yy_c = yy_meta[(unsigned int) yy_c];
                 }
         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-        yy_is_jam = (yy_current_state == 43);
+        yy_is_jam = (yy_current_state == 44);
 
         return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2162,7 +2166,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 188 "cmListFileLexer.in.l"
+#line 191 "cmListFileLexer.in.l"
 
 
 
@@ -2399,6 +2403,7 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
   switch(type)
     {
     case cmListFileLexer_Token_None: return "nothing";
+    case cmListFileLexer_Token_Space: return "space";
     case cmListFileLexer_Token_Newline: return "newline";
     case cmListFileLexer_Token_Identifier: return "identifier";
     case cmListFileLexer_Token_ParenLeft: return "left paren";
diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h
index 5f4db33..cc78b5c 100644
--- a/Source/cmListFileLexer.h
+++ b/Source/cmListFileLexer.h
@@ -15,6 +15,7 @@
 typedef enum cmListFileLexer_Type_e
 {
   cmListFileLexer_Token_None,
+  cmListFileLexer_Token_Space,
   cmListFileLexer_Token_Newline,
   cmListFileLexer_Token_Identifier,
   cmListFileLexer_Token_ParenLeft,
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index 45fcdd2..e5ddb9e 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -168,8 +168,11 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t])*\"
   return 1;
 }
 
-[ \t\r] {
+[ \t\r]+ {
+  lexer->token.type = cmListFileLexer_Token_Space;
+  cmListFileLexerSetToken(lexer, yytext, yyleng);
   lexer->column += yyleng;
+  return 1;
 }
 
 . {
@@ -420,6 +423,7 @@ const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
   switch(type)
     {
     case cmListFileLexer_Token_None: return "nothing";
+    case cmListFileLexer_Token_Space: return "space";
     case cmListFileLexer_Token_Newline: return "newline";
     case cmListFileLexer_Token_Identifier: return "identifier";
     case cmListFileLexer_Token_ParenLeft: return "left paren";
diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
index 2d111aa..89c2d2a 100644
--- a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
+++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
@@ -1,3 +1,19 @@
-^\[1 \${var} \\n 4\]
+CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+  Syntax Warning in cmake code at
+
+    .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28
+
+  Argument not separated from preceding token by whitespace.
+This warning is for project developers.  Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+  Syntax Warning in cmake code at
+
+    .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31
+
+  Argument not separated from preceding token by whitespace.
+This warning is for project developers.  Use -Wno-dev to suppress it.
+
+\[1 \${var} \\n 4\]
 \[x\]
 \[y\]$

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e75b69f55bcdc6ee524dfd0cab568644379fbacb
commit e75b69f55bcdc6ee524dfd0cab568644379fbacb
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sat Feb 16 20:14:23 2013 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:27 2013 -0400

    cmListFileCache: Convert CMake language parser to class
    
    Refactor the parser implementation into a class to make
    it easier to extend.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 7b25351..f57ca22 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -22,43 +22,52 @@
 # pragma warn -8060 /* possibly incorrect assignment */
 #endif
 
-bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
-                                  cmListFileFunction& function,
-                                  const char* filename);
+//----------------------------------------------------------------------------
+struct cmListFileParser
+{
+  cmListFileParser(cmListFile* lf, cmMakefile* mf, const char* filename);
+  ~cmListFileParser();
+  bool ParseFile();
+  bool ParseFunction(const char* name, long line);
+  void AddArgument(cmListFileLexer_Token* token,
+                   cmListFileArgument::Delimiter delim);
+  cmListFile* ListFile;
+  cmMakefile* Makefile;
+  const char* FileName;
+  cmListFileLexer* Lexer;
+  cmListFileFunction Function;
+};
 
-bool cmListFile::ParseFile(const char* filename,
-                           bool topLevel,
-                           cmMakefile *mf)
+//----------------------------------------------------------------------------
+cmListFileParser::cmListFileParser(cmListFile* lf, cmMakefile* mf,
+                                   const char* filename):
+  ListFile(lf), Makefile(mf), FileName(filename),
+  Lexer(cmListFileLexer_New())
 {
-  if(!cmSystemTools::FileExists(filename))
-    {
-    return false;
-    }
+}
 
-  // Create the scanner.
-  cmListFileLexer* lexer = cmListFileLexer_New();
-  if(!lexer)
-    {
-    cmSystemTools::Error("cmListFileCache: error allocating lexer ");
-    return false;
-    }
+//----------------------------------------------------------------------------
+cmListFileParser::~cmListFileParser()
+{
+  cmListFileLexer_Delete(this->Lexer);
+}
 
+//----------------------------------------------------------------------------
+bool cmListFileParser::ParseFile()
+{
   // Open the file.
-  if(!cmListFileLexer_SetFileName(lexer, filename))
+  if(!cmListFileLexer_SetFileName(this->Lexer, this->FileName))
     {
-    cmListFileLexer_Delete(lexer);
     cmSystemTools::Error("cmListFileCache: error can not open file ",
-                         filename);
+                         this->FileName);
     return false;
     }
 
   // Use a simple recursive-descent parser to process the token
   // stream.
-  this->ModifiedTime = cmSystemTools::ModifiedTime(filename);
-  bool parseError = false;
   bool haveNewline = true;
-  cmListFileLexer_Token* token;
-  while(!parseError && (token = cmListFileLexer_Scan(lexer)))
+  while(cmListFileLexer_Token* token =
+        cmListFileLexer_Scan(this->Lexer))
     {
     if(token->type == cmListFileLexer_Token_Newline)
       {
@@ -69,50 +78,65 @@ bool cmListFile::ParseFile(const char* filename,
       if(haveNewline)
         {
         haveNewline = false;
-        cmListFileFunction inFunction;
-        inFunction.Name = token->text;
-        inFunction.FilePath = filename;
-        inFunction.Line = token->line;
-        if(cmListFileCacheParseFunction(lexer, inFunction, filename))
+        if(this->ParseFunction(token->text, token->line))
           {
-          this->Functions.push_back(inFunction);
+          this->ListFile->Functions.push_back(this->Function);
           }
         else
           {
-          parseError = true;
+          return false;
           }
         }
       else
         {
         cmOStringStream error;
         error << "Error in cmake code at\n"
-              << filename << ":" << token->line << ":\n"
+              << this->FileName << ":" << token->line << ":\n"
               << "Parse error.  Expected a newline, got "
-              << cmListFileLexer_GetTypeAsString(lexer, token->type)
+              << cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
               << " with text \"" << token->text << "\".";
         cmSystemTools::Error(error.str().c_str());
-        parseError = true;
+        return false;
         }
       }
     else
       {
       cmOStringStream error;
       error << "Error in cmake code at\n"
-            << filename << ":" << token->line << ":\n"
+            << this->FileName << ":" << token->line << ":\n"
             << "Parse error.  Expected a command name, got "
-            << cmListFileLexer_GetTypeAsString(lexer, token->type)
+            << cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
             << " with text \""
             << token->text << "\".";
       cmSystemTools::Error(error.str().c_str());
-      parseError = true;
+      return false;
       }
     }
-  if (parseError)
+  return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmListFile::ParseFile(const char* filename,
+                           bool topLevel,
+                           cmMakefile *mf)
+{
+  if(!cmSystemTools::FileExists(filename))
     {
-    this->ModifiedTime = 0;
+    return false;
     }
 
-  cmListFileLexer_Delete(lexer);
+  bool parseError = false;
+  this->ModifiedTime = cmSystemTools::ModifiedTime(filename);
+
+  {
+  cmListFileParser parser(this, mf, filename);
+  parseError = !parser.ParseFile();
+  }
+
+  if(parseError)
+    {
+    this->ModifiedTime = 0;
+    }
 
   // do we need a cmake_policy(VERSION call?
   if(topLevel)
@@ -209,17 +233,22 @@ bool cmListFile::ParseFile(const char* filename,
   return true;
 }
 
-bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
-                                  cmListFileFunction& function,
-                                  const char* filename)
+//----------------------------------------------------------------------------
+bool cmListFileParser::ParseFunction(const char* name, long line)
 {
+  // Inintialize a new function call.
+  this->Function = cmListFileFunction();
+  this->Function.FilePath = this->FileName;
+  this->Function.Name = name;
+  this->Function.Line = line;
+
   // Command name has already been parsed.  Read the left paren.
   cmListFileLexer_Token* token;
-  if(!(token = cmListFileLexer_Scan(lexer)))
+  if(!(token = cmListFileLexer_Scan(this->Lexer)))
     {
     cmOStringStream error;
-    error << "Error in cmake code at\n"
-          << filename << ":" << cmListFileLexer_GetCurrentLine(lexer) << ":\n"
+    error << "Error in cmake code at\n" << this->FileName << ":"
+          << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
           << "Parse error.  Function missing opening \"(\".";
     cmSystemTools::Error(error.str().c_str());
     return false;
@@ -227,26 +256,24 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
   if(token->type != cmListFileLexer_Token_ParenLeft)
     {
     cmOStringStream error;
-    error << "Error in cmake code at\n"
-          << filename << ":" << cmListFileLexer_GetCurrentLine(lexer) << ":\n"
+    error << "Error in cmake code at\n" << this->FileName << ":"
+          << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
           << "Parse error.  Expected \"(\", got "
-          << cmListFileLexer_GetTypeAsString(lexer, token->type)
+          << cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
           << " with text \"" << token->text << "\".";
     cmSystemTools::Error(error.str().c_str());
     return false;
     }
 
   // Arguments.
-  unsigned long lastLine = cmListFileLexer_GetCurrentLine(lexer);
+  unsigned long lastLine = cmListFileLexer_GetCurrentLine(this->Lexer);
   unsigned long parenDepth = 0;
-  while((token = cmListFileLexer_Scan(lexer)))
+  while((token = cmListFileLexer_Scan(this->Lexer)))
     {
     if(token->type == cmListFileLexer_Token_ParenLeft)
       {
       parenDepth++;
-      cmListFileArgument a("(", cmListFileArgument::Unquoted,
-                           filename, token->line);
-      function.Arguments.push_back(a);
+      this->AddArgument(token, cmListFileArgument::Unquoted);
       }
     else if(token->type == cmListFileLexer_Token_ParenRight)
       {
@@ -255,43 +282,36 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
         return true;
         }
       parenDepth--;
-      cmListFileArgument a(")", cmListFileArgument::Unquoted,
-                           filename, token->line);
-      function.Arguments.push_back(a);
+      this->AddArgument(token, cmListFileArgument::Unquoted);
       }
     else if(token->type == cmListFileLexer_Token_Identifier ||
             token->type == cmListFileLexer_Token_ArgumentUnquoted)
       {
-      cmListFileArgument a(token->text, cmListFileArgument::Unquoted,
-                           filename, token->line);
-      function.Arguments.push_back(a);
+      this->AddArgument(token, cmListFileArgument::Unquoted);
       }
     else if(token->type == cmListFileLexer_Token_ArgumentQuoted)
       {
-      cmListFileArgument a(token->text, cmListFileArgument::Quoted,
-                           filename, token->line);
-      function.Arguments.push_back(a);
+      this->AddArgument(token, cmListFileArgument::Quoted);
       }
     else if(token->type != cmListFileLexer_Token_Newline)
       {
       // Error.
       cmOStringStream error;
-      error << "Error in cmake code at\n"
-            << filename << ":" << cmListFileLexer_GetCurrentLine(lexer)
-            << ":\n"
+      error << "Error in cmake code at\n" << this->FileName << ":"
+            << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n"
             << "Parse error.  Function missing ending \")\".  "
             << "Instead found "
-            << cmListFileLexer_GetTypeAsString(lexer, token->type)
+            << cmListFileLexer_GetTypeAsString(this->Lexer, token->type)
             << " with text \"" << token->text << "\".";
       cmSystemTools::Error(error.str().c_str());
       return false;
       }
-    lastLine = cmListFileLexer_GetCurrentLine(lexer);
+    lastLine = cmListFileLexer_GetCurrentLine(this->Lexer);
     }
 
   cmOStringStream error;
   error << "Error in cmake code at\n"
-        << filename << ":" << lastLine << ":\n"
+        << this->FileName << ":" << lastLine << ":\n"
         << "Parse error.  Function missing ending \")\".  "
         << "End of file reached.";
   cmSystemTools::Error(error.str().c_str());
@@ -300,6 +320,14 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
 }
 
 //----------------------------------------------------------------------------
+void cmListFileParser::AddArgument(cmListFileLexer_Token* token,
+                                   cmListFileArgument::Delimiter delim)
+{
+  cmListFileArgument a(token->text, delim, this->FileName, token->line);
+  this->Function.Arguments.push_back(a);
+}
+
+//----------------------------------------------------------------------------
 std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc)
 {
   os << lfc.FilePath;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e945949d141c196df7f6232a7839c1de94f935ec
commit e945949d141c196df7f6232a7839c1de94f935ec
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sat Feb 16 20:10:21 2013 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:27 2013 -0400

    Add RunCMake.Syntax test cases for command invocation styles
    
    Cover commands with whitespace present in allowed combinations.
    Also cover command error cases such as two on one line.

diff --git a/Tests/RunCMake/Syntax/.gitattributes b/Tests/RunCMake/Syntax/.gitattributes
new file mode 100644
index 0000000..fc9ebff
--- /dev/null
+++ b/Tests/RunCMake/Syntax/.gitattributes
@@ -0,0 +1 @@
+CommandTabs.cmake   whitespace=-tab-in-indent
diff --git a/Tests/RunCMake/Syntax/CommandComments-stderr.txt b/Tests/RunCMake/Syntax/CommandComments-stderr.txt
new file mode 100644
index 0000000..df72cc5
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandComments-stderr.txt
@@ -0,0 +1,4 @@
+Example Message
+Example Message
+Example Message
+Second Line of Example
diff --git a/Tests/RunCMake/Syntax/CommandComments.cmake b/Tests/RunCMake/Syntax/CommandComments.cmake
new file mode 100644
index 0000000..0fd7484
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandComments.cmake
@@ -0,0 +1,6 @@
+message("Example Message"#)
+        )
+message ("Example Message" # )
+        )
+message( "Example Message\n" # "Commented" )
+         "Second Line of Example")
diff --git a/Tests/RunCMake/Syntax/CommandError0-result.txt b/Tests/RunCMake/Syntax/CommandError0-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandError0-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/CommandError0-stderr.txt b/Tests/RunCMake/Syntax/CommandError0-stderr.txt
new file mode 100644
index 0000000..24d7997
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandError0-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error: Error in cmake code at
+.*/Tests/RunCMake/Syntax/CommandError0.cmake:2:
+Parse error.  Expected "\(", got newline with text "
+".
+CMake Error at CMakeLists.txt:3 \(include\):
+  include could not find load file:
+
+    CommandError0.cmake
diff --git a/Tests/RunCMake/Syntax/CommandError0.cmake b/Tests/RunCMake/Syntax/CommandError0.cmake
new file mode 100644
index 0000000..3222a97
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandError0.cmake
@@ -0,0 +1,2 @@
+message
+  ("Example Message")
diff --git a/Tests/RunCMake/Syntax/CommandError1-result.txt b/Tests/RunCMake/Syntax/CommandError1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandError1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/CommandError1-stderr.txt b/Tests/RunCMake/Syntax/CommandError1-stderr.txt
new file mode 100644
index 0000000..599f600
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandError1-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error: Error in cmake code at
+.*/Tests/RunCMake/Syntax/CommandError1.cmake:1:
+Parse error.  Expected a newline, got identifier with text "message".
+CMake Error at CMakeLists.txt:3 \(include\):
+  include could not find load file:
+
+    CommandError1.cmake
diff --git a/Tests/RunCMake/Syntax/CommandError1.cmake b/Tests/RunCMake/Syntax/CommandError1.cmake
new file mode 100644
index 0000000..f8661a1
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandError1.cmake
@@ -0,0 +1 @@
+message("Example Message") message("Second Message")
diff --git a/Tests/RunCMake/Syntax/CommandNewlines-stderr.txt b/Tests/RunCMake/Syntax/CommandNewlines-stderr.txt
new file mode 100644
index 0000000..571b152
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandNewlines-stderr.txt
@@ -0,0 +1,3 @@
+Example Message
+Example Message
+Example Message
diff --git a/Tests/RunCMake/Syntax/CommandNewlines.cmake b/Tests/RunCMake/Syntax/CommandNewlines.cmake
new file mode 100644
index 0000000..0587afb
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandNewlines.cmake
@@ -0,0 +1,10 @@
+message(
+  "Example Message")
+message (
+  "Example Message"
+  )
+message(
+
+  "Example Message"
+
+  )
diff --git a/Tests/RunCMake/Syntax/CommandSpaces-stderr.txt b/Tests/RunCMake/Syntax/CommandSpaces-stderr.txt
new file mode 100644
index 0000000..54a8b38
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandSpaces-stderr.txt
@@ -0,0 +1,6 @@
+Example Message
+Example Message
+Example Message
+Example Message
+Example Message
+Example Message
diff --git a/Tests/RunCMake/Syntax/CommandSpaces.cmake b/Tests/RunCMake/Syntax/CommandSpaces.cmake
new file mode 100644
index 0000000..5bd4294
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandSpaces.cmake
@@ -0,0 +1,6 @@
+message("Example Message")
+message ("Example Message")
+message( "Example Message" )
+message( "Example Message")
+  message  ( "Example Message")
+message ( Example " " Message )
diff --git a/Tests/RunCMake/Syntax/CommandTabs-stderr.txt b/Tests/RunCMake/Syntax/CommandTabs-stderr.txt
new file mode 100644
index 0000000..54a8b38
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandTabs-stderr.txt
@@ -0,0 +1,6 @@
+Example Message
+Example Message
+Example Message
+Example Message
+Example Message
+Example Message
diff --git a/Tests/RunCMake/Syntax/CommandTabs.cmake b/Tests/RunCMake/Syntax/CommandTabs.cmake
new file mode 100644
index 0000000..93876f8
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CommandTabs.cmake
@@ -0,0 +1,6 @@
+message("Example Message")
+message	("Example Message")
+message(	"Example Message"	)
+message(	"Example Message")
+	message (	"Example Message")
+message	(	Example	" "	Message	)
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index f2424c9..b1eeff9 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -1,5 +1,11 @@
 include(RunCMake)
 
+run_cmake(CommandSpaces)
+run_cmake(CommandTabs)
+run_cmake(CommandNewlines)
+run_cmake(CommandComments)
+run_cmake(CommandError0)
+run_cmake(CommandError1)
 run_cmake(String0)
 run_cmake(String1)
 run_cmake(StringNoSpace)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0546484e4b7856c417f30a5b8ff6af6a5a080f0d
commit 0546484e4b7856c417f30a5b8ff6af6a5a080f0d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 6 10:07:58 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:27 2013 -0400

    cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum
    
    Replace the boolean value that indicates whether an argument is unquoted
    or quoted with a generalized enumeration of possible argument types.
    For now "Quoted" and "Unquoted" remain the only types.

diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 48ae50e..cb62f21 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -422,8 +422,9 @@ int CCONV cmExecuteCommand(void *arg, const char *name,
   for(int i = 0; i < numArgs; ++i)
     {
     // Assume all arguments are quoted.
-    lff.Arguments.push_back(cmListFileArgument(args[i], true,
-                                               "[CMake-Plugin]", 0));
+    lff.Arguments.push_back(
+      cmListFileArgument(args[i], cmListFileArgument::Quoted,
+                         "[CMake-Plugin]", 0));
     }
   cmExecutionStatus status;
   return mf->ExecuteCommand(lff,status);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 36d84f3..7b25351 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -196,7 +196,8 @@ bool cmListFile::ParseFile(const char* filename,
       {
       cmListFileFunction project;
       project.Name = "PROJECT";
-      cmListFileArgument prj("Project", false, filename, 0);
+      cmListFileArgument prj("Project", cmListFileArgument::Unquoted,
+                             filename, 0);
       project.Arguments.push_back(prj);
       this->Functions.insert(this->Functions.begin(),project);
       }
@@ -243,8 +244,8 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
     if(token->type == cmListFileLexer_Token_ParenLeft)
       {
       parenDepth++;
-      cmListFileArgument a("(",
-                           false, filename, token->line);
+      cmListFileArgument a("(", cmListFileArgument::Unquoted,
+                           filename, token->line);
       function.Arguments.push_back(a);
       }
     else if(token->type == cmListFileLexer_Token_ParenRight)
@@ -254,21 +255,21 @@ bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
         return true;
         }
       parenDepth--;
-      cmListFileArgument a(")",
-                           false, filename, token->line);
+      cmListFileArgument a(")", cmListFileArgument::Unquoted,
+                           filename, token->line);
       function.Arguments.push_back(a);
       }
     else if(token->type == cmListFileLexer_Token_Identifier ||
             token->type == cmListFileLexer_Token_ArgumentUnquoted)
       {
-      cmListFileArgument a(token->text,
-                           false, filename, token->line);
+      cmListFileArgument a(token->text, cmListFileArgument::Unquoted,
+                           filename, token->line);
       function.Arguments.push_back(a);
       }
     else if(token->type == cmListFileLexer_Token_ArgumentQuoted)
       {
-      cmListFileArgument a(token->text,
-                           true, filename, token->line);
+      cmListFileArgument a(token->text, cmListFileArgument::Quoted,
+                           filename, token->line);
       function.Arguments.push_back(a);
       }
     else if(token->type != cmListFileLexer_Token_Newline)
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index fec3d07..7bb3b34 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -25,22 +25,27 @@ class cmMakefile;
 
 struct cmListFileArgument
 {
-  cmListFileArgument(): Value(), Quoted(false), FilePath(0), Line(0) {}
+  enum Delimiter
+    {
+    Unquoted,
+    Quoted
+    };
+  cmListFileArgument(): Value(), Delim(Unquoted), FilePath(0), Line(0) {}
   cmListFileArgument(const cmListFileArgument& r):
-    Value(r.Value), Quoted(r.Quoted), FilePath(r.FilePath), Line(r.Line) {}
-  cmListFileArgument(const std::string& v, bool q, const char* file,
-                     long line): Value(v), Quoted(q),
+    Value(r.Value), Delim(r.Delim), FilePath(r.FilePath), Line(r.Line) {}
+  cmListFileArgument(const std::string& v, Delimiter d, const char* file,
+                     long line): Value(v), Delim(d),
                                  FilePath(file), Line(line) {}
   bool operator == (const cmListFileArgument& r) const
     {
-    return (this->Value == r.Value) && (this->Quoted == r.Quoted);
+    return (this->Value == r.Value) && (this->Delim == r.Delim);
     }
   bool operator != (const cmListFileArgument& r) const
     {
     return !(*this == r);
     }
   std::string Value;
-  bool Quoted;
+  Delimiter Delim;
   const char* FilePath;
   long Line;
 };
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index bd7ec00..8ba612c 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -227,7 +227,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
         }
 
       arg.Value = tmps;
-      arg.Quoted = k->Quoted;
+      arg.Delim = k->Delim;
       arg.FilePath = k->FilePath;
       arg.Line = k->Line;
       newLFF.Arguments.push_back(arg);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index aae92dd..c4859b6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2799,7 +2799,7 @@ bool cmMakefile::ExpandArguments(
 
     // If the argument is quoted, it should be one argument.
     // Otherwise, it may be a list of arguments.
-    if(i->Quoted)
+    if(i->Delim == cmListFileArgument::Quoted)
       {
       outArgs.push_back(value);
       }
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 297a92b..70c6524 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -86,15 +86,20 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable,
     std::string command = *it;
     newLFF.Arguments.clear();
     newLFF.Arguments.push_back(
-      cmListFileArgument(variable, true, "unknown", 9999));
+      cmListFileArgument(variable, cmListFileArgument::Quoted,
+                         "unknown", 9999));
     newLFF.Arguments.push_back(
-      cmListFileArgument(accessString, true, "unknown", 9999));
+      cmListFileArgument(accessString, cmListFileArgument::Quoted,
+                         "unknown", 9999));
     newLFF.Arguments.push_back(
-      cmListFileArgument(newValue?newValue:"", true, "unknown", 9999));
+      cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted,
+                         "unknown", 9999));
     newLFF.Arguments.push_back(
-      cmListFileArgument(currentListFile, true, "unknown", 9999));
+      cmListFileArgument(currentListFile, cmListFileArgument::Quoted,
+                         "unknown", 9999));
     newLFF.Arguments.push_back(
-      cmListFileArgument(stack, true, "unknown", 9999));
+      cmListFileArgument(stack, cmListFileArgument::Quoted,
+                         "unknown", 9999));
     newLFF.Name = command;
     newLFF.FilePath = "Some weird path";
     newLFF.Line = 9999;
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 4000345..7d2eead 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -49,9 +49,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
           unsigned int i;
           for(i =0; i < this->Args.size(); ++i)
             {
-            err += (this->Args[i].Quoted?"\"":"");
+            err += (this->Args[i].Delim?"\"":"");
             err += this->Args[i].Value;
-            err += (this->Args[i].Quoted?"\"":"");
+            err += (this->Args[i].Delim?"\"":"");
             err += " ";
             }
           err += "(";

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28685ade7a8f60e8519b6bf8a824e6a01365c181
commit 28685ade7a8f60e8519b6bf8a824e6a01365c181
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 6 09:53:03 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:26 2013 -0400

    cmListFileLexer: Split normal and legacy unquoted arguments
    
    Match legacy arguments separately.  Add macros to simplify and clarify
    matching rules.

diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index ff54d04..a256b9b 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -369,8 +369,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
         *yy_cp = '\0'; \
         yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 15
-#define YY_END_OF_BUFFER 16
+#define YY_NUM_RULES 16
+#define YY_END_OF_BUFFER 17
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -378,12 +378,13 @@ struct yy_trans_info
         flex_int32_t yy_verify;
         flex_int32_t yy_nxt;
         };
-static yyconst flex_int16_t yy_accept[40] =
+static yyconst flex_int16_t yy_accept[44] =
     {   0,
-        0,    0,    0,    0,   16,    6,   13,    1,    7,    2,
-        6,    3,    4,    6,   14,    8,   10,   11,   12,    6,
-        0,    6,    0,    2,    0,    5,    6,    8,    0,    9,
-        0,    0,    0,    0,    0,    0,    0,    0,    0
+        0,    0,    0,    0,   17,    6,   14,    1,    8,    2,
+        6,    3,    4,    6,   15,    9,   11,   12,   13,    6,
+        0,    6,    0,    2,    0,    5,    6,    9,    0,   10,
+        0,    7,    0,    0,    0,    7,    0,    7,    0,    0,
+        0,    0,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -424,58 +425,64 @@ static yyconst flex_int32_t yy_meta[13] =
         4,    1
     } ;
 
-static yyconst flex_int16_t yy_base[49] =
+static yyconst flex_int16_t yy_base[54] =
     {   0,
-        0,    0,   10,   20,   35,   32,   86,   86,   86,    0,
-       26,   86,   86,   35,    0,   19,   86,   86,   44,    0,
-       49,   22,    0,    0,   20,    0,    0,   16,   22,   86,
-        0,   18,    0,   15,   12,   11,   10,    9,   86,   61,
-       65,   69,   73,   77,   13,   81,   12,   10
+        0,    0,   10,   20,   36,   32,  102,  102,  102,    0,
+       27,  102,  102,   35,    0,   22,  102,  102,   44,    0,
+       49,   23,    0,    0,   21,    0,    0,   17,   23,  102,
+        0,   61,   19,    0,   17,    0,   15,   13,    0,   11,
+       10,    9,  102,   73,   77,   81,   85,   89,   13,   93,
+       12,   97,   10
     } ;
 
-static yyconst flex_int16_t yy_def[49] =
+static yyconst flex_int16_t yy_def[54] =
     {   0,
-       39,    1,   40,   40,   39,   39,   39,   39,   39,   41,
-        6,   39,   39,    6,   42,   43,   39,   39,   43,    6,
-       39,    6,   44,   41,   45,   14,    6,   43,   43,   39,
-       21,   21,   46,   47,   45,   48,   47,   48,    0,   39,
-       39,   39,   39,   39,   39,   39,   39,   39
+       43,    1,   44,   44,   43,   43,   43,   43,   43,   45,
+        6,   43,   43,    6,   46,   47,   43,   43,   47,    6,
+       43,    6,   48,   45,   49,   14,    6,   47,   47,   43,
+       21,   43,   21,   50,   51,   32,   49,   32,   52,   53,
+       51,   53,    0,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43
     } ;
 
-static yyconst flex_int16_t yy_nxt[99] =
+static yyconst flex_int16_t yy_nxt[115] =
     {   0,
         6,    7,    8,    7,    9,   10,   11,   12,   13,    6,
-       14,   15,   17,   38,   18,   37,   35,   31,   20,   31,
-       27,   19,   17,   20,   18,   36,   28,   29,   27,   34,
-       29,   19,   20,   25,   39,   39,   21,   39,   22,   39,
-       39,   20,   20,   23,   26,   26,   30,   39,   28,   31,
-       31,   39,   39,   20,   39,   32,   39,   39,   31,   31,
-       33,   16,   16,   16,   16,   24,   39,   24,   24,   27,
-       39,   27,   27,   28,   39,   39,   28,   20,   39,   20,
-       20,   31,   39,   31,   31,    5,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39
-
+       14,   15,   17,   42,   18,   41,   37,   31,   32,   31,
+       35,   19,   17,   36,   18,   32,   40,   28,   29,   36,
+       35,   19,   20,   29,   25,   43,   21,   43,   22,   43,
+       43,   20,   20,   23,   26,   26,   30,   43,   28,   31,
+       31,   43,   43,   32,   43,   33,   43,   43,   31,   31,
+       34,   32,   43,   43,   43,   21,   43,   38,   43,   43,
+       32,   32,   39,   16,   16,   16,   16,   24,   43,   24,
+       24,   27,   43,   27,   27,   28,   43,   43,   28,   20,
+       43,   20,   20,   31,   43,   31,   31,   32,   43,   32,
+
+       32,    5,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43
     } ;
 
-static yyconst flex_int16_t yy_chk[99] =
+static yyconst flex_int16_t yy_chk[115] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    3,   48,    3,   47,   45,   38,   37,   36,
-       35,    3,    4,   34,    4,   32,   29,   28,   25,   22,
-       16,    4,    6,   11,    5,    0,    6,    0,    6,    0,
+        1,    1,    3,   53,    3,   51,   49,   42,   41,   40,
+       38,    3,    4,   37,    4,   35,   33,   29,   28,   25,
+       22,    4,    6,   16,   11,    5,    6,    0,    6,    0,
         0,    6,    6,    6,   14,   14,   19,    0,   19,   21,
        21,    0,    0,   21,    0,   21,    0,    0,   21,   21,
-       21,   40,   40,   40,   40,   41,    0,   41,   41,   42,
-        0,   42,   42,   43,    0,    0,   43,   44,    0,   44,
-       44,   46,    0,   46,   46,   39,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39
+       21,   32,    0,    0,    0,   32,    0,   32,    0,    0,
+       32,   32,   32,   44,   44,   44,   44,   45,    0,   45,
+       45,   46,    0,   46,   46,   47,    0,    0,   47,   48,
+        0,   48,   48,   50,    0,   50,   50,   52,    0,   52,
 
+       52,   43,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[16] =
+static yyconst flex_int32_t yy_rule_can_match_eol[17] =
     {   0,
-1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,     };
+1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,     };
 
 /* The intent behind this definition is that it'll catch
  * any uses of REJECT which flex missed.
@@ -554,7 +561,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
 
 /*--------------------------------------------------------------------------*/
 
-#line 560 "cmListFileLexer.c"
+#line 567 "cmListFileLexer.c"
 
 #define INITIAL 0
 #define STRING 1
@@ -783,10 +790,10 @@ YY_DECL
         int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 79 "cmListFileLexer.in.l"
+#line 81 "cmListFileLexer.in.l"
 
 
-#line 794 "cmListFileLexer.c"
+#line 801 "cmListFileLexer.c"
 
         if ( !yyg->yy_init )
                 {
@@ -839,13 +846,13 @@ yy_match:
                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                 {
                                 yy_current_state = (int) yy_def[yy_current_state];
-                                if ( yy_current_state >= 40 )
+                                if ( yy_current_state >= 44 )
                                         yy_c = yy_meta[(unsigned int) yy_c];
                                 }
                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                         ++yy_cp;
                         }
-                while ( yy_base[yy_current_state] != 86 );
+                while ( yy_base[yy_current_state] != 102 );
 
 yy_find_action:
                 yy_act = yy_accept[yy_current_state];
@@ -884,7 +891,7 @@ do_action:      /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 81 "cmListFileLexer.in.l"
+#line 83 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Newline;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -894,14 +901,14 @@ YY_RULE_SETUP
 }
 case 2:
 YY_RULE_SETUP
-#line 89 "cmListFileLexer.in.l"
+#line 91 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
 }
         YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 93 "cmListFileLexer.in.l"
+#line 95 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ParenLeft;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -910,7 +917,7 @@ YY_RULE_SETUP
 }
 case 4:
 YY_RULE_SETUP
-#line 100 "cmListFileLexer.in.l"
+#line 102 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ParenRight;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -919,7 +926,7 @@ YY_RULE_SETUP
 }
 case 5:
 YY_RULE_SETUP
-#line 107 "cmListFileLexer.in.l"
+#line 109 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Identifier;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -928,7 +935,7 @@ YY_RULE_SETUP
 }
 case 6:
 YY_RULE_SETUP
-#line 114 "cmListFileLexer.in.l"
+#line 116 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -937,7 +944,16 @@ YY_RULE_SETUP
 }
 case 7:
 YY_RULE_SETUP
-#line 121 "cmListFileLexer.in.l"
+#line 123 "cmListFileLexer.in.l"
+{
+  lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
+  cmListFileLexerSetToken(lexer, yytext, yyleng);
+  lexer->column += yyleng;
+  return 1;
+}
+case 8:
+YY_RULE_SETUP
+#line 130 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
   cmListFileLexerSetToken(lexer, "", 0);
@@ -945,67 +961,67 @@ YY_RULE_SETUP
   BEGIN(STRING);
 }
         YY_BREAK
-case 8:
+case 9:
 YY_RULE_SETUP
-#line 128 "cmListFileLexer.in.l"
+#line 137 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
         YY_BREAK
-case 9:
-/* rule 9 can match eol */
+case 10:
+/* rule 10 can match eol */
 YY_RULE_SETUP
-#line 133 "cmListFileLexer.in.l"
+#line 142 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
   lexer->column = 1;
 }
         YY_BREAK
-case 10:
-/* rule 10 can match eol */
+case 11:
+/* rule 11 can match eol */
 YY_RULE_SETUP
-#line 139 "cmListFileLexer.in.l"
+#line 148 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
   lexer->column = 1;
 }
         YY_BREAK
-case 11:
+case 12:
 YY_RULE_SETUP
-#line 145 "cmListFileLexer.in.l"
+#line 154 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
   BEGIN(INITIAL);
   return 1;
 }
-case 12:
+case 13:
 YY_RULE_SETUP
-#line 151 "cmListFileLexer.in.l"
+#line 160 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
         YY_BREAK
 case YY_STATE_EOF(STRING):
-#line 156 "cmListFileLexer.in.l"
+#line 165 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadString;
   BEGIN(INITIAL);
   return 1;
 }
-case 13:
+case 14:
 YY_RULE_SETUP
-#line 162 "cmListFileLexer.in.l"
+#line 171 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
 }
         YY_BREAK
-case 14:
+case 15:
 YY_RULE_SETUP
-#line 166 "cmListFileLexer.in.l"
+#line 175 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadCharacter;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1013,18 +1029,18 @@ YY_RULE_SETUP
   return 1;
 }
 case YY_STATE_EOF(INITIAL):
-#line 173 "cmListFileLexer.in.l"
+#line 182 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_None;
   cmListFileLexerSetToken(lexer, 0, 0);
   return 0;
 }
-case 15:
+case 16:
 YY_RULE_SETUP
-#line 179 "cmListFileLexer.in.l"
+#line 188 "cmListFileLexer.in.l"
 ECHO;
         YY_BREAK
-#line 1041 "cmListFileLexer.c"
+#line 1058 "cmListFileLexer.c"
 
         case YY_END_OF_BUFFER:
                 {
@@ -1316,7 +1332,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                         {
                         yy_current_state = (int) yy_def[yy_current_state];
-                        if ( yy_current_state >= 40 )
+                        if ( yy_current_state >= 44 )
                                 yy_c = yy_meta[(unsigned int) yy_c];
                         }
                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1345,11 +1361,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                 {
                 yy_current_state = (int) yy_def[yy_current_state];
-                if ( yy_current_state >= 40 )
+                if ( yy_current_state >= 44 )
                         yy_c = yy_meta[(unsigned int) yy_c];
                 }
         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-        yy_is_jam = (yy_current_state == 39);
+        yy_is_jam = (yy_current_state == 43);
 
         return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2146,7 +2162,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 179 "cmListFileLexer.in.l"
+#line 188 "cmListFileLexer.in.l"
 
 
 
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index 4459c7b..45fcdd2 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -75,6 +75,8 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
 %x STRING
 
 MAKEVAR \$\([A-Za-z0-9_]*\)
+UNQUOTED ([^ \t\r\n\(\)#\\\"]|\\.)
+LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t])*\"
 
 %%
 
@@ -111,7 +113,14 @@ MAKEVAR \$\([A-Za-z0-9_]*\)
   return 1;
 }
 
-({MAKEVAR}|[^ \t\r\n\(\)#\\\"]|\\.)({MAKEVAR}|[^ \t\r\n\(\)#\\\"]|\\.|\"({MAKEVAR}|[^\r\n\(\)#\\\"]|\\.)*\")* {
+({UNQUOTED})({UNQUOTED})* {
+  lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
+  cmListFileLexerSetToken(lexer, yytext, yyleng);
+  lexer->column += yyleng;
+  return 1;
+}
+
+({MAKEVAR}|{UNQUOTED})({LEGACY})* {
   lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
   lexer->column += yyleng;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1eafa3edaf34569cb6fa7eb449a9825049fe6270
commit 1eafa3edaf34569cb6fa7eb449a9825049fe6270
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 6 09:41:10 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:26 2013 -0400

    cmListFileLexer: Fix line number after backslash in string
    
    If a line inside a string ends in a backslash count the following
    newline character as a line increment.  Add a test covering this case to
    verify that subsequent line numbers are correct.

diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index e7965b5..ff54d04 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 31
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -31,7 +31,15 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#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;
@@ -46,7 +54,6 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -77,6 +84,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -86,11 +95,12 @@ typedef unsigned int flex_uint32_t;
 
 #else   /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif  /* __STDC__ */
+#endif  /* defined (__STDC__) */
 #endif  /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -126,8 +136,6 @@ typedef void* yyscan_t;
 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
 #define yy_flex_debug yyg->yy_flex_debug_r
 
-int cmListFileLexer_yylex_init (yyscan_t* scanner);
-
 /* Enter a start condition.  This macro really ought to take a parameter,
  * but we do it the disgusting crufty way forced on us by the ()-less
  * definition of BEGIN.
@@ -151,9 +159,21 @@ int cmListFileLexer_yylex_init (yyscan_t* scanner);
 
 /* 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
 
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
 #define YY_TYPEDEF_YY_BUFFER_STATE
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
@@ -192,14 +212,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
                 } \
         while ( 0 )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -354,8 +369,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
         *yy_cp = '\0'; \
         yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 14
-#define YY_END_OF_BUFFER 15
+#define YY_NUM_RULES 15
+#define YY_END_OF_BUFFER 16
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -363,12 +378,12 @@ struct yy_trans_info
         flex_int32_t yy_verify;
         flex_int32_t yy_nxt;
         };
-static yyconst flex_int16_t yy_accept[39] =
+static yyconst flex_int16_t yy_accept[40] =
     {   0,
-        0,    0,    0,    0,   15,    6,   12,    1,    7,    2,
-        6,    3,    4,    6,   13,    8,    9,   10,   11,    6,
-        0,    6,    0,    2,    0,    5,    6,    8,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0
+        0,    0,    0,    0,   16,    6,   13,    1,    7,    2,
+        6,    3,    4,    6,   14,    8,   10,   11,   12,    6,
+        0,    6,    0,    2,    0,    5,    6,    8,    0,    9,
+        0,    0,    0,    0,    0,    0,    0,    0,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -409,60 +424,58 @@ static yyconst flex_int32_t yy_meta[13] =
         4,    1
     } ;
 
-static yyconst flex_int16_t yy_base[48] =
+static yyconst flex_int16_t yy_base[49] =
     {   0,
-        0,    0,   10,   20,   34,   32,   89,   89,   89,    0,
-       23,   89,   89,   35,    0,   18,   89,   89,   44,    0,
-       49,   21,    0,    0,   19,    0,    0,   15,   59,    0,
-       18,    0,   15,   12,   11,   10,    9,   89,   64,   68,
-       72,   76,   80,   13,   84,   12,   10
+        0,    0,   10,   20,   35,   32,   86,   86,   86,    0,
+       26,   86,   86,   35,    0,   19,   86,   86,   44,    0,
+       49,   22,    0,    0,   20,    0,    0,   16,   22,   86,
+        0,   18,    0,   15,   12,   11,   10,    9,   86,   61,
+       65,   69,   73,   77,   13,   81,   12,   10
     } ;
 
-static yyconst flex_int16_t yy_def[48] =
+static yyconst flex_int16_t yy_def[49] =
     {   0,
-       38,    1,   39,   39,   38,   38,   38,   38,   38,   40,
-        6,   38,   38,    6,   41,   42,   38,   38,   42,    6,
-       38,    6,   43,   40,   44,   14,    6,   42,   42,   21,
-       21,   45,   46,   44,   47,   46,   47,    0,   38,   38,
-       38,   38,   38,   38,   38,   38,   38
+       39,    1,   40,   40,   39,   39,   39,   39,   39,   41,
+        6,   39,   39,    6,   42,   43,   39,   39,   43,    6,
+       39,    6,   44,   41,   45,   14,    6,   43,   43,   39,
+       21,   21,   46,   47,   45,   48,   47,   48,    0,   39,
+       39,   39,   39,   39,   39,   39,   39,   39
     } ;
 
-static yyconst flex_int16_t yy_nxt[102] =
+static yyconst flex_int16_t yy_nxt[99] =
     {   0,
         6,    7,    8,    7,    9,   10,   11,   12,   13,    6,
-       14,   15,   17,   37,   18,   36,   34,   30,   20,   30,
-       27,   19,   17,   20,   18,   35,   29,   27,   33,   29,
-       25,   19,   20,   38,   38,   38,   21,   38,   22,   38,
-       38,   20,   20,   23,   26,   26,   28,   38,   28,   30,
-       30,   38,   38,   20,   38,   31,   38,   38,   30,   30,
-       32,   28,   38,   28,   16,   16,   16,   16,   24,   38,
-       24,   24,   27,   38,   27,   27,   28,   38,   38,   28,
-       20,   38,   20,   20,   30,   38,   30,   30,    5,   38,
-       38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
-
-       38
+       14,   15,   17,   38,   18,   37,   35,   31,   20,   31,
+       27,   19,   17,   20,   18,   36,   28,   29,   27,   34,
+       29,   19,   20,   25,   39,   39,   21,   39,   22,   39,
+       39,   20,   20,   23,   26,   26,   30,   39,   28,   31,
+       31,   39,   39,   20,   39,   32,   39,   39,   31,   31,
+       33,   16,   16,   16,   16,   24,   39,   24,   24,   27,
+       39,   27,   27,   28,   39,   39,   28,   20,   39,   20,
+       20,   31,   39,   31,   31,    5,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39
+
     } ;
 
-static yyconst flex_int16_t yy_chk[102] =
+static yyconst flex_int16_t yy_chk[99] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    3,   47,    3,   46,   44,   37,   36,   35,
-       34,    3,    4,   33,    4,   31,   28,   25,   22,   16,
-       11,    4,    6,    5,    0,    0,    6,    0,    6,    0,
+        1,    1,    3,   48,    3,   47,   45,   38,   37,   36,
+       35,    3,    4,   34,    4,   32,   29,   28,   25,   22,
+       16,    4,    6,   11,    5,    0,    6,    0,    6,    0,
         0,    6,    6,    6,   14,   14,   19,    0,   19,   21,
        21,    0,    0,   21,    0,   21,    0,    0,   21,   21,
-       21,   29,    0,   29,   39,   39,   39,   39,   40,    0,
-       40,   40,   41,    0,   41,   41,   42,    0,    0,   42,
-       43,    0,   43,   43,   45,    0,   45,   45,   38,   38,
-       38,   38,   38,   38,   38,   38,   38,   38,   38,   38,
+       21,   40,   40,   40,   40,   41,    0,   41,   41,   42,
+        0,   42,   42,   43,    0,    0,   43,   44,    0,   44,
+       44,   46,    0,   46,   46,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39
 
-       38
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[15] =
+static yyconst flex_int32_t yy_rule_can_match_eol[16] =
     {   0,
-1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,     };
+1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,     };
 
 /* The intent behind this definition is that it'll catch
  * any uses of REJECT which flex missed.
@@ -494,6 +507,7 @@ Run flex like this:
 
 Modify cmListFileLexer.c:
   - remove TABs
+  - remove use of the 'register' storage class specifier
   - remove the yyunput function
   - add a statement "(void)yyscanner;" to the top of these methods:
       yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
@@ -540,7 +554,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
 
 /*--------------------------------------------------------------------------*/
 
-#line 568 "cmListFileLexer.c"
+#line 560 "cmListFileLexer.c"
 
 #define INITIAL 0
 #define STRING 1
@@ -591,6 +605,12 @@ struct yyguts_t
 
     }; /* end struct yyguts_t */
 
+static int yy_init_globals (yyscan_t yyscanner );
+
+int cmListFileLexer_yylex_init (yyscan_t* scanner);
+
+int cmListFileLexer_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. */
 
@@ -620,6 +640,10 @@ int cmListFileLexer_yyget_lineno (yyscan_t yyscanner );
 
 void cmListFileLexer_yyset_lineno (int line_number ,yyscan_t yyscanner );
 
+int cmListFileLexer_yyget_column  (yyscan_t yyscanner );
+
+void cmListFileLexer_yyset_column (int column_no ,yyscan_t yyscanner );
+
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
  */
@@ -652,7 +676,12 @@ static int input (yyscan_t yyscanner );
 
 /* 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
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -660,7 +689,7 @@ static int input (yyscan_t yyscanner );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -754,14 +783,14 @@ YY_DECL
         int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 100 "cmListFileLexer.in.l"
+#line 79 "cmListFileLexer.in.l"
 
 
-#line 787 "cmListFileLexer.c"
+#line 794 "cmListFileLexer.c"
 
-        if ( yyg->yy_init )
+        if ( !yyg->yy_init )
                 {
-                yyg->yy_init = 0;
+                yyg->yy_init = 1;
 
 #ifdef YY_USER_INIT
                 YY_USER_INIT;
@@ -810,13 +839,13 @@ yy_match:
                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                 {
                                 yy_current_state = (int) yy_def[yy_current_state];
-                                if ( yy_current_state >= 39 )
+                                if ( yy_current_state >= 40 )
                                         yy_c = yy_meta[(unsigned int) yy_c];
                                 }
                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                         ++yy_cp;
                         }
-                while ( yy_base[yy_current_state] != 89 );
+                while ( yy_base[yy_current_state] != 86 );
 
 yy_find_action:
                 yy_act = yy_accept[yy_current_state];
@@ -855,7 +884,7 @@ do_action:      /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 102 "cmListFileLexer.in.l"
+#line 81 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Newline;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -865,14 +894,14 @@ YY_RULE_SETUP
 }
 case 2:
 YY_RULE_SETUP
-#line 110 "cmListFileLexer.in.l"
+#line 89 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
 }
         YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 114 "cmListFileLexer.in.l"
+#line 93 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ParenLeft;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -881,7 +910,7 @@ YY_RULE_SETUP
 }
 case 4:
 YY_RULE_SETUP
-#line 121 "cmListFileLexer.in.l"
+#line 100 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ParenRight;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -890,7 +919,7 @@ YY_RULE_SETUP
 }
 case 5:
 YY_RULE_SETUP
-#line 128 "cmListFileLexer.in.l"
+#line 107 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Identifier;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -899,7 +928,7 @@ YY_RULE_SETUP
 }
 case 6:
 YY_RULE_SETUP
-#line 135 "cmListFileLexer.in.l"
+#line 114 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -908,7 +937,7 @@ YY_RULE_SETUP
 }
 case 7:
 YY_RULE_SETUP
-#line 142 "cmListFileLexer.in.l"
+#line 121 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
   cmListFileLexerSetToken(lexer, "", 0);
@@ -917,9 +946,8 @@ YY_RULE_SETUP
 }
         YY_BREAK
 case 8:
-/* rule 8 can match eol */
 YY_RULE_SETUP
-#line 149 "cmListFileLexer.in.l"
+#line 128 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
@@ -928,7 +956,7 @@ YY_RULE_SETUP
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 154 "cmListFileLexer.in.l"
+#line 133 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
@@ -936,38 +964,48 @@ YY_RULE_SETUP
 }
         YY_BREAK
 case 10:
+/* rule 10 can match eol */
+YY_RULE_SETUP
+#line 139 "cmListFileLexer.in.l"
+{
+  cmListFileLexerAppend(lexer, yytext, yyleng);
+  ++lexer->line;
+  lexer->column = 1;
+}
+        YY_BREAK
+case 11:
 YY_RULE_SETUP
-#line 160 "cmListFileLexer.in.l"
+#line 145 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
   BEGIN(INITIAL);
   return 1;
 }
-case 11:
+case 12:
 YY_RULE_SETUP
-#line 166 "cmListFileLexer.in.l"
+#line 151 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
         YY_BREAK
 case YY_STATE_EOF(STRING):
-#line 171 "cmListFileLexer.in.l"
+#line 156 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadString;
   BEGIN(INITIAL);
   return 1;
 }
-case 12:
+case 13:
 YY_RULE_SETUP
-#line 177 "cmListFileLexer.in.l"
+#line 162 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
 }
         YY_BREAK
-case 13:
+case 14:
 YY_RULE_SETUP
-#line 181 "cmListFileLexer.in.l"
+#line 166 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadCharacter;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -975,18 +1013,18 @@ YY_RULE_SETUP
   return 1;
 }
 case YY_STATE_EOF(INITIAL):
-#line 188 "cmListFileLexer.in.l"
+#line 173 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_None;
   cmListFileLexerSetToken(lexer, 0, 0);
   return 0;
 }
-case 14:
+case 15:
 YY_RULE_SETUP
-#line 194 "cmListFileLexer.in.l"
+#line 179 "cmListFileLexer.in.l"
 ECHO;
         YY_BREAK
-#line 1025 "cmListFileLexer.c"
+#line 1041 "cmListFileLexer.c"
 
         case YY_END_OF_BUFFER:
                 {
@@ -1171,7 +1209,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
         else
                 {
-                        size_t num_to_read =
+                        int num_to_read =
                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
                 while ( num_to_read <= 0 )
@@ -1216,7 +1254,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
                 /* Read in more data. */
                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                        yyg->yy_n_chars, num_to_read );
+                        yyg->yy_n_chars, (size_t) num_to_read );
 
                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
                 }
@@ -1240,6 +1278,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
         else
                 ret_val = EOB_ACT_CONTINUE_SCAN;
 
+        if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+                /* Extend the array by 50%, plus the number we really need. */
+                yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmListFileLexer_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+        }
+
         yyg->yy_n_chars += number_to_move;
         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1270,7 +1316,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                         {
                         yy_current_state = (int) yy_def[yy_current_state];
-                        if ( yy_current_state >= 39 )
+                        if ( yy_current_state >= 40 )
                                 yy_c = yy_meta[(unsigned int) yy_c];
                         }
                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1287,7 +1333,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
 {
         int yy_is_jam;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
         char *yy_cp = yyg->yy_c_buf_p;
 
         YY_CHAR yy_c = 1;
@@ -1299,11 +1345,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                 {
                 yy_current_state = (int) yy_def[yy_current_state];
-                if ( yy_current_state >= 39 )
+                if ( yy_current_state >= 40 )
                         yy_c = yy_meta[(unsigned int) yy_c];
                 }
         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-        yy_is_jam = (yy_current_state == 38);
+        yy_is_jam = (yy_current_state == 39);
 
         return yy_is_jam ? 0 : yy_current_state;
 }
@@ -1633,6 +1679,8 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
                 yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                 , yyscanner);
+                if ( ! yyg->yy_buffer_stack )
+                        YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
 
                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
@@ -1651,6 +1699,8 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
                                                                 (yyg->yy_buffer_stack,
                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                 , yyscanner);
+                if ( ! yyg->yy_buffer_stack )
+                        YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yyensure_buffer_stack()" );
 
                 /* zero only the new slots.*/
                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1695,26 +1745,26 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer  (char * base, yy_size_t  size ,
 
 /** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will
  * scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * @param yystr a NUL-terminated string to scan
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
  *       cmListFileLexer_yy_scan_bytes() instead.
  */
-YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
+YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
 {
 
-        return cmListFileLexer_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
+        return cmListFileLexer_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to cmListFileLexer_yylex() will
  * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes  (yyconst char * bytes, int  len , yyscan_t yyscanner)
+YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
 {
         YY_BUFFER_STATE b;
         char *buf;
@@ -1722,15 +1772,15 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes  (yyconst char * bytes, int  len ,
         int i;
 
         /* Get memory for full buffer, including space for trailing EOB's. */
-        n = len + 2;
+        n = _yybytes_len + 2;
         buf = (char *) cmListFileLexer_yyalloc(n ,yyscanner );
         if ( ! buf )
                 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_bytes()" );
 
-        for ( i = 0; i < len; ++i )
-                buf[i] = bytes[i];
+        for ( i = 0; i < _yybytes_len; ++i )
+                buf[i] = yybytes[i];
 
-        buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
         b = cmListFileLexer_yy_scan_buffer(buf,n ,yyscanner);
         if ( ! b )
@@ -1918,21 +1968,87 @@ void cmListFileLexer_yyset_debug (int  bdebug , yyscan_t yyscanner)
 
 /* Accessor methods for yylval and yylloc */
 
+/* User-visible API */
+
+/* cmListFileLexer_yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int cmListFileLexer_yylex_init(yyscan_t* ptr_yy_globals)
+
+{
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+
+    *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+
+    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
+/* cmListFileLexer_yylex_init_extra has the same functionality as cmListFileLexer_yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to cmListFileLexer_yyalloc in
+ * the yyextra field.
+ */
+
+int cmListFileLexer_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
+
+{
+    struct yyguts_t dummy_yyguts;
+
+    cmListFileLexer_yyset_extra (yy_user_defined, &dummy_yyguts);
+
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+
+    *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+
+    /* By setting to 0xAA, we expose bugs in
+    yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+    cmListFileLexer_yyset_extra (yy_user_defined, *ptr_yy_globals);
+
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
 static int yy_init_globals (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
     /* Initialization is the same as for the non-reentrant scanner.
-       This function is called once per scanner lifetime. */
+     * This function is called from cmListFileLexer_yylex_destroy(), so don't allocate here.
+     */
 
     yyg->yy_buffer_stack = 0;
     yyg->yy_buffer_stack_top = 0;
     yyg->yy_buffer_stack_max = 0;
     yyg->yy_c_buf_p = (char *) 0;
-    yyg->yy_init = 1;
+    yyg->yy_init = 0;
     yyg->yy_start = 0;
+
     yyg->yy_start_stack_ptr = 0;
     yyg->yy_start_stack_depth = 0;
-    yyg->yy_start_stack = (int *) 0;
+    yyg->yy_start_stack =  NULL;
 
 /* Defined in main.c */
 #ifdef YY_STDINIT
@@ -1949,33 +2065,6 @@ static int yy_init_globals (yyscan_t yyscanner)
     return 0;
 }
 
-/* User-visible API */
-
-/* cmListFileLexer_yylex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-
-int cmListFileLexer_yylex_init(yyscan_t* ptr_yy_globals)
-
-{
-    if (ptr_yy_globals == NULL){
-        errno = EINVAL;
-        return 1;
-    }
-
-    *ptr_yy_globals = (yyscan_t) cmListFileLexer_yyalloc ( sizeof( struct yyguts_t ), NULL );
-
-    if (*ptr_yy_globals == NULL){
-        errno = ENOMEM;
-        return 1;
-    }
-
-    memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
-
-    return yy_init_globals ( *ptr_yy_globals );
-}
-
 /* cmListFileLexer_yylex_destroy is for both reentrant and non-reentrant scanners. */
 int cmListFileLexer_yylex_destroy  (yyscan_t yyscanner)
 {
@@ -1996,8 +2085,13 @@ int cmListFileLexer_yylex_destroy  (yyscan_t yyscanner)
         cmListFileLexer_yyfree(yyg->yy_start_stack ,yyscanner );
         yyg->yy_start_stack = NULL;
 
+    /* Reset the globals. This is important in a non-reentrant scanner so the next time
+     * cmListFileLexer_yylex() is called, initialization will occur. */
+    yy_init_globals( yyscanner);
+
     /* Destroy the main struct (reentrant only). */
     cmListFileLexer_yyfree ( yyscanner , yyscanner );
+    yyscanner = NULL;
     return 0;
 }
 
@@ -2009,7 +2103,6 @@ int cmListFileLexer_yylex_destroy  (yyscan_t yyscanner)
 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
 {
         int i;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
         for ( i = 0; i < n; ++i )
                 s1[i] = s2[i];
 }
@@ -2019,7 +2112,6 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
 {
         int n;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
         for ( n = 0; s[n]; ++n )
                 ;
 
@@ -2054,19 +2146,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#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
-#undef YY_DECL_IS_OURS
-#undef YY_DECL
-#endif
-#line 194 "cmListFileLexer.in.l"
+#line 179 "cmListFileLexer.in.l"
 
 
 
@@ -2122,7 +2202,7 @@ static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
     }
 
   /* We need to extend the buffer.  */
-  temp = (char*)malloc(newSize);
+  temp = malloc(newSize);
   if(lexer->token.text)
     {
     memcpy(temp, lexer->token.text, lexer->token.length);
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index eedf494..4459c7b 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -125,11 +125,17 @@ MAKEVAR \$\([A-Za-z0-9_]*\)
   BEGIN(STRING);
 }
 
-<STRING>([^\\\n\"]|\\(.|\n))+ {
+<STRING>([^\\\n\"]|\\.)+ {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
 
+<STRING>\\\n {
+  cmListFileLexerAppend(lexer, yytext, yyleng);
+  ++lexer->line;
+  lexer->column = 1;
+}
+
 <STRING>\n {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index 4a3d462..f2424c9 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -6,4 +6,5 @@ run_cmake(StringNoSpace)
 run_cmake(Unquoted0)
 run_cmake(Unquoted1)
 run_cmake(UnterminatedCall1)
+run_cmake(UnterminatedCall2)
 run_cmake(UnterminatedString)
diff --git a/Tests/RunCMake/Syntax/UnterminatedCall2-result.txt b/Tests/RunCMake/Syntax/UnterminatedCall2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedCall2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/UnterminatedCall2-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedCall2-stderr.txt
new file mode 100644
index 0000000..065de30
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedCall2-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error: Error in cmake code at
+.*/Syntax/UnterminatedCall2.cmake:4:
+Parse error.  Function missing ending "\)".  End of file reached.
+CMake Error at CMakeLists.txt:3 \(include\):
+  include could not find load file:
+
+    UnterminatedCall2.cmake
diff --git a/Tests/RunCMake/Syntax/UnterminatedCall2.cmake b/Tests/RunCMake/Syntax/UnterminatedCall2.cmake
new file mode 100644
index 0000000..26e9e62
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedCall2.cmake
@@ -0,0 +1,3 @@
+set(var "\
+")
+message(

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3155cd62ab669afc9d21bc877d5eb452ed94a7d
commit f3155cd62ab669afc9d21bc877d5eb452ed94a7d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Aug 6 09:29:20 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 8 13:26:26 2013 -0400

    Add RunCMake.Syntax test to cover argument parsing
    
    Test basic unquoted and quoted argument parsing cases including failure
    on an unterminated string and an unterminated command invocation.  Also
    cover arguments not separated by any spaces, which is accidentally
    allowed by the current parser.

diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 1b9c17b..e45aba3 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -85,6 +85,7 @@ if(NOT WIN32)
   endif()
 endif()
 add_RunCMake_test(CompatibleInterface)
+add_RunCMake_test(Syntax)
 
 add_RunCMake_test(add_dependencies)
 add_RunCMake_test(build_command)
diff --git a/Tests/RunCMake/Syntax/CMakeLists.txt b/Tests/RunCMake/Syntax/CMakeLists.txt
new file mode 100644
index 0000000..618473a
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.9)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
new file mode 100644
index 0000000..4a3d462
--- /dev/null
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(String0)
+run_cmake(String1)
+run_cmake(StringNoSpace)
+run_cmake(Unquoted0)
+run_cmake(Unquoted1)
+run_cmake(UnterminatedCall1)
+run_cmake(UnterminatedString)
diff --git a/Tests/RunCMake/Syntax/String0-stderr.txt b/Tests/RunCMake/Syntax/String0-stderr.txt
new file mode 100644
index 0000000..8eea069
--- /dev/null
+++ b/Tests/RunCMake/Syntax/String0-stderr.txt
@@ -0,0 +1 @@
+^1 2;3 4$
diff --git a/Tests/RunCMake/Syntax/String0.cmake b/Tests/RunCMake/Syntax/String0.cmake
new file mode 100644
index 0000000..95281d7
--- /dev/null
+++ b/Tests/RunCMake/Syntax/String0.cmake
@@ -0,0 +1,2 @@
+set(var 2 3)
+message("1 ${var} 4")
diff --git a/Tests/RunCMake/Syntax/String1-stderr.txt b/Tests/RunCMake/Syntax/String1-stderr.txt
new file mode 100644
index 0000000..07e98da
--- /dev/null
+++ b/Tests/RunCMake/Syntax/String1-stderr.txt
@@ -0,0 +1,3 @@
+^
+  1 \${var} 4
+ $
diff --git a/Tests/RunCMake/Syntax/String1.cmake b/Tests/RunCMake/Syntax/String1.cmake
new file mode 100644
index 0000000..a94c9ff
--- /dev/null
+++ b/Tests/RunCMake/Syntax/String1.cmake
@@ -0,0 +1,3 @@
+message("
+  1 \${var} 4
+ ")
diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
new file mode 100644
index 0000000..2d111aa
--- /dev/null
+++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
@@ -0,0 +1,3 @@
+^\[1 \${var} \\n 4\]
+\[x\]
+\[y\]$
diff --git a/Tests/RunCMake/Syntax/StringNoSpace.cmake b/Tests/RunCMake/Syntax/StringNoSpace.cmake
new file mode 100644
index 0000000..76f22db
--- /dev/null
+++ b/Tests/RunCMake/Syntax/StringNoSpace.cmake
@@ -0,0 +1,4 @@
+# Quoted arguments may be immediately followed by another argument.
+foreach(x "1 \${var} \\n 4""x"y)
+  message("[${x}]")
+endforeach()
diff --git a/Tests/RunCMake/Syntax/Unquoted0-stderr.txt b/Tests/RunCMake/Syntax/Unquoted0-stderr.txt
new file mode 100644
index 0000000..ea68ebf
--- /dev/null
+++ b/Tests/RunCMake/Syntax/Unquoted0-stderr.txt
@@ -0,0 +1 @@
+^1234$
diff --git a/Tests/RunCMake/Syntax/Unquoted0.cmake b/Tests/RunCMake/Syntax/Unquoted0.cmake
new file mode 100644
index 0000000..c5314c9
--- /dev/null
+++ b/Tests/RunCMake/Syntax/Unquoted0.cmake
@@ -0,0 +1,2 @@
+set(var 2 3)
+message(1 ${var} 4)
diff --git a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt
new file mode 100644
index 0000000..ff8194a
--- /dev/null
+++ b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt
@@ -0,0 +1 @@
+^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$
diff --git a/Tests/RunCMake/Syntax/Unquoted1.cmake b/Tests/RunCMake/Syntax/Unquoted1.cmake
new file mode 100644
index 0000000..0344fbd
--- /dev/null
+++ b/Tests/RunCMake/Syntax/Unquoted1.cmake
@@ -0,0 +1 @@
+message([] [=] [$ $(MV) -DSTR=" [=" [;])
diff --git a/Tests/RunCMake/Syntax/UnterminatedCall1-result.txt b/Tests/RunCMake/Syntax/UnterminatedCall1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedCall1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt
new file mode 100644
index 0000000..281ce0d
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error: Error in cmake code at
+.*/Syntax/UnterminatedCall1.cmake:2:
+Parse error.  Function missing ending "\)".  End of file reached.
+CMake Error at CMakeLists.txt:3 \(include\):
+  include could not find load file:
+
+    UnterminatedCall1.cmake
diff --git a/Tests/RunCMake/Syntax/UnterminatedCall1.cmake b/Tests/RunCMake/Syntax/UnterminatedCall1.cmake
new file mode 100644
index 0000000..1166109
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedCall1.cmake
@@ -0,0 +1 @@
+message(
diff --git a/Tests/RunCMake/Syntax/UnterminatedString-result.txt b/Tests/RunCMake/Syntax/UnterminatedString-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedString-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/UnterminatedString-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedString-stderr.txt
new file mode 100644
index 0000000..d925032
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedString-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error: Error in cmake code at
+.*/Syntax/UnterminatedString.cmake:2:
+Parse error.  Function missing ending "\)".  Instead found unterminated string with text "\)
+".
+CMake Error at CMakeLists.txt:3 \(include\):
+  include could not find load file:
+
+    UnterminatedString.cmake$
diff --git a/Tests/RunCMake/Syntax/UnterminatedString.cmake b/Tests/RunCMake/Syntax/UnterminatedString.cmake
new file mode 100644
index 0000000..721ae75
--- /dev/null
+++ b/Tests/RunCMake/Syntax/UnterminatedString.cmake
@@ -0,0 +1 @@
+set(var ")

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list