@@ -1489,7 +1489,7 @@ local function _processFileOrString(params, isFile)
14891489
14901490 -- Check if the rest of the line is an expression.
14911491 if true then
1492- local lastUsableToken , lastUsableIndex = getNextUsableToken (tokens , metaLineIndexEnd + 1 , 1 , - 1 )
1492+ local lastUsableToken , lastUsableIndex = getNextUsableToken (tokens , metaLineIndexEnd , 1 , - 1 )
14931493 local parts = {}
14941494
14951495 table.insert (parts , " return (" )
@@ -1509,6 +1509,11 @@ local function _processFileOrString(params, isFile)
15091509 end
15101510
15111511 -- Output.
1512+ local s = metaParts [# metaParts ]
1513+ if s and s :sub (# s ) ~= " \n " then
1514+ table.insert (metaParts , " \n " )
1515+ end
1516+
15121517 if isDebug then
15131518 table.insert (metaParts , ' __LUA("' )
15141519
@@ -1548,7 +1553,23 @@ local function _processFileOrString(params, isFile)
15481553
15491554 while true do
15501555 local tok = tokens [tokenIndex ]
1551- if not tok then return end
1556+
1557+ if not tok then
1558+ if bracketBalance ~= 0 then
1559+ errorInFile (
1560+ luaUnprocessed , pathIn , # luaUnprocessed , " Parser" ,
1561+ " Unexpected end-of-data. Preprocessor line"
1562+ .. (tokens [tokenIndex - 1 ].line == metaStartLine and " " or " (starting at line %d)" )
1563+ .. " has unbalanced brackets." ,
1564+ metaStartLine
1565+ )
1566+
1567+ elseif isDual then
1568+ outputFinalDualValueStatement (metaLineIndexStart , tokenIndex - 1 )
1569+ end
1570+
1571+ return
1572+ end
15521573
15531574 local tokType = tok .type
15541575 if
0 commit comments