class Puppet::Pops::Parser::EppParser

The EppParser is a specialized Puppet Parser that starts parsing in Epp Text mode

Public Instance Methods

_parse() click to toggle source

Performs the parsing and returns the resulting model. The lexer holds state, and this is setup with {#parse_string}, or {#parse_file}.

TODO: deal with options containing origin (i.e. parsing a string from externally known location). TODO: should return the model, not a Hostclass

@api private

   # File lib/puppet/pops/parser/epp_parser.rb
31 def _parse()
32   begin
33     @yydebug = false
34     main = yyparse(@lexer,:scan_epp)
35     # #Commented out now because this hides problems in the racc grammar while developing
36     # # TODO include this when test coverage is good enough.
37     #      rescue Puppet::ParseError => except
38     #        except.line ||= @lexer.line
39     #        except.file ||= @lexer.file
40     #        except.pos  ||= @lexer.pos
41     #        raise except
42     #      rescue => except
43     #        raise Puppet::ParseError.new(except.message, @lexer.file, @lexer.line, @lexer.pos, except)
44   end
45   return main
46 ensure
47   @lexer.clear
48   @namestack = []
49   @definitions = []
50 end
initvars() click to toggle source

Initializes the epp parser support by creating a new instance of {Puppet::Pops::Parser::Lexer} configured to start in Epp Lexing mode. @return [void]

   # File lib/puppet/pops/parser/epp_parser.rb
 8 def initvars
 9   self.lexer = Puppet::Pops::Parser::Lexer2.new()
10 end
parse_file(file) click to toggle source

Parses a file expected to contain epp text/DSL logic.

   # File lib/puppet/pops/parser/epp_parser.rb
13 def parse_file(file)
14   unless FileTest.exist?(file)
15     unless file =~ /\.epp$/
16       file = file + ".epp"
17     end
18   end
19   @lexer.file = file
20   _parse()
21 end