mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix parsing decimals
A number literal is a float if it contains ".", not if it is divisible by 1. For example, 1.0 should be considered a float literal.
This commit is contained in:
parent
c69a12096c
commit
883a136103
8 changed files with 24 additions and 6 deletions
|
@ -193,7 +193,10 @@ class XmlOutput(OutputFormat):
|
|||
elif isinstance(value, TypeLiteral):
|
||||
xml.put_text(value.type_name.glib_type_name)
|
||||
else:
|
||||
xml.put_text(value.value)
|
||||
if isinstance(value.value, float) and value.value == int(value.value):
|
||||
xml.put_text(int(value.value))
|
||||
else:
|
||||
xml.put_text(value.value)
|
||||
|
||||
def _emit_value(self, value: Value, xml: XmlEmitter):
|
||||
if isinstance(value.child, Literal):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue