aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljslexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ES6: add support for default arguments for function parametersLars Knoll2018-04-251-0/+11
| | | | | | | | | The parser can also handle rest parameters correctly, this will however require some additional work in the runtime to support it correctly. Change-Id: Ib6f4d27683774966b2d2aac075494d2f5066d2a2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for ES6 template stringsLars Knoll2018-04-251-138/+186
| | | | | | | | | | | | | This requires a bit of bookeeping in the lexer, as we can have arbitrary expressions inside the ${...}. To make this work, keep a stack of template states, in which we count the unclosed braces to match up with the correct closing brace. Implements support for `...`. Expressions of the type Foo`...` and Foo()`...` will come in follow-up commits. Change-Id: Ia332796cfb77895583d0093732e6f56c8b0662c9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove unused function - convertUnicode()Liang Qi2018-03-071-6/+0
| | | | | | | The usage of it was removed in b555f45c10a050be9410f9dc6286a44753cc7d98. Change-Id: I3b28f32e1d2f4fbd7c16fb0251888cf10507578f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-271-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/parser/qqmljslexer.cpp src/qml/qml/v8/qv8engine.cpp src/qml/util/qqmladaptormodel_p.h src/quick/items/qquickanimatedsprite.cpp tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
| * use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Properly parse identifiers containing chars outside the BMPLars Knoll2018-02-091-41/+76
| | | | | | | | | | | | | | | | | | | | If the identifier contains characters outside the Unicode BMP, we need to correctly decode them from surrogate pairs or unicode escape sequences before testing whether they are valid characters for an identifier. Change-Id: I5d6ceaf27a353d3a708da86f08cfb9796eb8b1d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement parsing of ECMAScript 6 Unicode escape sequencesLars Knoll2018-02-081-20/+36
| | | | | | | | | | | | | | | | | | | | | | ECMAScript 6 added the \u{XXXX} syntax to encode arbitrary Unicode code points. Support this properly in our lexer. One issue currently is that codepoints outside the BMP will not yet be handled correctly. Change-Id: Id46f9ec6fdbb264a5a919d84a16857afc9e8ca6e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Unify error handling in decodeUnicodeEscapeSequenceLars Knoll2018-02-081-14/+7
| | | | | | | | | | Change-Id: I69b9b9308b278ab50207e355467bf3db4b8ccbc9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for parsing of binary and octal numbersLars Knoll2018-02-081-115/+104
| | | | | | | | | | | | | | In line with Chapter 11.8.3 of ECMAScript 6. Change-Id: I3c67e001858eb8f055ec49f83ec51a1bf9c8154b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Simplify line and column number handling in the lexerLars Knoll2018-02-081-20/+10
|/ | | | | Change-Id: I7e6245fb064d071518e0d46d1cc56e516d230abc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce Q_FALLTHROUGH()Friedemann Kleint2018-01-101-1/+1
| | | | | | | Silence g++ 7.X warnings. Change-Id: Iba80ab547111d883ff8b3e99173cc5f3a79ae81f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Initialize members in parserRobert Loehning2017-08-101-0/+1
| | | | | Change-Id: Iea5f8ca269bb759c615c4768d63a7c09ec9975fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlComponent: Fix heap buffer overflow with bogus inputPeter Hartmann2017-05-031-0/+5
| | | | | Change-Id: I8a725018a5aeb39df370f856cd77d887faa511e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Clean up JS .import/.pragma directive scanningSimon Hausmann2015-01-081-21/+138
| | | | | | | | | | | There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so let's get rid of extra parser that operates on a string. Instead this way we can do the scanning all in one shot, avoid detaching a copy of the source code string and (most importantly) bring the parser closer to the copy in Qt Creator, which uses the directives approach to extract imports and pragma. Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
* QQmlJS::Lexer::scanNumber: Use a QVarLengthArray to avoid heap allocations.Robin Burchell2014-12-191-2/+1
| | | | | | | | This shaved the time of this function in half on an (admittedly very morbid) testcase of mine, from 161ms to 72ms total. Change-Id: I88ad8d4ad4791dc4e7eadb9af9265ff02fe5376f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-1/+1
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix another bug with automatic semicolon insertionSimon Hausmann2013-08-081-1/+2
| | | | | | | Avoid empty statements after else. Change-Id: Ia7782a3371bc79c7e93857aa252309d2824a5a9e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move the parser folder from src/qml/qml to src/qmlLars Knoll2013-08-081-0/+1329
Change-Id: I5e5684f5b98b00f791ade99c4cb6bc2ed880ad6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>