Usage
BibtexParser parser = new BibtexParser(importFormatPreferences); ParserResult result = parser.parse();
Can be used standalone.
Main using method:
`OpenDatabase.(org.jabref.logic.importer.OpenDatabase#loadDatabase(java.nio.file.Path, org.jabref.logic.importer.ImportFormatPreferences, org.jabref.model.util.FileUpdateMonitor))
Opposite class:
BibDatabaseWriter
FIXME: This class relies on char, but should use java. to be fully Unicode compliant.
| Modifier and Type | Class and Description |
|---|---|
| private static class | BibtexParser.
Thrown as soon as an unresolved version control conflict marker is read, which makes the rest of the file meaningless. |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private GroupTreeNode | |
| private int | |
| private static final int | CONFLICT_MARKER_LENGTH
Git writes conflict markers as seven characters at the start of a line, but a botched merge can produce longer runs (https://github.com/JabRef/jabref/issues/9167). |
| private char | conflictMarkerCharacter
|
| private BibDatabase | |
| private static final DocumentBuilderFactory | |
| private Set | |
| private boolean | |
| private static final Pattern | |
| private final Deque | |
| private final ImportFormatPreferences | |
| private static final int | |
| private int | |
| private static final Logger | |
| private static final int | |
| private final MetaDataParser | |
| private final Map | |
| private ParserResult | |
| private final Deque | |
| private PushbackReader |
| Access | Constructor and Description |
|---|---|
| public | BibtexParser(@NonNull ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileMonitor)
|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | addBibDeskGroupEntriesToJabRefGroups(Character keywordSeparator)
Adds BibDesk group entries to the JabRef database |
| private void | |
| private void | checkForConflictMarker(int character)
Detects a run of conflict marker characters at the start of a line. |
| private void | |
| private void | |
| private void | |
| private boolean | |
| private void | |
| private String | |
| private String | Returns: the text read so farPuts all text that has been read from the reader, including newlines, etc., since the last call of this method into a string. |
| private String | |
| private String | |
| public Collection | |
| private void | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| public ParserResult | |
| private void | |
| private void | parseBibDeskComment(String comment, Map<String, String> meta)
Parses comment types found in BibDesk, to migrate BibDesk Static Groups to JabRef. |
| private void | |
| private StringBuilder | parseBracketedFieldContent(boolean recoverAtEntryStart)
This is called if a field in the form of |
| private String | |
| private void | |
| public List | |
| private BibEntry | |
| private void | |
| private String | |
| private ParserResult | |
| private void | |
| private String | |
| private String | |
| private StringBuilder | |
| private void | |
| public Optional | |
| private BibtexString | |
| private String | parseTextToken()
This method is used to parse string labels, field names, entry type and numbers outside brackets. |
| private int | |
| private char[] | |
| private String | |
| private String | Returns: a String without eof charactersRemoves all eof characters from a StringBuilder and returns a new String with the resulting content |
| private int | |
| private StringBuilder | removeWhitespaces(StringBuilder toRemove)
returns a new |
| public static Optional | Returns: AnOptional<BibEntry>. Optional.empty() if non was found or an error occurred.Parses BibtexEntries from the given string and returns one entry found (or null if none found) It is undetermined which entry is returned, so use this in case you know there is only one entry in the string. |
| private String | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void |
| BIB_DESK_ROOT_GROUP_NAME | back to summary |
|---|---|
| private static final String BIB_DESK_ROOT_GROUP_NAME | |
| bibDeskGroupTreeNode | back to summary |
|---|---|
| private GroupTreeNode bibDeskGroupTreeNode | |
| column | back to summary |
|---|---|
| private int column | |
| CONFLICT_MARKER_LENGTH | back to summary |
|---|---|
| private static final int CONFLICT_MARKER_LENGTH Git writes conflict markers as seven characters at the start of a line, but a botched merge can produce longer runs (https://github.com/JabRef/jabref/issues/9167). | |
| conflictMarkerCharacter | back to summary |
|---|---|
| private char conflictMarkerCharacter
| |
| database | back to summary |
|---|---|
| private BibDatabase database | |
| DOCUMENT_BUILDER_FACTORY | back to summary |
|---|---|
| private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY | |
| entryTypes | back to summary |
|---|---|
| private Set<BibEntryType> entryTypes | |
| eof | back to summary |
|---|---|
| private boolean eof | |
| EPILOG_PATTERN | back to summary |
|---|---|
| private static final Pattern EPILOG_PATTERN | |
| highestColumns | back to summary |
|---|---|
| private final Deque<Integer> highestColumns | |
| importFormatPreferences | back to summary |
|---|---|
| private final ImportFormatPreferences importFormatPreferences | |
| INDEX_RELATIVE_PATH_IN_PLIST | back to summary |
|---|---|
| private static final int INDEX_RELATIVE_PATH_IN_PLIST | |
| line | back to summary |
|---|---|
| private int line | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| LOOKAHEAD | back to summary |
|---|---|
| private static final int LOOKAHEAD | |
| metaDataParser | back to summary |
|---|---|
| private final MetaDataParser metaDataParser | |
| parsedBibDeskGroups | back to summary |
|---|---|
| private final Map<String, String> parsedBibDeskGroups | |
| parserResult | back to summary |
|---|---|
| private ParserResult parserResult | |
| pureTextFromFile | back to summary |
|---|---|
| private final Deque<Character> pureTextFromFile | |
| pushbackReader | back to summary |
|---|---|
| private PushbackReader pushbackReader | |
| BibtexParser | back to summary |
|---|---|
| public BibtexParser(@NonNull ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileMonitor) | |
| BibtexParser | back to summary |
|---|---|
| public BibtexParser(ImportFormatPreferences importFormatPreferences) | |
| addBibDeskGroupEntriesToJabRefGroups | back to summary |
|---|---|
| private void addBibDeskGroupEntriesToJabRefGroups(Character keywordSeparator) Adds BibDesk group entries to the JabRef database | |
| checkEpilog | back to summary |
|---|---|
| private void checkEpilog() | |
| checkForConflictMarker | back to summary |
|---|---|
| private void checkForConflictMarker(int character) Detects a run of conflict marker characters at the start of a line. The state is keyed on Only | |
| consume | back to summary |
|---|---|
| private void consume(char expected) throws IOException | |
| consume | back to summary |
|---|---|
| private void consume(Field field, char expected) throws IOException | |
| consume | back to summary |
|---|---|
| private void consume(char firstOption, char secondOption) throws IOException | |
| consumeUncritically | back to summary |
|---|---|
| private boolean consumeUncritically(char expected) throws IOException | |
| createBibDeskGroupTree | back to summary |
|---|---|
| private void createBibDeskGroupTree(Character keywordSeparator) | |
| determineNewLineSeparator | back to summary |
|---|---|
| private String determineNewLineSeparator() throws IOException | |
| dumpTextReadSoFarToString | back to summary |
|---|---|
| private String dumpTextReadSoFarToString() Puts all text that has been read from the reader, including newlines, etc., since the last call of this method into a string. Removes the JabRef file header, if it is found
| |
| fixKey | back to summary |
|---|---|
| private String fixKey() throws IOException Tries to restore the key
| |
| getPureTextFromFile | back to summary |
|---|---|
| private String getPureTextFromFile() | |
| getStringValues | back to summary |
|---|---|
| public Collection | |
| initializeParserResult | back to summary |
|---|---|
| private void initializeParserResult(String newLineSeparator) | |
| isClosingBracketNext | back to summary |
|---|---|
| private boolean isClosingBracketNext() | |
| isEntryStart | back to summary |
|---|---|
| private boolean isEntryStart() throws IOException | |
| isEOFCharacter | back to summary |
|---|---|
| private boolean isEOFCharacter(int character) | |
| isEscapeSymbol | back to summary |
|---|---|
| private boolean isEscapeSymbol(char character) | |
| parse | back to summary |
|---|---|
| public ParserResult parse(@NonNull Reader in) throws IOException Parses BibTeX data found when reading from reader. The reader will be consumed. Multiple calls to parse() return the same results Handling of encoding is done at | |
| parseAndAddEntry | back to summary |
|---|---|
| private void parseAndAddEntry(String type) | |
| parseBibDeskComment | back to summary |
|---|---|
| private void parseBibDeskComment(String comment, Map<String, String> meta) throws ParseException Parses comment types found in BibDesk, to migrate BibDesk Static Groups to JabRef. | |
| parseBibtexString | back to summary |
|---|---|
| private void parseBibtexString() throws IOException | |
| parseBracketedFieldContent | back to summary |
|---|---|
| private StringBuilder parseBracketedFieldContent(boolean recoverAtEntryStart) throws IOException This is called if a field in the form of | |
| parseBracketedText | back to summary |
|---|---|
| private String parseBracketedText() throws IOException | |
| parseDatabaseID | back to summary |
|---|---|
| private void parseDatabaseID() throws IOException | |
| parseEntries | back to summary |
|---|---|
| public List Implements org.
| |
| parseEntry | back to summary |
|---|---|
| private BibEntry parseEntry(String entryType) throws IOException | |
| parseField | back to summary |
|---|---|
| private void parseField(BibEntry entry) throws IOException | |
| parseFieldContent | back to summary |
|---|---|
| private String parseFieldContent(Field field) throws IOException | |
| parseFileContent | back to summary |
|---|---|
| private ParserResult parseFileContent() throws IOException | |
| parseJabRefComment | back to summary |
|---|---|
| private void parseJabRefComment(Map<String, String> meta) | |
| parseKey | back to summary |
|---|---|
| private String parseKey() throws IOException This method is used to parse the citation key of an entry. | |
| parsePreamble | back to summary |
|---|---|
| private String parsePreamble() throws IOException | |
| parseQuotedFieldExactly | back to summary |
|---|---|
| private StringBuilder parseQuotedFieldExactly() throws IOException | |
| parseRemainingContent | back to summary |
|---|---|
| private void parseRemainingContent() | |
| parseSingleEntry | back to summary |
|---|---|
| public Optional | |
| parseString | back to summary |
|---|---|
| private BibtexString parseString() throws IOException | |
| parseTextToken | back to summary |
|---|---|
| private String parseTextToken() throws IOException This method is used to parse string labels, field names, entry type and numbers outside brackets. | |
| peek | back to summary |
|---|---|
| private int peek() throws IOException | |
| peekTwoCharacters | back to summary |
|---|---|
| private char[] peekTwoCharacters() throws IOException | |
| purge | back to summary |
|---|---|
| private String purge(String context, String stringToPurge) Purges the given stringToPurge (if it exists) from the given context
| |
| purgeEOFCharacters | back to summary |
|---|---|
| private String purgeEOFCharacters(String input) Removes all eof characters from a StringBuilder and returns a new String with the resulting content
| |
| read | back to summary |
|---|---|
| private int read() throws IOException | |
| removeWhitespaces | back to summary |
|---|---|
| private StringBuilder removeWhitespaces(StringBuilder toRemove) returns a new | |
| singleFromString | back to summary |
|---|---|
| public static Optional Parses BibtexEntries from the given string and returns one entry found (or null if none found) It is undetermined which entry is returned, so use this in case you know there is only one entry in the string. | |
| skipAndRecordWhitespace | back to summary |
|---|---|
| private String skipAndRecordWhitespace(int character) throws IOException | |
| skipOneNewline | back to summary |
|---|---|
| private void skipOneNewline() throws IOException | |
| skipSpace | back to summary |
|---|---|
| private void skipSpace() throws IOException | |
| skipWhitespace | back to summary |
|---|---|
| private void skipWhitespace() throws IOException | |
| unread | back to summary |
|---|---|
| private void unread(int character) throws IOException | |
| unreadBuffer | back to summary |
|---|---|
| private void unreadBuffer(StringBuilder stringBuilder) throws IOException pushes buffer back into input
| |
Unchecked on purpose: the parser recovers from IOException in several places (e.g., isClosingBracketNext()), and a conflict marker must not be recoverable.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| ConflictMarkerFoundException | back to summary |
|---|---|
| pack-priv ConflictMarkerFoundException(int line) | |