package net.sf.yacas;

class XmlTokenizer extends LispTokenizer {
    @Override
    public String NextToken(LispInput aInput, LispHashTable aHashTable) throws Exception {

        char c;

        while (Character.isWhitespace(aInput.Peek()))
            aInput.Next();

        if (aInput.EndOfStream())
            return aHashTable.LookUp("");

        StringBuilder token = new StringBuilder();

        c = aInput.Next();
        token.append(c);

        if (c == '<') {
            while (c != '>') {
                c = aInput.Next();
                LispError.Check(!aInput.EndOfStream(), LispError.KLispErrCommentToEndOfFile);
                token.append(c);
            }
        } else {
            while (aInput.Peek() != '<' && !aInput.EndOfStream()) {
                c = aInput.Next();
                token.append(c);
            }
        }
        return aHashTable.LookUp(token.toString());
    }
}

@@ -182,16 +182,152 @@
 har c;%0A%0A
+        if (aInput.EndOfStream())%0A            return aHashTable.LookUp(%22%22);%0A%0A        StringBuilder leadingSpaces = new StringBuilder();%0A
         
@@ -384,16 +384,37 @@
         
+leadingSpaces.append(
 aInput.N
@@ -418,16 +418,17 @@
 t.Next()
+)
 ;%0A%0A     
@@ -663,43 +663,8 @@
 ) %7B%0A
-                c = aInput.Next();%0A
     
@@ -753,16 +753,51 @@
 fFile);%0A
+                c = aInput.Next();%0A
         
@@ -980,32 +980,32 @@
 oken.append(c);%0A
-
             %7D%0A  
@@ -994,32 +994,108 @@
 ;%0A            %7D%0A
+            leadingSpaces.append(token);%0A            token = leadingSpaces;%0A
         %7D%0A      

bring jyacas OpenMath parser on par with cyacas