Changeset 8592


Ignore:
Timestamp:
02/16/05 21:39:20 (16 years ago)
Author:
piso
Message:

public boolean isDelimited(Position pos, int length)

Location:
trunk/j/src/org/armedbear/j
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/AbstractMode.java

    r4380 r8592  
    22 * AbstractMode.java
    33 *
    4  * Copyright (C) 1998-2003 Peter Graves
    5  * $Id: AbstractMode.java,v 1.20 2003-10-15 14:52:25 piso Exp $
     4 * Copyright (C) 1998-2005 Peter Graves
     5 * $Id: AbstractMode.java,v 1.21 2005-02-16 21:39:20 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    861861    }
    862862
     863    public boolean isDelimited(Position pos, int length)
     864    {
     865        final Line line = pos.getLine();
     866        final int offset = pos.getOffset();
     867        if (offset > 0) {
     868            if (isIdentifierPart(line.charAt(offset - 1)))
     869                return false;
     870        }
     871        final int after = offset + length;
     872        if (after < pos.getLineLength() && isIdentifierPart(line.charAt(after)))
     873            return false;
     874        return true;
     875    }
     876
    863877    /**
    864878     * {@inheritDoc}
     
    10681082    }
    10691083
    1070     public final String getIdentifier(Line line, int offset)
    1071     {
    1072         int limit = line.length();
     1084    public String getIdentifier(Line line, int offset)
     1085    {
     1086        final int limit = line.length();
    10731087        if (offset < limit) {
    10741088            char c = line.charAt(offset);
  • trunk/j/src/org/armedbear/j/Mode.java

    r2669 r8592  
    22 * Mode.java
    33 *
    4  * Copyright (C) 1998-2003 Peter Graves
    5  * $Id: Mode.java,v 1.9 2003-06-30 17:00:41 piso Exp $
     4 * Copyright (C) 1998-2005 Peter Graves
     5 * $Id: Mode.java,v 1.10 2005-02-16 21:38:39 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    387387    public boolean isIdentifierPart(char c);
    388388
     389    public boolean isDelimited(Position pos, int length);
     390
    389391    /**
    390392     * Returns <code>true</code> if the specified position is inside a quoted
Note: See TracChangeset for help on using the changeset viewer.