.. java:import:: fr.inria.tapenade.representation ILUtils .. java:import:: fr.inria.tapenade.representation TapEnv .. java:import:: fr.inria.tapenade.representation TapList .. java:import:: fr.inria.tapenade.utils ILLang .. java:import:: fr.inria.tapenade.utils ILLangOps .. java:import:: fr.inria.tapenade.utils Operator .. java:import:: fr.inria.tapenade.utils TapIntList .. java:import:: fr.inria.tapenade.utils Tree .. java:import:: fr.inria.tapenade.utils ToInt .. java:import:: java.io BufferedReader .. java:import:: java.io IOException .. java:import:: java.io InputStream .. java:import:: java.io InputStreamReader TreeProtocol ============ .. java:package:: fr.inria.tapenade.frontend :noindex: .. java:type:: public class TreeProtocol Manages a connection with an input stream that carries a tree, in agreement with our tree protocol. Operators may come as strings or coded as integers. Constructors ------------ TreeProtocol ^^^^^^^^^^^^ .. java:constructor:: public TreeProtocol(InputStream is) :outertype: TreeProtocol Creates one TreeProtocol. Opens a reader on the stream "is". TreeProtocol ^^^^^^^^^^^^ .. java:constructor:: public TreeProtocol(BufferedReader reader) :outertype: TreeProtocol Creates one TreeProtocol. Opens a reader on the stream "reader". TreeProtocol ^^^^^^^^^^^^ .. java:constructor:: public TreeProtocol(LibReader reader) :outertype: TreeProtocol Methods ------- popTreeReader ^^^^^^^^^^^^^ .. java:method:: public Tree popTreeReader() :outertype: TreeProtocol position ^^^^^^^^ .. java:method:: public int position() :outertype: TreeProtocol :return: the index of the last thing (operator or value) read. This index starts at 0 (before the first thing is read). pushTreeReader ^^^^^^^^^^^^^^ .. java:method:: public void pushTreeReader() :outertype: TreeProtocol readOperator ^^^^^^^^^^^^ .. java:method:: public Operator readOperator() throws IOException :outertype: TreeProtocol :throws IOException: when operator is incorrect or when stream is empty. :return: the next thing (assumed to be an Operator) on the InputStream. Does not keep it, so that next see or read will return next operator on the stream. readPrefixTree ^^^^^^^^^^^^^^ .. java:method:: public Tree readPrefixTree() throws IOException :outertype: TreeProtocol Used by GeneralLibReader. Read an IL Tree written in prefix form with parentheses. :throws IOException: when operator is incorrect or when stream is empty. readString ^^^^^^^^^^ .. java:method:: public String readString() throws IOException :outertype: TreeProtocol Assumes next thing on stack is a String. :throws IOException: when operator is incorrect or when stream is empty. :return: Pops it and returns it. readTree ^^^^^^^^ .. java:method:: public Tree readTree(ToInt toLineNumber) throws IOException :outertype: TreeProtocol Same as readTree(), but returns into toLineNumber the smallest line number found while reading this Tree. readTree ^^^^^^^^ .. java:method:: public Tree readTree() throws IOException :outertype: TreeProtocol Read a Tree with this protocol. :throws IOException: when operator is incorrect or when stream is empty. :return: the next incoming complete Tree on the InputStream. Advances the pointer in the InputStream to the next token immediately following this returned tree. Attaches to the top of the returned tree an annotation with the "position" in the protocol just after the top operator of this tree was read. seeOperator ^^^^^^^^^^^ .. java:method:: public Operator seeOperator() throws IOException :outertype: TreeProtocol :throws IOException: when operator is incorrect or when stream is empty. :return: the next thing (assumed to be an Operator) on the InputStream. But keeps it, so that next see or read will return the same Operator. setPosition ^^^^^^^^^^^ .. java:method:: public void setPosition(int pos) :outertype: TreeProtocol setTraceOn ^^^^^^^^^^ .. java:method:: public void setTraceOn(boolean traceOn) :outertype: TreeProtocol When true, things arriving through the inputStream will be shown.