Lua output fixes (#1811)

* encoder_lua: Handle explicitly positive infinity

* encoder_lua: Fix inclusion of pre-/suffix when prettyPrinted

It seems certain operations like --prettyPrint or subset selections does
not produce a DocumentNode, which is where the lua pre- and suffix was
printed, causing those to be omitted.

* encoder_lua: Improve Tag handling robustness

Using the method call seems more reliable in case the input parser
forgets to set the tag.
This commit is contained in:
Kim Alvefur
2023-10-12 11:25:26 +11:00
committed by GitHub
parent 610896e5ed
commit 7c78a15b23
4 changed files with 75 additions and 21 deletions
+4
View File
@@ -135,6 +135,8 @@ numbers:
- octal: 0o30
- float: 123.45
- infinity: .inf
plus_infinity: +.inf
minus_infinity: -.inf
- not: .nan
`,
expected: `return {
@@ -161,6 +163,8 @@ numbers:
},
{
["infinity"] = (1/0);
["plus_infinity"] = (1/0);
["minus_infinity"] = (-1/0);
},
{
["not"] = (0/0);