Improve parsing of escape characters and regexp literals.
authorRoberto Raggi <roberto.raggi@nokia.com>
Tue, 6 Dec 2011 13:09:22 +0000 (14:09 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 6 Dec 2011 14:29:39 +0000 (15:29 +0100)
commite7d1a74d994445749275e8e5cb88b0a21938bb09
tree6dde884c6079e8a448a4f645b144fd252b4e3d6e
parente7281e2dc89ca934d3c1e89484d279331a96de71
Improve parsing of escape characters and regexp literals.

That is, in QML/JS you can escape characters in identifiers, e.g.

  var c\u0061se = 25

declares a variable called `case' with value 25. In such cases
qmlmin needs to preserve the escape sequence in the declaration.

Also, fix possible errors when pasting keywords after regexp literals.
The minifier needs to preserve the whitespace character after the
regexp delimiter, e.g.

  /x/instanceof blah

without the white space after the regexp, the `i' of `instanceof'
is parsed as a regexp flag.

Change-Id: I5f426ac62949e34d092d4fdb0a41243de8ff2236
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
src/declarative/qml/parser/qdeclarativejslexer.cpp
src/declarative/qml/parser/qdeclarativejslexer_p.h
tests/auto/declarative/qmlmin/tst_qmlmin.cpp
tools/qmlmin/main.cpp