private void checkForNumber() {
        int offs = this.currentPos;
        Element element = this.getParagraphElement(offs);
        String elementText = "";
        try {
            // this gets our chuck of current text for the element we're on
            elementText = this.getText(element.getStartOffset(), element
                    .getEndOffset()
                    - element.getStartOffset());
        } catch (Exception ex) {
            // whoops!
            System.out.println("no text");
        }
        int strLen = elementText.length();
        if (strLen == 0) {
            return;
        }
        int i = 0;
 
        if (element.getStartOffset() > 0) {
            // translates backward if neccessary
            offs = offs - element.getStartOffset();
        }
        mode = TEXT_MODE;
        if ((offs >= 0) && (offs <= strLen - 1)) {
            i = offs;
            while (i > 0) {
                // the while loop walks back until we hit a delimiter
                char charAt = elementText.charAt(i);
                if ((charAt == ' ') | (i == 0) | (charAt == '(')
                        | (charAt == ')') | (charAt == '{') | (charAt == '}') /* | */) { // if i
                    // == 0
                    // then
                    // we're
                    // at
                    // the
                    // begininng
                    if (i != 0) {
                        i++;
                    }
                    mode = NUMBER_MODE;
                    break;
                } else if (!(charAt >= '0' & charAt <= '9' | charAt == '.'
                        | charAt == '+' | charAt == '-' | charAt == '/'
                        | charAt == '*' | charAt == '%' | charAt == '=')) {
                    mode = TEXT_MODE;
                    break;
                }
                i--;
            }
        }
    }