diff options
| author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-20 12:05:39 +0100 | 
|---|---|---|
| committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-20 12:05:39 +0100 | 
| commit | e2774a2ca2d58d4dd507b210d4a62a23a538e833 (patch) | |
| tree | 4341ba920ebf1d1893a73d37f613bc772c331f73 /main/lex.go | |
| parent | c1c33227ab72de1e5f21a08ee74c3df667148343 (diff) | |
| download | stred-go-e2774a2ca2d58d4dd507b210d4a62a23a538e833.tar | |
Adds a substitute path command: S
Diffstat (limited to 'main/lex.go')
| -rw-r--r-- | main/lex.go | 31 | 
1 files changed, 1 insertions, 30 deletions
| diff --git a/main/lex.go b/main/lex.go index e93e42a..2826b1e 100644 --- a/main/lex.go +++ b/main/lex.go @@ -113,39 +113,10 @@ type TokenType int  const (  	TokenErr TokenType = iota // Lexing error  	TokenEOF // end of file -	TokenLParen // ( -	TokenRParen // )  	TokenLBrace // {  	TokenRBrace // } -	TokenLBrack // [ -	TokenRBrack // ]  	TokenCommand // A command character -	TokenHash // # -	TokenAt // @ -	TokenDot // . -	TokenAst // * -	TokenBar // | -	TokenOr // || -	TokenAnd // && -	TokenHat // ^ -	TokenDollar // $ -	TokenQuestion // ? -	TokenHatDollar // ^$ -	TokenExclamation // ! -	TokenTilde // ~ -	TokenDoubleQuote // " -	TokenStringLiteral // A string literal, not including the " either side -	TokenNullLiteral // null -	TokenTrueLiteral // true -	TokenFalseLiteral // false -	TokenColon // : -	TokenComma // ,  	TokenSubstituteDelimiter // usually / but could be something else -	TokenSubstitutePlaceholder // \1, \2 etc. -	TokenTerminalLiteral // One of {, }, [, ] -	TokenNumberLiteral // A number literal -	TokenPatternStringIndex // A string index in a pattern -	TokenPatternIntegerIndex // An integer index in a pattern  	TokenSubex // A subex  ) @@ -208,7 +179,7 @@ func lexCommand(l *lexer) stateFunc {  		case '}':  			l.emit(TokenRBrace)  			return lexCommand -		case 's': +		case 's', 'S':  			l.emit(TokenCommand)  			return lexSubstitution  	} | 
