diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-21 14:13:24 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-21 14:13:24 -0700 |
| commit | e478b33d7abba5933ddfcc60558585b58b898bff (patch) | |
| tree | 6238bf612439c305fe443ac98e2a91c92004f0e5 /lib/operators.nom | |
| parent | 4fd6b61a0074ea69f0ce3e11768e867d355307ac (diff) | |
Tidying up.
Diffstat (limited to 'lib/operators.nom')
| -rw-r--r-- | lib/operators.nom | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/operators.nom b/lib/operators.nom index 3f2336f..67383fa 100644 --- a/lib/operators.nom +++ b/lib/operators.nom @@ -74,12 +74,12 @@ macro [%a != %b] =: ".."|(not compiler.utils.equivalent(\%a as lua\, \%b as lua\ # Commutative Operators defined for up to 8 operands # TODO: work out solution for commutative operators using more clever macros lua block ".." - |local function make_comops() + |local function make_comops(max_operands) |local comops = {"+","*","and","or"} |for _,_op in ipairs(comops) do | local op = _op | local spec = "%1 "..op.." %2" - | for n=3,8 do + | for n=3,max_operands do | spec = spec .." "..op.." %"..tostring(n) | compiler:defmacro(spec, (function(compiler, vars, kind) | local bits = {} @@ -91,9 +91,9 @@ lua block ".." | end |end |end - |make_comops() + |make_comops(8) -# Chained compairsions (e.g. x < y <= z < w) are defined up to 3 operands +# Chained compairsions (e.g. x < y <= z) are defined up to 3 operands lua block ".." |local function chained_comparisons(max_operands) |for _,chainers in ipairs({{"<","<="},{">",">="}}) do |
