NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Config.Syntax.RootSyntaxNode Class Reference
Inheritance diagram for Ntp.Analyzer.Config.Syntax.RootSyntaxNode:
Collaboration diagram for Ntp.Analyzer.Config.Syntax.RootSyntaxNode:

Public Member Functions

 RootSyntaxNode ()
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< Configuration >
void Add (ISyntaxNode node)
 
void Assemble (ISyntaxNode node)
 
Compile ()
 
void CompileNode ()
 
IEnumerator< ISyntaxNodeGetEnumerator ()
 
void Resolve (SymbolTable table)
 
void Validate (SymbolTable table)
 

Protected Member Functions

override Configuration InternalCompile ()
 
override void ValidateMandatories ()
 Override to validates the mandatory types in this syntax node. More...
 
- Protected Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< Configuration >
 SyntaxNode (Symbol symbol, string name, int line, bool requirePath=false)
 
void AddError (string message)
 
void AddReferenceNameError (ISyntaxNode node, string keyword, string name)
 
void AddReferenceTypeError (ISyntaxNode node, string keyword, string section, string name)
 
void CheckAllIsPresent (IEnumerable< Symbol > list)
 
void CheckIsUnique (IEnumerable< Symbol > list)
 
Uri CheckLink (string link, string keyword)
 
void CheckOneIsPresent (IEnumerable< Symbol > list)
 
void CheckOnlyOneIsPresent (IEnumerable< Symbol > list)
 
void CheckTypeIs< TU > (Symbol symbol)
 
void CheckTypeIs< TU, TV > (Symbol symbol)
 
virtual void InternalResolve (SymbolTable table)
 Override to resolve references to other syntax nodes from this syntax node. More...
 
virtual void ValidateReferences (SymbolTable table)
 Override to validates the references in this syntax node. More...
 
virtual void ValidateTypes ()
 Override to validates the types in this syntax node. More...
 

Additional Inherited Members

- Public Attributes inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< Configuration >
ConfigurationNode CompiledNode
 
IEnumerable< string > Errors
 
bool HasErrors
 
- Properties inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< Configuration >
int Line [get]
 
string Name [get]
 
List< ISyntaxNodeNodes [get]
 
bool RequirePath [get]
 
Symbol Symbol [get]
 

Detailed Description

Definition at line 29 of file RootSyntaxNode.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Config.Syntax.RootSyntaxNode.RootSyntaxNode ( )
inline

Definition at line 31 of file RootSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.RootNode.

32  : base(Symbol.RootNode, null, 0)
33  {
34  }

Member Function Documentation

override Configuration Ntp.Analyzer.Config.Syntax.RootSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

Implements Ntp.Analyzer.Config.Syntax.SyntaxNode< Configuration >.

Definition at line 36 of file RootSyntaxNode.cs.

37  {
38  var permission = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPermission) as PermissionSyntaxNode;
39  var daemon = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDaemon) as HeartbeatSyntaxNode ??
40  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordService) as HeartbeatSyntaxNode;
41  var database = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDatabase) as DatabaseSyntaxNode;
42 
43  // TODO: Change to collection
44  var notify = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordNotify) as NotifySyntaxNode;
45 
46  return new Configuration(
47  Name,
48  database?.Compile(),
49  daemon?.Compile(),
50  (permission ?? new PermissionSyntaxNode(null, 0)).Compile(),
51  null, // NOTICE: Cluster function is not implemented
52  notify?.Compile(),
53  Nodes.OfType<ReadingSyntaxNode>().Select(n => n.Compile()),
54  Nodes.OfType<ListenerSyntaxNode>().Select(n => n.Compile()),
55  Nodes.OfType<LogSyntaxNode>().Select(n => n.Compile()),
56  Nodes.OfType<HostSyntaxNode>().Select(n => n.Compile())
57  );
58  }
override void Ntp.Analyzer.Config.Syntax.RootSyntaxNode.ValidateMandatories ( )
inlineprotectedvirtual

Override to validates the mandatory types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< Configuration >.

Definition at line 60 of file RootSyntaxNode.cs.

61  {
62  CheckIsUnique(new List<Symbol>
63  {
64  Symbol.KeywordDatabase,
65  Symbol.KeywordNotify,
66  Symbol.KeywordPermission,
67  Symbol.KeywordDaemon
68  });
69 
70  CheckAllIsPresent(new List<Symbol>
71  {
72  Symbol.KeywordDatabase,
73  Symbol.KeywordServer
74  });
75  }
void CheckAllIsPresent(IEnumerable< Symbol > list)
Definition: SyntaxNode.cs:205
void CheckIsUnique(IEnumerable< Symbol > list)
Definition: SyntaxNode.cs:340

The documentation for this class was generated from the following file: