fred-wang / TeXZilla

LALR Javascript LaTeX-to-MathML converter compatible with Unicode
http://fred-wang.github.io/TeXZilla/
130 stars 21 forks source link

Java JDK7 Rhino ScriptEngine issues #38

Closed fede-gh closed 10 years ago

fede-gh commented 10 years ago

Hello, I've been using TeXZilla as a library in Java ScriptEngine API, (http://docs.oracle.com/javase/7/docs/technotes/guides/scripting/programmer_guide/) I found a couple of issues with TeXZilla 0.9.7 when running on the following engine:

JS engine name: Rhino version: Rhino 1.7 release 0.7.r2.2.el6 2010 08 21 language version: 1.7

This is the default engine for Java 1.7

  1. Math object is sealed, cannot add the log2 property
  2. Object.getPrototypeOf doesn't exist

I've attached a quick patch that fixes the issues.

fede-gh commented 10 years ago

Can't attach the patch afterall, happy to send it.

fred-wang commented 10 years ago

@fede-gh Thanks for the feedback. I guess the standard way to submit changes on GitHub is to use https://help.github.com/articles/using-pull-requests. If you can do that, I'd be happy to take a look at your patch.

fred-wang commented 10 years ago

Thanks for the report. I believe this is now fixed on master.

fred-wang commented 10 years ago

I verified that it works with Rhino in Java7 and added an example: https://github.com/fred-wang/TeXZilla/blob/master/examples/TeXZillaParser.java

(didn't try Nashorn in Java8, but hopefully that works too).