Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
TermReportGroups.cs
Go to the documentation of this file.
1 #region License
2 /* **********************************************************************************
3  * Copyright (c) Roman Ivantsov
4  * This source code is subject to terms and conditions of the MIT License
5  * for Irony. A copy of the license can be found in the License.txt file
6  * at the root of this distribution.
7  * By using this source code in any fashion, you are agreeing to be bound by the terms of the
8  * MIT License.
9  * You must not remove this notice from this software.
10  * **********************************************************************************/
11 #endregion
12 
13 using System;
14 using System.Collections.Generic;
15 using System.Linq;
16 using System.Text;
17 
18 namespace Irony.Parsing {
19 
20  //Terminal report group is a facility for improving syntax error messages.
21  // Irony parser/scanner reports an error like "Syntax error, invalid character. Expected: <expected list>."
22  // The <expected list> is a list of all terminals (symbols) that are expected in current position.
23  // This list might quite long and quite difficult to look through. The solution is to provide Group names for
24  // groups of terminals - Group of type Normal.
25  // Some terminals might be excluded from showing in expected list by including them into group of type Exclude.
26  // Finally, Operator group allows you to specify group name for all operator symbols without listing operators -
27  // Irony will collect all operator symbols registered with RegisterOperator method automatically.
28 
29  public enum TermReportGroupType {
30  Normal,
31  Exclude,
32  Operator
33  }
34  public class TermReportGroup {
35  public string Alias;
37  public TerminalSet Terminals = new TerminalSet();
38 
39  public TermReportGroup(string alias, TermReportGroupType groupType, IEnumerable<Terminal> terminals) {
40  Alias = alias;
41  GroupType = groupType;
42  if (terminals != null)
43  Terminals.UnionWith(terminals);
44  }
45 
46  }//class
47 
48  public class TermReportGroupList : List<TermReportGroup> { }
49 
50 }//namespace
TermReportGroup(string alias, TermReportGroupType groupType, IEnumerable< Terminal > terminals)
TermReportGroupType GroupType