Sha256: 57422bc8706bc8cff3aeccc0c362155b95dcc30989b252d28943105ca57d8660

Contents?: true

Size: 1.62 KB

Versions: 312

Compression:

Stored size: 1.62 KB

Contents

# The EppParser is a specialized Puppet Parser that starts parsing in Epp Text mode
class Puppet::Pops::Parser::EppParser < Puppet::Pops::Parser::Parser

  # Initializes the epp parser support by creating a new instance of {Puppet::Pops::Parser::Lexer}
  # configured to start in Epp Lexing mode.
  # @return [void]
  #
  def initvars
    self.lexer = Puppet::Pops::Parser::Lexer2.new()# {:mode => :epp})
  end

  # Parses a file expected to contain epp text/DSL logic.
  def parse_file(file)
    unless FileTest.exist?(file)
      unless file =~ /\.epp$/
        file = file + ".epp"
      end
    end
    @lexer.file = file
    _parse()
  end

  # 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
  #
  def _parse()
    begin
      @yydebug = false
      main = yyparse(@lexer,:scan_epp)
      # #Commented out now because this hides problems in the racc grammar while developing
      # # TODO include this when test coverage is good enough.
      #      rescue Puppet::ParseError => except
      #        except.line ||= @lexer.line
      #        except.file ||= @lexer.file
      #        except.pos  ||= @lexer.pos
      #        raise except
      #      rescue => except
      #        raise Puppet::ParseError.new(except.message, @lexer.file, @lexer.line, @lexer.pos, except)
    end
    return main
  ensure
    @lexer.clear
    @namestack = []
    @definitions = []
  end
end

Version data entries

312 entries across 312 versions & 3 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/pops/parser/epp_parser.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.7 lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.7-x86-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.7-x64-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.7-universal-darwin lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.12 lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.12-x86-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.12-x64-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.12-universal-darwin lib/puppet/pops/parser/epp_parser.rb
bolt-0.20.3 vendored/puppet/lib/puppet/pops/parser/epp_parser.rb
bolt-0.20.2 vendored/puppet/lib/puppet/pops/parser/epp_parser.rb
bolt-0.19.1 vendored/puppet/lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.11 lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.11-x86-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.11-x64-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-4.10.11-universal-darwin lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.6 lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.6-x86-mingw32 lib/puppet/pops/parser/epp_parser.rb
puppet-5.3.6-x64-mingw32 lib/puppet/pops/parser/epp_parser.rb