module Puppet::Pops::Model

Private Class Methods

register_pcore_types() click to toggle source
     # File lib/puppet/pops/model/ast.rb
4569 def self.register_pcore_types
4570   return if @@pcore_ast_initialized
4571   @@pcore_ast_initialized = true
4572   all_types = [
4573   Parser::Locator::Locator19,
4574   Model::PopsObject,
4575   Model::Positioned,
4576   Model::Expression,
4577   Model::Nop,
4578   Model::BinaryExpression,
4579   Model::UnaryExpression,
4580   Model::ParenthesizedExpression,
4581   Model::NotExpression,
4582   Model::UnaryMinusExpression,
4583   Model::UnfoldExpression,
4584   Model::AssignmentExpression,
4585   Model::ArithmeticExpression,
4586   Model::RelationshipExpression,
4587   Model::AccessExpression,
4588   Model::ComparisonExpression,
4589   Model::MatchExpression,
4590   Model::InExpression,
4591   Model::BooleanExpression,
4592   Model::AndExpression,
4593   Model::OrExpression,
4594   Model::LiteralList,
4595   Model::KeyedEntry,
4596   Model::LiteralHash,
4597   Model::BlockExpression,
4598   Model::ApplyBlockExpression,
4599   Model::CaseOption,
4600   Model::CaseExpression,
4601   Model::QueryExpression,
4602   Model::ExportedQuery,
4603   Model::VirtualQuery,
4604   Model::AbstractAttributeOperation,
4605   Model::AttributeOperation,
4606   Model::AttributesOperation,
4607   Model::CollectExpression,
4608   Model::Parameter,
4609   Model::Definition,
4610   Model::NamedDefinition,
4611   Model::FunctionDefinition,
4612   Model::ResourceTypeDefinition,
4613   Model::QRefDefinition,
4614   Model::TypeAlias,
4615   Model::TypeMapping,
4616   Model::TypeDefinition,
4617   Model::NodeDefinition,
4618   Model::HeredocExpression,
4619   Model::HostClassDefinition,
4620   Model::PlanDefinition,
4621   Model::LambdaExpression,
4622   Model::ApplyExpression,
4623   Model::IfExpression,
4624   Model::UnlessExpression,
4625   Model::CallExpression,
4626   Model::CallFunctionExpression,
4627   Model::CallNamedFunctionExpression,
4628   Model::CallMethodExpression,
4629   Model::Literal,
4630   Model::LiteralValue,
4631   Model::LiteralRegularExpression,
4632   Model::LiteralString,
4633   Model::LiteralNumber,
4634   Model::LiteralInteger,
4635   Model::LiteralFloat,
4636   Model::LiteralUndef,
4637   Model::LiteralDefault,
4638   Model::LiteralBoolean,
4639   Model::TextExpression,
4640   Model::ConcatenatedString,
4641   Model::QualifiedName,
4642   Model::ReservedWord,
4643   Model::QualifiedReference,
4644   Model::VariableExpression,
4645   Model::EppExpression,
4646   Model::RenderStringExpression,
4647   Model::RenderExpression,
4648   Model::ResourceBody,
4649   Model::AbstractResource,
4650   Model::ResourceExpression,
4651   Model::ResourceDefaultsExpression,
4652   Model::ResourceOverrideExpression,
4653   Model::SelectorEntry,
4654   Model::SelectorExpression,
4655   Model::NamedAccessExpression,
4656   Model::Program]
4657 
4658   # Create and register a TypeSet that corresponds to all types in the AST model
4659   types_map = {}
4660   all_types.each do |type|
4661     types_map[type._pcore_type.simple_name] = type._pcore_type
4662   end
4663   type_set = Types::PTypeSetType.new({
4664     'name' => 'Puppet::AST',
4665     'pcore_version' => '1.0.0',
4666     'types' => types_map
4667   })
4668   loc = Puppet::Util.path_to_uri("#{__FILE__}")
4669   Loaders.static_loader.set_entry(Loader::TypedName.new(:type, 'puppet::ast', Pcore::RUNTIME_NAME_AUTHORITY), type_set, URI("#{loc}?line=1"))
4670   Loaders.register_static_implementations(all_types)
4671 end