Commit Graph

16 Commits

Author SHA1 Message Date
Kim Alvefur
11605f6b63 Respect string Style in Lua encoder
Lua has 'single', "double" and [[ long ]] strings.
2023-08-05 17:28:31 +02:00
Kim Alvefur
0debfc3cf9 Implement indentation in in Lua output 2023-08-05 17:28:21 +02:00
Kim Alvefur
ba90b795da Convert octal for Lua output
Lua doesn't have the 0oNNN syntax for octal integers, only decimal and
hexadecimal, hence those can be passed trough as is while octal needs
special treatment.
2023-08-05 17:08:38 +02:00
Kim Alvefur
58d14f7ea9 Return error instead of panic in Lua encoder 2023-08-05 17:08:38 +02:00
Kim Alvefur
f544580692 Add note about how Lua nil is unsuitable as table key
Could add some context tracking in the future to allow rejecting nil in
a table key context.
2023-08-05 17:08:38 +02:00
Kim Alvefur
5b7c00aa62 Reject unhandled scalar Tags in Lua encoder 2023-08-05 17:08:38 +02:00
Kim Alvefur
7830940a9a Handle special-case numbers in Lua encoder 2023-08-05 17:08:38 +02:00
Kim Alvefur
32277e2c7c Handle YAML case varied booleans in Lua encoder 2023-08-05 17:08:38 +02:00
Kim Alvefur
1ff44c5d52 Panic on unhandled YAML Kind in Lua encoder 2023-08-05 17:08:38 +02:00
Kim Alvefur
03560a3d84 Allow special characters in Lua prefix and suffix
--lua-suffix='});^M' didn't work, so taking this approach instead
2023-08-05 17:08:38 +02:00
Kim Alvefur
c4de13e874 Hook up settings for Lua output 2023-08-05 17:08:38 +02:00
Kim Alvefur
cabb73b12c Make output of unquoted Lua table keys optional
Generally safer and simpler to not do it.
2023-08-05 17:08:38 +02:00
Kim Alvefur
c8919f20da Quote Lua keywords in table keys
Keywords are not valid as unquoted keys, thus must be quoted
2023-08-05 17:08:38 +02:00
Kim Alvefur
21fda2eb3d Print simple keys unquoted in Lua output
String keys that satisfy the requirements for variable names can be used
as keys without quotes in tables.
2023-08-05 17:08:38 +02:00
Kim Alvefur
21c64fa945 Escape larger set of characters in Lua output
Started with a minimum of replacements, this should be more complete,
tho not all substitutions are strictly required in Lua.
2023-08-05 17:08:38 +02:00
Kim Alvefur
07b53fca7d Implement basic Lua output support
Ref #1700

Basic but working serialization to Lua tables.
2023-08-05 17:08:38 +02:00