Class CharStream


  • final class CharStream
    extends java.lang.Object
    String reader designed for use from the lexer. Callers invoke the tryConsume* methods to specify what characters they expect and then readAndResetRecorded() to retrieve and consume the matched characters. This is a slightly odd API -- why not just return the matched characters from tryConsume? -- but it is convenient for the lexer.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.String remaining  
      (package private) int toConsume  
    • Constructor Summary

      Constructors 
      Constructor Description
      CharStream​(java.lang.String input)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) boolean isExhausted()  
      (package private) java.lang.String readAndResetRecorded()  
      (package private) boolean tryConsume​(java.lang.String expected)  
      (package private) boolean tryConsumeRegex​(java.util.regex.Pattern pattern)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • remaining

        java.lang.String remaining
      • toConsume

        int toConsume
    • Constructor Detail

      • CharStream

        CharStream​(java.lang.String input)
    • Method Detail

      • tryConsume

        boolean tryConsume​(java.lang.String expected)
      • tryConsumeRegex

        boolean tryConsumeRegex​(java.util.regex.Pattern pattern)
      • readAndResetRecorded

        java.lang.String readAndResetRecorded()
      • isExhausted

        boolean isExhausted()