| Next: Backend construction Previous: Set up Active Contents handling Contents: Contents |
And now, the parser can be called. Because it is implemented by a class, we first need to build an object, which is simple.
# build parser my $parser=new PerlPoint::Parser; |
The objects method run() invokes the parser to process all document sources. Various parameters control how this task is performed and need to be set according to the converter options. It should be sufficient to simply copy this call and to slightly adapt it.
# call parser
$parser->run(
stream => \@streamData,
files => \@ARGV,
filter => 'perl|sdf|html',
safe => exists $options{activeContents} ? $safe : undef,
activeBaseData => {
targetLanguage => 'SDF',
userSettings => {map {$_=>1} exists $options{set} ? @{$options{set}} : ()},
},
predeclaredVars => {
CONVERTER_NAME => basename($0),
CONVERTER_VERSION => do {no strict 'refs'; ${join('::', __PACKAGE__, 'VERSION')}},
},
vispro => 1,
cache => (exists $options{cache} ? CACHE_ON : CACHE_OFF)
+ (exists $options{cacheCleanup} ? CACHE_CLEANUP : 0),
display => DISPLAY_ALL
+ (exists $options{noinfo} ? DISPLAY_NOINFO : 0)
+ (exists $options{nowarn} ? DISPLAY_NOWARN : 0),
trace => TRACE_NOTHING
+ ((exists $options{trace} and $options{trace} & 1) ? TRACE_PARAGRAPHS : 0)
+ ((exists $options{trace} and $options{trace} & 2) ? TRACE_LEXER : 0)
+ ((exists $options{trace} and $options{trace} & 4) ? TRACE_PARSER : 0)
+ ((exists $options{trace} and $options{trace} & 8) ? TRACE_SEMANTIC : 0)
+ ((exists $options{trace} and $options{trace} & 16) ? TRACE_ACTIVE : 0),
) or exit(1); |
So what happens here?
streamfilesfiltersafe$safe.
activeBaseData$main::PerlPoint. The keys targetLanguage and userSettings are provided by convention, but you may add whatever keys you need.
visprocachedisplaytrace
run() returns a true value if parsing was successful. It is recommended to evaluate this code and to stop processing in case of an error.
# call parser $parser->run(...) or exit(1); |
| Next: Backend construction Previous: Set up Active Contents handling Contents: Contents |