1
2
3
4 package edu.odu.cs.codeAnnotation;
5
6 import java.io.BufferedReader;
7 import java.io.BufferedWriter;
8 import java.io.FileReader;
9 import java.io.FileWriter;
10 import java.io.IOException;
11 import java.io.StringReader;
12 import java.io.StringWriter;
13
14
15
16
17
18
19
20 public class Code2TeX {
21
22 private static BufferedReader input;
23 private static BufferedWriter output;
24
25
26
27
28 private static void processArgs(String[] args) throws IOException
29 {
30 String inputFileName = args[0];
31 String outputFileName = inputFileName + ".tex";
32
33 input = new BufferedReader(new FileReader(inputFileName));
34 output = new BufferedWriter(new FileWriter(outputFileName));
35
36 }
37
38 public static String test (String inputText) throws IOException
39 {
40 input = new BufferedReader(new StringReader(inputText));
41 StringWriter strOutput = new StringWriter();
42 output = new BufferedWriter(strOutput);
43 CppJavaTeXScanner scanner = new CppJavaTeXScanner(input);
44 scanner.output = output;
45 scanner.yylex();
46 scanner.flush();
47 output.close();
48 return strOutput.toString();
49 }
50
51 public static void generateTeX() throws IOException
52 {
53 CppJavaTeXScanner scanner = new CppJavaTeXScanner(input);
54 scanner.output = output;
55 scanner.yylex();
56 scanner.flush();
57 output.close();
58 }
59
60
61
62
63
64 public static void main(String[] args) throws IOException {
65 processArgs(args);
66 generateTeX();
67 }
68
69 }