<- 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.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/lex.go b/main/lex.go
index f28244d..198c346 100644
--- a/main/lex.go
+++ b/main/lex.go
@@ -118,6 +118,7 @@ const (
TokenCommand // A command character
TokenSubstituteDelimiter // usually / but could be something else
TokenSubex // A subex
+ TokenLabel // A label
)
type Token struct {
@@ -182,6 +183,9 @@ func lexCommand(l *lexer) stateFunc {
case 's', 'S', 'f', 'F', 'l', 'L', 'a', 'A':
l.emit(TokenCommand)
return lexSubstitution
+ case ':', 'b':
+ l.emit(TokenCommand)
+ return lexLabel
}
if isAlpha(r) {
l.emit(TokenCommand)
@@ -212,3 +216,9 @@ func lexSubstitution(l *lexer) stateFunc {
}
return lexCommand
}
+
+func lexLabel(l *lexer) stateFunc {
+ l.next()
+ l.emit(TokenLabel)
+ return lexCommand
+}