From d489c3359b712be0d7c10dced97ea8c726d3586a Mon Sep 17 00:00:00 2001 From: ReFreezed Date: Sun, 16 May 2021 22:27:37 +0200 Subject: [PATCH] Updated changelog. --- Changelog.txt | 9 +++++++++ preprocess-cl.lua | 2 +- preprocess.lua | 16 ++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 0b53ef4..3745f79 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,15 @@ Changelog LuaPreprocess +v1.13.1 (2021-05-16) +Library: +- Dual code now supports multiple identifiers: !!x, y = ... +- Some non-ASCII characters in serialized strings look nicer. +- Added params.fastStrings . +- Fixed backtick strings not working in macros. +Command line program: +- Added --faststrings option. + v1.13 (2021-05-14) Library: - Added macros (in the form of '@insert func()' or '@@func()'). diff --git a/preprocess-cl.lua b/preprocess-cl.lua index 25cb4ab..d671b0a 100644 --- a/preprocess-cl.lua +++ b/preprocess-cl.lua @@ -314,7 +314,7 @@ for _, arg in ipairs(args) do elseif arg == "--silent" then silent = true - elseif arg == "--faststrings" then -- @Doc + elseif arg == "--faststrings" then fastStrings = true else diff --git a/preprocess.lua b/preprocess.lua index 15adb0e..123794f 100644 --- a/preprocess.lua +++ b/preprocess.lua @@ -118,7 +118,7 @@ -local PP_VERSION = "1.13.0" +local PP_VERSION = "1.13.1" local MAX_DUPLICATE_FILE_INSERTS = 1000 -- @Incomplete: Make this a parameter for processFile()/processString(). @@ -161,8 +161,6 @@ local ESCAPE_SEQUENCES = { local USELESS_TOKENS = {whitespace=true, comment=true} -local ERROR_UNFINISHED_VALUE = 1 - local major, minor = _VERSION:match"Lua (%d+)%.(%d+)" if not major then io.stderr:write("[LuaPreprocess] Warning: Could not detect Lua version.\n") @@ -397,6 +395,8 @@ end +local ERROR_UNFINISHED_STRINGLIKE = 1 + local function parseStringlike(s, ptr) local reprStart = ptr local reprEnd @@ -429,7 +429,7 @@ local function parseStringlike(s, ptr) local i1, i2 = s:find("%]"..longEqualSigns.."%]", ptr) if not i1 then - return nil, ERROR_UNFINISHED_VALUE + return nil, ERROR_UNFINISHED_STRINGLIKE end reprEnd = i2 @@ -559,7 +559,7 @@ function _tokenize(s, path, allowPpTokens, allowBacktickStrings, allowJitSyntax) tok, ptr = parseStringlike(s, ptr) if not tok then local errCode = ptr - if errCode == ERROR_UNFINISHED_VALUE then + if errCode == ERROR_UNFINISHED_STRINGLIKE then errorInFile(s, path, reprStart, "Tokenizer", "Unfinished long comment.") else errorInFile(s, path, reprStart, "Tokenizer", "Invalid comment.") @@ -642,7 +642,7 @@ function _tokenize(s, path, allowPpTokens, allowBacktickStrings, allowJitSyntax) tok, ptr = parseStringlike(s, ptr) if not tok then local errCode = ptr - if errCode == ERROR_UNFINISHED_VALUE then + if errCode == ERROR_UNFINISHED_STRINGLIKE then errorInFile(s, path, reprStart, "Tokenizer", "Unfinished long string.") else errorInFile(s, path, reprStart, "Tokenizer", "Invalid long string.") @@ -2749,7 +2749,7 @@ local pp = { -- backtickStrings = boolean -- [Optional] Enable the backtick (`) to be used as string literal delimiters. Backtick strings don't interpret any escape sequences and can't contain other backticks. (Default: false) -- jitSyntax = boolean -- [Optional] Allow LuaJIT-specific syntax. (Default: false) -- canOutputNil = boolean -- [Optional] Allow !() and outputValue() to output nil. (Default: true) - -- fastStrings = boolean -- [Optional] Force fast serialization of string values. (Non-ASCII characters will look ugly.) (Default: false) @Doc + -- fastStrings = boolean -- [Optional] Force fast serialization of string values. (Non-ASCII characters will look ugly.) (Default: false) -- validate = boolean -- [Optional] Validate output. (Default: true) -- -- onInsert = function( name ) -- [Optional] Called for each @insert"name" statement. It's expected to return a Lua code string. By default 'name' is a path to a file to be inserted. @@ -2775,7 +2775,7 @@ local pp = { -- backtickStrings = boolean -- [Optional] Enable the backtick (`) to be used as string literal delimiters. Backtick strings don't interpret any escape sequences and can't contain other backticks. (Default: false) -- jitSyntax = boolean -- [Optional] Allow LuaJIT-specific syntax. (Default: false) -- canOutputNil = boolean -- [Optional] Allow !() and outputValue() to output nil. (Default: true) - -- fastStrings = boolean -- [Optional] Force fast serialization of string values. (Non-ASCII characters will look ugly.) (Default: false) @Doc + -- fastStrings = boolean -- [Optional] Force fast serialization of string values. (Non-ASCII characters will look ugly.) (Default: false) -- validate = boolean -- [Optional] Validate output. (Default: true) -- -- onInsert = function( name ) -- [Optional] Called for each @insert"name" statement. It's expected to return a Lua code string. By default 'name' is a path to a file to be inserted.