diff options
author | buraq <buraq@epfl.ch> | 2004-07-05 15:36:21 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-07-05 15:36:21 +0000 |
commit | eb5957859c6339e8fb16d9a8251fe86d3312b4e4 (patch) | |
tree | 8284d47e798e0d32eb66e8caa1386861dc695639 | |
parent | f0462d89218b6cfbd050cd1611a81507692388bf (diff) | |
download | scala-eb5957859c6339e8fb16d9a8251fe86d3312b4e4.tar.gz scala-eb5957859c6339e8fb16d9a8251fe86d3312b4e4.tar.bz2 scala-eb5957859c6339e8fb16d9a8251fe86d3312b4e4.zip |
regexp refactor
-rw-r--r-- | config/list/library.lst | 8 | ||||
-rw-r--r-- | sources/scala/tools/dtd2scala/DeclToScala.scala | 10 | ||||
-rw-r--r-- | sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/config/list/library.lst b/config/list/library.lst index f13fcb3280..4f769b4f68 100644 --- a/config/list/library.lst +++ b/config/list/library.lst @@ -155,6 +155,12 @@ runtime/matching/Rule.scala testing/UnitTest.scala +util/regexp/Alphabet.scala +util/regexp/Base.scala +util/regexp/WordExp.scala +util/regexp/PointedHedgeExp.scala +util/regexp/SyntaxErrorException.scala + xml/Attribute.scala xml/AttributeSeq.scala xml/BindingFactoryAdapter.scala @@ -175,9 +181,9 @@ xml/Text.scala xml/TextBuffer.scala xml/Utility.scala +xml/dtd/ContentModel.scala xml/dtd/Decl.scala xml/dtd/Parser.scala -xml/dtd/RegExp.scala xml/dtd/Scanner.scala xml/dtd/Tokens.scala xml/dtd/Validation.scala diff --git a/sources/scala/tools/dtd2scala/DeclToScala.scala b/sources/scala/tools/dtd2scala/DeclToScala.scala index 12b92e2fbf..e089645395 100644 --- a/sources/scala/tools/dtd2scala/DeclToScala.scala +++ b/sources/scala/tools/dtd2scala/DeclToScala.scala @@ -12,7 +12,9 @@ import scala.collection.Map ; import scala.collection.mutable.HashMap ; import scala.xml._ ; -import scala.xml.dtd.{AttrDecl,ElemDecl,RegExp,ANY_,PCDATA_,Eps,Star,RNode,Sequ,Alt} +import scala.xml.dtd.{AttrDecl, ContentModel, ElemName, ElemDecl}; + +import ContentModel._ ; import scala.xml.dtd.{REQUIRED,IMPLIED,DEFAULT}; import scala.xml.nobinding.XML ; @@ -115,7 +117,7 @@ class DeclToScala(fOut: PrintWriter, objectName: String, namespace: String, elem /*Console.println("sCM:"+ r.getClass() + " r:"+r );*/ r match { case Eps => "" - case RNode(name) => refTag( name ).toString(); + case Letter(ElemName(name)) => refTag( name ).toString(); case Star(r) => "("+shallowContentModel( r ) +") *" case Alt( rs @ _* ) => shallowContentModel1( rs, '|' ) case Sequ( rs @ _* ) => shallowContentModel1( rs, ',' ) @@ -134,7 +136,7 @@ class DeclToScala(fOut: PrintWriter, objectName: String, namespace: String, elem val sb = new StringBuffer("tagIterator( ch ).forall( x:Int => x match {"); for( val alt <- alts.elements ) { sb.append(" case "); - alt match { case RNode( name ) => sb.append( refTag( name ).toString() )} + alt match { case Letter(ElemName( name )) => sb.append( refTag( name ).toString() )} sb.append(" => true \n"); } sb.append("case _ => false })"); @@ -175,7 +177,7 @@ class DeclToScala(fOut: PrintWriter, objectName: String, namespace: String, elem fOut.print(sb.toString()); case "elemDecl" => - fOut.print(curModel.toString()); + fOut.print(ContentModel.toString( curModel )); case "template" => { lookup.update("objectName", objectName); diff --git a/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml b/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml index 994b2411ae..ad092946de 100644 --- a/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml +++ b/sources/scala/tools/dtd2scala/template/ObjectTemplate.scala.xml @@ -76,6 +76,7 @@ private val &ccElementName;Validator = { import scala.xml.dtd._; + import ContentModel._; new ElementValidator(<qstring ref="namespace"/>, <elemDecl/>); } |