From 6e4a229a9626277cd2d99bc33024c576185c9329 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 4 Nov 2016 10:03:07 +0000 Subject: [PATCH] Add && + || as alternatives for AND + OR in SQL --- sql/scanner.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sql/scanner.go b/sql/scanner.go index 5430a029..f1cd7465 100644 --- a/sql/scanner.go +++ b/sql/scanner.go @@ -128,6 +128,22 @@ func (s *scanner) scan() (tok Token, lit string, val interface{}) { return NONECONTAINEDIN, string(ch), val case '#': return s.scanCommentSingle(ch) + case '|': + chn := s.next() + switch { + case chn == '|': + return OR, "OR", val + default: + s.undo() + } + case '&': + chn := s.next() + switch { + case chn == '&': + return AND, "AND", val + default: + s.undo() + } case '/': chn := s.next() switch {