亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? yyindent.cpp

?? qtopia的源程序,一種嵌入式圖形操作系統(tǒng)
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/******************************************************************************** Copyright (C) 1992-$THISYEAR$ Trolltech AS. All rights reserved.**** This file is part of the $MODULE$ of the Qt Toolkit.**** $LICENSE$**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************//*  This file is a self-contained interactive indenter for C++ and Qt  Script.  The general problem of indenting a C++ program is ill posed. On the  one hand, an indenter has to analyze programs written in a  free-form formal language that is best described in terms of  tokens, not characters, not lines. On the other hand, indentation  applies to lines and white space characters matter, and otherwise  the programs to indent are formally invalid in general, as they are  begin edited.  The approach taken here works line by line. We receive a program  consisting of N lines or more, and we want to compute the  indentation appropriate for the Nth line. Lines beyond the Nth  lines are of no concern to us, so for simplicity we pretend the  program has exactly N lines and we call the Nth line the "bottom  line". Typically, we have to indent the bottom line when it's still  empty, so we concentrate our analysis on the N - 1 lines that  precede.  By inspecting the (N - 1)-th line, the (N - 2)-th line, ...  backwards, we determine the kind of the bottom line and indent it  accordingly.    * The bottom line is a comment line. See      bottomLineStartsInCComment() and      indentWhenBottomLineStartsInCComment().    * The bottom line is a continuation line. See isContinuationLine()      and indentForContinuationLine().    * The bottom line is a standalone line. See      indentForStandaloneLine().  Certain tokens that influence the indentation, notably braces, are  looked for in the lines. This is done by simple string comparison,  without a real tokenizer. Confusing constructs such as comments and  string literals are removed beforehand.*/#include <qregexp.h>#include <qstringlist.h>/* qmake ignore Q_OBJECT *//*  The indenter avoids getting stuck in almost infinite loops by  imposing arbitrary limits on the number of lines it analyzes when  looking for a construct.  For example, the indenter never considers more than BigRoof lines  backwards when looking for the start of a C-style comment.*/static const int SmallRoof = 40;static const int BigRoof = 400;/*  The indenter supports a few parameters:    * ppHardwareTabSize is the size of a '\t' in your favorite editor.    * ppIndentSize is the size of an indentation, or software tab      size.    * ppContinuationIndentSize is the extra indent for a continuation      line, when there is nothing to align against on the previous      line.    * ppCommentOffset is the indentation within a C-style comment,      when it cannot be picked up.*/static int ppHardwareTabSize = 8;static int ppIndentSize = 4;static int ppContinuationIndentSize = 8;static const int ppCommentOffset = 2;void setTabSize( int size ){    ppHardwareTabSize = size;}void setIndentSize( int size ){    ppIndentSize = size;    ppContinuationIndentSize = 2 * size;}static QRegExp *literal = 0;static QRegExp *label = 0;static QRegExp *inlineCComment = 0;static QRegExp *braceX = 0;static QRegExp *iflikeKeyword = 0;/*  Returns the first non-space character in the string t, or  QChar::null if the string is made only of white space.*/static QChar firstNonWhiteSpace( const QString& t ){    int i = 0;    while ( i < (int) t.length() ) {	if ( !t[i].isSpace() )	    return t[i];	i++;    }    return QChar::Null;}/*  Returns true if string t is made only of white space; otherwise  returns false.*/static bool isOnlyWhiteSpace( const QString& t ){    return firstNonWhiteSpace( t ).isNull();}/*  Assuming string t is a line, returns the column number of a given  index. Column numbers and index are identical for strings that don't  contain '\t's.*/int columnForIndex( const QString& t, int index ){    int col = 0;    if ( index > (int) t.length() )	index = t.length();    for ( int i = 0; i < index; i++ ) {	if ( t[i] == QChar('\t') ) {	    col = ( (col / ppHardwareTabSize) + 1 ) * ppHardwareTabSize;	} else {	    col++;	}    }    return col;}/*  Returns the indentation size of string t.*/int indentOfLine( const QString& t ){    return columnForIndex( t, t.find(firstNonWhiteSpace(t)) );}/*  Replaces t[k] by ch, unless t[k] is '\t'. Tab characters are better  left alone since they break the "index equals column" rule. No  provisions are taken against '\n' or '\r', which shouldn't occur in  t anyway.*/static inline void eraseChar( QString& t, int k, QChar ch ){    if ( t[k] != '\t' )	t[k] = ch;}/*  Removes some nefast constructs from a code line and returns the  resulting line.*/static QString trimmedCodeLine( const QString& t ){    QString trimmed = t;    int k;    /*      Replace character and string literals by X's, since they may      contain confusing characters (such as '{' and ';'). "Hello!" is      replaced by XXXXXXXX. The literals are rigourously of the same      length before and after; otherwise, we would break alignment of      continuation lines.    */    k = 0;    while ( (k = trimmed.find(*literal, k)) != -1 ) {	for ( int i = 0; i < literal->matchedLength(); i++ )	    eraseChar( trimmed, k + i, 'X' );	k += literal->matchedLength();    }    /*      Replace inline C-style comments by spaces. Other comments are      handled elsewhere.    */    k = 0;    while ( (k = trimmed.find(*inlineCComment, k)) != -1 ) {	for ( int i = 0; i < inlineCComment->matchedLength(); i++ )	    eraseChar( trimmed, k + i, ' ' );	k += inlineCComment->matchedLength();    }    /*      Replace goto and switch labels by whitespace, but be careful      with this case:	  foo1: bar1;	      bar2;    */    while ( trimmed.findRev(':') != -1 && trimmed.find(*label) != -1 ) {	QString cap1 = label->cap( 1 );	int pos1 = label->pos( 1 );	int stop = cap1.length();	if ( pos1 + stop < (int) trimmed.length() && ppIndentSize < stop )	    stop = ppIndentSize;	int i = 0;	while ( i < stop ) {	    eraseChar( trimmed, pos1 + i, ' ' );	    i++;	}	while ( i < (int) cap1.length() ) {	    eraseChar( trimmed, pos1 + i, ';' );	    i++;	}    }    /*      Remove C++-style comments.    */    k = trimmed.find( QString::fromLatin1("//") );    if ( k != -1 )	trimmed.truncate( k );    return trimmed;}/*  Returns '(' if the last parenthesis is opening, ')' if it is  closing, and QChar::null if there are no parentheses in t.*/static inline QChar lastParen( const QString& t ){    int i = t.length();    while ( i > 0 ) {	i--;	if ( t[i] == QChar('(') || t[i] == QChar(')') )	    return t[i];    }    return QChar::Null;}/*  Returns true if typedIn the same as okayCh or is null; otherwise  returns false.*/static inline bool okay( QChar typedIn, QChar okayCh ){    return typedIn == QChar::Null || typedIn == okayCh;}/*  The "linizer" is a group of functions and variables to iterate  through the source code of the program to indent. The program is  given as a list of strings, with the bottom line being the line to  indent. The actual program might contain extra lines, but those are  uninteresting and not passed over to us.*/struct LinizerState{    QString line;    int braceDepth;    bool leftBraceFollows;    QStringList::ConstIterator iter;    bool inCComment;    bool pendingRightBrace;};static QStringList *yyProgram = 0;static LinizerState *yyLinizerState = 0;// shorthandsstatic const QString *yyLine = 0;static const int *yyBraceDepth = 0;static const bool *yyLeftBraceFollows = 0;/*  Saves and restores the state of the global linizer. This enables  backtracking.*/#define YY_SAVE() \	LinizerState savedState = *yyLinizerState#define YY_RESTORE() \	*yyLinizerState = savedState/*  Advances to the previous line in yyProgram and update yyLine  accordingly. yyLine is cleaned from comments and other damageable  constructs. Empty lines are skipped.*/static bool readLine(){    int k;    yyLinizerState->leftBraceFollows =	    ( firstNonWhiteSpace(yyLinizerState->line) == QChar('{') );    do {	if ( yyLinizerState->iter == yyProgram->begin() ) {	    yyLinizerState->line = QString::null;	    return false;	}	--yyLinizerState->iter;	yyLinizerState->line = *yyLinizerState->iter;	yyLinizerState->line = trimmedCodeLine( yyLinizerState->line );	/*	  Remove C-style comments that span multiple lines. If the	  bottom line starts in a C-style comment, we are not aware	  of that and eventually yyLine will contain a slash-aster.	  Notice that both if's can be executed, since	  yyLinizerState->inCComment is potentially set to false in	  the first if. The order of the if's is also important.	*/	if ( yyLinizerState->inCComment ) {	    QString slashAster( "/*" );	    k = yyLinizerState->line.find( slashAster );	    if ( k == -1 ) {		yyLinizerState->line = QString::null;	    } else {		yyLinizerState->line.truncate( k );		yyLinizerState->inCComment = false;	    }	}	if ( !yyLinizerState->inCComment ) {	    QString asterSlash( "*/" );	    k = yyLinizerState->line.find( asterSlash );	    if ( k != -1 ) {		for ( int i = 0; i < k + 2; i++ )		    eraseChar( yyLinizerState->line, i, ' ' );		yyLinizerState->inCComment = true;	    }	}	/*	  Remove preprocessor directives.	*/	k = 0;	while ( k < (int) yyLinizerState->line.length() ) {	    QChar ch = yyLinizerState->line[k];	    if ( ch == QChar('#') ) {		yyLinizerState->line = QString::null;	    } else if ( !ch.isSpace() ) {		break;	    }	    k++;	}	/*	  Remove trailing spaces.	*/	k = yyLinizerState->line.length();	while ( k > 0 && yyLinizerState->line[k - 1].isSpace() )	    k--;	yyLinizerState->line.truncate( k );	/*	  '}' increment the brace depth and '{' decrements it and not	  the other way around, as we are parsing backwards.	*/	yyLinizerState->braceDepth +=            yyLinizerState->line.count( '}' ) - yyLinizerState->line.count( '{' );	/*	  We use a dirty trick for	      } else ...	  We don't count the '}' yet, so that it's more or less	  equivalent to the friendly construct	      }	      else ...	*/	if ( yyLinizerState->pendingRightBrace )	    yyLinizerState->braceDepth++;	yyLinizerState->pendingRightBrace =		( yyLinizerState->line.find(*braceX) == 0 );	if ( yyLinizerState->pendingRightBrace )	    yyLinizerState->braceDepth--;    } while ( yyLinizerState->line.isEmpty() );    return true;}/*  Resets the linizer to its initial state, with yyLine containing the  line above the bottom line of the program.*/static void startLinizer(){    yyLinizerState->braceDepth = 0;    yyLinizerState->inCComment = false;    yyLinizerState->pendingRightBrace = false;    yyLine = &yyLinizerState->line;    yyBraceDepth = &yyLinizerState->braceDepth;    yyLeftBraceFollows = &yyLinizerState->leftBraceFollows;    yyLinizerState->iter = yyProgram->end();    --yyLinizerState->iter;    yyLinizerState->line = *yyLinizerState->iter;    readLine();}/*  Returns true if the start of the bottom line of yyProgram (and  potentially the whole line) is part of a C-style comment; otherwise  returns false.*/static bool bottomLineStartsInCComment(){    QString slashAster( "/*" );    QString asterSlash( "*/" );    /*      We could use the linizer here, but that would slow us down      terribly. We are better to trim only the code lines we need.    */    QStringList::ConstIterator p = yyProgram->end();    --p; // skip bottom line    for ( int i = 0; i < BigRoof; i++ ) {	if ( p == yyProgram->begin() )	    return false;	--p;	if ( (*p).find(slashAster) != -1 || (*p).find(asterSlash) != -1 ) {	    QString trimmed = trimmedCodeLine( *p );	    if ( trimmed.find(slashAster) != -1 ) {		return true;	    } else if ( trimmed.find(asterSlash) != -1 ) {		return false;	    }	}    }    return false;}/*  Returns the recommended indent for the bottom line of yyProgram  assuming that it starts in a C-style comment, a condition that is  tested elsewhere.  Essentially, we're trying to align against some text on the previous  line.*/static int indentWhenBottomLineStartsInCComment(){    int k = yyLine->findRev( QString::fromLatin1("/*") );    if ( k == -1 ) {	/*	  We found a normal text line in a comment. Align the	  bottom line with the text on this line.	*/	return indentOfLine( *yyLine );    } else {	/*	  The C-style comment starts on this line. If there is	  text on the same line, align with it. Otherwise, align	  with the slash-aster plus a given offset.	*/	int indent = columnForIndex( *yyLine, k );	k += 2;	while ( k < (int) yyLine->length() ) {	    if ( !(*yyLine)[k].isSpace() )		return columnForIndex( *yyLine, k );	    k++;	}	return indent + ppCommentOffset;    }}/*  A function called match...() modifies the linizer state. If it  returns true, yyLine is the top line of the matched construct;  otherwise, the linizer is left in an unknown state.  A function called is...() keeps the linizer state intact.*//*  Returns true if the current line (and upwards) forms a braceless  control statement; otherwise returns false.  The first line of the following example is a "braceless control  statement":      if ( x )	  y;*/static bool matchBracelessControlStatement(){    int delimDepth = 0;    if ( yyLine->endsWith(QString::fromLatin1("else")) )	return true;    if ( !yyLine->endsWith(QString::fromLatin1(")")) )	return false;    for ( int i = 0; i < SmallRoof; i++ ) {	int j = yyLine->length();	while ( j > 0 ) {	    j--;	    QChar ch = (*yyLine)[j];	    switch ( ch.unicode() ) {	    case ')':		delimDepth++;		break;	    case '(':		delimDepth--;		if ( delimDepth == 0 ) {		    if ( yyLine->find(*iflikeKeyword) != -1 ) {			/*			  We have			      if ( x )				  y			  "if ( x )" is not part of the statement			  "y".			*/			return true;		    }		}		if ( delimDepth == -1 ) {		    /*		      We have			  if ( (1 +				2)		      and not			  if ( 1 +			       2 )		    */		    return false;		}		break;	    case '{':	    case '}':	    case ';':		/*		  We met a statement separator, but not where we		  expected it. What follows is probably a weird		  continuation line. Be careful with ';' in for,		  though.		*/		if ( ch != QChar(';') || delimDepth == 0 )		    return false;	    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区在线观看视频| 亚洲欧洲日韩女同| 亚洲天堂av老司机| 另类的小说在线视频另类成人小视频在线 | 亚洲视频每日更新| 老司机免费视频一区二区 | 一二三区精品视频| 国产mv日韩mv欧美| 精品日本一线二线三线不卡| 亚洲综合在线视频| 成人免费高清在线观看| 久久男人中文字幕资源站| 天堂一区二区在线| 色偷偷一区二区三区| 久久毛片高清国产| 国产精品久久久久久久久快鸭 | 久久精品国产第一区二区三区| 色94色欧美sute亚洲线路一久| 国产亚洲福利社区一区| 免费成人深夜小野草| 欧美妇女性影城| 亚洲一区视频在线观看视频| 91欧美激情一区二区三区成人| 国产欧美视频一区二区三区| 国产美女精品在线| 精品久久久久久亚洲综合网 | 99re在线精品| 国产精品国产三级国产aⅴ入口| 成人一区二区三区在线观看 | 日韩一区二区免费在线电影 | 尤物在线观看一区| 欧亚一区二区三区| 亚洲1区2区3区4区| 91麻豆精品国产91久久久使用方法| 亚洲成人午夜影院| 日韩午夜在线观看视频| 日本麻豆一区二区三区视频| 5566中文字幕一区二区电影 | 精品免费视频一区二区| 国产综合色在线视频区| 国产蜜臀97一区二区三区| 不卡一卡二卡三乱码免费网站| 国产精品久久久爽爽爽麻豆色哟哟| 波多野洁衣一区| 亚洲乱码一区二区三区在线观看| 色88888久久久久久影院按摩| 一区二区三区日韩在线观看| 欧美乱熟臀69xxxxxx| 美女一区二区视频| 国产丝袜欧美中文另类| 91丨九色丨蝌蚪丨老版| 午夜精品久久一牛影视| 精品国精品自拍自在线| 国产成人自拍在线| 亚洲综合一区在线| 日韩欧美综合在线| 成人福利在线看| 亚洲国产另类av| 国产亚洲欧美日韩日本| 91婷婷韩国欧美一区二区| 天天色图综合网| 国产午夜一区二区三区| 91无套直看片红桃| 久久超级碰视频| 中文字幕中文乱码欧美一区二区| 欧美性生交片4| 国产精品一区二区在线播放| 亚洲欧美激情插| 欧美精品一区二区三区很污很色的 | 欧美私人免费视频| 极品瑜伽女神91| 亚洲在线一区二区三区| 国产偷国产偷亚洲高清人白洁| 91久久精品网| 韩国精品主播一区二区在线观看| 亚洲欧美日韩小说| 精品精品欲导航| 欧美私人免费视频| 99热99精品| 国产一区二区精品在线观看| 五月激情六月综合| |精品福利一区二区三区| 精品av综合导航| 欧美日韩国产精品自在自线| 国产不卡一区视频| 麻豆精品国产传媒mv男同| 亚洲女同ⅹxx女同tv| 国产嫩草影院久久久久| 日韩免费在线观看| 欧美高清视频在线高清观看mv色露露十八 | 色天使色偷偷av一区二区| 国产91精品欧美| 久久精品72免费观看| 五月婷婷综合激情| 洋洋av久久久久久久一区| 国产精品久久久久久久久快鸭| 精品sm捆绑视频| 精品国免费一区二区三区| 91 com成人网| 3d成人h动漫网站入口| 欧美性大战久久久久久久| 色婷婷综合激情| 91年精品国产| 97se狠狠狠综合亚洲狠狠| 成人小视频在线| 成人一区二区三区视频在线观看| 九九视频精品免费| 国产一区二区伦理| 国产精品99久久久| 国产成人av一区二区| 国产精一区二区三区| 国产麻豆9l精品三级站| 国产伦精品一区二区三区免费| 久久 天天综合| 国产一区二区三区在线观看免费| 黄色成人免费在线| 国产成人8x视频一区二区| 国产91精品欧美| 色综合久久久久综合体| 欧美四级电影在线观看| 欧美丰满少妇xxxxx高潮对白| 欧美一区二区三区不卡| 精品人在线二区三区| 久久精品欧美日韩精品| 国产精品色眯眯| 亚洲精品日产精品乱码不卡| 亚洲国产中文字幕| 欧美bbbbb| 成人性视频免费网站| a级精品国产片在线观看| 一本一道久久a久久精品| 欧美网站一区二区| 精品国产污网站| **性色生活片久久毛片| 亚洲一级不卡视频| 激情综合五月婷婷| jlzzjlzz亚洲女人18| 欧美三级日本三级少妇99| 欧美r级在线观看| 国产精品成人免费| 免费高清在线视频一区·| 国产精品一品二品| 在线观看日韩电影| 精品粉嫩超白一线天av| 亚洲日本va午夜在线影院| 免费欧美高清视频| 99久久99精品久久久久久 | 国产精品乱码人人做人人爱| 亚洲成人一区二区| 国产suv精品一区二区6| 欧美日韩免费视频| 国产亚洲一区字幕| 亚洲一区二区中文在线| 国产精品伊人色| 欧美裸体一区二区三区| 日本一区二区视频在线观看| 午夜精品久久久久久久久久| 国产成人精品亚洲777人妖| 欧美日韩精品高清| 国产精品久久国产精麻豆99网站| 青青草原综合久久大伊人精品优势| 成人网在线播放| 欧美不卡一区二区三区| 亚洲精品成a人| 国产精品1区2区| 日韩一级成人av| 亚洲精品一二三四区| 国产一区二区福利视频| 欧美一区二区三区公司| 亚洲精品中文在线| 福利视频网站一区二区三区| 欧美一区二区三区免费大片| 亚洲午夜免费视频| 色综合色狠狠天天综合色| 国产欧美一区二区精品性色超碰| 蜜臀久久久99精品久久久久久| 在线精品视频一区二区三四| 国产精品毛片高清在线完整版| 老司机精品视频一区二区三区| 欧美日韩一二区| 亚洲黄色在线视频| 99天天综合性| 国产精品女主播av| 国产mv日韩mv欧美| 久久精品视频网| 国产成人免费视频网站| 久久综合网色—综合色88| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美挠脚心视频网站| 亚洲午夜久久久久久久久久久| 91视频一区二区| 亚洲人亚洲人成电影网站色| 成人av在线资源网站| 欧美激情一区二区| 成人午夜私人影院| 国产精品短视频| 91蜜桃免费观看视频| 亚洲欧洲综合另类| 在线观看国产精品网站| 亚洲一二三区不卡|