Skip to main content

Crate mq_hir

Crate mq_hir 

Source
Expand description

This module provides the core functionality for the mq-hir crate, which includes the High-level Intermediate Representation (HIR) for the mq.

§Example

use std::str::FromStr;

use itertools::Itertools;
use mq_hir::{Hir, Symbol, SymbolId};
use url::Url;

// Create a new HIR instance
let mut hir = Hir::default();

// Add some code to the HIR
let code = r#"
  def main():
    let x = 42; | x;
  "#;
hir.add_code(Some(Url::from_str("file:///main.rs").unwrap()), code);

// Retrieve symbols from the HIR
let symbols: Vec<(SymbolId, &Symbol)> = hir.symbols().collect::<Vec<_>>();

// Print the symbols
for (symbol_id, symbol) in symbols {
  println!("{:?}, {:?}, {:?}", symbol_id, symbol.value, symbol.kind);
}

Structs§

Hir
Scope
ScopeId
Source
SourceId
SourceInfo
Symbol
SymbolId

Enums§

HirError
HirWarning
ScopeKind
SymbolKind