ballercat / walt

:zap: Walt is a JavaScript-like syntax for WebAssembly text format :zap:
https://ballercat.github.io/walt/
MIT License
4.64k stars 122 forks source link

compile error when string has whitespace #158

Closed Pyrolistical closed 5 years ago

Pyrolistical commented 5 years ago

Bug Report

Overview

Crashes when there is a space in a string.

Expected

It should compile

Actual

Crash.

Compile failed { Invariant Violation: Ambiguous syntax number of productions: 4
    at invariant (/Users/.../node_modules/walt-compiler/dist/walt.js:169:15)
    at parse (/Users/.../node_modules/walt-compiler/dist/walt.js:1934:3)
    at processInvocation (/Users/.../node_modules/walt-compiler/dist/walt.js:1055:50)
    at /Users/.../node_modules/walt-compiler/dist/walt.js:978:24
    at compile (/Users/.../node_modules/walt-compiler/dist/walt.js:5814:15)
    at readFile (/Users/.../node_modules/walt-cli/src/compile-from-file.js:15:22)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3) name: 'Invariant Violation', framesToPop: 1 }

Example

hello.walt

export function x(): i32 {
  return "Hello world!";
}

$ walt hello.walt -o hello.wasm

If you change it to return "Helloworld!"; it compiles.

ballercat commented 5 years ago

Thanks for reporting this. This is an odd one... But is patched by #159