org.jacaranda.verifier
Class Verifier

java.lang.Object
  extended by org.jacaranda.verifier.Verifier

public class Verifier
extends java.lang.Object

Main public interface to the verifier.

Use this API in preference to constructing instances of JacarandaFilterStream, JacarandaLexer and/or JacarandaParser, since those classes may change incompatibly.


Method Summary
static void main(java.lang.String[] argv)
           
static boolean verify(char[] chars, int length, Reporter reporter, java.lang.Appendable optDest, Reporter optDestReporter)
          Verifies whether given source code represents a valid Jacaranda program.
static boolean verify(char[] chars, Reporter reporter)
          Equivalent to verify(chars, -1, reporter, null, null).
static boolean verify(java.io.Reader reader, int length, Reporter reporter, java.lang.Appendable optDest, Reporter optDestReporter)
          Verifies whether source code from the given Reader represents a valid Jacaranda program.
static boolean verify(java.io.Reader reader, Reporter reporter)
          Equivalent to verify(reader, -1, reporter, null, null).
static boolean verify(java.lang.String source, Reporter reporter)
          Equivalent to verify(source, reporter, null, null).
static boolean verify(java.lang.String source, Reporter reporter, java.lang.Appendable optDest, Reporter optDestReporter)
          Verifies whether given source code represents a valid Jacaranda program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

verify

public static boolean verify(java.io.Reader reader,
                             Reporter reporter)
                      throws java.io.IOException
Equivalent to verify(reader, -1, reporter, null, null).

Throws:
java.io.IOException

verify

public static boolean verify(char[] chars,
                             Reporter reporter)
Equivalent to verify(chars, -1, reporter, null, null).


verify

public static boolean verify(java.lang.String source,
                             Reporter reporter)
Equivalent to verify(source, reporter, null, null).


verify

public static boolean verify(java.io.Reader reader,
                             int length,
                             Reporter reporter,
                             java.lang.Appendable optDest,
                             Reporter optDestReporter)
                      throws java.io.IOException
Verifies whether source code from the given Reader represents a valid Jacaranda program. (To verify source from an InputStream, use InputStreamReader.) The Reader is not closed. If 'length' is -1, the source is read until EOF.

If 'optDest' is nonnull, it gives an Appendable object (for example a StringBuilder) to which a rewritten program that is closer to valid Jacaranda should be output. If 'optDestReporter' is nonnull, the rewritten program will be reverified if necessary, and the results reported to 'optDestReporter'. If this method throws an exception, the output to 'optDest' may be partial and should not be used.

If the original source passes, it will not be automatically written to 'optDest'.

Returns true iff the original source passes.

Throws:
java.io.IOException

verify

public static boolean verify(char[] chars,
                             int length,
                             Reporter reporter,
                             java.lang.Appendable optDest,
                             Reporter optDestReporter)
Verifies whether given source code represents a valid Jacaranda program. If 'length' is -1, the whole of the 'chars' array is used.

If 'optDest' is nonnull, it gives an Appendable object (for example a StringBuilder) to which a rewritten program that is closer to valid Jacaranda should be output. If 'optDestReporter' is nonnull, the rewritten program will be reverified if necessary, and the results reported to 'optDestReporter'. If this method throws an exception, the output to 'optDest' may be partial and should not be used.

If the original source passes, it will not be automatically written to 'optDest'. To do so, assuming length == -1, use if (passed) { optDest.append(chars); }

Returns true iff the original source passes.


verify

public static boolean verify(java.lang.String source,
                             Reporter reporter,
                             java.lang.Appendable optDest,
                             Reporter optDestReporter)
Verifies whether given source code represents a valid Jacaranda program.

If 'optDest' is nonnull, it gives an Appendable object (for example a StringBuilder) to which a rewritten program that is closer to valid Jacaranda should be output. If 'optDestReporter' is nonnull, the rewritten program will be reverified if necessary, and the results reported to 'optDestReporter'. If this method throws an exception, the output to 'optDest' may be partial and should not be used.

If the original source passes, it will not be automatically written to 'optDest'. To do so, use if (passed) { optDest.append(source); }

Returns true iff the original source passes.


main

public static void main(java.lang.String[] argv)