Exemplo n.º 1
0
 def testStream(self):
     stream = InputStream("abcde")
     self.assertEqual(0, stream.index)
     self.assertEqual(5, stream.size)
     self.assertEqual(ord("a"), stream.LA(1))
     stream.consume()
     self.assertEqual(1, stream.index)
     stream.seek(5)
     self.assertEqual(Token.EOF, stream.LA(1))
     self.assertEqual("bcd", stream.getText(1, 3))
     stream.reset()
     self.assertEqual(0, stream.index)
Exemplo n.º 2
0
 def getText(self, input: InputStream):
     # index is first lookahead char, don't include.
     return input.getText(self.startIndex, input.index - 1)
Exemplo n.º 3
0
 def getText(self, input:InputStream):
     # index is first lookahead char, don't include.
     return input.getText(self.startIndex, input.index-1)