private BibtexFile convertParseNode(ParseNode node) { Nodes.BibtexFile parseFile = (Nodes.BibtexFile)node; BibtexFile bibtex = new BibtexFile(); foreach (Entry entry in parseFile.Entries) { if (entry.Type == "String") { bibtex.StringDefinitions.Add(entry.Tags.First().Key, entry.Tags.First().Value); } else { BibtexEntry bibtexEntry = new BibtexEntry { Key = entry.Key, Type = entry.Type }; entry.Tags.ToList().ForEach(x => bibtexEntry.Tags.Add(x.Key, x.Value)); bibtex.Entries.Add(bibtexEntry); } } return(bibtex); }
private ParseNode ParseInput(Tokenizer.Tokenizer tokenizer) { Nodes.BibtexFile file = new Nodes.BibtexFile(); while (!tokenizer.EndOfInput) { AbstractToken token = tokenizer.NextToken(); if (token.GetType() == typeof(At)) { file.Entries.Add(Entry(tokenizer)); } } return(file); }
private BibtexFile convertParseNode(ParseNode node) { Nodes.BibtexFile parseFile = (Nodes.BibtexFile) node; BibtexFile bibtex = new BibtexFile(); foreach (Entry entry in parseFile.Entries) { if (entry.Type == "String") { bibtex.StringDefinitions.Add(entry.Tags.First().Key, entry.Tags.First().Value); } else { BibtexEntry bibtexEntry = new BibtexEntry { Key = entry.Key, Type = entry.Type }; entry.Tags.ToList().ForEach(x => bibtexEntry.Tags.Add(x.Key, x.Value)); bibtex.Entries.Add(bibtexEntry); } } return bibtex; }
private ParseNode ParseInput(Tokenizer.Tokenizer tokenizer) { Nodes.BibtexFile file = new Nodes.BibtexFile(); while (!tokenizer.EndOfInput) { AbstractToken token = tokenizer.NextToken(); if (token.GetType() == typeof (At)) { file.Entries.Add(Entry(tokenizer)); } } return file; }