remove type lexing, which wasn't a thing

I had this idea that there would be an optional type system but
@cardamaro talked me out of it.  There's an off chance that something
like it will come back, but I wouldn't count on it.  It doesn't seem
that pressing right now.
master
Jordan Orelli 10 years ago
parent c29ff7de6a
commit bdf11713ea

@ -23,8 +23,6 @@ func (t tokenType) String() string {
return "t_string" return "t_string"
case t_name: case t_name:
return "t_name" return "t_name"
case t_type:
return "t_type"
case t_comment: case t_comment:
return "t_comment" return "t_comment"
case t_list_start: case t_list_start:
@ -51,7 +49,6 @@ const (
t_eof // end of file token t_eof // end of file token
t_string // a string literal t_string // a string literal
t_name // a name t_name // a name
t_type // a type
t_comment // a comment t_comment // a comment
t_list_start // [ t_list_start // [
t_list_end // ] t_list_end // ]
@ -225,12 +222,9 @@ func lexRoot(l *lexer) stateFn {
return lexNumber return lexNumber
case unicode.IsSpace(r): case unicode.IsSpace(r):
return lexRoot return lexRoot
case unicode.IsLower(r): case unicode.IsLower(r), unicode.IsUpper(r):
l.keep(r) l.keep(r)
return lexName return lexName
case unicode.IsUpper(r):
l.keep(r)
return lexType
default: default:
return lexErrorf("unexpected rune in lexRoot: %c", r) return lexErrorf("unexpected rune in lexRoot: %c", r)
} }
@ -303,22 +297,6 @@ func lexName(l *lexer) stateFn {
} }
} }
func lexType(l *lexer) stateFn {
r := l.next()
switch {
case unicode.IsLetter(r), unicode.IsDigit(r), r == '_':
l.keep(r)
return lexType
case r == eof:
l.emit(t_type)
return nil
default:
l.emit(t_type)
l.unread(r)
return lexRoot
}
}
func lexNumber(l *lexer) stateFn { func lexNumber(l *lexer) stateFn {
l.accept("+-") l.accept("+-")
digits := "0123456789" digits := "0123456789"

Loading…
Cancel
Save