aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljs.g
Commit message (Collapse)AuthorAgeFilesLines
* Add support for enum declarations in QMLMichael Brasser2017-07-131-0/+34
| | | | | | | | | | | | | | | | | 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>
* parser: Add "let" keyword (& T_LET)Robin Burchell2017-02-031-6/+22
| | | | | | | | | | | We also tie this up to the existing skeletal "const" support so that they are also checked for duplicate declarations. While we do that, change from using a boolean to an enum so we make the scope of a declaration a little more easily comprehensible. Change-Id: I6a6e08aed4e16a53690d6f6bafb55632807b6024 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix support for namespaced types in property/signal declarationsSimon Hausmann2016-11-301-14/+46
| | | | | | | | | | | | | | | | | | | | Declarations such as property Namespace.Item foo or property list<Namespace.Item> foo would get rejected by the grammar due to the lack of productions. This is now encapsulated in the UiPropertyType, which used to be merely an identifier but is now changed to produce a UiQualifiedId - the same type that's also used for MyNamespace.Item { ... } object declarations for example. Task-number: QTBUG-10822 Change-Id: Ic3ac1adbe17c83b24b67950c2f089e267b73b99b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix support for QML declared default list propertiesSimon Hausmann2016-11-231-0/+17
| | | | | | | | | | | | | | | | | The grammar was not permitting to write default property list<Item> myChildren; and instead developers had to work around it with an alias property list<Item> myChildrenData; default property alias myChildren: myChildrenData which is not nice. Fortunately this is easy to fix in the grammar. Task-number: QTBUG-10822 Change-Id: I4e914ddb9588913da09e9fb6c6aa154cf8a9e18f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix up QML grammar fileSimon Hausmann2016-11-231-14/+71
| | | | | | | | | | | | | | | Commit 45bd04ba73bd3e71c070e5724535ba87f6771323 changed the embedded license headers to the $LGPL tag but accidentally removed the header that is embedded in the output. In addition there have been changes to the generated code that were not reflected in the .g file. With these changes the qlalr output matches the files that are checked in. Change-Id: I693e20cf5237098425ba79182089d213179e6dfa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-221-1/+18
|\ | | | | | | Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
| * Fix up commit 9d7b27f5bf44a46707e6d50ebf51ecf73f91dd1bSimon Hausmann2016-01-161-1/+18
| | | | | | | | | | | | | | | | | | That commit changed qqmljsgrammar.cpp, which turns out to be a generated file. Therefore it's important to also make the modification to the original grammar file, to ensure that future re-generations of the file contain the new code. Change-Id: Id913b29e4a70bfa0c2786073c46dcc206c28b6ee Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-191-60/+21
|/ | | | | | | | | | | 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>
* Fix invocations of static methods of QGuiApplication/QCoreApplication.Friedemann Kleint2015-03-051-5/+5
| | | | | Change-Id: I7bcc209b0c6e77cf6d974af85a19487345a48975 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-21/+21
| | | | | | | | | 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>
* Fix syntax error when trying to declare read-only object propertiesSimon Hausmann2014-10-241-0/+25
| | | | | | | | | | | | | | | | | | | | The grammar did not allow for the declaration of readonly property QtObject foo: QtObject { ... } and it required a workaround through an alias: readonly property alias foo: _foo property QtObject _foo: QtObject { ... } This was merely a glitch in the grammar, I see no reason not to support this. The semantics are like a const pointer in C++, the property itself is read-only but the object pointed to has per-property defined read/write semantics. Task-number: QTBUG-41971 Change-Id: I99e2e7ed58731e387a38e46ec39922d280a21ceb Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix license headers in Qml grammar specificationSimon Hausmann2014-10-241-48/+42
| | | | | | | | | | The grammar file itself wasn't updated accordignly and the license headers that are embedded in the grammar that will be copied into the generated files were also oudated. Re-generating the parser would produce files with the wrong license headers. Change-Id: I1db83df8a9c4bddfb58901f41a4d40f6b1396507 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Revert commit d818575966e2e2000fe2b7ee390c620f595d9825Simon Hausmann2013-10-211-4/+0
| | | | | | | | | | | | This reverts the commit that deprecated the with statement and added a note to the docs that binding expressions will be compiled in strict mode in Qt 5.2. It turns out that we had to keep the with statement and enabling strict mode breaks just too much unfortunately. Change-Id: Id38c27f684fbfcb6b6b848be8f691658089d1adb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add Singleton support for QMLAntti Piira2013-09-211-10/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces Singleton support for QML (Composite Singleton). For now, the Singleton support is only availabe for QML types in modules or (remote and local) directories with qmldir file. However, in the future this support may be expanded to arbitrary QML file imports without by leaving out the qmldir requirement. You define a QML type as a Singleton with the following two steps: 1. By adding a pragma Singleton to a type's QML file: pragma Singleton The pragma and import statements can be mixed and their order does not matter. Singleton is the only supported pragma for now. Others will generate errors. 2. By specifying a qmldir file for the directory of your imported type and prepending the type with "singleton" keyword as follows: singleton TestTypeSingleton TestTypeSingleton.qml Alternatively you may specify a qmldir file for a module and specify your type as a singleton as follows: singleton TestTypeSingleton 1.0 TestTypeSingleton.qml Composite Singletons may be included in a module and may be used with a local namespace qualifier when imported with: "import xxx as NameSpace" A singleton instance is created at first use and stored into the QmlEngine (one instance per engine) and eventually released by the engine's destructor. CompositeSingletonType has a dual nature and will return true to both isComposite() and isSingleton() calls. In most cases its enough to check for just isComposite() or isSingleton(). However, there is a isCompositeSingleton() available as well. I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the qqmljsparser and qqmljsgrammar files from qqmljs.g. Unit tests are included. Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Fix invalid condition in comparisson.Erik Verbruggen2013-08-091-1/+1
| | | | | | | | | Thanks to clang (top-of-trunk) pointing out that the unary not operator only applies to the left-hand side of the equality expression. Change-Id: I093b447d55995a4122aeac042a506eb56f8b2442 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move the parser folder from src/qml/qml to src/qmlLars Knoll2013-08-081-0/+3063
Change-Id: I5e5684f5b98b00f791ade99c4cb6bc2ed880ad6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>