Class new title: Reader subclassof: Object fields: 'source collector token nextchar typetbl ' declare: 'typetable ' classInit | t1 t2 t3 t4 t5 [typetable _ String new: 256. t1 _ Stream new of: (5 0 255 1 65 90 1 97 122 2 48 57 3 58 58 3 3 3 4 9 10 4 12 13 4 32 32 6 34 34 6 25 25 7 39 39 8 21 21 9 26 26 10 30 30 11 40 41 ). while [t2 _ t1 next. t2] do [t3 _ t1 next. t4 _ t1 next. for t5 from: (t3 + 1 to: t4 + 1) do [typetable  t5 _ t2]]] of: t1 [typetbl _ typetable. token _ Stream default. source _ t1 asStream. self step] rdint: t1 [token reset. [nextchar = t1  [token next_ t1. self step]]. while nextchar do [nextchar < 48  [token contents] [nextchar > 57  [nextchar > 72  [token contents] nextchar < 65  [token contents] token next_ nextchar. nextchar _ source next]]. token next_ nextchar. nextchar _ source next]. token contents] read [self readInto: TokenCollector default] readInto: t1 | t2 [collector _ t1. while nextchar do [t2 _ typetbl  (nextchar + 1). t2 = 4  [collector separator: nextchar. nextchar _ source next] t2 = 1  [self readatom: 0] t2 = 5  [collector onechar: nextchar. nextchar _ source next] t2 = 6  [self upto: nextchar  [collector notify: 'Unmatched comment quote'] collector comment: token contents] t2 = 2  [self readnum] t2 = 11  [[nextchar = 40  [collector leftparen] collector rightparen]. nextchar _ source next] t2 = 7  [self upto: nextchar  [collector notify: 'Unmatched string quote'] collector string: token contents] t2 = 8  [self readnum] t2 = 9  [self upto: 13  [collector notify: '^Z without CR'] collector trailer: token contents] t2 = 10  [collector contents] t2 = 3  [self readatom: 1]]. collector contents] readatom: t1 | t2 t3 t4 [token reset. while [token next_ nextchar. nextchar _ source next. nextchar and [t2 _ typetbl  (nextchar + 1). t2  3]] do [t2 = 3  [t1 _ t1 + 1]]. t3 _ token contents. t1 = 0  [collector identifier: t3] t1 > 1  [collector otheratom: t3] t3 length = 1  [collector otheratom: t3] t4 _ t3  t3 length. t4 = 58  [collector keyword: t3] t4 = 3  [collector keyword: t3] collector otheratom: t3] readnum | t1 t2 t3 [t1 _ self rdint: 21. nextchar = 46  [self step. nextchar  false or nextchar isdigit  false  [collector integer: t1. collector onechar: 46] t2 _ self rdint: 1. [nextchar = 101  [self step. t3 _ self rdint: 21] t3 _ '']. collector float: t1 fraction: t2 exp: t3] collector integer: t1] step [nextchar _ source next] upto: t1 | t2 [t2 _ source position. token reset. while [nextchar _ source next. nextchar] do [[nextchar = t1  [self step. t1  39  [false] nextchar  39  [false]]]. token next_ nextchar]. source skip: t2 - 1 - source position. true]