Skip to content

Instantly share code, notes, and snippets.

@rwstauner
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwstauner/de8865e4e0697ba2c9b4 to your computer and use it in GitHub Desktop.
Save rwstauner/de8865e4e0697ba2c9b4 to your computer and use it in GitHub Desktop.
Pod::Simple parsing binary
perl -e ' print "hi\n\n=F\0?}\302\240\0?}\302\200\n\nyo\n" '| perl -0777 -M'5; sub Pod::Simple::DEBUG { 10 }' -MPod::Text -ne ' my $parser = Pod::Text->new( code => 0, alt => 1, sentence => 0, width => 78 ); $parser->no_errata_section(1); $parser->parse_string_document($_) '
MANY_LINES is 20
# We are in ASCII-land
# We are under a Unicode-safe Perl.
# Parsing starting at line 0.
# About to parse lines: [hi]
First line: [hi]
First line is BOM-less.
# Parsing line: [hi]
# It's a code-line.
# Parsing starting at line 1.
# About to parse lines: []
# Parsing line: []
# It's a code-line.
# Parsing starting at line 2.
# About to parse lines: [=F?} ?}€]
Found an encoding line "=encoding UTF-8"
About to try loading Pod::Simple::TranscodeSmart...
OK, loaded Pod::Simple::TranscodeSmart.
Setting encoding to UTF-8
Discarding erratum (at line 3) Non-ASCII character seen before =encoding in '=F?}�?}�'. Assuming UTF-8
because no_errata_section is on.
# Parsing line: [=F?}�?}�]
Starting plain para at line 3
[ "~Para", {"start_line"=>3}, "=F\x{0}?}\x{a0}\x{0}?}\x{80}" ]
# Parsing starting at line 3.
# About to parse lines: []
# Parsing line: []
Noting para ends with blank line at 4
[ "~Para", {"start_line"=>3}, "=F\x{0}?}\x{a0}\x{0}?}\x{80}" ]
# Parsing starting at line 4.
# About to parse lines: [yo]
# Parsing line: [yo]
# Starting contentful document
Pondering a ~Para paragraph, given the stack: ([empty])
Pondering non-magical ~Para
Treating Plain paragraph as such because stack is empty.
giving plain treatment...
Paragraph:
=F?} ?}�
Paragraphic tokenstack = ()
Found stuff "=F?} ?}�"
Skipping _remap_sequences: formatless treelet.
Formatless treelet gets fast-tracked.
[ "Para", {"start_line"=>3}, "=F\x{0}?} \x{0}?}\x{80}" ]
Starting plain para at line 5
[ "~Para", {"start_line"=>5}, "yo" ]
# Parsing starting at line 5.
# About to parse lines: EOF
# Undef-line seen.
Pondering a ~Para paragraph, given the stack: ([empty])
Pondering non-magical ~Para
Treating Plain paragraph as such because stack is empty.
giving plain treatment...
Paragraph:
yo
Paragraphic tokenstack = ()
Found stuff "yo"
Skipping _remap_sequences: formatless treelet.
Formatless treelet gets fast-tracked.
[ "Para", {"start_line"=>5}, "yo" ]
Pondering a ~end paragraph, given the stack: ([empty])
Okay, stack is empty now.
Throwing end-document event.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment