|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re^2: Parsing Emacs Lisp sexpr?by perlancar (Hermit) |
| on Apr 09, 2020 at 03:00 UTC ( [id://11115256]=note: print w/replies, xml ) | Need Help?? |
|
Nice work! I wonder why you opt to parse this format specifically instead of the generic lisp format though. As for the speed, it's actually rather on-par with Data::SExpression, which uses Parse::Yapp. I commented out the dumping and then: % time perl 11115197.pl archive-contents real 0m7.449s user 0m7.036s sys 0m0.413s % time perl -MFile::Slurper=read_text -MData::SExpression -E'$ds=Data::SExpression->new; ($sexp, $text) = $ds->read(read_text "archive-contents.2");' real 0m5.411s user 0m5.386s sys 0m0.025s archive-contents.2 is just the original file with replaced with ( ), and then the problematic @ atom replaced by "@". Perl regex or Regexp::Grammars will probably be several times faster.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||