kdubs
kdubs

Reputation: 1722

Parse::RecDescent does it only operate on a string?

I was looking at using Parse::RecDescent to parse some large files. I was figuring I'd pass it a token at a time. After looking at it a while, it appears that the tokenizer is built into it and you have to pass it the whole string up front. Is this correct?

Upvotes: 1

Views: 51

Answers (1)

cjm
cjm

Reputation: 62109

Yes. You normally pass the complete text to be parsed as a string.

However, note that it's documented that if you pass the text as a reference:

$parser->startrule(\$text);

then the matched portion of $text will be removed, leaving only what did not match. It may be possible to design your grammar so that you can parse a file in chunks.

Upvotes: 2

Related Questions