public virtual string GetWithNullsDistinctString(IndexDefinition index) { bool?GetNullsDistinct(IndexColumnDefinition column) { return(column.GetAdditionalFeature(SqlServerExtensions.IndexColumnNullsDistinct, (bool?)null)); } var indexNullsDistinct = index.GetAdditionalFeature(SqlServerExtensions.IndexColumnNullsDistinct, (bool?)null); var nullDistinctColumns = index.Columns.Where(c => indexNullsDistinct != null || GetNullsDistinct(c) != null).ToList(); if (nullDistinctColumns.Count != 0 && !index.IsUnique) { // Should never occur CompatibilityMode.HandleCompatibilty("With nulls distinct can only be used for unique indexes"); return(string.Empty); } // The "Nulls (not) distinct" value of the column // takes higher precedence than the value of the index // itself. var conditions = nullDistinctColumns .Where(x => (GetNullsDistinct(x) ?? indexNullsDistinct ?? true) == false) .Select(c => $"{Quoter.QuoteColumnName(c.Name)} IS NOT NULL"); var condition = string.Join(" AND ", conditions); if (condition.Length == 0) { return(string.Empty); } return($" WHERE {condition}"); }
/// <summary> /// Convert settings to their AppCompatFlag REG_SZ representation. /// </summary> public static string ToRegistryString(CompatibilityMode compatibilityMode, ColorMode colorMode, DPIScaling dpiScaling, OtherFlags otherFlags, List <string> additionalFlags) { var substrings = new List <string>(); // Add all flags substrings.AddRange(new List <string>() { compatibilityMode.ToRegistryString(), colorMode.ToRegistryString(), dpiScaling.ToRegistryString(), }); substrings.AddRange(otherFlags.ToRegistryString()); substrings.AddRange(additionalFlags); substrings = substrings.Where(s => !string.IsNullOrWhiteSpace(s)).ToList(); // On Windows 8 or above, a tilde is appended at beginning of the string. if (substrings.Any() && OSVersionServices.IsWindows8OrAbove) { substrings.Insert(0, RegistryServices.W8Prefix); } var appCompatFlags = string.Join(" ", substrings); return(appCompatFlags); }
//warnaserror[+|-] //warnaserror[+|-]:<warn list> //unsafe[+|-] //warn:<n> //nowarn:<warn list> public ParseOptions( CompatibilityMode compatibility = CompatibilityMode.None, LanguageVersion languageVersion = CSharp.LanguageVersion.CSharp4, IEnumerable <string> preprocessorSymbols = null, bool suppressDocumentationCommentParse = false, SourceCodeKind kind = SourceCodeKind.Regular) { if (!compatibility.IsValid()) { throw new ArgumentOutOfRangeException("compatibility"); } if (!languageVersion.IsValid()) { throw new ArgumentOutOfRangeException("languageVersion"); } if (!kind.IsValid()) { throw new ArgumentOutOfRangeException("kind"); } this.Compatibility = compatibility; this.LanguageVersion = languageVersion; this.PreprocessorSymbols = preprocessorSymbols.AsReadOnlyOrEmpty(); this.SuppressDocumentationCommentParse = suppressDocumentationCommentParse; this.Kind = kind; }
private void Initialize(byte[] decryptionKey, byte[] validationKey, ShaVersion hashAlgorithm, CompatibilityMode compatibilityMode) { _CompatibilityMode = compatibilityMode; _DecryptionKeyBlob = KeyDerivator.DeriveKey(decryptionKey, _CompatibilityMode); _hasher = HashProvider.Create(KeyDerivator.DeriveKey(validationKey, _CompatibilityMode), hashAlgorithm); }
/// <summary> /// Handles unsupported generator features according to a compatibility mode. /// </summary> /// <param name="mode">The compatibility modee</param> /// <param name="message">The exception message (if any gets thrown)</param> /// <returns>The string to be returned (if no exception was thrown)</returns> /// <exception cref="DatabaseOperationNotSupportedException">The exception to be thrown</exception> public static string HandleCompatibilty(this CompatibilityMode mode, string message) { if (CompatibilityMode.STRICT == mode) { throw new DatabaseOperationNotSupportedException(message); } return(string.Empty); }
public FormsAuthenticationTicketEncryptor( byte[] decryptionKey, byte[] validationKey, DecryptionKeyAlgorithm decryptionKeyAlgorithm, ValidationKeyAlgorithm validationKeyAlgorithm, CompatibilityMode compatibilityMode) { Initialize(decryptionKey, validationKey, decryptionKeyAlgorithm, validationKeyAlgorithm, compatibilityMode); }
public override string Generate(CreateSequenceExpression expression) { var result = new StringBuilder("CREATE SEQUENCE "); var seq = expression.Sequence; if (string.IsNullOrEmpty(seq.SchemaName)) { result.AppendFormat(Quoter.QuoteSequenceName(seq.Name)); } else { result.AppendFormat("{0}", Quoter.QuoteSequenceName(seq.Name, seq.SchemaName)); } if (seq.Increment.HasValue) { result.AppendFormat(" INCREMENT BY {0}", seq.Increment); } if (seq.MinValue.HasValue) { result.AppendFormat(" MINVALUE {0}", seq.MinValue); } if (seq.MaxValue.HasValue) { result.AppendFormat(" MAXVALUE {0}", seq.MaxValue); } if (seq.StartWith.HasValue) { result.AppendFormat(" START WITH {0}", seq.StartWith); } const long MINIMUM_CACHE_VALUE = 2; if (seq.Cache.HasValue) { if (seq.Cache.Value < MINIMUM_CACHE_VALUE) { return(CompatibilityMode.HandleCompatibilty("Oracle does not support Cache value equal to 1; if you intended to disable caching, set Cache to null. For information on Oracle limitations, see: https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-SEQUENCE.html#GUID-E9C78A8C-615A-4757-B2A8-5E6EFB130571__GUID-7E390BE1-2F6C-4E5A-9D5C-5A2567D636FB")); } result.AppendFormat(" CACHE {0}", seq.Cache); } else { result.Append(" NOCACHE"); } if (seq.Cycle) { result.Append(" CYCLE"); } return(result.ToString()); }
public override string Generate(CreateForeignKeyExpression expression) { // If a FK name starts with $$IGNORE$$_ then it means it was handled by the CREATE TABLE // routine and we know it's been handled so we should just not bother erroring. if (expression.ForeignKey.Name.StartsWith("$$IGNORE$$_")) { return(string.Empty); } return(CompatibilityMode.HandleCompatibilty("Foreign keys are not supported in SQLite")); }
public FormsAuthenticationTicketEncryptor( string decryptionKey, string validationKey, DecryptionKeyAlgorithm decryptionKeyAlgorithm, ValidationKeyAlgorithm validationKeyAlgorithm, CompatibilityMode compatibilityMode) { byte[] descriptionKeyBytes = HexUtils.HexToBinary(decryptionKey); byte[] validationKeyBytes = HexUtils.HexToBinary(validationKey); Initialize(descriptionKeyBytes, validationKeyBytes, decryptionKeyAlgorithm, validationKeyAlgorithm, compatibilityMode); }
public override string Generate(Expressions.AlterColumnExpression expression) { try { // throws an exception of an attempt is made to alter an identity column, as it is not supported by most version of DB2. return(string.Format("ALTER TABLE {0} {1}", Quoter.QuoteTableName(expression.TableName, expression.SchemaName), ((Db2Column)Column).GenerateAlterClause(expression.Column))); } catch (NotSupportedException e) { return(CompatibilityMode.HandleCompatibilty(e.Message)); } }
public override string Generate(CreateSequenceExpression expression) { var result = new StringBuilder("CREATE SEQUENCE "); var seq = expression.Sequence; result.AppendFormat(Quoter.QuoteSequenceName(seq.Name)); if (seq.Increment.HasValue) { result.AppendFormat(" INCREMENT BY {0}", seq.Increment); } if (seq.MinValue.HasValue) { result.AppendFormat(" MINVALUE {0}", seq.MinValue); } if (seq.MaxValue.HasValue) { result.AppendFormat(" MAXVALUE {0}", seq.MaxValue); } if (seq.StartWith.HasValue) { result.AppendFormat(" START WITH {0}", seq.StartWith); } const long MINIMUM_CACHE_VALUE = 2; if (seq.Cache.HasValue) { if (seq.Cache.Value < MINIMUM_CACHE_VALUE) { return(CompatibilityMode.HandleCompatibilty("Cache size must be greater than 1; if you intended to disable caching, set Cache to null.")); } result.AppendFormat(" CACHE {0}", seq.Cache); } else { result.Append(" NO CACHE"); } if (seq.Cycle) { result.Append(" CYCLE"); } result.Append(";"); return(result.ToString()); }
/// <summary> /// Creates a token from the given string. /// </summary> /// <param name="text"> The text. </param> /// <param name="compatibilityMode"> The script engine compatibility mode. </param> /// <param name="strictMode"> <c>true</c> if the lexer is operating in strict mode; /// <c>false</c> otherwise. </param> /// <returns> The token corresponding to the given string, or <c>null</c> if the string /// does not represent a valid token. </returns> public static Token FromString(string text, CompatibilityMode compatibilityMode, bool strictMode) { // Determine the lookup table to use. Dictionary <string, Token> lookupTable; if (compatibilityMode == CompatibilityMode.ECMAScript3) { // Initialize the ECMAScript 3 lookup table, if it hasn't already been intialized. if (ecmaScript3LookupTable == null) { lookupTable = InitializeLookupTable(ecmaScript3ReservedWords); System.Threading.Thread.MemoryBarrier(); ecmaScript3LookupTable = lookupTable; } lookupTable = ecmaScript3LookupTable; } else if (strictMode == false) { // Initialize the ECMAScript 5 lookup table, if it hasn't already been intialized. if (ecmaScript5LookupTable == null) { lookupTable = InitializeLookupTable(new Token[0]); System.Threading.Thread.MemoryBarrier(); ecmaScript5LookupTable = lookupTable; } lookupTable = ecmaScript5LookupTable; } else { // Initialize the strict mode lookup table, if it hasn't already been intialized. if (strictModeLookupTable == null) { lookupTable = InitializeLookupTable(strictModeReservedWords); System.Threading.Thread.MemoryBarrier(); strictModeLookupTable = lookupTable; } lookupTable = strictModeLookupTable; } // Look up the keyword in the lookup table. Token result; if (lookupTable.TryGetValue(text, out result) == true) { return(result); } // If the text wasn't found, it is an identifier instead. return(IdentifierToken.Create(text)); }
private void SetMute(CompatibilityMode Mode) { if (Mode == CompatibilityMode.Compatible) { BooleanMixerControl bmx = ((MixerLine)Mixer.OpenMixer(0).DestinationLines[0]).MuteSwitch; bmx.SetMute(!bmx.IsMuted()); } else { MMDeviceEnumerator devEnum = new MMDeviceEnumerator(); MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); defaultDevice.AudioEndpointVolume.Mute = !defaultDevice.AudioEndpointVolume.Mute; } }
public override string Generate(RenameColumnExpression expression) { if (CompatibilityMode == CompatibilityMode.STRICT) { return(CompatibilityMode.HandleCompatibilty("SQLite does not support renaming of columns")); } return(string.Format( RenameColumn, Quoter.QuoteTableName(expression.TableName, expression.SchemaName), Quoter.QuoteColumnName(expression.OldName), Quoter.QuoteColumnName(expression.NewName) )); }
public override string Generate(DeleteConstraintExpression expression) { if (!expression.Constraint.IsUniqueConstraint) { return(CompatibilityMode.HandleCompatibilty("Only UNIQUE constraints are supported in SQLite")); } // Convert the constraint into a drop UNIQUE index var idx = new DeleteIndexExpression(); idx.Index.Name = expression.Constraint.ConstraintName; idx.Index.SchemaName = expression.Constraint.SchemaName; return(Generate(idx)); }
public static byte[] DeriveKey(byte[] keyDerivationKey, CompatibilityMode compatibilityMode) { if (compatibilityMode == CompatibilityMode.Framework20SP2) { return(keyDerivationKey); } using (HMACSHA512 hmac = new HMACSHA512(keyDerivationKey)) { byte[] label, context; GetKeyDerivationParameters(out label, out context); byte[] derivedKey = DeriveKeyImpl(hmac, label, context, keyDerivationKey.Length * 8); return(derivedKey); } }
private bool AdjustVolume(VolumeSettings Settings) { if (Settings == null) { return(false); } OperatingSystem osInfo = Environment.OSVersion; if (osInfo.Platform != PlatformID.Win32NT) { return(false); } CompatibilityMode Mode = osInfo.Version.Major <= 5 ? CompatibilityMode.Compatible : CompatibilityMode.Standard; try { switch ((Method)_Settings.Method) { case Method.VolumeUp: ChangeVolume(Mode, Method.VolumeUp); break; case Method.VolumeDown: ChangeVolume(Mode, Method.VolumeDown); break; case Method.Mute: SetMute(Mode); break; } return(true); } catch { MessageBox.Show("Could not change volume settings.", "Volume Change Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void ChangeVolume(CompatibilityMode Mode, Method ChangeMethod) { if (Mode == CompatibilityMode.Compatible) { FaderMixerControl fmx = ((MixerLine)Mixer.OpenMixer(0).DestinationLines[0]).VolumeControl; int iPercent = (fmx.Maximum / 100) * _Settings.Percent; iPercent = ChangeMethod == Method.VolumeUp ? iPercent : -iPercent; fmx.Values = fmx.Values.Select(i => i = GetCompatibleVolumeRange(i + iPercent, fmx.Minimum, fmx.Maximum)).ToArray(); } else { MMDeviceEnumerator devEnum = new MMDeviceEnumerator(); MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); float fPercent = (float)_Settings.Percent / 100F; fPercent = ChangeMethod == Method.VolumeUp ? fPercent : -fPercent; float newValue = defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar + fPercent; defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar = GetCompatibleVolumeRange(newValue, 0F, 1F); } }
public EventStoreConnectionLogicHandler(IEventStoreConnection esConnection, ConnectionSettings settings) { Ensure.NotNull(esConnection, "esConnection"); Ensure.NotNull(settings, "settings"); _esConnection = esConnection; _settings = settings; // NOTE: It can happen the user submitted operations before the connection was available and got postponed // by the operation or subscription manager. This leads the first operation to take time before being // executed. By initializing _lastTimeoutsTimeStamp like this we prevent the first operation from taking a // huge amount of time to complete. _lastTimeoutsTimeStamp = _settings.OperationTimeoutCheckPeriod.Negate(); _operations = new OperationsManager(_esConnection.ConnectionName, settings); _subscriptions = new SubscriptionsManager(_esConnection.ConnectionName, settings); _queue = new SimpleQueuedHandler(_settings.Log); _queue.RegisterHandler <StartConnectionMessage>(msg => StartConnection(msg.Task, msg.EndPointDiscoverer)); _queue.RegisterHandler <CloseConnectionMessage>(msg => CloseConnection(msg.Reason, msg.Exception)); _queue.RegisterHandler <StartOperationMessage>(msg => StartOperation(msg.Operation, msg.MaxRetries, msg.Timeout)); _queue.RegisterHandler <StartSubscriptionMessage>(StartSubscription); _queue.RegisterHandler <StartFilteredSubscriptionMessage>(StartFilteredSubscription); _queue.RegisterHandler <StartPersistentSubscriptionMessage>(StartSubscription); _queue.RegisterHandler <EstablishTcpConnectionMessage>(msg => EstablishTcpConnection(msg.EndPoints)); _queue.RegisterHandler <TcpConnectionEstablishedMessage>(msg => TcpConnectionEstablished(msg.Connection)); _queue.RegisterHandler <TcpConnectionErrorMessage>(msg => TcpConnectionError(msg.Connection, msg.Exception)); _queue.RegisterHandler <TcpConnectionClosedMessage>(msg => TcpConnectionClosed(msg.Connection)); _queue.RegisterHandler <HandleTcpPackageMessage>(msg => HandleTcpPackage(msg.Connection, msg.Package)); _queue.RegisterHandler <TimerTickMessage>(msg => TimerTick()); _timer = new Timer(_ => EnqueueMessage(TimerTickMessage), null, Consts.TimerPeriod, Consts.TimerPeriod); _compatibilityMode = CompatibilityMode.Create(_settings.CompatibilityMode); }
public override string Generate(CreateConstraintExpression expression) { if (!expression.Constraint.IsUniqueConstraint) { return(CompatibilityMode.HandleCompatibilty("Only UNIQUE constraints are supported in SQLite")); } // Convert the constraint into a UNIQUE index var idx = new CreateIndexExpression(); idx.Index.Name = expression.Constraint.ConstraintName; idx.Index.TableName = expression.Constraint.TableName; idx.Index.SchemaName = expression.Constraint.SchemaName; idx.Index.IsUnique = true; foreach (var col in expression.Constraint.Columns) { idx.Index.Columns.Add(new IndexColumnDefinition { Name = col }); } return(Generate(idx)); }
// SERIALIZATION //_________________________________________________________________________________________ #if !SILVERLIGHT /// <summary> /// Initializes a new instance of the ObjectInstance class with serialized data. /// </summary> /// <param name="info"> The SerializationInfo that holds the serialized object data about /// the exception being thrown. </param> /// <param name="context"> The StreamingContext that contains contextual information about /// the source or destination. </param> private ScriptEngine(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { // Set the DeserializationEnvironment to this script engine. ScriptEngine.DeserializationEnvironment = this; // Create the initial hidden class schema. This must be done first. this.emptySchema = HiddenClassSchema.CreateEmptySchema(); // Deserialize the compatibility mode. this.compatibilityMode = (CompatibilityMode)info.GetInt32("compatibilityMode"); // Deserialize the ForceStrictMode flag. this.ForceStrictMode = info.GetBoolean("forceStrictMode"); // Deserialize the built-in objects. this.globalObject = (GlobalObject)info.GetValue("globalObject", typeof(GlobalObject)); this.arrayConstructor = (ArrayConstructor)info.GetValue("arrayConstructor", typeof(ArrayConstructor)); this.booleanConstructor = (BooleanConstructor)info.GetValue("booleanConstructor", typeof(BooleanConstructor)); this.dateConstructor = (DateConstructor)info.GetValue("dateConstructor", typeof(DateConstructor)); this.functionConstructor = (FunctionConstructor)info.GetValue("functionConstructor", typeof(FunctionConstructor)); this.jsonObject = (JSONObject)info.GetValue("jsonObject", typeof(JSONObject)); this.mathObject = (MathObject)info.GetValue("mathObject", typeof(MathObject)); this.numberConstructor = (NumberConstructor)info.GetValue("numberConstructor", typeof(NumberConstructor)); this.objectConstructor = (ObjectConstructor)info.GetValue("objectConstructor", typeof(ObjectConstructor)); this.regExpConstructor = (RegExpConstructor)info.GetValue("regExpConstructor", typeof(RegExpConstructor)); this.stringConstructor = (StringConstructor)info.GetValue("stringConstructor", typeof(StringConstructor)); // Deserialize the built-in error objects. this.errorConstructor = (ErrorConstructor)info.GetValue("errorConstructor", typeof(ErrorConstructor)); this.rangeErrorConstructor = (ErrorConstructor)info.GetValue("rangeErrorConstructor", typeof(ErrorConstructor)); this.typeErrorConstructor = (ErrorConstructor)info.GetValue("typeErrorConstructor", typeof(ErrorConstructor)); this.syntaxErrorConstructor = (ErrorConstructor)info.GetValue("syntaxErrorConstructor", typeof(ErrorConstructor)); this.uriErrorConstructor = (ErrorConstructor)info.GetValue("uriErrorConstructor", typeof(ErrorConstructor)); this.evalErrorConstructor = (ErrorConstructor)info.GetValue("evalErrorConstructor", typeof(ErrorConstructor)); this.referenceErrorConstructor = (ErrorConstructor)info.GetValue("referenceErrorConstructor", typeof(ErrorConstructor)); }
public override string Generate(AlterColumnExpression expression) { Truncator.Truncate(expression); return(CompatibilityMode.HandleCompatibilty("Alter column is not supported as expected")); }
public override string Generate(DeleteSequenceExpression expression) { return(CompatibilityMode.HandleCompatibilty("Sequences are not supported in SQLite")); }
public override string Generate(DeleteConstraintExpression expression) { return(CompatibilityMode.HandleCompatibilty("Constraints are not supported")); }
public override string Generate(AlterDefaultConstraintExpression expression) { return(CompatibilityMode.HandleCompatibilty("SQLite does not support altering of default constraints")); }
public override string Generate(DeleteForeignKeyExpression expression) { return(CompatibilityMode.HandleCompatibilty("Foreign keys are not supported in SQLite")); }
public override string Generate(AlterColumnExpression expression) { return(CompatibilityMode.HandleCompatibilty("SQLite does not support alter column")); }
public override string Generate(DeleteColumnExpression expression) { return(CompatibilityMode.HandleCompatibilty("SQLite does not support deleting of columns")); }
public ParseOptions Copy( CompatibilityMode? compatibility = null, LanguageVersion? languageVersion = null, IEnumerable<string> preprocessorSymbols = null, bool? suppressDocumentationCommentParse = null, SourceCodeKind? kind = SourceCodeKind.Regular) { return new ParseOptions( compatibility ?? this.Compatibility, languageVersion ?? this.LanguageVersion, preprocessorSymbols ?? this.PreprocessorSymbols.AsEnumerable(), suppressDocumentationCommentParse ?? this.SuppressDocumentationCommentParse, kind ?? this.Kind ); }
//warnaserror[+|-] //warnaserror[+|-]:<warn list> //unsafe[+|-] //warn:<n> //nowarn:<warn list> public ParseOptions( CompatibilityMode compatibility = CompatibilityMode.None, LanguageVersion languageVersion = CSharp.LanguageVersion.CSharp4, IEnumerable<string> preprocessorSymbols = null, bool suppressDocumentationCommentParse = false, SourceCodeKind kind = SourceCodeKind.Regular) { if (!compatibility.IsValid()) { throw new ArgumentOutOfRangeException("compatibility"); } if (!languageVersion.IsValid()) { throw new ArgumentOutOfRangeException("languageVersion"); } if (!kind.IsValid()) { throw new ArgumentOutOfRangeException("kind"); } this.Compatibility = compatibility; this.LanguageVersion = languageVersion; this.PreprocessorSymbols = preprocessorSymbols.AsReadOnlyOrEmpty(); this.SuppressDocumentationCommentParse = suppressDocumentationCommentParse; this.Kind = kind; }
public override string Generate(RenameTableExpression expression) { Truncator.Truncate(expression); return(CompatibilityMode.HandleCompatibilty("Rename table is not supported")); }
/// <summary> /// Convert a CompatibilityMode value to its AppCompatFlag REG_SZ representation. /// </summary> public static string ToRegistryString(this CompatibilityMode enumValue) { return(EnumServices.ToRegistryString(enumValue, CompatibilityModeServices.Descriptions)); }
/// <summary> /// Creates a token from the given string. /// </summary> /// <param name="text"> The text. </param> /// <param name="compatibilityMode"> The script engine compatibility mode. </param> /// <param name="strictMode"> <c>true</c> if the lexer is operating in strict mode; /// <c>false</c> otherwise. </param> /// <returns> The token corresponding to the given string, or <c>null</c> if the string /// does not represent a valid token. </returns> public static Token FromString(string text, CompatibilityMode compatibilityMode, bool strictMode) { // Determine the lookup table to use. Dictionary<string, Token> lookupTable; if (compatibilityMode == CompatibilityMode.ECMAScript3) { // Initialize the ECMAScript 3 lookup table, if it hasn't already been intialized. if (ecmaScript3LookupTable == null) { lookupTable = InitializeLookupTable(ecmaScript3ReservedWords); System.Threading.Thread.MemoryBarrier(); ecmaScript3LookupTable = lookupTable; } lookupTable = ecmaScript3LookupTable; } else if (strictMode == false) { // Initialize the ECMAScript 5 lookup table, if it hasn't already been intialized. if (ecmaScript5LookupTable == null) { lookupTable = InitializeLookupTable(new Token[0]); System.Threading.Thread.MemoryBarrier(); ecmaScript5LookupTable = lookupTable; } lookupTable = ecmaScript5LookupTable; } else { // Initialize the strict mode lookup table, if it hasn't already been intialized. if (strictModeLookupTable == null) { lookupTable = InitializeLookupTable(strictModeReservedWords); System.Threading.Thread.MemoryBarrier(); strictModeLookupTable = lookupTable; } lookupTable = strictModeLookupTable; } // Look up the keyword in the lookup table. Token result; if (lookupTable.TryGetValue(text, out result) == true) return result; // If the text wasn't found, it is an identifier instead. return new IdentifierToken(text); }