Make util/lexgen/ mention itself in its auto-gen line
In the process, update the README's e-mail address for Simon and mention all recognized command-line options in the usage message. The generated CSS scanner was also out of sync with our source, so update it. Also fixed handling of FileHeader to cope with running from a shadow build by handling paths relative to __FILE__; and revised the CSS3 config to use the same copyright header as was already in use by the existing generated file. Change-Id: I918ff84dbdc95d0478fd6aa4ea74e9a221d1a476 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
c03803b9b3
commit
eafad93c3d
File diff suppressed because it is too large
Load Diff
@ -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>
|
||||
|
@ -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]
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user