rustwasm / weedle

A WebIDL Parser
MIT License
43 stars 27 forks source link

Problem on default sample code of weedle #53

Open ccrashes opened 2 years ago

ccrashes commented 2 years ago

Hi .

I've added a new rust project and used in test directory and the code looks like this (webgpu webidl):

use std::fs;
use std::io::Read;

fn read_file(path: &str) -> String {
    let mut file = fs::File::open(path).unwrap();
    let mut file_content = String::new();
    file.read_to_string(&mut file_content).unwrap();
    file_content
}

fn should_parse_webgpu_webidl() {
    let content = read_file("C:/weedle/tests/defs/webgpu.webidl");
    let parsed = weedle::parse(&content).unwrap();
    println!("{:?}", parsed);

    //// assert_eq!(parsed.len(), 201);
}

fn main() {
    should_parse_webgpu_webidl();    
}

I'm running this on windows but after cargo run command I'm getting this error :

Compiling testweedle v0.1.0 (C:\weedle\testweedle\testweedle)
    Finished dev [unoptimized + debuginfo] target(s) in 1.27s
     Running `target\debug\testweedle.exe`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failure(Code(CompleteStr("[Exposed=(Window, DedicatedWorker), SecureContext]\r\ninterface GPU {\r\n    Promise<GPUAdapter?> 

...
...
...

  GPUIntegerCoordinate x = 0;\r\n    GPUIntegerCoordinate y = 0;\r\n};\r\ntypedef (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict) GPUOrigin2D;\r\n\r\ndictionary GPUOrigin3DDict {\r\n    GPUIntegerCoordinate x = 0;\r\n    GPUIntegerCoordinate y = 0;\r\n    GPUIntegerCoordinate z = 0;\r\n};\r\ntypedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D;\r\n\r\ndictionary GPUExtent3DDict {\r\n    required GPUIntegerCoordinate width;\r\n    GPUIntegerCoordinate height = 1;\r\n    GPUIntegerCoordinate depthOrArrayLayers = 1;\r\n};\r\ntypedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D;\r\n"), Custom(0)))', src\main.rs:15:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\testweedle.exe` (exit code: 101)

What's the problem with this code? (I have installed Rust nightly on my system) .

Thanks .