mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
tokenizer: Fix multiline comment regex
This commit is contained in:
parent
7cab7da4bb
commit
3804d91118
4 changed files with 26 additions and 1 deletions
|
@ -57,7 +57,7 @@ _tokens = [
|
|||
(TokenType.CLOSE_BLOCK, r"\}"),
|
||||
(TokenType.STMT_END, r";"),
|
||||
(TokenType.WHITESPACE, r"\s+"),
|
||||
(TokenType.COMMENT, r"/\*[\s\S]*\*/"),
|
||||
(TokenType.COMMENT, r"\/\*[\s\S]*?\*\/"),
|
||||
(TokenType.COMMENT, r"\/\/[^\n]*"),
|
||||
(TokenType.OPEN_BRACKET, r"\["),
|
||||
(TokenType.CLOSE_BRACKET, r"\]"),
|
||||
|
|
15
tests/samples/comments.blp
Normal file
15
tests/samples/comments.blp
Normal file
|
@ -0,0 +1,15 @@
|
|||
using Gtk 4.0;
|
||||
using GObject 2.0;
|
||||
|
||||
GObject.Object {
|
||||
/* multiline-style comment 1 */
|
||||
}
|
||||
|
||||
Gtk.Label {
|
||||
/* Translators: multiline-style comment 2 */
|
||||
label: _("Test"); // single-line comment
|
||||
/**/ visible: false; /**/
|
||||
}
|
||||
|
||||
/* Note: The output XML does not need to contain translator comments. The
|
||||
translation tooling reads blueprint files, not the generated files. */
|
9
tests/samples/comments.ui
Normal file
9
tests/samples/comments.ui
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GObject"></object>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="true">Test</property>
|
||||
<property name="visible">false</property>
|
||||
</object>
|
||||
</interface>
|
|
@ -96,6 +96,7 @@ class TestSamples(unittest.TestCase):
|
|||
self.assert_sample("binding")
|
||||
self.assert_sample("child_type")
|
||||
self.assert_sample("combo_box_text")
|
||||
self.assert_sample("comments")
|
||||
self.assert_sample("enum")
|
||||
self.assert_sample("file_filter")
|
||||
self.assert_sample("flags")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue