Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Server / System / Data / Services / Parsing / Token.cs / 1 / Token.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a type to represent a parsed token. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Parsing { using System; using System.Diagnostics; ///Use this class to represent a lexical token. [DebuggerDisplay("{Id} @ {Position}: [{Text}]")] internal struct Token { ///Kind of token. internal TokenId Id; ///Token text. internal string Text; ///Position of token. internal int Position; ///Checks whether this token is a comparison operator. internal bool IsComparisonOperator { get { if (this.Id != TokenId.Identifier) { return false; } return this.Text == ExpressionConstants.KeywordEqual || this.Text == ExpressionConstants.KeywordNotEqual || this.Text == ExpressionConstants.KeywordLessThan || this.Text == ExpressionConstants.KeywordGreaterThan || this.Text == ExpressionConstants.KeywordLessThanOrEqual || this.Text == ExpressionConstants.KeywordGreaterThanOrEqual; } } ///Checks whether this token is an equality operator. internal bool IsEqualityOperator { get { return this.Id == TokenId.Identifier && (this.Text == ExpressionConstants.KeywordEqual || this.Text == ExpressionConstants.KeywordNotEqual); } } ///Checks whether this token is a valid token for a key value. internal bool IsKeyValueToken { get { return this.Id == TokenId.BinaryLiteral || this.Id == TokenId.BooleanLiteral || this.Id == TokenId.DateTimeLiteral || this.Id == TokenId.GuidLiteral || this.Id == TokenId.StringLiteral || ExpressionLexer.IsNumeric(this.Id); } } ///Provides a string representation of this token. ///String representation of this token. public override string ToString() { return String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} @ {1}: [{2}]", this.Id, this.Position, this.Text); } ///Gets the current identifier text. ///The current identifier text. internal string GetIdentifier() { if (this.Id != TokenId.Identifier) { throw DataServiceException.CreateSyntaxError(Strings.RequestQueryParser_IdentifierExpected(this.Position)); } return this.Text; } ///Checks that this token has the specified identifier. /// Identifier to check. ///true if this is an identifier with the specified text. internal bool IdentifierIs(string id) { return this.Id == TokenId.Identifier && this.Text == id; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a type to represent a parsed token. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Parsing { using System; using System.Diagnostics; ///Use this class to represent a lexical token. [DebuggerDisplay("{Id} @ {Position}: [{Text}]")] internal struct Token { ///Kind of token. internal TokenId Id; ///Token text. internal string Text; ///Position of token. internal int Position; ///Checks whether this token is a comparison operator. internal bool IsComparisonOperator { get { if (this.Id != TokenId.Identifier) { return false; } return this.Text == ExpressionConstants.KeywordEqual || this.Text == ExpressionConstants.KeywordNotEqual || this.Text == ExpressionConstants.KeywordLessThan || this.Text == ExpressionConstants.KeywordGreaterThan || this.Text == ExpressionConstants.KeywordLessThanOrEqual || this.Text == ExpressionConstants.KeywordGreaterThanOrEqual; } } ///Checks whether this token is an equality operator. internal bool IsEqualityOperator { get { return this.Id == TokenId.Identifier && (this.Text == ExpressionConstants.KeywordEqual || this.Text == ExpressionConstants.KeywordNotEqual); } } ///Checks whether this token is a valid token for a key value. internal bool IsKeyValueToken { get { return this.Id == TokenId.BinaryLiteral || this.Id == TokenId.BooleanLiteral || this.Id == TokenId.DateTimeLiteral || this.Id == TokenId.GuidLiteral || this.Id == TokenId.StringLiteral || ExpressionLexer.IsNumeric(this.Id); } } ///Provides a string representation of this token. ///String representation of this token. public override string ToString() { return String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} @ {1}: [{2}]", this.Id, this.Position, this.Text); } ///Gets the current identifier text. ///The current identifier text. internal string GetIdentifier() { if (this.Id != TokenId.Identifier) { throw DataServiceException.CreateSyntaxError(Strings.RequestQueryParser_IdentifierExpected(this.Position)); } return this.Text; } ///Checks that this token has the specified identifier. /// Identifier to check. ///true if this is an identifier with the specified text. internal bool IdentifierIs(string id) { return this.Id == TokenId.Identifier && this.Text == id; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NativeRightsManagementAPIsStructures.cs
- StretchValidation.cs
- AuthenticationSchemesHelper.cs
- TextAutomationPeer.cs
- TemplateContent.cs
- HttpValueCollection.cs
- ConsoleTraceListener.cs
- Serializer.cs
- DSACryptoServiceProvider.cs
- XmlUtil.cs
- AssemblyUtil.cs
- RuleSetBrowserDialog.cs
- WebServiceMethodData.cs
- CapabilitiesRule.cs
- IgnoreSection.cs
- DataConnectionHelper.cs
- Utils.cs
- ObjRef.cs
- LongTypeConverter.cs
- StorageMappingFragment.cs
- RoutedCommand.cs
- SafeRightsManagementQueryHandle.cs
- RouteUrlExpressionBuilder.cs
- XsltContext.cs
- FormattedTextSymbols.cs
- SoapCommonClasses.cs
- AuthenticationManager.cs
- CommandID.cs
- XmlUtf8RawTextWriter.cs
- WpfPayload.cs
- CodeMethodInvokeExpression.cs
- Variable.cs
- BaseInfoTable.cs
- DispatcherProcessingDisabled.cs
- DifferencingCollection.cs
- XomlCompiler.cs
- UIHelper.cs
- Size3DValueSerializer.cs
- DataSourceHelper.cs
- XmlAggregates.cs
- MergeFilterQuery.cs
- MatrixKeyFrameCollection.cs
- EventDescriptor.cs
- BindingElementExtensionElement.cs
- ArraySubsetEnumerator.cs
- TreeWalker.cs
- CodeTypeMemberCollection.cs
- PathGeometry.cs
- PeerResolverElement.cs
- ThemeInfoAttribute.cs
- PersonalizableAttribute.cs
- LowerCaseStringConverter.cs
- ViewKeyConstraint.cs
- Boolean.cs
- RayHitTestParameters.cs
- BindingExpression.cs
- IProducerConsumerCollection.cs
- EntityEntry.cs
- SynchronizationContext.cs
- BaseComponentEditor.cs
- DuplicateWaitObjectException.cs
- MinimizableAttributeTypeConverter.cs
- InvokeBase.cs
- x509utils.cs
- ExpressionCopier.cs
- TextMarkerSource.cs
- DocumentApplicationJournalEntry.cs
- querybuilder.cs
- NameScope.cs
- MessageSecurityProtocol.cs
- EventLogSession.cs
- RealProxy.cs
- Bold.cs
- ArcSegment.cs
- InputLanguageEventArgs.cs
- FormsAuthenticationUserCollection.cs
- DataQuery.cs
- RichTextBoxConstants.cs
- SessionStateUtil.cs
- Visual3D.cs
- x509utils.cs
- ThicknessConverter.cs
- BitArray.cs
- CfgParser.cs
- HttpCapabilitiesSectionHandler.cs
- OracleRowUpdatingEventArgs.cs
- FormatSettings.cs
- BrowserCapabilitiesCodeGenerator.cs
- ValueOfAction.cs
- ConnectionManagementElement.cs
- login.cs
- AttributeAction.cs
- TypeRestriction.cs
- WpfSharedXamlSchemaContext.cs
- ColorTransform.cs
- SiteMapNodeItemEventArgs.cs
- AmbientProperties.cs
- EditingCoordinator.cs
- EntityDataSourceChangedEventArgs.cs
- SigningDialog.cs