1 using System;
2 using System.Collections;
3
4 namespace soulcm.scm2html
5 {
6 public class Domain
7 {
8 public const List<ParserFile*>& ParserFiles() const
9 {
10 return parserFiles;
11 }
12 public void Accept(Visitor& visitor)
13 {
14 visitor.Visit(*this);
15 }
16 public void AddParserFile(ParserFile* parserFile)
17 {
18 parserFiles.Add(parserFile);
19 }
20 public void AddParser(GrammarParser* parser)
21 {
22 Map<ustring, GrammarParser*>.ConstIterator it = parserMap.CFind(parser->Name());
23 if (it != parserMap.CEnd())
24 {
25 throw Exception("parser \'" + ToUtf8(parser->Name()) + "\' already exists");
26 }
27 parserMap[parser->Name()] = parser;
28 }
29 public GrammarParser* GetParser(const ustring& parserName) const
30 {
31 Map<ustring, GrammarParser*>.ConstIterator it = parserMap.CFind(parserName);
32 if (it != parserMap.CEnd())
33 {
34 return it->second;
35 }
36 else
37 {
38 throw Exception("parser \'" + ToUtf8(parserName) + "\' not found");
39 }
40 }
41 private List<ParserFile*> parserFiles;
42 private Map<ustring, GrammarParser*> parserMap;
43 }
44 }