A very simple comment parser has been added
This commit is contained in:
parent
7f0a074ddd
commit
0c025241b7
|
@ -41,6 +41,10 @@ public class Reader {
|
||||||
|
|
||||||
char c = (char) inputStream.read();
|
char c = (char) inputStream.read();
|
||||||
while ((byte) c != -1) {
|
while ((byte) c != -1) {
|
||||||
|
if (c == ';') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
inputStream.unread(c);
|
inputStream.unread(c);
|
||||||
nodes.add(readNode(inputStream));
|
nodes.add(readNode(inputStream));
|
||||||
skipWhiteSpaces(inputStream);
|
skipWhiteSpaces(inputStream);
|
||||||
|
@ -114,7 +118,7 @@ public class Reader {
|
||||||
|
|
||||||
private static Node readString(PushbackReader inputStream) throws IOException {
|
private static Node readString(PushbackReader inputStream) throws IOException {
|
||||||
char opening = (char) inputStream.read();
|
char opening = (char) inputStream.read();
|
||||||
assert opening == '"' : "Strings should start with \"";
|
assert opening == '"' : "Strings should start with '\"'";
|
||||||
String str = "";
|
String str = "";
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -127,7 +131,29 @@ public class Reader {
|
||||||
};
|
};
|
||||||
|
|
||||||
return new StringNode(str);
|
return new StringNode(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static char readAndIgnoreComments(PushbackReader inputStream) throws IOException {
|
||||||
|
char firstChar = (char) inputStream.read();
|
||||||
|
System.out.println("RAIC");
|
||||||
|
System.out.println(firstChar);
|
||||||
|
|
||||||
|
if (firstChar == ';') {
|
||||||
|
while(true) {
|
||||||
|
char ch = (char) inputStream.read();
|
||||||
|
System.out.println("T");
|
||||||
|
System.out.println(ch);
|
||||||
|
|
||||||
|
if(ch == -1 || ch == '\n') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return readAndIgnoreComments(inputStream);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("F");
|
||||||
|
return firstChar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void skipWhiteSpaces(PushbackReader inputStream) throws IOException {
|
private static void skipWhiteSpaces(PushbackReader inputStream) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue