checking in stuff
[IRC.git] / Robust / JavaGrammar / Lex / Comment.java
diff --git a/Robust/JavaGrammar/Lex/Comment.java b/Robust/JavaGrammar/Lex/Comment.java
new file mode 100644 (file)
index 0000000..6a0aae4
--- /dev/null
@@ -0,0 +1,26 @@
+package Lex;
+
+abstract class Comment extends InputElement {
+  private StringBuffer comment = new StringBuffer();
+
+  String getComment() { return comment.toString(); }
+
+  void appendLine(String more) { // 'more' is '\n' terminated.
+    int i=0;
+
+    // skip leading white space.
+    for (; i<more.length(); i++)
+      if (!Character.isSpaceChar(more.charAt(i))) 
+       break;
+
+    // skip any leading stars.
+    for (; i<more.length(); i++)
+      if (more.charAt(i)!='*')
+       break;
+
+    // the rest of the string belongs to the comment.
+    if (i<more.length())
+      comment.append(more.substring(i));
+  }
+
+}