summaryrefslogtreecommitdiffstats
path: root/util/lexgen
diff options
context:
space:
mode:
Diffstat (limited to 'util/lexgen')
-rw-r--r--util/lexgen/README3
-rw-r--r--util/lexgen/css3-simplified.lexgen2
-rw-r--r--util/lexgen/generator.cpp15
-rw-r--r--util/lexgen/main.cpp2
4 files changed, 12 insertions, 10 deletions
diff --git a/util/lexgen/README b/util/lexgen/README
index 435c7f31ee..005b77b81c 100644
--- a/util/lexgen/README
+++ b/util/lexgen/README
@@ -11,6 +11,5 @@ you want. But I like that it generates code that operates on QChar and friends.
Use at your own risk ;-)
-
--
-Simon Hausmann <simon.hausmann@digia.com>
+Simon Hausmann <simon.hausmann@qt.io>
diff --git a/util/lexgen/css3-simplified.lexgen b/util/lexgen/css3-simplified.lexgen
index 99463d524e..d86a4786be 100644
--- a/util/lexgen/css3-simplified.lexgen
+++ b/util/lexgen/css3-simplified.lexgen
@@ -5,7 +5,7 @@ classname = QCssScanner_Generated
[Code Generator Options]
MapToCode[a-z] = (ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256
TokenPrefix = QCss::
-FileHeader = ../../src/tools/moc/util/licenseheader.txt
+FileHeader = ../../header.LGPL
[Macros]
escape = \\[^\r\n\f0-9a-f]
diff --git a/util/lexgen/generator.cpp b/util/lexgen/generator.cpp
index edd2b603e7..481d586e73 100644
--- a/util/lexgen/generator.cpp
+++ b/util/lexgen/generator.cpp
@@ -29,6 +29,7 @@
#include "generator.h"
#include <QFile>
+#include <QDir>
void Function::printDeclaration(CodeBlock &block, const QString &funcNamePrefix) const
{
@@ -505,14 +506,16 @@ QString Generator::generate()
klass.addMember(Class::PublicMember, lexFunc);
QString header;
- QFile headerFile(headerFileName);
- if (!headerFileName.isEmpty()
- && headerFile.exists()
- && headerFile.open(QIODevice::ReadOnly)) {
- header = QString::fromUtf8(headerFile.readAll());
+ if (!headerFileName.isEmpty()) {
+ QString self(QDir::fromNativeSeparators(QStringLiteral(__FILE__)));
+ int lastSep = self.lastIndexOf(QChar('/'));
+ QDir here(lastSep < 0 ? QStringLiteral(".") : self.left(lastSep));
+ QFile headerFile(QDir::cleanPath(here.filePath(headerFileName)));
+ if (headerFile.exists() && headerFile.open(QIODevice::ReadOnly))
+ header = QString::fromUtf8(headerFile.readAll());
}
- header += QLatin1String("// auto generated. DO NOT EDIT.\n");
+ header += QLatin1String("// auto generated by qtbase/util/lexgen/. DO NOT EDIT.\n");
return header + klass.declaration() + klass.definition();
}
diff --git a/util/lexgen/main.cpp b/util/lexgen/main.cpp
index 22b99b633c..517629f4c1 100644
--- a/util/lexgen/main.cpp
+++ b/util/lexgen/main.cpp
@@ -256,7 +256,7 @@ int main(int argc, char **argv)
}
if (ruleFile.isEmpty()) {
- qWarning("usage: lexgen [-test rulefile");
+ qWarning("usage: lexgen [-debug] [-cache] [-test] rulefile");
qWarning(" ");
qWarning(" the -test option will cause lexgen to interpret standard input");
qWarning(" according to the specified rules and print out pairs of token and");