ballercat / walt

:zap: Walt is a JavaScript-like syntax for WebAssembly text format :zap:

Home Page:https://ballercat.github.io/walt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compile error when string has whitespace

Pyrolistical opened this issue · comments

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.

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