Skip to content

Commit

Permalink
Move bst package to logic (#1587)
Browse files Browse the repository at this point in the history
* Move bst package into logic

* Set new location of bst package for antlr

* Add changelog entry

* Reformulate changelog entry
  • Loading branch information
lenhard authored Jul 15, 2016
1 parent 17a679c commit f97c89c
Show file tree
Hide file tree
Showing 24 changed files with 42 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
## [Unreleased]

### Changed
- For developers: Moved the bst package into logic. This requires the regeneration of antlr sources, execute: gradlew generateSource
- [#1026](https://github.com/JabRef/jabref/issues/1026) JabRef does no longer delete user comments outside of BibTeX entries and strings
- [#1249](https://github.com/JabRef/jabref/issues/1249) Date layout formatter added

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ task generateBstGrammarSource(type: JavaExec) {
File antlrSource = file('src/main/antlr3/net/sf/jabref/bst/Bst.g')

inputs.file antlrSource
outputs.file file('src/main/gen/net/sf/jabref/bst/BstLexer.java')
outputs.file file('src/main/gen/net/sf/jabref/bst/BstParser.java')
outputs.file file('src/main/gen/net/sf/jabref/logic/bst/BstLexer.java')
outputs.file file('src/main/gen/net/sf/jabref/logic/bst/BstParser.java')

main = 'org.antlr.Tool'
classpath = configurations.antlr3
args = ["-o", file('src/main/gen/net/sf/jabref/bst/'), antlrSource]
args = ["-o", file('src/main/gen/net/sf/jabref/logic/bst/'), antlrSource]
}

task generateSearchGrammarSource(type: JavaExec) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/antlr3/net/sf/jabref/bst/Bst.g
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ tokens {

// applies only to the parser:
@header {// Generated by ANTLR
package net.sf.jabref.bst;}
package net.sf.jabref.logic.bst;}

// applies only to the lexer:
@lexer::header {// Generated by ANTLR
package net.sf.jabref.bst;}
package net.sf.jabref.logic.bst;}

program : commands+ -> ^(COMMANDS commands+);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Arrays;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// $Id$
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// $Id$
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

/**
* The |built_in| function {\.{text.prefix\$}} pops the top two literals (the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// $Id$
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Stack;

import net.sf.jabref.bst.BibtexCaseChanger.FORMAT_MODE;
import net.sf.jabref.bst.VM.BstEntry;
import net.sf.jabref.bst.VM.BstFunction;
import net.sf.jabref.logic.bst.BibtexCaseChanger.FORMAT_MODE;
import net.sf.jabref.logic.bst.VM.BstEntry;
import net.sf.jabref.logic.bst.VM.BstFunction;

/**
* From the Bibtex manual:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Stack;

import net.sf.jabref.bst.VM.BstEntry;
import net.sf.jabref.bst.VM.BstFunction;
import net.sf.jabref.logic.bst.VM.BstEntry;
import net.sf.jabref.logic.bst.VM.BstFunction;
import net.sf.jabref.model.entry.Author;
import net.sf.jabref.model.entry.AuthorList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Stack;

import net.sf.jabref.bst.VM.BstEntry;
import net.sf.jabref.bst.VM.BstFunction;
import net.sf.jabref.logic.bst.VM.BstEntry;
import net.sf.jabref.logic.bst.VM.BstFunction;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Stack;

import net.sf.jabref.bst.VM.BstEntry;
import net.sf.jabref.bst.VM.BstFunction;
import net.sf.jabref.logic.bst.VM.BstEntry;
import net.sf.jabref.logic.bst.VM.BstFunction;

/**
The |built_in| function {\.{text.prefix\$}} pops the top two literals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

public class VMException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

@FunctionalInterface
public interface Warn {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.util.Stack;

import net.sf.jabref.bst.VM.BstEntry;
import net.sf.jabref.bst.VM.BstFunction;
import net.sf.jabref.logic.bst.VM.BstEntry;
import net.sf.jabref.logic.bst.VM.BstFunction;

/**
* The |built_in| function {\.{width\$}} pops the top (string) literal and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Map;

import net.sf.jabref.Globals;
import net.sf.jabref.bst.BibtexNameFormatter;
import net.sf.jabref.logic.bst.BibtexNameFormatter;
import net.sf.jabref.logic.layout.LayoutFormatter;
import net.sf.jabref.model.entry.AuthorList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import net.sf.jabref.bst.BibtexCaseChanger.FORMAT_MODE;
import net.sf.jabref.logic.bst.BibtexCaseChanger.FORMAT_MODE;

import org.junit.Assert;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import net.sf.jabref.model.entry.AuthorList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import org.junit.Assert;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import org.junit.Assert;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import java.io.File;
import java.io.IOException;
Expand All @@ -9,10 +9,10 @@

import net.sf.jabref.Globals;
import net.sf.jabref.JabRefPreferences;
import net.sf.jabref.bst.VM.BstEntry;
import net.sf.jabref.bst.VM.StackFunction;
import net.sf.jabref.importer.ParserResult;
import net.sf.jabref.importer.fileformat.BibtexParser;
import net.sf.jabref.logic.bst.VM.BstEntry;
import net.sf.jabref.logic.bst.VM.StackFunction;
import net.sf.jabref.model.entry.BibEntry;

import org.antlr.runtime.RecognitionException;
Expand All @@ -30,7 +30,7 @@ public void setPreferences() {

@Test
public void testAbbrv() throws RecognitionException, IOException {
VM vm = new VM(new File("src/test/resources/net/sf/jabref/bst/abbrv.bst"));
VM vm = new VM(new File("src/test/resources/net/sf/jabref/logic/bst/abbrv.bst"));
List<BibEntry> v = new ArrayList<>();
v.add(t1BibtexEntry());

Expand Down Expand Up @@ -664,7 +664,7 @@ private String t1BibtexString() {

@Test
public void testHypthenatedName() throws RecognitionException, IOException {
VM vm = new VM(new File("src/test/resources/net/sf/jabref/bst/abbrv.bst"));
VM vm = new VM(new File("src/test/resources/net/sf/jabref/logic/bst/abbrv.bst"));
List<BibEntry> v = new ArrayList<>();
v.add(TestVM.bibtexString2BibtexEntry("@article{canh05, author = \"Jean-Paul Sartre\" }"));
Assert.assertTrue(vm.run(v).contains("J.-P. Sartre"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sf.jabref.bst;
package net.sf.jabref.logic.bst;

import org.junit.Assert;
import org.junit.Test;
Expand Down

0 comments on commit f97c89c

Please sign in to comment.