Reimplementation of Scansion in Rust
Find a file
Maxime “pep” Buquet af9e47f0a8
ScanElement: Propagate context
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-04-19 13:21:03 +02:00
examples Example/spec: Allow folders to be specified 2023-01-11 18:09:28 +01:00
src ScanElement: Propagate context 2023-04-19 13:21:03 +02:00
.gitignore From each according to their ability, to each according to their needs 2023-01-08 10:45:31 +01:00
.woodpecker.yml CI: Use nightly for rustfmt 2023-01-08 21:37:32 +01:00
Cargo.toml Implement scansion:strict 2023-04-15 19:08:25 +02:00
LICENSE From each according to their ability, to each according to their needs 2023-01-08 10:45:31 +01:00
README.md README: Update progress 2023-01-14 12:28:37 +01:00
rustfmt.toml From each according to their ability, to each according to their needs 2023-01-08 10:45:31 +01:00

Scansion-dsl

Parser for the Scansion project DSL.

License

SPDX: MPL-2.0. See LICENSE file.

Parsing support

Language features are defined here:
https://matthewwild.co.uk/projects/scansion/usage/script-basics/

This library supports parsing the following:

  • Metadata
    Lines starting with # at the beginning of the file. All metadata lines are optional. If a single line is found it's set as the title, the second lines is set as the description. Lines starting with ## right below will be added as tags. A description is not needed for tags to be added.
    • title: optional
    • description: optional
    • tags: optional
  • Client
    • Attributes
      Following lines beginning with at least a tab (\t) character, in the form attr: value, and ending with a newline (\n). Any line that matches this format will be parsed and will be discarded if it doesn't match an actual client attribute.
      • jid: Expects a bare jid or a full jid. Will be converted to jid::Jid.
      • password
      • custom_host
      • custom_port: Expect a u16
  • [-] Actions
    • 'connects'
    • 'disconnects'
    • [-] 'sends:' / 'receives:'
      • A block of lines each starting with a tab (\t) after the action will be converted to a minidom::Element.
    • receives: nothing as the absence of received stanza.
  • Comments
    Optional lines starting with a # or // and ending with a newline (\n). They get discarded in the output

minidom::Element

Minidom Elements require every element to be namespaced. This parser adds jabber:client as a default namespace. It also adds a scansion namespace that is used for the scansion:strict XML parameter.

Reporting bugs

Everything that's supported by upstream should be supported by this library, as long as it concerns parsing.