summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2004-08-19 17:16:44 +0000
committerburaq <buraq@epfl.ch>2004-08-19 17:16:44 +0000
commit5f9cb270e802e2e667adf4e985f92a1d200065fd (patch)
tree5db8719329d2c2425506e8d53aac7e3bd293b54e /sources
parent31c6c0a62d6fba695912f5a0d999cd4017057696 (diff)
downloadscala-5f9cb270e802e2e667adf4e985f92a1d200065fd.tar.gz
scala-5f9cb270e802e2e667adf4e985f92a1d200065fd.tar.bz2
scala-5f9cb270e802e2e667adf4e985f92a1d200065fd.zip
added constructors from scala.io.Source
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/xml/parsing/ConstructingParser.scala21
1 files changed, 15 insertions, 6 deletions
diff --git a/sources/scala/xml/parsing/ConstructingParser.scala b/sources/scala/xml/parsing/ConstructingParser.scala
index bac49c06e3..9e142483a0 100644
--- a/sources/scala/xml/parsing/ConstructingParser.scala
+++ b/sources/scala/xml/parsing/ConstructingParser.scala
@@ -1,5 +1,20 @@
package scala.xml.parsing ;
+object ConstructingParser {
+ def fromSource(inp: scala.io.Source): ConstructingParser =
+ fromSource(new ConstructingHandler(), inp);
+
+ def fromSource(theHandle: ConstructingHandler, inp: scala.io.Source): ConstructingParser = {
+ val p = new ConstructingParser() {
+ val input = inp;
+ override val handle = theHandle;
+ def nextch = { ch = input.next; pos = input.pos; }
+ override val preserveWS = true;
+ };
+ p.nextch;
+ p
+ }
+}
/** an xml parser. parses XML and invokes callback methods of a MarkupHandler
*/
@@ -7,16 +22,10 @@ abstract class ConstructingParser extends MarkupParser[Node] {
val handle = new ConstructingHandler();
- //val enableEmbeddedExpressions: Boolean;
-
/** report a syntax error */
def reportSyntaxError(str: String): Unit = throw FatalError(str);
/** this method assign the next character to ch and advances in input */
def nextch: Unit;
- /** this method should assign the first character of the input to ch */
- def init: Unit;
-
-
}