<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/main/lex.go
diff options
context:
space:
mode:
Diffstat (limited to 'main/lex.go')
-rw-r--r--main/lex.go27
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)