Ejemplo n.º 1
0
        }     /* end PrintSettings */

/* ---------------------------------------------------------------------------
 * private method SetCapability(option, value)
 * ---------------------------------------------------------------------------
 * Sets the capability associated with option to the given value.
 * ------------------------------------------------------------------------ */

        private static void SetCapability(Option option, bool value)
        {
            Capability capability;

            switch (option)
            {
            case Option.Synonyms:
                capability = Capability.Synonyms;
                break;

            case Option.OctalLiterals:
                capability = Capability.OctalLiterals;
                break;

            case Option.LowlineIdentifiers:
                capability = Capability.LowlineIdentifiers;
                break;

            case Option.ExplicitCast:
                capability = Capability.ExplicitCast;
                break;

            case Option.Coroutines:
                capability = Capability.Coroutines;
                break;

            case Option.VariantRecords:
                capability = Capability.VariantRecords;
                break;

            case Option.LocalModules:
                capability = Capability.LocalModules;
                break;

            case Option.ToDoStatement:
                capability = Capability.ToDoStatement;
                break;

            default:
                // not a capability option
                return;
            } /* end switch */

            if (Dialects.IsMutableCapability(dialect, capability))
            {
                Capabilities.SetCapability(capability, value);
            } /* end if */
        }     /* end SetCapability */
Ejemplo n.º 2
0
/* ---------------------------------------------------------------------------
 * method SetDialect(dialect)
 * ---------------------------------------------------------------------------
 * Sets the current dialect to the given dialect and sets all capabilities to
 * the dialect's default capability settings.
 * ------------------------------------------------------------------------ */

        public static void SetDialect(Dialect dialect)
        {
            Capability cap;
            bool       value;

            /* clear mutually exclusive capabilities */
            Capabilities.SetCapability(Capability.VariantRecords, false);
            Capabilities.SetCapability(Capability.ExtensibleRecords, false);
            Capabilities.SetCapability(Capability.IndeterminateRecords, false);

            for (cap = Capability.First; cap <= Capability.Last; cap++)
            {
                value = Dialects.IsDefaultCapability(dialect, cap);
                Capabilities.SetCapability(cap, value);
            } /* end for */

            CompilerOptions.dialect = dialect;
        } /* end SetDialect */
Ejemplo n.º 3
0
        }     /* end SetOption */

/* ---------------------------------------------------------------------------
 * method IsMutableOption(option)
 * ---------------------------------------------------------------------------
 * Returns true if option is mutable for the current dialect, else false.
 * ------------------------------------------------------------------------ */

        public static bool IsMutableOption(Option option)
        {
            Capability capability;

            switch (option)
            {
            case Option.Synonyms:
                capability = Capability.Synonyms;
                break;

            case Option.OctalLiterals:
                capability = Capability.OctalLiterals;
                break;

            case Option.LowlineIdentifiers:
                capability = Capability.LowlineIdentifiers;
                break;

            case Option.ExplicitCast:
                capability = Capability.ExplicitCast;
                break;

            case Option.VariantRecords:
                capability = Capability.VariantRecords;
                break;

            case Option.LocalModules:
                capability = Capability.LocalModules;
                break;

            case Option.ToDoStatement:
                capability = Capability.ToDoStatement;
                break;

            default:
                return(true);
            } /* end switch */

            return(Dialects.IsMutableCapability(dialect, capability));
        } /* end SetCapability */