aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljslexer_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Support static as a keyword in class definitionsLars Knoll2018-04-251-2/+7
| | | | | | | | | This requires some interaction between parser and lexer as static is only recognized as a keyword directly in the class declaration. Change-Id: Ib64157ae6ad542706a5eee8ff4ec7f9cb79a62c3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Bring JS grammar in line with ES7 specLars Knoll2018-04-251-5/+0
| | | | | | | | | | | | | | | | | | | | | | | This basically updates all grammar rules in the qqmljs.g file to be in line with the ES7 specification. Some special handling for the lookahead rules appearing in the spec was needed and is implemented through empty lookahead rules in the grammar, that might push an additional token into the token stream. Renamed some classes in the AST to be in line with the names used in ES7, and removed some other ones (SourceElements) that are no longer used. The ES7 grammar rules contain lots of variations of the base rules (with In/Return/Yield/Default suffixes). With the exception of the In and Default rules, these are implemented through state tracking in the parser and lexer. Change-Id: I4017d97cd050ed816c1dad11833e882cba30801a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add yield as a keywordLars Knoll2018-04-251-1/+20
| | | | | | | | | | | | 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>
* Add support for ES6 template stringsLars Knoll2018-04-251-0/+12
| | | | | | | | | | | | | 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>
* Disentangle some includes by moving QQmlJS::Directives into qqmljsengine_p.hLars Knoll2018-04-251-26/+1
| | | | | Change-Id: Iee5a5a9edc8b79649a8f43612584ecf046a9aa2c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of qlalr generated filesLars Knoll2018-04-251-2/+2
| | | | | | | | Let's not check in the files generated by qlalr. This is ok, as qlalr is part of qtbase since a long time. Change-Id: I1298c76e919169c8f02f1e5d067f128a9f2a7542 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Properly parse identifiers containing chars outside the BMPLars Knoll2018-02-091-1/+1
| | | | | | | | | | 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-1/+0
| | | | | | | | | | | 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>
* Add support for parsing of binary and octal numbersLars Knoll2018-02-081-1/+1
| | | | | | | 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-6/+3
| | | | | Change-Id: I7e6245fb064d071518e0d46d1cc56e516d230abc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for enum declarations in QMLMichael Brasser2017-07-131-1/+0
| | | | | | | | | | | | | | | | | Enums can be declared with the following syntax: enum MyEnum { Value1, Value2 } Grammar changes done by Simon Hausmann. [ChangeLog][QtQml] Enums can now be declared directly in QML. Task-number: QTBUG-14861 Change-Id: Ic6b6e032651d01ee2ecf9d5ce5734976cb3ad7ab 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-3/+8
| | | | | | | | | | | 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>
* 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>
* Move the parser folder from src/qml/qml to src/qmlLars Knoll2013-08-081-0/+253
Change-Id: I5e5684f5b98b00f791ade99c4cb6bc2ed880ad6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>