blob: 42cf7679a700ece0b95a4ad5366c2fd236ef1b7c [file] [log] [blame]
-------------------------------------------------------------------------------
-- Copyright (c) 2006-2013 Fabien Fleutot and others.
--
-- All rights reserved.
--
-- This program and the accompanying materials are made available
-- under the terms of the Eclipse Public License v1.0 which
-- accompanies this distribution, and is available at
-- http://www.eclipse.org/legal/epl-v10.html
--
-- This program and the accompanying materials are also made available
-- under the terms of the MIT public license which accompanies this
-- distribution, and is available at http://www.lua.org/license.html
--
-- Contributors:
-- Fabien Fleutot - API and implementation
--
-------------------------------------------------------------------------------
local function b(x, suffix)
local v, ontrue, onfalse = mlp.gensym "test", unpack (suffix)
return `Stat{
+{ block:
local -{v}
if -{x} then (-{v}) = -{ontrue} else (-{v}) = -{onfalse or `Nil} end },
v }
end
mlp.expr.suffix:add{ "?", mlp.expr, gg.onkeyword{ ",", mlp.expr }, prec=5, builder=b }