Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: feed transpile command #1523

Merged
merged 2 commits into from
Nov 22, 2023
Merged

Add: feed transpile command #1523

merged 2 commits into from
Nov 22, 2023

Conversation

nichtsfrei
Copy link
Member

@nichtsfrei nichtsfrei commented Nov 8, 2023

Adds a new feature called transpile to feed of nasl-cli.

With it you can manipulate a feed, currently it is able to rename,
remove, add, push parameter or functions within a feed.

To demonstrate it there is an example within
examples/nasl-cli/transpile.toml to show case

  • rename service www to word-wide-web in register_product
  • register_host_detail to add_host_detail

to execute it call:

nasl-cli -v feed transpile -p /tmp/feed\
  -r examples/nasl-cli/transpile.toml

Additionally to line and colum number byte ranges got added. This allows
us to lookup complete statements without having to create line no lookup
tables or reading twice.

Usually the statements get discarded after execution so the additional
memory should not be a big issue.

SC-881

@nichtsfrei nichtsfrei force-pushed the function-renamer branch 6 times, most recently from 51ae0a4 to e8a1465 Compare November 15, 2023 12:28
@nichtsfrei nichtsfrei changed the title function renamer Add: feed transpile command Nov 15, 2023
@nichtsfrei nichtsfrei marked this pull request as ready for review November 15, 2023 12:41
@nichtsfrei nichtsfrei requested a review from a team as a code owner November 15, 2023 12:41
Adds a new feature called transpile to feed of nasl-cli.

With it you can manipulate a feed, currently it is able to rename,
remove, add, push parameter or functions within a feed.

To demonstrate it there is an example within
`examples/nasl-cli/transpile.toml` to show case
- rename service `www` to `word-wide-web` in register_product
- `register_host_detail` to `add_host_detail`

to execute it call:

```
nasl-cli -v feed transpile -p /tmp/feed\
  -r examples/nasl-cli/transpile.toml
```

Additionally to line and colum number byte ranges got added. This allows
us to lookup complete statements without having to create line no lookup
tables or reading twice.

Usually the statements get discarded after execution so the additional
memory should not be a big issue.
rust/feed/src/transpile/mod.rs Outdated Show resolved Hide resolved
rust/feed/src/transpile/mod.rs Outdated Show resolved Hide resolved
rust/feed/src/transpile/mod.rs Outdated Show resolved Hide resolved
rust/feed/src/transpile/mod.rs Outdated Show resolved Hide resolved
rust/feed/src/transpile/mod.rs Outdated Show resolved Hide resolved
rust/feed/src/verify/mod.rs Outdated Show resolved Hide resolved
rust/nasl-cli/src/main.rs Outdated Show resolved Hide resolved
rust/nasl-cli/src/main.rs Outdated Show resolved Hide resolved
rust/nasl-cli/src/main.rs Outdated Show resolved Hide resolved
rust/examples/nasl-cli/transpile.toml Outdated Show resolved Hide resolved
@Kraemii
Copy link
Member

Kraemii commented Nov 22, 2023

Great work 🚀

Co-authored-by: Christoph Krämer <[email protected]>
@nichtsfrei nichtsfrei merged commit c482c2f into main Nov 22, 2023
29 checks passed
@nichtsfrei nichtsfrei deleted the function-renamer branch November 22, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants