Skip to content

Expose parsing #USAGE comments from a script in a string in Rust API #781

Description

@mdekstrand

Right now it appears the Rust API exposes 3 ways to parse a Spec:

  • parse from a file with parse_file
  • parse from a script file with parse_script
  • parse from in-memory string (deprecated) with parse

I am attempting to write a program that will embed scripts into a binary (for running scripts with a self-contained interpreter), and this interpreter supports #USAGE comments natively. For this embedded script scenario, I see two solutions:

  • Parse the USAGE comments out of the script embedded as a string in the binary.
  • Parse the USAGE comments at compile-time and serialize them into the binary (currently blocked by Spec implementing Serialize but not Deserialize).

Either solution would solve my problem; parsing the in-memory #USAGE comments seems simpler to me.

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