//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// PLEASE DO NOT EDIT WITHOUT THE EXPLICIT CONSENT OF THE AUTHOR! \\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
using System.IO;
using Ilog.Language.Util;
namespace Ilog.Language.Syntax
{
/**
* This class centralizes all the options that are properties
* of a given grammar. That is, it defines a property's name,
* its default value, its accesser, and its modifier.
*
* @version Last modified on Mon May 23 17:41:29 2005 by hak
* @author Hassan Aït-Kaci
* @copyright © 2000 ILOG, S.A.
*/
public static class Options
{
/* ******************************************************************* */
/**
* The maximal number of parser table initialization constructions
* per method. This may be set to a lesser value than the default
* (1000) if the parser's initialization method is too large.
*/
private static int initMethodSize = 1000;
public static int InitMethodSize
{
get { return initMethodSize; }
set { initMethodSize = value; }
}
/* ******************************************************************* */
/**
* The output stream (default: System.Console.Out).
*/
private static TextWriter _out = System.Console.Out;
public static TextWriter Out
{
get { return _out; }
set { _out = value; }
}
/* ******************************************************************* */
/**
* The error stream (default: System.Console.Error).
*/
private static TextWriter error = System.Console.Error;
public static TextWriter Error
{
get { return error; }
set { error = value; }
}
/* ******************************************************************* */
/**
* The level of verbosity (default: Verbose.NORMAL).
*/
private static int verbosity = Verbose.NORMAL;
public static int Verbosity
{
get { return verbosity; }
set { verbosity = value; }
}
/* ******************************************************************* */
/**
* The prefix of the grammar's file name (default: "Grammar").
*/
private static string grammarPrefix = "Grammar";
public static string GrammarPrefix
{
get { return grammarPrefix; }
set { grammarPrefix = value; }
}
/* ******************************************************************* */
/**
* The suffix of the grammar's file name (default: "grm").
*/
private static string grammarSuffix = "grm";
public static string GrammarSuffix
{
get { return grammarSuffix; }
set { grammarSuffix = value; }
}
/* ******************************************************************* */
/**
* The name of the grammar's file.
*/
public static string GrammarName
{
get { return grammarPrefix + "." + grammarSuffix; }
}
/* ******************************************************************* */
/**
* The prefix of the parser's file name (default: "Parser").
*/
private static string parserPrefix = "Parser";
public static string ParserPrefix
{
get { return parserPrefix; }
set { parserPrefix = value; }
}
/* ******************************************************************* */
/**
* When true, this prevents building the parser (default:
* false).
*/
private static bool noParser = false;
public static bool NoParser
{
get { return noParser; }
set { noParser = value; }
}
/* ******************************************************************* */
/**
* When true, this builds a grammar documentation (default:
* false).
*/
private static bool docOnly = false;
public static bool DocOnly
{
get { return docOnly; }
set { docOnly = value; }
}
/* ******************************************************************* */
/**
* When true, allows an incomplete grammar (default:
* false).
*/
private static bool isPermissible = false;
public static bool IsPermissible
{
get { return isPermissible; }
set { isPermissible = value; }
}
/* ******************************************************************* */
/**
* When true, R/R conflicts are resolved using rule
* precedence (namely, choose the rule with higher tag precedence,
* or if they are equal, choose the rule that comes first in the
* grammmar. When false, pick the rule that comes first
* in the grammar; (default: false).
*/
private static bool resolveRRsWithPrecedence = false;
public static bool ResolveRRsWithPrecedence
{
get { return resolveRRsWithPrecedence; }
set { resolveRRsWithPrecedence = value; }
}
/* ******************************************************************* */
/**
* When true, a DynamicParser will bundle unresolved
* conflicts into a choice action such that each option in the choice
* action are tried in turn, backtracking upon failure, up to the size
* of the sizes of the choice and trail stacks (i.e., the values
* of CHOICE_HISTORY and/or TRAIL_HISTORY.
*/
private static bool allowChoiceActions = false;
public static bool AllowChoiceActions
{
get { return allowChoiceActions; }
set { allowChoiceActions = value; }
}
/* ******************************************************************* */
/**
* How many choice points to keep by a dynamic parser (default: 10).
*/
private static int CHOICE_HISTORY = 10;
public static int ChoiceHistory
{
get { return CHOICE_HISTORY; }
set { if (value >= 0) CHOICE_HISTORY = value; }
}
/* ******************************************************************* */
/**
* How much history may be undone by a dynamic parser (default: 100).
*/
private static int TRAIL_HISTORY = 100;
public static int TrailHistory
{
get { return TRAIL_HISTORY; }
set { if (value >= 0) TRAIL_HISTORY = value; }
}
}
}