-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add templating mechanism to generate .c/.h files
Generate the c/h code for constant definitions and object initialization. We make sure the Rake task builds the required templates so we can compile the extension. Co-authored-by: Alexandre Terrasa <[email protected]>
- Loading branch information
1 parent
d9000d2
commit b8d3eb3
Showing
12 changed files
with
1,371 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,323 @@ | ||
nodes: | ||
- name: RBS::AST::Annotation | ||
fields: | ||
- name: string | ||
- name: location | ||
- name: RBS::AST::Comment | ||
fields: | ||
- name: string | ||
- name: location | ||
- name: RBS::AST::Declarations::Class | ||
fields: | ||
- name: name | ||
- name: type_params | ||
- name: super_class | ||
- name: members | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::Class::Super | ||
fields: | ||
- name: name | ||
- name: args | ||
- name: location | ||
- name: RBS::AST::Declarations::ClassAlias | ||
fields: | ||
- name: new_name | ||
- name: old_name | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::Constant | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::Global | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::Interface | ||
fields: | ||
- name: name | ||
- name: type_params | ||
- name: members | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::Module | ||
fields: | ||
- name: name | ||
- name: type_params | ||
- name: self_types | ||
- name: members | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::Module::Self | ||
fields: | ||
- name: name | ||
- name: args | ||
- name: location | ||
- name: RBS::AST::Declarations::ModuleAlias | ||
fields: | ||
- name: new_name | ||
- name: old_name | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Declarations::TypeAlias | ||
fields: | ||
- name: name | ||
- name: type_params | ||
- name: type | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Directives::Use | ||
fields: | ||
- name: clauses | ||
- name: location | ||
- name: RBS::AST::Directives::Use::SingleClause | ||
fields: | ||
- name: type_name | ||
- name: new_name | ||
- name: location | ||
- name: RBS::AST::Directives::Use::WildcardClause | ||
fields: | ||
- name: namespace | ||
- name: location | ||
- name: RBS::AST::Members::Alias | ||
fields: | ||
- name: new_name | ||
- name: old_name | ||
- name: kind | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::AttrAccessor | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: ivar_name | ||
- name: kind | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: visibility | ||
- name: RBS::AST::Members::AttrReader | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: ivar_name | ||
- name: kind | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: visibility | ||
- name: RBS::AST::Members::AttrWriter | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: ivar_name | ||
- name: kind | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: visibility | ||
- name: RBS::AST::Members::ClassInstanceVariable | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::ClassVariable | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::Extend | ||
fields: | ||
- name: name | ||
- name: args | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::Include | ||
fields: | ||
- name: name | ||
- name: args | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::InstanceVariable | ||
fields: | ||
- name: name | ||
- name: type | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::MethodDefinition | ||
fields: | ||
- name: name | ||
- name: kind | ||
- name: overloads | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: overloading | ||
- name: visibility | ||
- name: RBS::AST::Members::MethodDefinition::Overload | ||
fields: | ||
- name: annotations | ||
- name: method_type | ||
- name: RBS::AST::Members::Prepend | ||
fields: | ||
- name: name | ||
- name: args | ||
- name: annotations | ||
- name: location | ||
- name: comment | ||
- name: RBS::AST::Members::Private | ||
fields: | ||
- name: location | ||
- name: RBS::AST::Members::Public | ||
fields: | ||
- name: location | ||
- name: RBS::AST::TypeParam | ||
fields: | ||
- name: name | ||
- name: variance | ||
- name: upper_bound | ||
- name: default_type | ||
- name: location | ||
- name: RBS::MethodType | ||
fields: | ||
- name: type_params | ||
- name: type | ||
- name: block | ||
- name: location | ||
- name: RBS::Namespace | ||
fields: | ||
- name: path | ||
- name: absolute | ||
- name: RBS::TypeName | ||
fields: | ||
- name: namespace | ||
- name: name | ||
- name: RBS::Types::Alias | ||
fields: | ||
- name: name | ||
c_name: typename # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: args | ||
- name: location | ||
- name: RBS::Types::Bases::Any | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Bool | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Bottom | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Class | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Instance | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Nil | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Self | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Top | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Bases::Void | ||
fields: | ||
- name: location | ||
- name: RBS::Types::Block | ||
fields: | ||
- name: type | ||
- name: required | ||
- name: self_type | ||
- name: RBS::Types::ClassInstance | ||
fields: | ||
- name: name | ||
c_name: typename # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: args | ||
c_name: type_args # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: location | ||
- name: RBS::Types::ClassSingleton | ||
fields: | ||
- name: name | ||
c_name: typename # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: location | ||
- name: RBS::Types::Function | ||
fields: | ||
- name: required_positionals | ||
c_name: required_positional_params # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: optional_positionals | ||
c_name: optional_positional_params # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: rest_positionals | ||
c_name: rest_positional_params # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: trailing_positionals | ||
c_name: trailing_positional_params # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: required_keywords | ||
- name: optional_keywords | ||
- name: rest_keywords | ||
- name: return_type | ||
- name: RBS::Types::Function::Param | ||
fields: | ||
- name: type | ||
- name: name | ||
- name: location | ||
- name: RBS::Types::Interface | ||
fields: | ||
- name: name | ||
c_name: typename # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: args | ||
c_name: type_args # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: location | ||
- name: RBS::Types::Intersection | ||
fields: | ||
- name: types | ||
- name: location | ||
- name: RBS::Types::Literal | ||
fields: | ||
- name: literal | ||
- name: location | ||
- name: RBS::Types::Optional | ||
fields: | ||
- name: type | ||
- name: location | ||
- name: RBS::Types::Proc | ||
fields: | ||
- name: type | ||
c_name: function # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: block | ||
- name: location | ||
- name: self_type | ||
- name: RBS::Types::Record | ||
fields: | ||
- name: all_fields | ||
c_name: fields # Temporary name to match existing C code. Will be removed in next PR. | ||
- name: location | ||
- name: RBS::Types::Tuple | ||
fields: | ||
- name: types | ||
- name: location | ||
- name: RBS::Types::Union | ||
fields: | ||
- name: types | ||
- name: location | ||
- name: RBS::Types::UntypedFunction | ||
fields: | ||
- name: return_type | ||
- name: RBS::Types::Variable | ||
fields: | ||
- name: name | ||
- name: location |
Oops, something went wrong.