Added C-style comment folding.

This is a "back-port" for 57f2b3e44d from master
into 2.0.

Done-with: ckamm
This commit is contained in:
Erik Verbruggen
2010-06-15 11:26:27 +02:00
parent 512e75a561
commit e5b9c76f27
6 changed files with 38 additions and 18 deletions

View File

@@ -77,7 +77,7 @@ const _Tp *end(const _Tp (&a)[N])
}
Scanner::Scanner()
: _state(0),
: _state(Normal),
_scanComments(true)
{
}
@@ -122,11 +122,6 @@ static bool isNumberChar(QChar ch)
QList<Token> Scanner::operator()(const QString &text, int startState)
{
enum {
Normal = 0,
MultiLineComment = 1
};
_state = startState;
QList<Token> tokens;

View File

@@ -77,13 +77,18 @@ public:
class QMLJS_EXPORT Scanner
{
public:
enum {
Normal = 0,
MultiLineComment = 1
};
Scanner();
virtual ~Scanner();
bool scanComments() const;
void setScanComments(bool scanComments);
QList<Token> operator()(const QString &text, int startState = 0);
QList<Token> operator()(const QString &text, int startState = Normal);
int state() const;
bool isKeyword(const QString &text) const;