From 7ca975a8d286a7483f7d372ccaec60c9976c2c8d Mon Sep 17 00:00:00 2001 From: Vlastimil Slintak Date: Tue, 3 Jul 2018 09:23:22 +0200 Subject: [PATCH] Support for binary AND and OR operators. --- minify.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/minify.lua b/minify.lua index 6401f70..f867cf3 100644 --- a/minify.lua +++ b/minify.lua @@ -151,7 +151,7 @@ local Digits = lookupify{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} local HexDigits = lookupify{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'a', 'B', 'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f'} -local Symbols = lookupify{'+', '-', '*', '/', '^', '%', ',', '{', '}', '[', ']', '(', ')', ';', '#', '.', ':'} +local Symbols = lookupify{'+', '-', '*', '/', '^', '%', ',', '{', '}', '[', ']', '(', ')', ';', '#', '.', ':', '|', '&'} local EqualSymbols = lookupify{'~', '=', '>', '<'} @@ -170,7 +170,7 @@ local BinopSet = lookupify{ '+', '-', '*', '/', '%', '^', '#', '..', '.', ':', '>', '<', '<=', '>=', '~=', '==', - 'and', 'or' + 'and', 'or', '&', '|' } local GlobalRenameIgnore = lookupify{ @@ -192,7 +192,9 @@ local BinaryPriority = { ['>='] = {3, 3}; ['<='] = {3, 3}; ['and'] = {2, 2}; + ['&'] = {2, 2}; ['or'] = {1, 1}; + ['|'] = {1, 1}; } local UnaryPriority = 8