2
* Copyright (C) 2003 Oliver Kellogg
3
* okellogg@users.sourceforge.net
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
#include "ada_indent.h"
14
AdaIndent::AdaIndent( QEditor* ed )
15
: QEditorIndenter( ed ),
16
rxCompoundStmt("^\\s*(begin|for|declare|while|case|loop|if|else|subtype|type)\\b.*")
20
AdaIndent::~AdaIndent()
24
int AdaIndent::indentForLine( int line )
29
int prevLine = QMAX( 0, previousNonBlankLine( line ) );
32
QString lineText = editor()->text( line );
33
QString prevLineText = editor()->text( prevLine );
35
int lineInd = indentation( lineText );
36
int prevLineInd = indentation( prevLineText );
38
kdDebug() << "lineText=" << lineText << " prevLineText=" << prevLineText << " indent prev=" << lineInd << endl;
40
if (rxCompoundStmt.exactMatch(prevLineText))
42
kdDebug() << "exact match for compound statement match" << endl;
43
return prevLineInd + sw;