aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljslexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.12.0' into 5.12Qt Forward Merge Bot2018-12-071-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4script.cpp src/qml/parser/qqmljslexer.cpp Change-Id: I82252a8c504a4b77c45f4f8efe849ff9acb949fd
| * QML Lexer: Stop scanning template literals on closing '`'v5.12.0-rc2v5.12.0-rc1v5.12.0Ulf Hermann2018-11-191-1/+1
| | | | | | | | | | | | | | Fixes: QTBUG-71812 Change-Id: I93b99496a7572c0f5128c69b865bb2b4f87d29af Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Also store the raw string value for template strings in the lexerLars Knoll2018-11-021-22/+45
|/ | | | | | | | This is required to properly implement support for tagged templates and String.raw. Change-Id: Id548f97dd8ebfb7206abb55967f979c3fa6f6eea Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Cleanup RegExpObjectLars Knoll2018-08-151-0/+1
| | | | | | | | | | | Move properties from RegExpObject to getters in RegExp.prototype to be compliant with the JS spec. Implement support for the sticky flags ('y') and correctly parse the flags in the RegExp constructor. Change-Id: I5cf05d14e8139cf30d46235b8d466fb96084fcb7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable unicode regular expressionsLars Knoll2018-08-101-0/+1
| | | | | | | Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix grammar for ES modulesLars Knoll2018-08-021-2/+2
| | | | | | | | | | | | * Always parse 'import' as a keyword, as it is now one in Qml and ES. * Always parse 'as' as keyword but allow it as identifier using the same trick as for the other keywords. This fixes basic import statements such as import "foo.mjs" as bar but still allows funny variations such as import "foo.mjs" as as. Change-Id: I76a600aab90c1b5c07d079bf11b0a78742d44c53 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix multi line string literals using backquotesLars Knoll2018-05-261-1/+1
| | | | | | Task-number: QTBUG-67476 Change-Id: Ia8c6863ad35c8a92298e5dffd750d17628200573 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add some basic support for for-of loopsLars Knoll2018-05-091-0/+1
| | | | | | | | | | | | | The support is basically at the same level as for for-in at the moment. Currently unimplemented: * Destructuring * Proper lexical scoping * calling iterator.throw()/return() when required Change-Id: If193ce0b054c4315fc16b7e174334a31b2730dcf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Added support for generator functions and yield expressions to the ASTLars Knoll2018-04-271-0/+1
| | | | | | | | | Some smaller changes to the codegen are included as well to ensure that we catch all uses of generators and properly throw an unimplemented error on them for now. Change-Id: Ib915a0e862e128644ff00dfe989507783c912c66 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't fail on pre increment operator after a newlineLars Knoll2018-04-271-2/+2
| | | | | | | | In some valid cases, the lexer would add an automatic semicolon before the ++/-- operators even if it shouldn't. Change-Id: I2935259fd98a4c7f3f929cc1cecea85f7dde8016 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for the ** and **= operatorsLars Knoll2018-04-261-0/+4
| | | | | Change-Id: I58a21e70fdd040175b52465d6ba52e7fceaf6398 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix tokenizer to generate arrow and exponentiation tokensLars Knoll2018-04-251-0/+6
| | | | | Change-Id: Ib228925db9285e61acebc79f881acfbc2de9ff16 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add yield as a keywordLars Knoll2018-04-251-1/+1
| | | | | | | | | | | | It's not a keyword outside of generator functions, so extend the qmlmode boolean on the lexer to become a more general parsemode that we can use to also turn the yield keyword on and of. The parser can then set the flag when it enters the body of a generator function. Change-Id: Ibf792d4c7c567d825c6706f7b4997362c87fc575 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* 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>