diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-02-16 11:28:33 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-02-22 11:00:19 +0100 |
commit | bdb2bb561054ad7e95ced2f4b79533d13000172b (patch) | |
tree | 8cf445d89c335bd13ca21720c87aa5bc69271ece /src/qml/parser/qqmljs.g | |
parent | 763dad999dc5bf6109158283c9dc6b396a4e75f6 (diff) |
QML: Allow pragmas with multiple values
This will be needed in follow-up changes.
Task-number: QTBUG-94807
Change-Id: I6243ea31290251c30dd0aceaae878568bc1c0525
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/parser/qqmljs.g')
-rw-r--r-- | src/qml/parser/qqmljs.g | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index 394edf0fed..13c54d387b 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -217,6 +217,7 @@ public: AST::UiProgram *UiProgram; AST::UiHeaderItemList *UiHeaderItemList; + AST::UiPragmaValueList *UiPragmaValueList; AST::UiPragma *UiPragma; AST::UiImport *UiImport; AST::UiParameterList *UiParameterList; @@ -717,10 +718,31 @@ UiHeaderItemList: UiHeaderItemList UiImport; ./ PragmaId: JsIdentifier; +PragmaValue: JsIdentifier; Semicolon: T_AUTOMATIC_SEMICOLON; Semicolon: T_SEMICOLON; +UiPragmaValueList: PragmaValue; +/. + case $rule_number: { + AST::UiPragmaValueList *list + = new (pool) AST::UiPragmaValueList(stringRef(1)); + list->location = loc(1); + sym(1).Node = list; + } break; +./ + +UiPragmaValueList: UiPragmaValueList T_COMMA PragmaValue; +/. + case $rule_number: { + AST::UiPragmaValueList *list + = new (pool) AST::UiPragmaValueList(sym(1).UiPragmaValueList, stringRef(3)); + list->location = loc(3); + sym(1).Node = list; + } break; +./ + UiPragma: T_PRAGMA PragmaId Semicolon; /. case $rule_number: { @@ -731,10 +753,11 @@ UiPragma: T_PRAGMA PragmaId Semicolon; } break; ./ -UiPragma: T_PRAGMA PragmaId T_COLON JsIdentifier Semicolon; +UiPragma: T_PRAGMA PragmaId T_COLON UiPragmaValueList Semicolon; /. case $rule_number: { - AST::UiPragma *pragma = new (pool) AST::UiPragma(stringRef(2), stringRef(4)); + AST::UiPragma *pragma = new (pool) AST::UiPragma( + stringRef(2), sym(4).UiPragmaValueList->finish()); pragma->pragmaToken = loc(1); pragma->semicolonToken = loc(5); sym(1).Node = pragma; |