Changeset 7206


Ignore:
Timestamp:
2004-04-20T09:20:11+12:00 (20 years ago)
Author:
kjdon
Message:

added a new field: strip_quotes. added a new constructor which sets it. now it uses strip_quotes to determine whether to strip the quotes from the tokens or not - sometimes we don't want it to

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/CommandTokenizer.java

    r6539 r7206  
    6363    private int count = -1;
    6464    private StringTokenizer internal_tokenizer;
    65    
     65    private boolean strip_quotes = true;
    6666    /** Basic Constructor. Used to parse tokens from a string keeping tokens surrounded by speechmarks or square brackets intact. Thus something like:<br>
    6767     * collectionmeta collectionextra [l = en] "Hello World"<br>
     
    9090    }
    9191   
     92    public CommandTokenizer(String command, BufferedReader in_stream, boolean strip_quotes) {
     93    this.internal_tokenizer = new StringTokenizer(command);
     94    this.in_stream = in_stream;
     95    this.strip_quotes = strip_quotes;
     96    }
     97   
    9298    /** Returns the minumum number of remaining tokens before the tokenizer runs out of string. There may be more tokens than this count, but never less. The discrepancy is due to internal functionality and the fact we can't read ahead in the string or associated stream without risking the need for unpredictable push-back
    9399     * @return the minumum number of tokens available as an int
     
    120126        case StaticStrings.DOUBLEQUOTE_CHAR:
    121127        ///ystem.err.println("Building token wrapped by double quotes.");
    122         result = buildToken(buffer, StaticStrings.DOUBLEQUOTE_CHAR, true);
     128        result = buildToken(buffer, StaticStrings.DOUBLEQUOTE_CHAR, this.strip_quotes);
    123129        break;
    124130        case StaticStrings.SINGLEQUOTE_CHAR:
    125131        ///ystem.err.println("Building token wrapped by single quotes.");
    126         result = buildToken(buffer, StaticStrings.SINGLEQUOTE_CHAR, true);
     132        result = buildToken(buffer, StaticStrings.SINGLEQUOTE_CHAR, this.strip_quotes);
    127133        break;
    128134        case StaticStrings.OPENBRACKET_CHAR:
Note: See TracChangeset for help on using the changeset viewer.