void GaduEmoticonParser::parse() { QChar c = peek(); if (c.isNull()) return; if (c == '*') // ignore first *, I don't know why eat(); QStringList aliases = parseAliases(); eat(); // , QString animatedPath = parseQuoted(); eat(); // , QString staticPath = parseQuoted(); if (aliases.isEmpty() || animatedPath.isEmpty()) return; animatedPath = ThemePath + fixFileName(ThemePath, animatedPath); if (staticPath.isEmpty()) staticPath = animatedPath; else staticPath = ThemePath + fixFileName(ThemePath, staticPath); Result = Emoticon(aliases.at(0), staticPath, animatedPath); foreach (const QString &alias, aliases) Aliases.append(Emoticon(alias, staticPath, animatedPath)); }
QStringList GaduEmoticonParser::parseAliases() { QStringList result; QChar c = peek(); if (c.isNull()) return result; bool multiple = false; if (c == '(') { multiple = true; eat(); } while (true) { QString alias = parseQuoted(); if (!alias.isEmpty()) result.append(alias); if (!multiple) return result; c = get(); if (c.isNull() || c == ')') return result; if (c != ',') // some kind of error return result; } Q_ASSERT(false); }
cbool parseLexQuoted( parse *p, char *s ) { return ( parseSpaceAndComments( p ) && parseQuoted( p, s ) ); }