[][src]Struct open_vaf::ir::ast::Ast

pub struct Ast {
    pub branches: IndexVec<BranchId, AttributeNode<BranchDeclaration>>,
    pub nets: IndexVec<NetId, AttributeNode<Net>>,
    pub ports: IndexVec<PortId, AttributeNode<Port>>,
    pub variables: IndexVec<VariableId, AttributeNode<Variable>>,
    pub parameters: IndexVec<ParameterId, AttributeNode<Parameter>>,
    pub modules: IndexVec<ModuleId, AttributeNode<Module>>,
    pub functions: IndexVec<FunctionId, AttributeNode<Function>>,
    pub disciplines: IndexVec<DisciplineId, AttributeNode<Discipline>>,
    pub natures: IndexVec<NatureId, AttributeNode<Nature>>,
    pub expressions: IndexVec<ExpressionId, Node<Expression>>,
    pub blocks: IndexVec<BlockId, AttributeNode<SeqBlock>>,
    pub attributes: IndexVec<AttributeId, Attribute>,
    pub statements: IndexVec<StatementId, Statement>,
    pub top_symbols: SymbolTable,
}

An Ast representing a parsed Verilog-AMS project (root file); It provides stable indicies for every Node because the entire Tree is immutable once created; It uses preallocated constant size arrays for performance

Fields

branches: IndexVec<BranchId, AttributeNode<BranchDeclaration>>nets: IndexVec<NetId, AttributeNode<Net>>ports: IndexVec<PortId, AttributeNode<Port>>variables: IndexVec<VariableId, AttributeNode<Variable>>parameters: IndexVec<ParameterId, AttributeNode<Parameter>>modules: IndexVec<ModuleId, AttributeNode<Module>>functions: IndexVec<FunctionId, AttributeNode<Function>>disciplines: IndexVec<DisciplineId, AttributeNode<Discipline>>natures: IndexVec<NatureId, AttributeNode<Nature>>expressions: IndexVec<ExpressionId, Node<Expression>>blocks: IndexVec<BlockId, AttributeNode<SeqBlock>>attributes: IndexVec<AttributeId, Attribute>statements: IndexVec<StatementId, Statement>top_symbols: SymbolTable

Implementations

impl Ast[src]

#[must_use]pub fn new() -> Self[src]

impl Ast[src]

pub fn lower(self) -> Result<Hir, (Vec<Error>, Self)>[src]

Lowers an AST to an HIR by resolving references, ambiguities and enforcing nature/discipline comparability

pub fn lower_with_decl_handler(
    self,
    declaration_handler: &mut impl DeclarationHandler
) -> Result<Hir, (Vec<Error>, Self)>
[src]

Lowers an AST to an HIR by resolving references, ambiguities and enforcing nature/discipline comparability

pub fn lower_and_print_errors(
    self,
    source_map: &SourceMap,
    translate_lines: bool
) -> Option<Hir>
[src]

Lowers an AST to an HIR by resolving references, ambiguities and enforcing nature/discipline comparability and printing any errors or warnings that might occur

pub fn lower_and_print_errors_with_var_decl_handle(
    self,
    source_map: &SourceMap,
    translate_lines: bool,
    declaration_handler: &mut impl DeclarationHandler
) -> Option<Hir>
[src]

Lowers an AST to an HIR by resolving references, ambiguities and enforcing nature/discipline comparability and printing any errors or warnings that might occur

impl Ast[src]

pub fn parse_from<'source_map, 'lt>(
    &'lt mut self,
    main_file: &Path,
    source_map_allocator: &'source_map Bump
) -> Result<(&'source_map SourceMap<'source_map>, Vec<Error>, Vec<Warning>)>
[src]

The main point of this module. Parses a verilog-ams source file into an ast and returns any errors that occur

Arguments

  • main_file - The Verilog-A source file to parse

  • source_map_allocator - A bump allocator that will be used to allocate the source map. (Bump::new() can be used to create one)

Returns

  • An Io Error if the main_file could not be read
  • A SourceMap of the parsed file generated during parsing
  • A list of all Errors that occurred during parsing
  • A list of all Warnings generated during parsing

pub fn parse_from_and_print_errors<'source_map, 'lt>(
    &'lt mut self,
    main_file: &Path,
    source_map_allocator: &'source_map Bump,
    translate_lines: bool
) -> Option<&'source_map SourceMap<'source_map>>
[src]

Parses a verilog-ams source file into an ast and prints any errors that occur

Arguments

  • main_file - The Verilog-A source file to parse

  • source_map_allocator - A bump allocator that will be used to allocate the source map. (Bump::new() can be used to create one)

  • translate_lines - When this is set to true the line numbers of printed errors are translated to reflect the line in the original source file instead of the source that was expanded by the preprocessor

Returns

  • Parse successful - A Source Map of the parsed source
  • Errors occurred during - Prints the errors and returns None

Trait Implementations

impl Index<AttributeId> for Ast[src]

type Output = Attribute

The returned type after indexing.

impl Index<BlockId> for Ast[src]

type Output = AttributeNode<SeqBlock>

The returned type after indexing.

impl Index<BranchId> for Ast[src]

type Output = AttributeNode<BranchDeclaration>

The returned type after indexing.

impl Index<DisciplineId> for Ast[src]

type Output = AttributeNode<Discipline>

The returned type after indexing.

impl Index<ExpressionId> for Ast[src]

type Output = Node<Expression>

The returned type after indexing.

impl Index<FunctionId> for Ast[src]

type Output = AttributeNode<Function>

The returned type after indexing.

impl Index<IdRange<AttributeId>> for Ast[src]

type Output = IndexSlice<AttributeId, [Attribute]>

The returned type after indexing.

impl Index<IdRange<BlockId>> for Ast[src]

type Output = IndexSlice<BlockId, [AttributeNode<SeqBlock>]>

The returned type after indexing.

impl Index<IdRange<BranchId>> for Ast[src]

type Output = IndexSlice<BranchId, [AttributeNode<BranchDeclaration>]>

The returned type after indexing.

impl Index<IdRange<DisciplineId>> for Ast[src]

type Output = IndexSlice<DisciplineId, [AttributeNode<Discipline>]>

The returned type after indexing.

impl Index<IdRange<ExpressionId>> for Ast[src]

type Output = IndexSlice<ExpressionId, [Node<Expression>]>

The returned type after indexing.

impl Index<IdRange<FunctionId>> for Ast[src]

type Output = IndexSlice<FunctionId, [AttributeNode<Function>]>

The returned type after indexing.

impl Index<IdRange<ModuleId>> for Ast[src]

type Output = IndexSlice<ModuleId, [AttributeNode<Module>]>

The returned type after indexing.

impl Index<IdRange<NatureId>> for Ast[src]

type Output = IndexSlice<NatureId, [AttributeNode<Nature>]>

The returned type after indexing.

impl Index<IdRange<NetId>> for Ast[src]

type Output = IndexSlice<NetId, [AttributeNode<Net>]>

The returned type after indexing.

impl Index<IdRange<ParameterId>> for Ast[src]

type Output = IndexSlice<ParameterId, [AttributeNode<Parameter>]>

The returned type after indexing.

impl Index<IdRange<PortId>> for Ast[src]

type Output = IndexSlice<PortId, [AttributeNode<Port>]>

The returned type after indexing.

impl Index<IdRange<StatementId>> for Ast[src]

type Output = IndexSlice<StatementId, [Statement]>

The returned type after indexing.

impl Index<IdRange<VariableId>> for Ast[src]

type Output = IndexSlice<VariableId, [AttributeNode<Variable>]>

The returned type after indexing.

impl Index<ModuleId> for Ast[src]

type Output = AttributeNode<Module>

The returned type after indexing.

impl Index<NatureId> for Ast[src]

type Output = AttributeNode<Nature>

The returned type after indexing.

impl Index<NetId> for Ast[src]

type Output = AttributeNode<Net>

The returned type after indexing.

impl Index<ParameterId> for Ast[src]

type Output = AttributeNode<Parameter>

The returned type after indexing.

impl Index<PortId> for Ast[src]

type Output = AttributeNode<Port>

The returned type after indexing.

impl Index<Range<AttributeId>> for Ast[src]

type Output = IndexSlice<AttributeId, [Attribute]>

The returned type after indexing.

impl Index<Range<BlockId>> for Ast[src]

type Output = IndexSlice<BlockId, [AttributeNode<SeqBlock>]>

The returned type after indexing.

impl Index<Range<BranchId>> for Ast[src]

type Output = IndexSlice<BranchId, [AttributeNode<BranchDeclaration>]>

The returned type after indexing.

impl Index<Range<DisciplineId>> for Ast[src]

type Output = IndexSlice<DisciplineId, [AttributeNode<Discipline>]>

The returned type after indexing.

impl Index<Range<ExpressionId>> for Ast[src]

type Output = IndexSlice<ExpressionId, [Node<Expression>]>

The returned type after indexing.

impl Index<Range<FunctionId>> for Ast[src]

type Output = IndexSlice<FunctionId, [AttributeNode<Function>]>

The returned type after indexing.

impl Index<Range<ModuleId>> for Ast[src]

type Output = IndexSlice<ModuleId, [AttributeNode<Module>]>

The returned type after indexing.

impl Index<Range<NatureId>> for Ast[src]

type Output = IndexSlice<NatureId, [AttributeNode<Nature>]>

The returned type after indexing.

impl Index<Range<NetId>> for Ast[src]

type Output = IndexSlice<NetId, [AttributeNode<Net>]>

The returned type after indexing.

impl Index<Range<ParameterId>> for Ast[src]

type Output = IndexSlice<ParameterId, [AttributeNode<Parameter>]>

The returned type after indexing.

impl Index<Range<PortId>> for Ast[src]

type Output = IndexSlice<PortId, [AttributeNode<Port>]>

The returned type after indexing.

impl Index<Range<StatementId>> for Ast[src]

type Output = IndexSlice<StatementId, [Statement]>

The returned type after indexing.

impl Index<Range<VariableId>> for Ast[src]

type Output = IndexSlice<VariableId, [AttributeNode<Variable>]>

The returned type after indexing.

impl Index<StatementId> for Ast[src]

type Output = Statement

The returned type after indexing.

impl Index<VariableId> for Ast[src]

type Output = AttributeNode<Variable>

The returned type after indexing.

impl IndexMut<AttributeId> for Ast[src]

impl IndexMut<BlockId> for Ast[src]

impl IndexMut<BranchId> for Ast[src]

impl IndexMut<DisciplineId> for Ast[src]

impl IndexMut<ExpressionId> for Ast[src]

impl IndexMut<FunctionId> for Ast[src]

impl IndexMut<IdRange<AttributeId>> for Ast[src]

impl IndexMut<IdRange<BlockId>> for Ast[src]

impl IndexMut<IdRange<BranchId>> for Ast[src]

impl IndexMut<IdRange<DisciplineId>> for Ast[src]

impl IndexMut<IdRange<ExpressionId>> for Ast[src]

impl IndexMut<IdRange<FunctionId>> for Ast[src]

impl IndexMut<IdRange<ModuleId>> for Ast[src]

impl IndexMut<IdRange<NatureId>> for Ast[src]

impl IndexMut<IdRange<NetId>> for Ast[src]

impl IndexMut<IdRange<ParameterId>> for Ast[src]

impl IndexMut<IdRange<PortId>> for Ast[src]

impl IndexMut<IdRange<StatementId>> for Ast[src]

impl IndexMut<IdRange<VariableId>> for Ast[src]

impl IndexMut<ModuleId> for Ast[src]

impl IndexMut<NatureId> for Ast[src]

impl IndexMut<NetId> for Ast[src]

impl IndexMut<ParameterId> for Ast[src]

impl IndexMut<PortId> for Ast[src]

impl IndexMut<Range<AttributeId>> for Ast[src]

impl IndexMut<Range<BlockId>> for Ast[src]

impl IndexMut<Range<BranchId>> for Ast[src]

impl IndexMut<Range<DisciplineId>> for Ast[src]

impl IndexMut<Range<ExpressionId>> for Ast[src]

impl IndexMut<Range<FunctionId>> for Ast[src]

impl IndexMut<Range<ModuleId>> for Ast[src]

impl IndexMut<Range<NatureId>> for Ast[src]

impl IndexMut<Range<NetId>> for Ast[src]

impl IndexMut<Range<ParameterId>> for Ast[src]

impl IndexMut<Range<PortId>> for Ast[src]

impl IndexMut<Range<StatementId>> for Ast[src]

impl IndexMut<Range<VariableId>> for Ast[src]

impl IndexMut<StatementId> for Ast[src]

impl IndexMut<VariableId> for Ast[src]

Auto Trait Implementations

impl RefUnwindSafe for Ast

impl Send for Ast

impl Sync for Ast

impl Unpin for Ast

impl UnwindSafe for Ast

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.