ada_indent.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "ada_indent.h"
00011 #include "qeditor.h"
00012 #include <kdebug.h>
00013
00014 AdaIndent::AdaIndent( QEditor* ed )
00015 : QEditorIndenter( ed ),
00016 rxCompoundStmt("^\\s*(begin|for|declare|while|case|loop|if|else|subtype|type)\\b.*")
00017 {
00018 }
00019
00020 AdaIndent::~AdaIndent()
00021 {
00022 }
00023
00024 int AdaIndent::indentForLine( int line )
00025 {
00026 if( line == 0 )
00027 return 0;
00028
00029 int prevLine = QMAX( 0, previousNonBlankLine( line ) );
00030 int sw = 3;
00031
00032 QString lineText = editor()->text( line );
00033 QString prevLineText = editor()->text( prevLine );
00034
00035 int lineInd = indentation( lineText );
00036 int prevLineInd = indentation( prevLineText );
00037
00038 kdDebug() << "lineText=" << lineText << " prevLineText=" << prevLineText << " indent prev=" << lineInd << endl;
00039
00040 if (rxCompoundStmt.exactMatch(prevLineText))
00041 {
00042 kdDebug() << "exact match for compound statement match" << endl;
00043 return prevLineInd + sw;
00044 }
00045 else
00046 return prevLineInd;
00047 }
00048
This file is part of the documentation for KDevelop Version 3.1.2.