From cfbe645715114234510bda068d2f30ffbe208eae Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sat, 27 Aug 2022 18:11:10 +0100 Subject: Adds new filters - Begin terminals - End terminals - All terminals - Negate - AND --- main/lex.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'main/lex.go') diff --git a/main/lex.go b/main/lex.go index fdb3b59..91231ed 100644 --- a/main/lex.go +++ b/main/lex.go @@ -116,7 +116,13 @@ const ( TokenDot // . TokenAst // * TokenBar // | + TokenAnd // && + TokenHat // ^ + TokenDollar // $ TokenQuestion // ? + TokenHatDollar // ^$ + TokenExclamation // ! + TokenTilde // ~ TokenPatternStringIndex // A string index in a pattern TokenPatternIntegerIndex // An integer index in a pattern ) @@ -205,6 +211,27 @@ func lexCommand(l *lexer) stateFunc { case '}': l.emit(TokenRBrace) return lexCommandEnd + case '&': + if l.accept("&") { + l.emit(TokenAnd) + return lexCommand + } + case '^': + if l.accept("$") { + l.emit(TokenHatDollar) + } else { + l.emit(TokenHat) + } + return lexCommand + case '$': + l.emit(TokenDollar) + return lexCommand + case '!': + l.emit(TokenExclamation) + return lexCommand + case '~': + l.emit(TokenTilde) + return lexCommand } if isAlpha(r) { l.emit(TokenCommand) -- cgit v1.2.3