Finish implementation of typescript generator.

The implementation is still untested and will
have issues
This commit is contained in:
Fabian Stamm
2025-05-27 19:58:40 +02:00
parent 0e73f7b5b3
commit ffacba2e96
9 changed files with 381 additions and 279 deletions

View File

@ -1,7 +1,7 @@
use std::{
collections::{HashMap, HashSet},
error::Error,
fmt::Display,
fmt::{Debug, Display},
hash::{Hash, Hasher},
};
@ -13,8 +13,9 @@ use crate::parser::{
static BUILT_INS: [&str; 6] = ["int", "float", "string", "boolean", "bytes", "void"];
pub trait Definition {
pub trait Definition: Debug {
fn get_position(&self) -> ParserPosition;
fn get_name(&self) -> String;
}
#[derive(Debug, Clone)]
@ -186,6 +187,9 @@ impl Definition for TypeDefinition {
fn get_position(&self) -> ParserPosition {
self.position.clone()
}
fn get_name(&self) -> String {
self.name.clone()
}
}
#[derive(Debug, Clone)]
@ -205,6 +209,9 @@ impl Definition for EnumDefinition {
fn get_position(&self) -> ParserPosition {
self.position.clone()
}
fn get_name(&self) -> String {
self.name.clone()
}
}
#[derive(Debug, Clone)]
@ -225,6 +232,9 @@ impl Definition for ServiceDefinition {
fn get_position(&self) -> ParserPosition {
self.position.clone()
}
fn get_name(&self) -> String {
self.name.clone()
}
}
#[derive(Debug, Clone)]