=> Operator ("M" Reference)
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
This operator has two uses. It is used for entity intialization. And it is used to specify custom projections for syntax and token rules when creating a custom language.
Field Name => value expression
Precedence PatternDeclaration => Projection
Remarks
When initializing fields in an entity, the value expression can be any expression that results in a valid Microsoft code name “M” value.
For more information about projections in syntax rules, see Custom Rule Projections
Example
The following code shows how to initialize an entity.
Contacts
{
{Name => "Bob", City => "Redmond" Email => "Bob@Contoso.com"}
{Name => "Jane", City => "Seattle" Email => "Jane@Microsoft.com"}
}
The following code shows how to define a custom projection for a syntax rule.
syntax Access = al:AccessLit av:AccessValue => Access {al, av};
token AccessLit = "Access=";
token AccessValue =
"public"
| "private"
| "internal"
| "protected";
The parser for this language recognizes input strings that start with the value "Access=", and followed by one of the values specified in the AccessValue
token rule. The projection in the Access
syntax rule produces output similar to the following.
Access{
"Access=",
"public"