/usr/lib/ruby/1.9.1/psych/parser.rb is in libruby1.9.1 1.9.3.484-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | module Psych
###
# YAML event parser class. This class parses a YAML document and calls
# events on the handler that is passed to the constructor. The events can
# be used for things such as constructing a YAML AST or deserializing YAML
# documents. It can even be fed back to Psych::Emitter to emit the same
# document that was parsed.
#
# See Psych::Handler for documentation on the events that Psych::Parser emits.
#
# Here is an example that prints out ever scalar found in a YAML document:
#
# # Handler for detecting scalar values
# class ScalarHandler < Psych::Handler
# def scalar value, anchor, tag, plain, quoted, style
# puts value
# end
# end
#
# parser = Psych::Parser.new(ScalarHandler.new)
# parser.parse(yaml_document)
#
# Here is an example that feeds the parser back in to Psych::Emitter. The
# YAML document is read from STDIN and written back out to STDERR:
#
# parser = Psych::Parser.new(Psych::Emitter.new($stderr))
# parser.parse($stdin)
#
# Psych uses Psych::Parser in combination with Psych::TreeBuilder to
# construct an AST of the parsed YAML document.
class Parser
class Mark < Struct.new(:index, :line, :column)
end
# The handler on which events will be called
attr_accessor :handler
# Set the encoding for this parser to +encoding+
attr_writer :external_encoding
###
# Creates a new Psych::Parser instance with +handler+. YAML events will
# be called on +handler+. See Psych::Parser for more details.
def initialize handler = Handler.new
@handler = handler
@external_encoding = ANY
end
end
end
|