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 32 def _parse() 33 begin 34 @yydebug = false 35 main = yyparse(@lexer,:scan_epp) 36 # #Commented out now because this hides problems in the racc grammar while developing 37 # # TODO include this when test coverage is good enough. 38 # rescue Puppet::ParseError => except 39 # except.line ||= @lexer.line 40 # except.file ||= @lexer.file 41 # except.pos ||= @lexer.pos 42 # raise except 43 # rescue => except 44 # raise Puppet::ParseError.new(except.message, @lexer.file, @lexer.line, @lexer.pos, except) 45 end 46 return main 47 ensure 48 @lexer.clear 49 @namestack = [] 50 @definitions = [] 51 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 9 def initvars 10 self.lexer = Puppet::Pops::Parser::Lexer2.new() 11 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 14 def parse_file(file) 15 unless FileTest.exist?(file) 16 unless file =~ /\.epp$/ 17 file = file + ".epp" 18 end 19 end 20 @lexer.file = file 21 _parse() 22 end