1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 01:55:24 +02:00
cdt/qt/org.eclipse.cdt.qt.qml.core/QML.g4
Doug Schaefer 00b591ae89 Start of QML parser.
Change-Id: I434e0267371a8b6e353c59b22d3b32832d842192
2015-07-17 09:59:13 -04:00

50 lines
No EOL
763 B
ANTLR

grammar QML;
import ECMAScript;
qmlProgram
: qmlHeaderItem* qmlObjectRoot EOF
;
qmlHeaderItem
: qmlImportDeclaration
| qmlPragmaDeclaration
;
qmlImportDeclaration
: 'import' qmlQualifiedId DecimalLiteral ('as' Identifier)? ';'?
| 'import' StringLiteral DecimalLiteral? ('as' Identifier)? ';'?
;
qmlQualifiedId
: Identifier ('.' Identifier)*
;
qmlPragmaDeclaration
: 'pragma' Identifier ';'?
;
qmlObjectRoot
: qmlObjectLiteral?
;
qmlObjectLiteral
: qmlQualifiedId qmlMembers
;
qmlMembers
: '{' qmlMember* '}'
;
qmlMember
: qmlQualifiedId ':' singleExpression
| qmlObjectLiteral
| 'readonly'? 'property' qmlPropertyType Identifier (':' singleExpression)?
| functionDeclaration
;
qmlPropertyType
: Identifier // TODO
| 'var'
;