Skip to content

Commit

Permalink
hand/lexer: Add support for lexing tokens starting with '!'.
Browse files Browse the repository at this point in the history
  • Loading branch information
mewmew committed Feb 22, 2016
1 parent d82e219 commit 3ecddc7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions uc/hand/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ func (l *lexer) next() (r rune) {
// backup backs up one rune in the input. It can only be called once per call to
// next.
func (l *lexer) backup() {
if l.width == 0 {
panic("invalid call to backup; no matching call to next")
}
l.cur -= l.width
l.width = 0
}
Expand Down
2 changes: 2 additions & 0 deletions uc/hand/lexer/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ func lexToken(l *lexer) stateFn {
return lexAmpersand
case '\'':
return lexCharLit
case '!':
return lexExclaim
}

// Lex integer literal.
Expand Down

0 comments on commit 3ecddc7

Please sign in to comment.