~fd/cane-lang

d2c6b7058dc5a5689a6c490e625518f7d40993fb — Ersei Saggi 10 months ago 8876778
Stdin, minor error message tweak
2 files changed, 10 insertions(+), 6 deletions(-)

M cane-lang/src/lib.rs
M cane-wasm/index.html
M cane-lang/src/lib.rs => cane-lang/src/lib.rs +1 -1
@@ 767,7 767,7 @@ where
                                    if key.is_none() {
                                        return Err(Error::new(
                                            ErrorKind::InvalidData,
                                            "No action name found".to_string(),
                                            "No variable name found".to_string(),
                                        ));
                                    }
                                    let var = self

M cane-wasm/index.html => cane-wasm/index.html +9 -5
@@ 12,7 12,8 @@
        overflow: scroll;
      }
      #code_input,
      #args_input {
      #args_input,
      #stdin {
        width: 100%;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;


@@ 49,6 50,7 @@ arg1 arg2 arg3 (space separated)</textarea
      >Demos</a
    >
    <pre id="output"><noscript>Enable Javascript to continue.</noscript></pre>
    <textarea id="stdin" placeholder="Standard input" rows="3"></textarea>
    <script type="module">
      // https://stackoverflow.com/a/47880734
      const supported = (() => {


@@ 69,10 71,12 @@ arg1 arg2 arg3 (space separated)</textarea
        return false
      })()

	  window.readIn = function readIn() {
		  writeOut("Web playground does not support stdin (yet!)")
		  return ""
	  }
      window.readIn = function readIn() {
        let result = document.getElementById('stdin').value || ''
        console.log('result: ' + result)
        document.getElementById('stdin').value = ''
        return result
      }

      window.writeOut = function writeOut(text) {
        document.getElementById('output').innerText += text