forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into controlsfx-tags
- Loading branch information
Showing
92 changed files
with
4,653 additions
and
3,425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
grammar Bst; | ||
|
||
// Lexer | ||
|
||
STRINGS : 'STRINGS'; | ||
INTEGERS : 'INTEGERS'; | ||
FUNCTION : 'FUNCTION'; | ||
EXECUTE : 'EXECUTE'; | ||
SORT : 'SORT'; | ||
ITERATE : 'ITERATE'; | ||
REVERSE : 'REVERSE'; | ||
ENTRY : 'ENTRY'; | ||
READ : 'READ'; | ||
MACRO : 'MACRO'; | ||
|
||
GT : '>'; | ||
LT : '<'; | ||
EQUAL : '='; | ||
ASSIGN : ':='; | ||
ADD : '+'; | ||
SUB : '-'; | ||
CONCAT : '*'; | ||
LBRACE : '{'; | ||
RBRACE : '}'; | ||
|
||
fragment LETTER : ('a'..'z'|'A'..'Z'|'.'|'$'); | ||
fragment NUMERAL : ('0'..'9'); | ||
|
||
IDENTIFIER : LETTER (LETTER|NUMERAL|'_')*; | ||
INTEGER : '#' ('+'|'-')? NUMERAL+; | ||
QUOTED : '\'' IDENTIFIER; | ||
STRING : '"' (~('"'))* '"'; | ||
|
||
WS: [ \r\n\t]+ -> skip; | ||
LINE_COMMENT : '%' ~('\n'|'\r')* '\r'? '\n' -> skip; | ||
|
||
// Parser | ||
|
||
bstFile | ||
: commands+ EOF | ||
; | ||
|
||
commands | ||
: STRINGS ids=idListObl #stringsCommand | ||
| INTEGERS ids=idListObl #integersCommand | ||
| FUNCTION LBRACE id=identifier RBRACE function=stack #functionCommand | ||
| MACRO LBRACE id=identifier RBRACE LBRACE repl=STRING RBRACE #macroCommand | ||
| READ #readCommand | ||
| EXECUTE LBRACE bstFunction RBRACE #executeCommand | ||
| ITERATE LBRACE bstFunction RBRACE #iterateCommand | ||
| REVERSE LBRACE bstFunction RBRACE #reverseCommand | ||
| ENTRY idListOpt idListOpt idListOpt #entryCommand | ||
| SORT #sortCommand | ||
; | ||
|
||
identifier | ||
: IDENTIFIER | ||
; | ||
|
||
// Obligatory identifier list | ||
idListObl | ||
: LBRACE identifier+ RBRACE | ||
; | ||
|
||
// Optional identifier list | ||
idListOpt | ||
: LBRACE identifier* RBRACE | ||
; | ||
|
||
bstFunction | ||
: LT | GT | EQUAL | ADD | SUB | ASSIGN | CONCAT | ||
| identifier | ||
; | ||
|
||
stack | ||
: LBRACE stackitem+ RBRACE | ||
; | ||
|
||
stackitem | ||
: bstFunction | ||
| STRING | ||
| INTEGER | ||
| QUOTED | ||
| stack | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ava/org/jabref/gui/edit/automaticfiededitor/AbstractAutomaticFieldEditorTabViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.jabref.gui.edit.automaticfiededitor; | ||
|
||
import java.util.Collection; | ||
import java.util.Comparator; | ||
import java.util.EnumSet; | ||
import java.util.HashSet; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
|
||
import org.jabref.gui.AbstractViewModel; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.model.database.BibDatabase; | ||
import org.jabref.model.entry.field.Field; | ||
import org.jabref.model.entry.field.StandardField; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public abstract class AbstractAutomaticFieldEditorTabViewModel extends AbstractViewModel { | ||
public static final Logger LOGGER = LoggerFactory.getLogger(AbstractAutomaticFieldEditorTabViewModel.class); | ||
|
||
protected final StateManager stateManager; | ||
|
||
private final ObservableList<Field> allFields = FXCollections.observableArrayList(); | ||
|
||
public AbstractAutomaticFieldEditorTabViewModel(BibDatabase bibDatabase, StateManager stateManager) { | ||
Objects.requireNonNull(bibDatabase); | ||
Objects.requireNonNull(stateManager); | ||
this.stateManager = stateManager; | ||
|
||
addFields(EnumSet.allOf(StandardField.class)); | ||
addFields(bibDatabase.getAllVisibleFields()); | ||
allFields.sort(Comparator.comparing(Field::getName)); | ||
} | ||
|
||
public ObservableList<Field> getAllFields() { | ||
return allFields; | ||
} | ||
|
||
private void addFields(Collection<? extends Field> fields) { | ||
Set<Field> fieldsSet = new HashSet<>(allFields); | ||
fieldsSet.addAll(fields); | ||
allFields.setAll(fieldsSet); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.