diff options
| author | Torgny Nyblom <kde@nyblom.org> | 2010-11-01 10:49:08 +0100 | 
|---|---|---|
| committer | Torgny Nyblom <kde@nyblom.org> | 2010-11-01 10:49:08 +0100 | 
| commit | 38a34dc9a3cced350b4b71120c9c1d1e005ed3a1 (patch) | |
| tree | 0d91534af5f2118c81afa5daa59856150af3dfd2 | |
| parent | 4fee08de4fa1e3592a4d9ee5c8a0835ddf97ebab (diff) | |
| download | svn2git-38a34dc9a3cced350b4b71120c9c1d1e005ed3a1.tar svn2git-38a34dc9a3cced350b4b71120c9c1d1e005ed3a1.tar.gz svn2git-38a34dc9a3cced350b4b71120c9c1d1e005ed3a1.tar.bz2 svn2git-38a34dc9a3cced350b4b71120c9c1d1e005ed3a1.tar.xz svn2git-38a34dc9a3cced350b4b71120c9c1d1e005ed3a1.zip  | |
Fix issue with variables not being defined when reading include files
| -rw-r--r-- | src/ruleparser.cpp | 8 | ||||
| -rw-r--r-- | src/ruleparser.h | 2 | 
2 files changed, 5 insertions, 5 deletions
diff --git a/src/ruleparser.cpp b/src/ruleparser.cpp index f21f5b6..6f98fbf 100644 --- a/src/ruleparser.cpp +++ b/src/ruleparser.cpp @@ -98,8 +98,6 @@ void Rules::load(const QString &filename)      QRegExp variableLine("\\$\\{(\\S+)\\}", Qt::CaseInsensitive);      QRegExp includeLine("include\\s+(.*)", Qt::CaseInsensitive); -    QMap<QString,QString> variables; -      enum { ReadingNone, ReadingRepository, ReadingMatch } state = ReadingNone;      Repository repo;      Match match; @@ -133,9 +131,9 @@ void Rules::load(const QString &filename)          } else {              int index = variableLine.indexIn(line);              if ( index != -1 ) { -                if (!variables.contains(variableLine.cap(1))) +                if (!m_variables.contains(variableLine.cap(1)))                      qFatal("Undeclared variable: %s", qPrintable(variableLine.cap(1))); -                line = line.replace(variableLine, variables[variableLine.cap(1)]); +                line = line.replace(variableLine, m_variables[variableLine.cap(1)]);              }              if (state == ReadingRepository) {                  if (matchBranchLine.exactMatch(line)) { @@ -226,7 +224,7 @@ void Rules::load(const QString &filename)              } else if (isVariableRule) {                  QString variable = declareLine.cap(1);                  QString value = declareLine.cap(2); -                variables.insert(variable, value); +                m_variables.insert(variable, value);              } else {                  qFatal("Malformed line in rules file: line %d: %s",                         lineNumber, qPrintable(origLine)); diff --git a/src/ruleparser.h b/src/ruleparser.h index c0fc689..f3f6c6a 100644 --- a/src/ruleparser.h +++ b/src/ruleparser.h @@ -19,6 +19,7 @@  #define RULEPARSER_H  #include <QList> +#include <QMap>  #include <QRegExp>  #include <QString>  #include <QStringList> @@ -91,6 +92,7 @@ private:      QString filename;      QList<Repository> m_repositories;      QList<Match> m_matchRules; +    QMap<QString,QString> m_variables;  };  class RulesList  | 
