forked from Orchid/orchid
very elegant extension API and parts of it used in std as POC
This commit is contained in:
@@ -2,26 +2,29 @@ use std::ops::Range;
|
||||
|
||||
use orchid_api_derive::Coding;
|
||||
|
||||
use crate::intern::{TStr, TStrv};
|
||||
use crate::interner::TStrv;
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Coding)]
|
||||
#[derive(Clone, Debug, Coding)]
|
||||
pub enum Location {
|
||||
None,
|
||||
/// Used in functions to denote the generated code that carries on the
|
||||
/// location of the call. Not allowed in the const tree.
|
||||
Inherit,
|
||||
Gen(CodeGenInfo),
|
||||
Range(SourceRange),
|
||||
/// Range and file
|
||||
SourceRange(SourceRange),
|
||||
/// Range only, file implied. Most notably used by parsers
|
||||
Range(Range<u32>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Coding)]
|
||||
#[derive(Clone, Debug, Coding)]
|
||||
pub struct SourceRange {
|
||||
pub path: TStrv,
|
||||
pub range: Range<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, Coding)]
|
||||
#[derive(Clone, Debug, Coding)]
|
||||
pub struct CodeGenInfo {
|
||||
pub generator: TStr,
|
||||
pub details: TStr,
|
||||
pub generator: TStrv,
|
||||
pub details: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user