pintariching/rustle

How to test?

jimafisk opened this issue ยท 13 comments

Awesome project, thanks for taking this on ๐ŸŽ‰

I assumed I could create an app.rustle file with the following contents:

<script>
  let test = "test";
</script>

<h1>{test}</h1>

Then run rustle_cli app.rustle to create a compiled app.js file, but that throws:

thread 'main' panicked at 'Parse error: expecting ={', /home/jimafisk/.cargo/registry/src/github.com-1ecc6299db9ec823/rustle_lib-0.0.1-alpha/src/compiler/parse/parser.rs:120:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I've moved the library crate from rustle_lib to rustle namespace on crates.io and rustle_cli 0.0.1-alpha depends on that namespace. I'm still learning and it's possible I've messed some things up on crates.io.
Can you try updating the rustle_cli binary with cargo install rustle_cli --version "0.0.2-alpha"

Thanks for the cargo command, I'm unfamiliar with Rust. That ran a build that completed with:

Compiling rustle v0.0.1-alpha
Compiling rustle_cli v0.0.2-alpha
Finished release [optimized] target(s) in 12m 17s
Replacing /home/jimafisk/.cargo/bin/rustle_cli
Replaced package `rustle_cli v0.0.1-alpha` with `rustle_cli v0.0.2-alpha` (executable `rustle_cli`)

Running which rustle_cli returns /home/jimafisk/.cargo/bin/rustle_cli

However rustle_cli --version still says Rustle 0.0.1-alpha and I get the same parse error when trying to compile app.rustle

Oh whoops, I forgot to update the version in the CLI crate. Running --version with the 0.0.2-alpha version is going to return 0.0.1-alpha.
I just saw the error and tried it out, and it appears that <h1> tags don't work and return that error. Try using a <div> instead, that should work.

Using a <div> worked! Very exciting! Can't wait for more, awesome job so far :)

Thank you for bringing this issue to my attention, I haven't realised that only div tags work. I'll look into it!

@pintariching the issue seems to be caused when trying to parse attributes.

Maybe the number in the tag is throwing the parser off? If you'd like you can look into it.

I skimmed through the part of the parser that handles attributes and seems it doesn't have conditions for parsing normal html attributes .

Looked through here to see how the svelte compiler parses attributes tag.ts

Currently busy I could look into it later though.

No worries, I'll take a look at it tomorrow.

This should work now

After upgrading with cargo install rustle_cli --version "0.1.2" this worked perfectly! Thanks!