Skip to content

scrapscript shebang #33

@drawkula

Description

@drawkula

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions