mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix number parsing
This commit is contained in:
parent
e76bff9291
commit
4e2501c7d7
4 changed files with 19 additions and 1 deletions
|
@ -40,8 +40,9 @@ _tokens = [
|
|||
(TokenType.IDENT, r"[A-Za-z_][\d\w\-_]*"),
|
||||
(TokenType.QUOTED, r'"(\\"|[^"\n])*"'),
|
||||
(TokenType.QUOTED, r"'(\\'|[^'\n])*'"),
|
||||
(TokenType.NUMBER, r"[-+]?[\d_]+(\.[\d_]+)?"),
|
||||
(TokenType.NUMBER, r"0x[A-Fa-f0-9]+"),
|
||||
(TokenType.NUMBER, r"[-+]?[\d_]*\d(\.[\d_]*\d)?"),
|
||||
(TokenType.NUMBER, r"[-+]?\.[\d_]*\d"),
|
||||
(TokenType.WHITESPACE, r"\s+"),
|
||||
(TokenType.COMMENT, r"\/\*[\s\S]*?\*\/"),
|
||||
(TokenType.COMMENT, r"\/\/[^\n]*"),
|
||||
|
|
7
tests/samples/numbers.blp
Normal file
7
tests/samples/numbers.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Gtk.Label {
|
||||
xalign: .5;
|
||||
margin-end: 1_000_000;
|
||||
margin-top: 0x30;
|
||||
}
|
9
tests/samples/numbers.ui
Normal file
9
tests/samples/numbers.ui
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="margin-end">1000000</property>
|
||||
<property name="margin-top">48</property>
|
||||
</object>
|
||||
</interface>
|
|
@ -142,6 +142,7 @@ class TestSamples(unittest.TestCase):
|
|||
self.assert_sample("inline_menu")
|
||||
self.assert_sample("layout")
|
||||
self.assert_sample("menu")
|
||||
self.assert_sample("numbers")
|
||||
self.assert_sample("object_prop")
|
||||
self.assert_sample("parseable")
|
||||
self.assert_sample("property")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue