mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-21 23:19:24 -04:00
Blueprint allows both `//` and `/*...*/` style comments, but if a project prefers only `/*...*/` comments, it is currently not possible to have these inline. Therefore, treat these comments equal if they occur inline. To make this easier to understand, we refactor the comment handling slightly to first handle single-line comment whitespace, and then handle newlines for both single-line and multi-line style comments. Adjust the test accordingly to make sure this works.
69 lines
935 B
Text
69 lines
935 B
Text
using Gtk 4.0;
|
|
using Adw 1;
|
|
|
|
template $MyTemplate: Label {
|
|
/**
|
|
* A list of strings.
|
|
*/
|
|
StringList {
|
|
// comment
|
|
strings [
|
|
"Hello",
|
|
C_("Greeting", "World"),
|
|
]
|
|
}
|
|
|
|
object: Button {
|
|
label: "Click me";
|
|
};
|
|
|
|
flags: a | b;
|
|
|
|
[child]
|
|
Label {}
|
|
|
|
[child]
|
|
Label label2 {}
|
|
|
|
// Single line comment.
|
|
|
|
/**
|
|
* Multiline comment.
|
|
*/
|
|
// Single line comment.
|
|
value: bind (1.0) as <double>;
|
|
as: 1;
|
|
signal => $on_signal() after; // Inline comment
|
|
type_value: typeof<$MyTemplate>;
|
|
}
|
|
|
|
Dialog {
|
|
[action response=ok]
|
|
$MyButton {}
|
|
}
|
|
|
|
menu menu {
|
|
item ("test")
|
|
|
|
item {
|
|
label: "test"; /* Different inline comment style */
|
|
}
|
|
|
|
item ("test")
|
|
}
|
|
|
|
Adw.MessageDialog {
|
|
responses [
|
|
save: "Save" suggested disabled,
|
|
]
|
|
}
|
|
|
|
Adw.Breakpoint {
|
|
condition ("width < 100")
|
|
|
|
setters {
|
|
label2.label: _("Hello, world!");
|
|
label2.visible: false;
|
|
label2.extra-menu: null;
|
|
}
|
|
}
|