NAME

Text::MediaWiki::Parser::Builder - Build a node tree from tokens

SYNOPSIS

use Text::MediaWiki::Parser::Tokenizer;
use Text::MediaWiki::Parser::Builder;

my $tokens = Text::MediaWiki::Parser::Tokenizer->new->tokenize($wikitext);
my $tree   = Text::MediaWiki::Parser::Builder->new->build($tokens);
print $tree->to_str;

DESCRIPTION

Consumes the token list produced by Text::MediaWiki::Parser::Tokenizer and returns a Text::MediaWiki::Parser::Wikicode tree. Tokens are read from the end of a reversed list, exactly as in the original implementation, so nested constructs are closed in the right order.

LICENSE

MIT. Ported from mwparserfromhell, copyright (C) 2012-2025 Ben Kurtovic.