1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use std::borrow::Cow;
use pest;
use pest_derive::Parser;
#[derive(Parser)]
#[grammar = "parser.pest"]
pub struct ChParser;
pub mod ast;
pub mod compile;
pub mod verify;
#[derive(Debug, Clone, PartialEq)]
pub enum Error {
TypeMismatch(ast::Type, ast::Type),
Validation(Cow<'static, str>),
SymbolExists(Cow<'static, str>),
CodegenError,
}
impl From<rspirv::mr::Error> for Error {
fn from(_e: rspirv::mr::Error) -> Error {
Error::CodegenError
}
}
#[cfg(test)]
mod tests {
use super::*;
use pest::Parser;
#[test]
fn parser_test() {
let input = "hello world";
let _pairs = ChParser::parse(Rule::ident, input).unwrap();
}
}