Class PendingParse

java.lang.Object
io.deephaven.lang.parse.PendingParse

public class PendingParse extends Object
An object to represent the operation of parsing documents from users. Because we update the server with new document state as the user types, we don't want to get a deluge of stale parse operations sucking down CPU. Only one version (the newest) of a given document will be parsed; all others will be cancelled.
  • Method Details

    • cancel

      public void cancel()
      Called when the user session is ended, and we need to shutdown.
    • getText

      public String getText()
      Returns:
      The full document text of the last-received document edit.
    • invalidate

      public void invalidate()
      Called when the document has been updated, but before we are ready to submit new text to be parsed. We'll just interrupt the parser thread, so it has time to cancel any work before our caller submits the new work. Note that we don't update the targetState field, since we use it to return the current text. Our caller must call getText() above and then apply diffs to create new document text before it can call .requestParse(). Calling invalidate() gives the parser thread a little extra time to realize that it is processing stale input and throw ParseCancelled(), so the parser thread can be ready to immediately start work when .requestParse() is called.