Changeset 4583


Ignore:
Timestamp:
10/30/03 19:25:30 (19 years ago)
Author:
piso
Message:

Patch from Jan-Wijbrand Kolman.

File:
1 edited

Legend:

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

    r1736 r4583  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: PythonIndenter.java,v 1.2 2003-05-07 16:31:43 piso Exp $
     5 * $Id: PythonIndenter.java,v 1.3 2003-10-30 19:25:30 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5656        if (modelText.length() == 0)
    5757            return 0; // Shouldn't happen.
    58         // Indent after '{' or '('.
     58        // Indent after '{', '(' or '['.
    5959        char c = modelText.charAt(modelText.length()-1);
    60         if (c == '{' || c == '(')
     60        if (c == '{' || c == '(' || c == '[')
    6161            return modelIndent + indentSize;
    6262        final String modelFirst = getFirstIdentifier(modelText);
     
    6464            final String[] indentAfter = {
    6565                "class", "def", "if", "else", "elif",
    66                 "for", "while", "try", "except"
     66                "for", "while", "try", "except", "finally"
    6767            };
    6868            if (Utilities.isOneOf(modelFirst, indentAfter))
     
    7575        if (lineFirst.equals("def"))
    7676            return indentDef();
    77         // Unindent after "break", "continue" and "return".
    78         final String[] unindentAfter = {"break", "continue", "return"};
     77        // Unindent after "break", "continue", "return" and "pass".
     78        final String[] unindentAfter = {"break", "continue", "return", "pass"};
    7979        if (Utilities.isOneOf(modelFirst, unindentAfter))
    8080            return Math.max(0, modelIndent - indentSize);
    81         // Unindent if the current line starts with "else", "elif" or "except".
    82         final String[] unindent = {"else", "elif", "except"};
     81        // Unindent if the current line starts with "else", "elif", "except" or
     82        // "finally".
     83        final String[] unindent = {"else", "elif", "except", "finally"};
    8384        if (Utilities.isOneOf(lineFirst, unindent))
    8485            return Math.max(0, modelIndent - indentSize);
Note: See TracChangeset for help on using the changeset viewer.