shelljs-transpiler icon indicating copy to clipboard operation
shelljs-transpiler copied to clipboard

calls to commands starting with digits

Open cancerberoSgx opened this issue 6 years ago • 2 comments

Seems it will fail if when calling a command which name start with a digit. probably around : https://github.com/nfischer/shelljs-transpiler/blob/a0fd697bd37573b767238a8fb2f1726d86f625fc/src/bash.ohm#L103

BTW which grammar syntax are you using ?

#!/bin/bash
ang=1
while [ $ang -le 360 ]
	do
	echo "ang=$ang"
	if [ $ang -gt 180 ] 
		then
		newang=`expr $ang - 360`
	else
		newang=$ang
	fi
	3Drotate tilt=30 pan=$newang zoom=-1.5 mandril.jpg $tmp
done
	
Unable to parse script
Line 12, col 3:
  11 | 	fi
> 12 | 	3Drotate tilt=30 pan=$newang zoom=-1.5 mandril.jpg $tmp
         ^
  13 | 
Expected not an alpha-numeric character
Please include this output in the bug report
Please file a bug report at git+https://github.com/nfischer/shelljs-transpiler.git
```

cancerberoSgx avatar Jul 03 '19 04:07 cancerberoSgx

BTW which grammar syntax are you using ?

It's PEG. We use the Ohm library: https://github.com/harc/ohm, https://ohmlang.github.io/

Seems it will fail if when calling a command which name start with a digit. probably around

Seems like a bug in the Bashword definition. echo 3three parses as echo(3, 'three') instead of echo('3three'). Bugfixes are encouraged, I don't actively work on this project anymore.

nfischer avatar Jul 03 '19 23:07 nfischer

Aja, unfortunately I'm not currently using it, but if that's the case in the future I will. Also just a comment seems to be a descent grammar for bash but not peg but antlr https://github.com/antlr/grammars-v4, just in case. Thanks!

cancerberoSgx avatar Jul 04 '19 00:07 cancerberoSgx