frysk.hpd
Class Preprocessor

java.lang.Object
  extended by frysk.hpd.Preprocessor

 class Preprocessor
extends Object

Preprocessor handles constructs like linebreaks and compound statements, also provides a couple of static functions that might come in handy.


Nested Class Summary
(package private)  class Preprocessor.LineBuffer
          LineBuffer is a simple class for accumulating lines of multiline commands
 
Field Summary
private  Preprocessor.LineBuffer buffer
           
 
Constructor Summary
Preprocessor()
          Constructor
 
Method Summary
private static ArrayList breakCompound(String cmd)
          Break a compound command into subcommands.
private static boolean isMultiline(String cmd)
          Check if this command spans multiple lines, that is ends with a '\'
 Iterator preprocess(String cmd)
          Preprocess the command - splitting, combining and replacing as needed
private static String stripComment(String cmd)
           
private static String stripLineBreak(String cmd)
          Remove the backslash from multiline command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

private Preprocessor.LineBuffer buffer
Constructor Detail

Preprocessor

public Preprocessor()
Constructor

Method Detail

preprocess

public Iterator preprocess(String cmd)
Preprocess the command - splitting, combining and replacing as needed

Returns:
An iterator of commands ready to be executed, empty iterator if no commands

stripLineBreak

private static String stripLineBreak(String cmd)
Remove the backslash from multiline command


breakCompound

private static ArrayList breakCompound(String cmd)
Break a compound command into subcommands.


stripComment

private static String stripComment(String cmd)

isMultiline

private static boolean isMultiline(String cmd)
Check if this command spans multiple lines, that is ends with a '\'