/* Parse stack was: commandset**/ /* Java code generated by "translate.java.pss" */ import java.io.*; import java.util.regex.*; import java.util.*; // contains stack public class javased { public StringBuffer patternSpace; public StringBuffer holdSpace; public int linesRead; private Scanner input; private boolean eof; /** make a new machine with a character stream reader */ public javased(Scanner scanner) { this.patternSpace = new StringBuffer(""); this.holdSpace = new StringBuffer(""); this.linesRead = 1; this.input = scanner; this.eof = false; } /** read one line from the input stream and update the machine. */ public void readLine() { int iChar; // try { if (this.eof) { System.exit(0); } // increment lines this.linesRead++; if (this.input.hasNext()) { this.patternSpace.append(this.input.next()); } else { this.eof = true; } //} //catch (IOException ex) { // System.out.println("Error reading input stream" + ex); // System.exit(-1); //} } /** command "x": swap the pattern-space with the work-space */ public void swap() { String s = new String(this.patternSpace); this.patternSpace.setLength(0); this.patternSpace.append(this.holdSpace.toString()); this.holdSpace.setLength(0); this.holdSpace.append(s); } /** save the patternspace to file "sav.pp" */ public void writeToFile(String fileName) { try { File file = new File(fileName); Writer out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(file), "UTF8")); out.append(this.patternSpace.toString()); out.flush(); out.close(); } catch (Exception e) { System.out.println(e.getMessage()); } } public static void main(String[] args) throws Exception { String temp = ""; javased mm = new javased(new Scanner(System.in)); while (!mm.eof) { mm.readLine(); /* [ok] Sed syntax appears ok */ /* --------------------- */ /* p; # print pattern-space d; # delete pattern-space, restart */