diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2022-08-26 18:15:56 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2022-08-26 18:15:56 +0100 |
commit | 094c9a8921fb5f54a34d8cdcb924b5dbacd336d8 (patch) | |
tree | 1ceb06246b2d5bd196746de7f300bdfe32a4a18a /main/lex.go | |
parent | ce5c224211a94bfd4c898b51d15febdf2ed9d6f2 (diff) | |
download | stred-go-094c9a8921fb5f54a34d8cdcb924b5dbacd336d8.tar |
Adds a bunch of new path pattern features
- Bracketting in expressions
- OR with |
- Optional with ?
Diffstat (limited to 'main/lex.go')
-rw-r--r-- | main/lex.go | 14 |
1 files changed, 14 insertions, 0 deletions
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 |