PeekableStream.st
changeset 16376 f96538a5ea67
parent 16375 340f80bcd892
child 16502 d80457997839
equal deleted inserted replaced
16375:340f80bcd892 16376:f96538a5ea67
   820 !
   820 !
   821 
   821 
   822 nextMatching:matchBlock1 thenMatching:matchBlock2
   822 nextMatching:matchBlock1 thenMatching:matchBlock2
   823     "read the next word. The first character must match matchBlock1,
   823     "read the next word. The first character must match matchBlock1,
   824      remaining characters must match matchBlock2.
   824      remaining characters must match matchBlock2.
   825      Return a string containing those characters."
   825      Return a string containing those characters.
       
   826      Useful to read identifiers, where the first char is from a different
       
   827      set than the remaining (letter vs. letterOrDigit)"
   826 
   828 
   827     |s c|
   829     |s c|
   828 
   830 
   829     self atEnd ifTrue:[^ nil].
   831     self atEnd ifTrue:[^ nil].
   830     (matchBlock1 value:self peek) ifFalse:[^ nil].
   832     (matchBlock1 value:self peek) ifFalse:[^ nil].
   897 ! !
   899 ! !
   898 
   900 
   899 !PeekableStream class methodsFor:'documentation'!
   901 !PeekableStream class methodsFor:'documentation'!
   900 
   902 
   901 version
   903 version
   902     ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.46 2014-04-18 19:14:56 cg Exp $'
   904     ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.47 2014-04-18 19:15:52 cg Exp $'
   903 !
   905 !
   904 
   906 
   905 version_CVS
   907 version_CVS
   906     ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.46 2014-04-18 19:14:56 cg Exp $'
   908     ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.47 2014-04-18 19:15:52 cg Exp $'
   907 ! !
   909 ! !
   908 
   910 
   909 
   911 
   910 PeekableStream initialize!
   912 PeekableStream initialize!