diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2022-08-27 18:11:10 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2022-08-27 18:11:10 +0100 |
commit | cfbe645715114234510bda068d2f30ffbe208eae (patch) | |
tree | c8be19865a676c7bd53bd121c3f5a2be43206a7e /main/lex.go | |
parent | 094c9a8921fb5f54a34d8cdcb924b5dbacd336d8 (diff) | |
download | stred-go-cfbe645715114234510bda068d2f30ffbe208eae.tar |
Adds new filters
- Begin terminals
- End terminals
- All terminals
- Negate
- AND
Diffstat (limited to 'main/lex.go')
-rw-r--r-- | main/lex.go | 27 |
1 files changed, 27 insertions, 0 deletions
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) |