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



28
29
30
# File 'lib/puppet/parser/parser_factory.rb', line 28

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.



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

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

.parserObject

Produces a parser instance for the given environment



13
14
15
# File 'lib/puppet/parser/parser_factory.rb', line 13

def self.parser
  evaluating_parser
end