scrapscript icon indicating copy to clipboard operation
scrapscript copied to clipboard

scrapscript shebang

Open drawkula opened this issue 2 years ago • 2 comments

Can you please allow # as comment char in the 1st line in a script?

That would make using #!/path/to/scrapscript.py there possible and so probably would allow directly executable scripts.

Current reaction:

$ ls -l test.ss 
-rwxr-xr-x 1 yeti yeti 104 Dec  8 16:08 test.ss
$ ./test.ss 
Traceback (most recent call last):
  File "/tmp/mc-yeti/scrapscript.py", line 2800, in <module>
    main()
  File "/tmp/mc-yeti/scrapscript.py", line 2796, in main
    args.func(args)
  File "/tmp/mc-yeti/scrapscript.py", line 2611, in eval_command
    tokens = tokenize(program)
  File "/tmp/mc-yeti/scrapscript.py", line 239, in tokenize
    while (token := lexer.read_one()) and not isinstance(token, EOF):
  File "/tmp/mc-yeti/scrapscript.py", line 180, in read_one
    raise ParseError(f"unexpected token {c!r}", ("<input>", self.lineno, self.colno, self.line))
  File "<input>", line 1
    #
     ^
__main__.ParseError: unexpected token '#'

Or is that a case of PEBCAK?

drawkula avatar Dec 08 '23 16:12 drawkula

This is a good point---I will think about what to do here.

tekknolagi avatar Dec 08 '23 21:12 tekknolagi

You can use the compiler now if you want to directly execute a scrap.

tekknolagi avatar Jun 06 '24 13:06 tekknolagi