~ubuntu-branches/ubuntu/natty/jabref/natty

« back to all changes in this revision

Viewing changes to src/java/net/sf/jabref/search/SearchExpressionTreeParser.java

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2010-04-27 16:49:34 UTC
  • mfrom: (2.1.8 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100427164934-ozu2dvinslmo3444
Tags: 2.6+ds-2
debian/control: add "Recommends: xdg-utils"; thanks to Vincent Fourmond
for the bug report (closes: #579346). Change xpdf to xpdf-reader in
Suggests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import java.util.regex.PatternSyntaxException;
7
7
 
8
8
import net.sf.jabref.BibtexEntry;
 
9
import net.sf.jabref.export.layout.format.RemoveLatexCommands;
9
10
import antlr.MismatchedTokenException;
10
11
import antlr.NoViableAltException;
11
12
import antlr.RecognitionException;
15
16
public class SearchExpressionTreeParser extends antlr.TreeParser       implements SearchExpressionTreeParserTokenTypes
16
17
 {
17
18
 
18
 
        private static final int MATCH_EXACT = 0;
 
19
    // Formatter used on every field before searching. Removes Latex commands that
 
20
    // may interfere with the search:
 
21
    static RemoveLatexCommands removeLatexCommands = new RemoveLatexCommands();
 
22
 
 
23
    private static final int MATCH_EXACT = 0;
19
24
        private static final int MATCH_CONTAINS = 1;
20
25
        private static final int MATCH_DOES_NOT_CONTAIN = 2;
21
26
 
24
29
 
25
30
    private static final int PSEUDOFIELD_TYPE = 1;
26
31
 
27
 
    public int apply(AST ast, BibtexEntry bibtexEntry) throws antlr.RecognitionException {
 
32
     public int apply(AST ast, BibtexEntry bibtexEntry) throws antlr.RecognitionException {
28
33
                this.bibtexEntry = bibtexEntry;
29
34
                // specification of fields to search is done in the search expression itself
30
35
                this.searchKeys = bibtexEntry.getAllFields().toArray();
174
179
                                                                default: // regular field
175
180
                                                                        if (!fieldSpec.matcher(searchKeys[i].toString()).matches())
176
181
                                                                                continue;
177
 
                                                                        content = bibtexEntry.getField(searchKeys[i].toString());
 
182
                                                                        content = removeLatexCommands.format(
 
183
                                            bibtexEntry.getField(searchKeys[i].toString()));
178
184
                                                        }
179
185
                        noSuchField = false;
180
186
                                                        if (content == null)