]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/mathml_editor/src/texlexer.cc
Initial revision
[helm.git] / helm / DEVEL / mathml_editor / src / texlexer.cc
diff --git a/helm/DEVEL/mathml_editor/src/texlexer.cc b/helm/DEVEL/mathml_editor/src/texlexer.cc
new file mode 100644 (file)
index 0000000..f062732
--- /dev/null
@@ -0,0 +1,26 @@
+
+#include "dom.hh"
+#include "TLexerPush.hh"
+
+main()
+{
+  std::string s;
+  while (getline(std::cin, s))
+    {
+      TLexerPush lexer;
+      for (unsigned long i = 0; i < s.length(); i++)
+       {
+         lexer.push(s[i]);
+         cout << "pending: " << lexer.pending()
+              << " amb: " << lexer.ambiguous();
+         if (!lexer.empty())
+           {
+             TToken tok = lexer.front();
+             DOM::GdomeString v(tok.value);
+             cout << " cat: " << tok.category << " value: " << v << " length: " << v.length();
+             if (!lexer.ambiguous()) lexer.pop();
+           }
+         cout << endl;
+       }
+    }
+}