fred-wang / TeXZilla

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

Strict Mode #46

Closed rgaiacs closed 8 years ago

rgaiacs commented 9 years ago
$ git log HEAD -1
commit 71f92bc764761fb69db8030e5d548ddcc83d98ca
Author: Frédéric Wang <fred.wang@free.fr>
Date:   Sun May 31 12:59:01 2015 +0200

    Travis: Just run "make build" without testing for now...
$ texzilla
/usr/local/lib/texzilla-js/TeXZilla.js:876
        function lex() {
        ^^^^^^^^
SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:124:16)
    at node.js:842:3
$ node --version
v0.11.14
rgaiacs commented 9 years ago

@fred-wang Could you help with this?

$ git rev-parse HEAD
589f5c6c804f8a15a9dc3655f62967148bf55b3c
$ git clean -fxd
$ ./configure 
checking for bash... /bin/bash
checking for closure-compiler... no
checking for nodejs... nodejs
checking for curl... curl
checking for egrep... egrep
checking for git... git
checking for jison... jison
checking for kill... kill
checking for make... make
checking for npm... npm
checking for pkill... pkill
checking for python... python
checking for sed... sed
checking for xsltproc... xsltproc
configure: creating ./config.status
config.status: creating Makefile
$ make build
curl http://www.w3.org/2003/entities/2007xml/unicode.xml -o unicode.xml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 8010k  100 8010k    0     0   187k      0  0:00:42  0:00:42 --:--:-- 96194
xsltproc extractChars.xsl unicode.xml > chars.txt
python generateCharCommands.py chars.txt char-commands.txt;
cat char-commands.txt base-commands.txt | egrep -v "^#" | \
sort --reverse --field-separator='"' --key=2,2 > commands.txt
cat main.jisonlex commands.txt > TeXZilla.jisonlex
echo "[\uD800-\uDBFF] return \"HIGH_SURROGATE\";" >> TeXZilla.jisonlex
echo "[\uDC00-\uDFFF] return \"LOW_SURROGATE\";" >> TeXZilla.jisonlex
echo ". return \"BMP_CHARACTER\";" >> TeXZilla.jisonlex
Generating the parser, this may take some time...
jison --outfile TeXZilla-web.js --module-type js --parser-type lalr TeXZilla.jison TeXZilla.jisonlex
sed -i "s|\\\\b)/|)/|g" TeXZilla-web.js # jison issue 204
sed -i "s|var TeXZillaWeb =|var TeXZilla =|" TeXZilla-web.js
sed -i "/typeof this.yy.parseError === 'function'/i this.parseError = parseError;" TeXZilla-web.js
sed -i "/typeof this.yy.parseError === 'function'/,/}"$"/d" TeXZilla-web.js
sed -i "1 i \"use strict\";" TeXZilla-web.js
cat MPL-header.js TeXZilla-web.js >> tmp.js
mv tmp.js TeXZilla-web.js
cp TeXZilla-web.js TeXZilla.js
sed "1,6d" commonJS.js >> TeXZilla.js
$ ./npmbin.sh 
/home/raniere/src/TeXZilla/TeXZilla.js:876
        function lex() {
        ^^^^^^^^
SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function.
    at exports.runInThisContext (vm.js:75:16)
    at Module._compile (module.js:445:25)
    at Object.Module._extensions..js (module.js:480:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:503:10)
    at startup (node.js:132:16)
    at node.js:817:3
rgaiacs commented 9 years ago

Previous reported upstream at https://github.com/zaach/jison/issues/285. =(

fred-wang commented 8 years ago

https://github.com/zaach/jison/issues/285#issuecomment-152290435 seems to say that this is fixed. Can you check again?