From 094c9a8921fb5f54a34d8cdcb924b5dbacd336d8 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Fri, 26 Aug 2022 18:15:56 +0100 Subject: Adds a bunch of new path pattern features - Bracketting in expressions - OR with | - Optional with ? --- main/lex.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'main/lex.go') diff --git a/main/lex.go b/main/lex.go index 6977f8a..fdb3b59 100644 --- a/main/lex.go +++ b/main/lex.go @@ -115,6 +115,8 @@ const ( TokenAt // @ TokenDot // . TokenAst // * + TokenBar // | + TokenQuestion // ? TokenPatternStringIndex // A string index in a pattern TokenPatternIntegerIndex // An integer index in a pattern ) @@ -185,6 +187,18 @@ func lexCommand(l *lexer) stateFunc { case '*': l.emit(TokenAst) return lexCommand + case '|': + l.emit(TokenBar) + return lexCommand + case '(': + l.emit(TokenLParen) + return lexCommand + case ')': + l.emit(TokenRParen) + return lexCommand + case '?': + l.emit(TokenQuestion) + return lexCommand case '{': l.emit(TokenLBrace) return lexCommand -- cgit v1.2.3