src/jdk/nashorn/internal/runtime/regexp/joni/UnsetAddrList.java

changeset 273
98798a6336de
parent 272
4c67a692ef97
child 275
a92be4c0063b
     1.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/UnsetAddrList.java	Thu May 16 13:44:25 2013 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,69 +0,0 @@
     1.4 -/*
     1.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
     1.6 - * this software and associated documentation files (the "Software"), to deal in
     1.7 - * the Software without restriction, including without limitation the rights to
     1.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
     1.9 - * of the Software, and to permit persons to whom the Software is furnished to do
    1.10 - * so, subject to the following conditions:
    1.11 - *
    1.12 - * The above copyright notice and this permission notice shall be included in all
    1.13 - * copies or substantial portions of the Software.
    1.14 - *
    1.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    1.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    1.21 - * SOFTWARE.
    1.22 - */
    1.23 -package jdk.nashorn.internal.runtime.regexp.joni;
    1.24 -
    1.25 -import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
    1.26 -import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
    1.27 -import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
    1.28 -import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
    1.29 -
    1.30 -public final class UnsetAddrList {
    1.31 -    int num;
    1.32 -    Node[]targets;
    1.33 -    int[]offsets;
    1.34 -
    1.35 -    public UnsetAddrList(int size) {
    1.36 -        targets = new Node[size];
    1.37 -        offsets = new int[size];
    1.38 -    }
    1.39 -
    1.40 -    public void add(int offset, Node node) {
    1.41 -        if (num >= offsets.length) {
    1.42 -            Node []ttmp = new Node[targets.length << 1];
    1.43 -            System.arraycopy(targets, 0, ttmp, 0, num);
    1.44 -            targets = ttmp;
    1.45 -            int[]otmp = new int[offsets.length << 1];
    1.46 -            System.arraycopy(offsets, 0, otmp, 0, num);
    1.47 -            offsets = otmp;
    1.48 -        }
    1.49 -        targets[num] = node;
    1.50 -        offsets[num] = offset;
    1.51 -
    1.52 -        num++;
    1.53 -    }
    1.54 -
    1.55 -    public void fix(Regex regex) {
    1.56 -        for (int i=0; i<num; i++) {
    1.57 -            EncloseNode en = (EncloseNode)targets[i];
    1.58 -            if (!en.isAddrFixed()) new InternalException(ErrorMessages.ERR_PARSER_BUG);
    1.59 -            regex.code[offsets[i]] = en.callAddr; // is this safe ?
    1.60 -        }
    1.61 -    }
    1.62 -
    1.63 -    public String toString() {
    1.64 -        StringBuilder value = new StringBuilder();
    1.65 -        if (num > 0) {
    1.66 -            for (int i=0; i<num; i++) {
    1.67 -                value.append("offset + " + offsets[i] + " target: " + targets[i].getAddressName());
    1.68 -            }
    1.69 -        }
    1.70 -        return value.toString();
    1.71 -    }
    1.72 -}

mercurial