diff options
author | Axel Waggershauser <awagger@gmail.com> | 2013-03-15 00:42:15 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-16 20:22:50 +0100 |
commit | b11317a64339f5a4bcffc8234ecaf15c7fb416f2 (patch) | |
tree | f81e40ee49f5109b4100048d131d5bb922b448aa /util/lexgen/generator.cpp | |
parent | 72367a94a750355eb748793ce8c365373a332c9c (diff) |
Whitespace cleanup: remove trailing whitespace
Remove all trailing whitespace from the following list of files:
*.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README
excluding 3rdparty, test-data and auto generated code.
Note A): the only non 3rdparty c++-files that still
have trailing whitespace after this change are:
* src/corelib/codecs/cp949codetbl_p.h
* src/corelib/codecs/qjpunicode.cpp
* src/corelib/codecs/qbig5codec.cpp
* src/corelib/xml/qxmlstream_p.h
* src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
* src/tools/uic/ui4.cpp
* tests/auto/other/qtokenautomaton/tokenizers/*
* tests/benchmarks/corelib/tools/qstring/data.cpp
* util/lexgen/tokenizer.cpp
Note B): in about 30 files some overlapping 'leading tab' and
'TAB character in non-leading whitespace' issues have been fixed
to make the sanity bot happy. Plus some general ws-fixes here
and there as asked for during review.
Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'util/lexgen/generator.cpp')
-rw-r--r-- | util/lexgen/generator.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/util/lexgen/generator.cpp b/util/lexgen/generator.cpp index a6fc93c0ca..06ba586c1f 100644 --- a/util/lexgen/generator.cpp +++ b/util/lexgen/generator.cpp @@ -48,7 +48,7 @@ void Function::printDeclaration(CodeBlock &block, const QString &funcNamePrefix) block << (iline ? "inline " : "") << signature(funcNamePrefix) << (iline ? QLatin1String(" {") : QLatin1String(";")); if (!iline) return; - + block.indent(); QString tmp = body; if (tmp.endsWith(QLatin1Char('\n'))) @@ -81,7 +81,7 @@ QString Function::definition() const QString result; result += signature(); result += QLatin1String("\n{\n"); - + QString tmp = body; if (tmp.endsWith(QLatin1Char('\n'))) @@ -92,7 +92,7 @@ QString Function::definition() const tmp.replace(QLatin1Char('\n'), QLatin1String("\n ")); result += tmp; - + result += QLatin1String("\n}\n"); return result; @@ -102,16 +102,16 @@ void Class::Section::printDeclaration(const Class *klass, CodeBlock &block) cons { foreach (Function ctor, constructors) ctor.printDeclaration(block, klass->name()); - + if (!constructors.isEmpty()) block.addNewLine(); - + foreach (Function func, functions) func.printDeclaration(block); - + if (!functions.isEmpty()) block.addNewLine(); - + foreach (QString var, variables) block << var << ';'; } @@ -133,13 +133,13 @@ void Class::addConstructor(Access access, const QString &body, const QString &_a QString Class::Section::definition(const Class *klass) const { QString result; - + foreach (Function ctor, constructors) { ctor.setName(klass->name() + "::" + klass->name() + ctor.name()); result += ctor.definition(); result += QLatin1Char('\n'); } - + foreach (Function func, functions) { if (!func.hasBody()) continue; func.setName(klass->name() + "::" + func.name()); @@ -153,10 +153,10 @@ QString Class::Section::definition(const Class *klass) const QString Class::declaration() const { CodeBlock block; - + block << QLatin1String("class ") << cname; block << "{"; - + if (!sections[PublicMember].isEmpty()) { block << "public:"; block.indent(); @@ -170,7 +170,7 @@ QString Class::declaration() const sections[ProtectedMember].printDeclaration(this, block); block.outdent(); } - + if (!sections[PrivateMember].isEmpty()) { block << "private:"; block.indent(); @@ -180,7 +180,7 @@ QString Class::declaration() const block << "};"; block.addNewLine(); - + return block.toString(); } @@ -406,12 +406,12 @@ void Generator::generateTransitions(CodeBlock &body, const TransitionMap &transi QString Generator::generate() { Class klass(cfg.className); - + klass.addMember(Class::PublicMember, "QString input"); klass.addMember(Class::PublicMember, "int pos"); klass.addMember(Class::PublicMember, "int lexemStart"); klass.addMember(Class::PublicMember, "int lexemLength"); - + { CodeBlock body; body << "input = inp;"; @@ -420,7 +420,7 @@ QString Generator::generate() body << "lexemLength = 0;"; klass.addConstructor(Class::PublicMember, body, "const QString &inp"); } - + { Function next("QChar", "next()"); next.setInline(true); @@ -430,7 +430,7 @@ QString Generator::generate() next.addBody("return (pos < input.length()) ? input.at(pos++).toLower() : QChar();"); klass.addMember(Class::PublicMember, next); } - + /* { Function lexem("QString", "lexem()"); @@ -450,7 +450,7 @@ QString Generator::generate() Function lexFunc; lexFunc.setReturnType("int"); lexFunc.setName("lex()"); - + CodeBlock body; body << "lexemStart = pos;"; body << "lexemLength = 0;"; @@ -487,14 +487,14 @@ QString Generator::generate() body.outdent(); body.indent(); - + if (!dfa.at(i).transitions.isEmpty()) { body << "ch = next();"; generateTransitions(body, dfa.at(i).transitions); } - + body << "goto out;"; - + body.outdent(); } @@ -512,9 +512,9 @@ QString Generator::generate() body.outdent(); body << "}"; body << "return token;"; - + lexFunc.addBody(body); - + klass.addMember(Class::PublicMember, lexFunc); QString header; @@ -526,7 +526,7 @@ QString Generator::generate() } header += QLatin1String("// auto generated. DO NOT EDIT.\n"); - + return header + klass.declaration() + klass.definition(); } |