func lexCheckOrElse(checkTypes []checkType, elseTyp Type) stateFunc {
	return func(t *Tokeniser) stateFunc {
		for _, ct := range checkTypes {
			w, ok := t.checkWord(ct.pattern)
			if ok {
				t.advance(w)
				t.emit(ct.typ)
				return lexCode
			}
		}
		return lexAndEmit(elseTyp)
	}
}
// lexCheckOrElse checks for patterns sequentially via checkTypes, if the runes
// next has the same pattern, scan that pattern and emit a token of that type
// Otherwise fallback emiting the next rune as elseTyp
lexCheckOrElse checks for patterns sequentially via checkTypes, if the runes
next has the same pattern, scan that pattern and emit a token of that type
Otherwise fallback emiting the next rune as elseTyp
// lexCheckOrElse checks for patterns sequentially via checkTypes if the runes // next has the same pattern scan that pattern and emit a token of that type // Otherwise fallback emiting the next rune as elseTyp
func lexCheckOrElse(checkTypes []checkType, elseTyp Type) stateFunc {
	return func(t *Tokeniser) stateFunc {
		for _, ct := range checkTypes {
			w, ok := t.checkWord(ct.pattern)
			if ok {
				t.advance(w)
				t.emit(ct.typ)
				return lexCode
			}
		}
		return lexAndEmit(elseTyp)
	}
}
func lexCheckOrElse ( checkTypes [ ] checkType , elseTyp Type ) stateFunc { return func ( t * Tokeniser ) stateFunc { for _ , ct := range checkTypes { w , ok := t . checkWord ( ct . pattern ) if ok { t . advance ( w ) t . emit ( ct . typ ) return lexCode } } return lexAndEmit ( elseTyp ) } }
lexCheckOrElse checks for patterns sequentially via checkTypes, if the runes
next has the same pattern, scan that pattern and emit a token of that type
Otherwise fallback emiting the next rune as elseTyp
lexCheckOrElse checks for patterns sequentially via checkTypes if the runes next has the same pattern scan that pattern and emit a token of that type Otherwise fallback emiting the next rune as elseTyp