IDL compiler front-end library
|
The AST builder. More...
#include <Builder.h>
Public Member Functions | |
const std::filesystem::path * | file () const noexcept |
Currently parsed IDL file path. | |
Location | location () const |
bool | is_main_file () const noexcept |
Test if currently parsed file is main. More... | |
const std::string & | prefix () const |
void | type_prefix (const ScopedName &name, const Variant &s, const Location &id_loc) |
Set repository id prefix for item. See the typeprefix IDL keyword. More... | |
void | type_id (const ScopedName &name, const Variant &id, const Location &id_loc) |
Set repository id for item. See the typeid IDL keyword. More... | |
void | pragma_version (const ScopedName &name, const Version &ver, const Location &loc) |
Set repository id version for item. See #pragma version . More... | |
const Item * | cur_parent () const |
void | native (const SimpleDeclarator &name) |
Create native type. More... | |
void | module_begin (const SimpleDeclarator &name) |
Begin module. More... | |
void | module_end () |
End module. | |
void | interface_decl (const SimpleDeclarator &name, InterfaceKind ik=InterfaceKind()) |
Create interface forward declaration. More... | |
void | interface_begin (const SimpleDeclarator &name, InterfaceKind ik=InterfaceKind()) |
Begin interface definition. More... | |
void | interface_bases (const ScopedNames &bases) |
Set current interface bases. More... | |
void | operation_begin (bool oneway, Type &&type, const SimpleDeclarator &name) |
Begin operation definition for the current interface or valuetype. More... | |
void | parameter (Parameter::Attribute att, Type &&type, const SimpleDeclarator &name) |
Add parameter to the current operation. More... | |
void | raises (const ScopedNames &names) |
Set raises for the current operation. More... | |
void | operation_context (const Variants &strings) |
Set context for the current operation. More... | |
void | operation_end () |
End of the operation definition. | |
void | attribute (bool readonly, Type &&type, const SimpleDeclarators &declarators) |
Add attributes to the current interface or valuetype. More... | |
void | attribute_begin (bool readonly, Type &&type, const SimpleDeclarator &name) |
Begin attribute definition for the current interface or valuetype. More... | |
void | getraises (const ScopedNames &names) |
Set getraises for the current attribute. More... | |
void | setraises (const ScopedNames &names) |
Set setraises for the current attribute. More... | |
void | attribute_end () |
End of the attribute definition. | |
void | interface_end () |
End of the interface definition. | |
void | type_def (Type &&type, const Declarators &declarators) |
Create type alias. More... | |
void | struct_decl (const SimpleDeclarator &name) |
Create structure forward declaration. More... | |
void | struct_begin (const SimpleDeclarator &name) |
Begin of the structure definition. More... | |
const NamedItem * | struct_end () |
End of the structure definition. More... | |
void | exception_begin (const SimpleDeclarator &name) |
Begin of the exception definition. More... | |
void | exception_end () |
End of the exception definition. | |
void | member (Type &&type, const Declarators &names) |
Add members to the current structure or exception. More... | |
void | union_decl (const SimpleDeclarator &name) |
Create union forward declaration. More... | |
void | union_begin (const SimpleDeclarator &name, const Type &switch_type, const Location &type_loc) |
Begin of the union definition. More... | |
void | union_label (const Variant &label, const Location &loc) |
Create label for the current union. More... | |
void | union_default (const Location &loc) |
Create default label for the current union. More... | |
void | union_element (Type &&type, const Declarator &decl) |
Create union element for the current label. More... | |
const NamedItem * | union_end () |
End of the union definition. More... | |
const NamedItem * | enum_type (const SimpleDeclarator &name, const SimpleDeclarators &items) |
Create enum type. More... | |
void | valuetype_decl (const SimpleDeclarator &name, bool is_abstract=false) |
Create valuetype forward declaration. More... | |
void | valuetype_begin (const SimpleDeclarator &name, ValueType::Modifier mod=ValueType::Modifier::NONE) |
Begin valuetype definition. More... | |
void | valuetype_bases (bool truncatable, const ScopedNames &bases) |
Set current valuetype bases. More... | |
void | valuetype_supports (const ScopedNames &interfaces) |
Set current valuetype supported interfaces. More... | |
void | state_member (bool is_public, Type &&type, const Declarators &names) |
Add members to the current valuetype. More... | |
void | valuetype_factory_begin (const SimpleDeclarator &name) |
Begin valuetype factory. More... | |
void | valuetype_factory_end () |
End valuetype factory. More... | |
void | valuetype_end () |
End of the valuetype definition. | |
void | valuetype_box (const SimpleDeclarator &name, Type &&type) |
Create value box definition. More... | |
void | constant (Type &&t, const SimpleDeclarator &name, Variant &&val, const Location &loc) |
Create constant definition. More... | |
void | constant (Type &&t, const SimpleDeclarator &name) |
Create interface constant definition (Nirvana extension). More... | |
Type | lookup_type (const ScopedName &scoped_name) |
Find type by name. More... | |
Additional Inherited Members | |
Message types. More... |
Location AST::Builder::location | ( | ) | const |
|
inlinenoexcept |
const std::string& AST::Builder::prefix | ( | ) | const |
typeprefix
IDL keyword. void AST::Builder::type_prefix | ( | const ScopedName & | name, |
const Variant & | s, | ||
const Location & | id_loc | ||
) |
Set repository id prefix for item. See the typeprefix
IDL keyword.
name | Item name. |
s | Prefix string. |
id_loc | typeprefix location. |
|
inline |
|
inline |
const Item* AST::Builder::cur_parent | ( | ) | const |
nullptr
if parent item is invalid. void AST::Builder::native | ( | const SimpleDeclarator & | name | ) |
Create native type.
name | Native type name. |
void AST::Builder::module_begin | ( | const SimpleDeclarator & | name | ) |
void AST::Builder::interface_decl | ( | const SimpleDeclarator & | name, |
InterfaceKind | ik = InterfaceKind() |
||
) |
Create interface forward declaration.
name | The interface name. |
ik | The interface kind. |
void AST::Builder::interface_begin | ( | const SimpleDeclarator & | name, |
InterfaceKind | ik = InterfaceKind() |
||
) |
Begin interface definition.
name | The interface name. |
ik | The interface kind. |
void AST::Builder::interface_bases | ( | const ScopedNames & | bases | ) |
Set current interface bases.
bases | Base names. |
void AST::Builder::operation_begin | ( | bool | oneway, |
Type && | type, | ||
const SimpleDeclarator & | name | ||
) |
Begin operation definition for the current interface or valuetype.
oneway | true for oneway operations. |
type | Return type. |
name | The operation name. |
void AST::Builder::parameter | ( | Parameter::Attribute | att, |
Type && | type, | ||
const SimpleDeclarator & | name | ||
) |
Add parameter to the current operation.
att | The parameter attribute. |
type | The parameter type. |
name | The parameter name. |
void AST::Builder::raises | ( | const ScopedNames & | names | ) |
Set raises for the current operation.
names | Exception names. |
void AST::Builder::operation_context | ( | const Variants & | strings | ) |
Set context for the current operation.
strings | Context strings. |
void AST::Builder::attribute | ( | bool | readonly, |
Type && | type, | ||
const SimpleDeclarators & | declarators | ||
) |
Add attributes to the current interface or valuetype.
readonly | true if attributes are read-only. |
type | The attributes type. |
declarators | The attribute names. |
void AST::Builder::attribute_begin | ( | bool | readonly, |
Type && | type, | ||
const SimpleDeclarator & | name | ||
) |
Begin attribute definition for the current interface or valuetype.
readonly | true if attribute is read-only. |
type | The attribute type. |
name | The attribute name. |
void AST::Builder::getraises | ( | const ScopedNames & | names | ) |
Set getraises for the current attribute.
names | Exception names. |
void AST::Builder::setraises | ( | const ScopedNames & | names | ) |
Set setraises for the current attribute.
names | Exception names. |
void AST::Builder::type_def | ( | Type && | type, |
const Declarators & | declarators | ||
) |
Create type alias.
type | The type. |
declarators | Type aliases. |
void AST::Builder::struct_decl | ( | const SimpleDeclarator & | name | ) |
Create structure forward declaration.
name | The structure name. |
void AST::Builder::struct_begin | ( | const SimpleDeclarator & | name | ) |
Begin of the structure definition.
name | The structure name. |
|
inline |
void AST::Builder::exception_begin | ( | const SimpleDeclarator & | name | ) |
Begin of the exception definition.
name | The exception name. |
void AST::Builder::member | ( | Type && | type, |
const Declarators & | names | ||
) |
Add members to the current structure or exception.
type | The members type. |
names | The member names. |
void AST::Builder::union_decl | ( | const SimpleDeclarator & | name | ) |
Create union forward declaration.
name | The union name. |
void AST::Builder::union_begin | ( | const SimpleDeclarator & | name, |
const Type & | switch_type, | ||
const Location & | type_loc | ||
) |
Begin of the union definition.
name | The union name. |
switch_type | The union discriminator type. |
type_loc | Discriminator type location. |
Create label for the current union.
label | The constant. |
loc | The label location. |
void AST::Builder::union_default | ( | const Location & | loc | ) |
Create default label for the current union.
loc | The label location. |
void AST::Builder::union_element | ( | Type && | type, |
const Declarator & | decl | ||
) |
Create union element for the current label.
type | The element type. |
decl | The element name. |
const NamedItem* AST::Builder::union_end | ( | ) |
End of the union definition.
const NamedItem* AST::Builder::enum_type | ( | const SimpleDeclarator & | name, |
const SimpleDeclarators & | items | ||
) |
Create enum type.
name | The enum type name. |
items | The enum items. |
void AST::Builder::valuetype_decl | ( | const SimpleDeclarator & | name, |
bool | is_abstract = false |
||
) |
Create valuetype forward declaration.
name | The valuetype name. |
is_abstract | true for abstract valuetype. |
void AST::Builder::valuetype_begin | ( | const SimpleDeclarator & | name, |
ValueType::Modifier | mod = ValueType::Modifier::NONE |
||
) |
Begin valuetype definition.
name | The valuetype name. |
mod | The valuetype modifier. |
void AST::Builder::valuetype_bases | ( | bool | truncatable, |
const ScopedNames & | bases | ||
) |
Set current valuetype bases.
truncatable | true if valuetype is truncatable. |
bases | Base names. |
void AST::Builder::valuetype_supports | ( | const ScopedNames & | interfaces | ) |
Set current valuetype supported interfaces.
interfaces | Supported interface names. |
void AST::Builder::state_member | ( | bool | is_public, |
Type && | type, | ||
const Declarators & | names | ||
) |
Add members to the current valuetype.
is_public | true for public members. |
type | The members type. |
names | The member names. |
void AST::Builder::valuetype_factory_begin | ( | const SimpleDeclarator & | name | ) |
Begin valuetype factory.
name | The valuetype factory name. |
|
inline |
void AST::Builder::valuetype_box | ( | const SimpleDeclarator & | name, |
Type && | type | ||
) |
Create value box definition.
name | The value box name. |
type | Boxed type. |
void AST::Builder::constant | ( | Type && | t, |
const SimpleDeclarator & | name, | ||
Variant && | val, | ||
const Location & | loc | ||
) |
Create constant definition.
t | The constant type. |
name | The constant name. |
val | The constant value. |
loc | The constant value location. |
void AST::Builder::constant | ( | Type && | t, |
const SimpleDeclarator & | name | ||
) |
Create interface constant definition (Nirvana extension).
t | The constant type. |
name | The constant name. |
Type AST::Builder::lookup_type | ( | const ScopedName & | scoped_name | ) |