abrobston / jscc

JS/CC LALR(1) Parser Generator: A LALR(1) Parser Generator for JavaScript written in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Npm version of jscc doesn't work on Linux

jcubic opened this issue · comments

they have \r which break the file in bash/linux probably the same on MacOSX, I got this when I've try to execute the script after install

$ jscc-node
/usr/bin/env: „node\r”: No such file or directory
$ which node
/usr/bin/node

I needed to strip the \r from the file using: dos2unix also there are no sh files in dest directory only symlinks to js files:

ls /usr/bin/jscc-*
/usr/bin/jscc-browser  /usr/bin/jscc-node
/usr/bin/jscc-nashorn  /usr/bin/jscc-rhino

this is not how symlinks work the cwd point file point to /usr/bin/ not the path where the original js file is located.

to make it work I need to run:

cd /usr/lib/node_modules/jscc-parser/bin/
ls | sudo xargs dos2unix
sudo chmod a+x jscc-node.sh

and then I could run the generator:

/usr/lib/node_modules/jscc-parser/bin/jscc-node.sh gramar.jscc > parser.js

the fix is to include post install script that will make script executable using chmod and maybe jscc-node in /usr/bin be scripts that execute

#!/bin/bash
/usr/lib/node_modules/jscc-parser/bin/jscc-node.sh $@

and maybe don't use \r at all browser and node will handle just \n and most editors/ide also can create files with just \n.

I don't want to make you mad but... It's doesn't not don't. (In the title)

@prolightHub thanks but this was created 2 years ago.