import io from pdfmajor.parser.PSStackParser.PSBaseParser import PSBaseParser TESTDATA = br'''%!PS begin end " @ # /a/BCD /Some_Name /foo#5f#xbaa 0 +1 -2 .5 1.234 (abc) () (abc ( def ) ghi) (def\040\0\0404ghi) (bach\\slask) (foo\nbaa) (this % is not a comment.) (foo baa) (foo\ baa) <> <20> < 40 4020 > func/a/b{(c)do*}def [ 1 (z) ! ] << /foo (bar) >> ''' parser = PSBaseParser(io.BytesIO(TESTDATA))