Class: Puppet::Parser::ParserFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/parser/parser_factory.rb

Overview

The ParserFactory makes selection of parser possible. Currently, it is possible to switch between two different parsers:

  • classic_parser, the parser in 3.1

  • eparser, the Expression Based Parser

Class Method Summary collapse

Class Method Details

.code_mergerObject



26
27
28
# File 'lib/puppet/parser/parser_factory.rb', line 26

def self.code_merger
  Puppet::Pops::Parser::CodeMerger.new
end

.evaluating_parserObject

Creates an instance of an E4ParserAdapter that adapts an EvaluatingParser to the 3x way of parsing.



18
19
20
21
22
23
24
# File 'lib/puppet/parser/parser_factory.rb', line 18

def self.evaluating_parser
  unless defined?(Puppet::Pops::Parser::E4ParserAdapter)
    require 'puppet/parser/e4_parser_adapter'
    require 'puppet/pops/parser/code_merger'
  end
  E4ParserAdapter.new
end

.parserObject

Produces a parser instance for the given environment



11
12
13
# File 'lib/puppet/parser/parser_factory.rb', line 11

def self.parser
  evaluating_parser
end