Skip to content

Commit

Permalink
feat: Echo command (#911)
Browse files Browse the repository at this point in the history
* Echo statement

* Double quotes
  • Loading branch information
Stevendeo authored Oct 19, 2023
1 parent b8563ad commit bfd698d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/bin/common/solving_loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,14 @@ let main () =

| {contents = `Exit; _} -> raise Exit

| {contents = `Echo str; _} ->
let new_str = String.concat "\"\"" (String.split_on_char '"' str) in
Fmt.pf
(Options.Output.get_fmt_regular ())
"\"%s\"@."
new_str;
st

| {contents = `Get_info kind; _ } ->
handle_get_info st kind;
st
Expand Down
44 changes: 43 additions & 1 deletion tests/dune.inc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/smtlib/testfile-echo1.dolmen.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"Hello, world!"
2 changes: 2 additions & 0 deletions tests/smtlib/testfile-echo1.dolmen.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(set-logic ALL)
(echo "Hello, world!")
1 change: 1 addition & 0 deletions tests/smtlib/testfile-echo2.dolmen.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"a""b"
2 changes: 2 additions & 0 deletions tests/smtlib/testfile-echo2.dolmen.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(set-logic ALL)
(echo "a""b")

0 comments on commit bfd698d

Please sign in to comment.