//========================================================================================= internal override ParserSpecification CreateParserSpecification(ScannerSpecification scannerSpecification) { var oSpec = new ParserSpecification(); oSpec.AddRule("Tag", "lt?separator? id?tagName? {id?attribute? eq?separator? attrValue?attributeValue?} gt?separator?"); oSpec.AddRule("Comment", "comment?comments?"); oSpec.AddRule("Cdata", "cdata?cdata?"); return oSpec; }
//========================================================================================= internal virtual ParserSpecification CreateParserSpecification(ScannerSpecification scannerSpecification) { ///Создание спецификации для парсера ПО УМОЛЧАНИЮ. ///По умолчанию все правила состоят из одного токена. var oSpec = new ParserSpecification(); Dictionary<string, string> ruleNames = new Dictionary<string, string>(); ///Найдем все упоминающиеся имена токенов и включим foreach (var oState in scannerSpecification.States) { string sTokenName = oState.ResultTokenName; if (!string.IsNullOrEmpty(sTokenName) && !ruleNames.ContainsKey(sTokenName)) { oSpec.AddRule(sTokenName, sTokenName); ruleNames.Add(sTokenName, sTokenName); } } return oSpec; }