-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLanguageRule.cs
More file actions
39 lines (35 loc) · 1.62 KB
/
LanguageRule.cs
File metadata and controls
39 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Microsoft Corporation. All rights reserved.
using System.Collections.Generic;
using ColorCode.Common;
namespace ColorCode
{
/// <summary>
/// Defines a single rule for a language. For instance a language rule might define string literals for a given language.
/// </summary>
public class LanguageRule
{
/// <summary>
/// Initializes a new instance of the <see cref="LanguageRule"/> class.
/// </summary>
/// <param name="regex">The regular expression that defines what the language rule matches and captures.</param>
/// <param name="captures">The scope indices and names of the regular expression's captures.</param>
public LanguageRule(string regex,
IDictionary<int, string> captures)
{
Guard.ArgNotNullAndNotEmpty(regex, "regex");
Guard.EnsureParameterIsNotNullAndNotEmpty(captures, "captures");
Regex = regex;
Captures = captures;
}
/// <summary>
/// Gets the regular expression that defines what the language rule matches and captures.
/// </summary>
/// <value>The regular expression that defines what the language rule matches and captures.</value>
public string Regex { get; private set; }
/// <summary>
/// Gets the scope indices and names of the regular expression's captures.
/// </summary>
/// <value>The scope indices and names of the regular expression's captures.</value>
public IDictionary<int, string> Captures { get; private set; }
}
}