Still working on standards.
This commit is contained in:
@@ -84,12 +84,38 @@ function interpret(content,uri,chain)
|
||||
current:insert(words,consumeExpression())
|
||||
end
|
||||
end
|
||||
local singleLineCommentPattern = "//"
|
||||
local function singleLineCommentMeal(current)
|
||||
return function(words,_)
|
||||
current:insert(words) -- Consume what was left
|
||||
consumer:consume({
|
||||
["[\n\r]"] = function() end
|
||||
})
|
||||
end
|
||||
end
|
||||
local multiLineCommentPattern = "/%*"
|
||||
local function multiLineCommentMeal(current)
|
||||
return function(words,_) -- consume what was left
|
||||
current:insert(words)
|
||||
consumer:consume({
|
||||
["%*/"] = function() end
|
||||
})
|
||||
end
|
||||
end
|
||||
local colonSyntaxPattern = ":"
|
||||
local function colonSyntaxMeal(current)
|
||||
return function(words,_)
|
||||
current:insert(words,consumeColonExpression())
|
||||
end
|
||||
end
|
||||
function consumeBlock()
|
||||
local expressions = {}
|
||||
local current = expression()
|
||||
local loop = true
|
||||
while loop do
|
||||
local expr = consumer:consume({
|
||||
[multiLineCommentPattern] = multiLineCommentMeal(current),
|
||||
[singleLineCommentPattern] = singleLineCommentMeal(current),
|
||||
[uriOpenPattern] = URIMeal(current,uriClosePattern),
|
||||
[expressionOpenPattern] = expressionMeal(current),
|
||||
[multiLineStringOpenPattern] =
|
||||
@@ -99,16 +125,24 @@ function interpret(content,uri,chain)
|
||||
singleLineStringMeal(
|
||||
current,singleLineStringPattern),
|
||||
[blockDelimiterPattern] = function(words,_)
|
||||
current:insert(words)
|
||||
if current:empty() then
|
||||
error("Extravenous semicolon.")
|
||||
--error("Extravenous semicolon.")
|
||||
else
|
||||
table.insert(expressions,current)
|
||||
end
|
||||
table.insert(expressions,current)
|
||||
current = expression()
|
||||
end,
|
||||
[blockClosePattern] = function(words,_)
|
||||
current:insert(words)
|
||||
loop = false
|
||||
end
|
||||
end,
|
||||
[blockOpenPattern] = function(words,_)
|
||||
current:insert(
|
||||
words,
|
||||
consumeBlock()
|
||||
)
|
||||
end,
|
||||
})
|
||||
end
|
||||
if #current.items ~= 0 then
|
||||
@@ -124,6 +158,8 @@ function interpret(content,uri,chain)
|
||||
while loop do
|
||||
local remaining = consumer:remaining()
|
||||
local expr = consumer:consume({
|
||||
[multiLineCommentPattern] = multiLineCommentMeal(current),
|
||||
[singleLineCommentPattern] = singleLineCommentMeal(current),
|
||||
[uriOpenPattern] = URIMeal(current,uriClosePattern),
|
||||
[expressionOpenPattern] = expressionMeal(current),
|
||||
[multiLineStringOpenPattern] =
|
||||
|
||||
Reference in New Issue
Block a user