protected virtual void DealWithTreeFilterMode()
{
object filterMode = (string)GetOption( "filter" );
if ( type == GrammarType.TreeParser && filterMode != null && filterMode.ToString().Equals( "true" ) )
{
// check for conflicting options
// filter => backtrack=true
// filter&&output=AST => rewrite=true
// filter&&output!=AST => error
// any deviation from valid option set is an error
object backtrack = (string)GetOption( "backtrack" );
object output = GetOption( "output" );
object rewrite = GetOption( "rewrite" );
if ( backtrack != null && !backtrack.ToString().Equals( "true" ) )
{
ErrorManager.Error( ErrorManager.MSG_CONFLICTING_OPTION_IN_TREE_FILTER,
"backtrack", backtrack );
}
if ( output != null && !output.ToString().Equals( "AST" ) )
{
ErrorManager.Error( ErrorManager.MSG_CONFLICTING_OPTION_IN_TREE_FILTER,
"output", output );
SetOption( "output", "", null );
}
if ( rewrite != null && !rewrite.ToString().Equals( "true" ) )
{
ErrorManager.Error( ErrorManager.MSG_CONFLICTING_OPTION_IN_TREE_FILTER,
"rewrite", rewrite );
}
// set options properly
SetOption( "backtrack", "true", null );
if ( output != null && output.ToString().Equals( "AST" ) )
{
SetOption( "rewrite", "true", null );
}
// @synpredgate set to state.backtracking==1 by code gen when filter=true
// superClass set in template target::treeParser
}
}