当前位置: 首页>>代码示例>>C++>>正文


C++ Accessor::Match方法代码示例

本文整理汇总了C++中Accessor::Match方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessor::Match方法的具体用法?C++ Accessor::Match怎么用?C++ Accessor::Match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Accessor的用法示例。


在下文中一共展示了Accessor::Match方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CmakeNextLineHasElse

static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
{
    int nNextLine = -1;
    for ( unsigned int i = start; i < end; i++ ) {
        char cNext = styler.SafeGetCharAt( i );
        if ( cNext == '\n' ) {
            nNextLine = i+1;
            break;
        }
    }

    if ( nNextLine == -1 ) // We never foudn the next line...
        return false;

    for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) {
        char cNext = styler.SafeGetCharAt( firstChar );
        if ( cNext == ' ' )
            continue;
        if ( cNext == '\t' )
            continue;
        if ( styler.Match(firstChar, "ELSE")  || styler.Match(firstChar, "else"))
            return true;
        break;
    }

    return false;
}
开发者ID:Snake174,项目名称:PipmakAssistant,代码行数:27,代码来源:LexCmake.cpp

示例2: ClassifyErlangFoldPoint

static int ClassifyErlangFoldPoint(
  Accessor &styler,
  int styleNext,
  int keyword_start
) {
  int lev = 0;
  if (styler.Match(keyword_start,"case")
    || (
      styler.Match(keyword_start,"fun")
      && (SCE_ERLANG_FUNCTION_NAME != styleNext)
      )
    || styler.Match(keyword_start,"if")
    || styler.Match(keyword_start,"query")
    || styler.Match(keyword_start,"receive")
  ) {
    ++lev;
  } else if (styler.Match(keyword_start,"end")) {
    --lev;
  }

  return lev;
}
开发者ID:Snake174,项目名称:PipmakAssistant,代码行数:22,代码来源:LexErlang.cpp

示例3: FoldNoBoxVerilogDoc

// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle,
                            Accessor &styler) {
	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
	bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
	bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
        // Verilog specific folding options:
        // fold_at_module -
        //      Generally used methodology in verilog code is
        //      one module per file, so folding at module definition is useless.
        // fold_at_brace/parenthese -
        //      Folding of long port lists can be convenient.
	bool foldAtModule = styler.GetPropertyInt("fold.verilog.flags", 0) != 0;
	bool foldAtBrace  = 1;
	bool foldAtParenthese  = 1;

	unsigned int endPos = startPos + length;
	int visibleChars = 0;
	int lineCurrent = styler.GetLine(startPos);
	int levelCurrent = SC_FOLDLEVELBASE;
	if (lineCurrent > 0)
		levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
	int levelMinCurrent = levelCurrent;
	int levelNext = levelCurrent;
	char chNext = styler[startPos];
	int styleNext = styler.StyleAt(startPos);
	int style = initStyle;
	for (unsigned int i = startPos; i < endPos; i++) {
		char ch = chNext;
		chNext = styler.SafeGetCharAt(i + 1);
		int stylePrev = style;
		style = styleNext;
		styleNext = styler.StyleAt(i + 1);
		bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
		if (foldComment && IsStreamCommentStyle(style)) {
			if (!IsStreamCommentStyle(stylePrev)) {
				levelNext++;
			} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
				// Comments don't end at end of line and the next character may be unstyled.
				levelNext--;
			}
		}
		if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
		{
			if (!IsCommentLine(lineCurrent - 1, styler)
			    && IsCommentLine(lineCurrent + 1, styler))
				levelNext++;
			else if (IsCommentLine(lineCurrent - 1, styler)
			         && !IsCommentLine(lineCurrent+1, styler))
				levelNext--;
		}
		if (foldComment && (style == SCE_V_COMMENTLINE)) {
			if ((ch == '/') && (chNext == '/')) {
				char chNext2 = styler.SafeGetCharAt(i + 2);
				if (chNext2 == '{') {
					levelNext++;
				} else if (chNext2 == '}') {
					levelNext--;
				}
			}
		}
		if (foldPreprocessor && (style == SCE_V_PREPROCESSOR)) {
			if (ch == '`') {
				unsigned int j = i + 1;
				while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
					j++;
				}
				if (styler.Match(j, "if")) {
					levelNext++;
				} else if (styler.Match(j, "end")) {
					levelNext--;
				}
			}
		}
                if (style == SCE_V_OPERATOR) {
                    if (foldAtParenthese) {
			if (ch == '(') {
				levelNext++;
			} else if (ch == ')') {
				levelNext--;
			}
                    }
		}
                if (style == SCE_V_OPERATOR) {
                    if (foldAtBrace) {
			if (ch == '{') {
				levelNext++;
			} else if (ch == '}') {
				levelNext--;
			}
                    }
		}
                if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) {
                        unsigned int j = i;
                        if (styler.Match(j, "case") ||
                            styler.Match(j, "casex") ||
                            styler.Match(j, "casez") ||
//.........这里部分代码省略.........
开发者ID:JowC9V,项目名称:CLL-Synergie,代码行数:101,代码来源:LexVerilog.cpp

示例4: FoldMySQLDoc

// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment.
static void FoldMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler)
{
	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
	bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;

	int visibleChars = 0;
	int lineCurrent = styler.GetLine(startPos);
	int levelCurrent = SC_FOLDLEVELBASE;
	if (lineCurrent > 0)
		levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
	int levelNext = levelCurrent;

	int styleNext = styler.StyleAt(startPos);
	int style = initStyle;
  int activeState = (style == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : style & HIDDENCOMMAND_STATE;
	
  bool endPending = false;
	bool whenPending = false;
	bool elseIfPending = false;

  char nextChar = styler.SafeGetCharAt(startPos);
  for (unsigned int i = startPos; length > 0; i++, length--)
  {
		int stylePrev = style;
    int lastActiveState = activeState;
		style = styleNext;
		styleNext = styler.StyleAt(i + 1);
    activeState = (style == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : style & HIDDENCOMMAND_STATE;
    
    char currentChar = nextChar;
    nextChar = styler.SafeGetCharAt(i + 1);
		bool atEOL = (currentChar == '\r' && nextChar != '\n') || (currentChar == '\n');
	
    switch (MASKACTIVE(style))
    {
      case SCE_MYSQL_COMMENT:
        if (foldComment)
        {
          // Multiline comment style /* .. */ just started or is still in progress.
          if (IsStreamCommentStyle(style) && !IsStreamCommentStyle(stylePrev))
            levelNext++;
        }
        break;
      case SCE_MYSQL_COMMENTLINE:
        if (foldComment)
        { 
          // Not really a standard, but we add support for single line comments
          // with special curly braces syntax as foldable comments too.
          // MySQL needs -- comments to be followed by space or control char
          if (styler.Match(i, "--"))
          {
            char chNext2 = styler.SafeGetCharAt(i + 2);
            char chNext3 = styler.SafeGetCharAt(i + 3);
            if (chNext2 == '{' || chNext3 == '{')
              levelNext++;
            else
              if (chNext2 == '}' || chNext3 == '}')
                levelNext--;
          }
        }
        break;
      case SCE_MYSQL_HIDDENCOMMAND:
        /*
        if (endPending)
        {
          // A conditional command is not a white space so it should end the current block
          // before opening a new one.
          endPending = false;
          levelNext--;
          if (levelNext < SC_FOLDLEVELBASE)
            levelNext = SC_FOLDLEVELBASE;
        }
        }*/
        if (activeState != lastActiveState)
          levelNext++;
        break;
      case SCE_MYSQL_OPERATOR:
        if (endPending)
        {
          endPending = false;
          levelNext--;
          if (levelNext < SC_FOLDLEVELBASE)
            levelNext = SC_FOLDLEVELBASE;
        }
        if (currentChar == '(')
          levelNext++;
        else
          if (currentChar == ')')
          {
            levelNext--;
            if (levelNext < SC_FOLDLEVELBASE)
              levelNext = SC_FOLDLEVELBASE;
          }
        break;
      case SCE_MYSQL_MAJORKEYWORD:
      case SCE_MYSQL_KEYWORD:
      case SCE_MYSQL_FUNCTION:
//.........这里部分代码省略.........
开发者ID:6VV,项目名称:NewTeachingBox,代码行数:101,代码来源:LexMySQL.cpp

示例5: FoldTALDoc

static void FoldTALDoc(unsigned int startPos, int length, int initStyle, WordList *[],
                            Accessor &styler) {
	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
	bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
	unsigned int endPos = startPos + length;
	int visibleChars = 0;
	int lineCurrent = styler.GetLine(startPos);
	int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
	int levelCurrent = levelPrev;
	char chNext = styler[startPos];
	int styleNext = styler.StyleAt(startPos);
	int style = initStyle;
	bool was_end = false;
	bool section = false;

	int lastStart = 0;

	for (unsigned int i = startPos; i < endPos; i++) {
		char ch = chNext;
		chNext = styler.SafeGetCharAt(i + 1);
		int stylePrev = style;
		style = styleNext;
		styleNext = styler.StyleAt(i + 1);
		bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');

		if (stylePrev == SCE_C_DEFAULT && (style == SCE_C_WORD || style == SCE_C_UUID || style == SCE_C_PREPROCESSOR))
		{
			// Store last word start point.
			lastStart = i;
		}

		if (stylePrev == SCE_C_WORD || style == SCE_C_UUID || stylePrev == SCE_C_PREPROCESSOR) {
			if(isTALwordchar(ch) && !isTALwordchar(chNext)) {
				char s[100];
				getRange(lastStart, i, styler, s, sizeof(s));
				if (stylePrev == SCE_C_PREPROCESSOR && strcmp(s, "?section") == 0)
					{
					section = true;
					levelCurrent = 1;
					levelPrev = 0;
					}
				else if (stylePrev == SCE_C_WORD || stylePrev == SCE_C_UUID)
					{
					if (strcmp(s, "block") == 0)
						{
						// block keyword is ignored immediately after end keyword
						if (!was_end)
							levelCurrent++;
						}
					else
						levelCurrent += classifyFoldPointTAL(s);
					if (strcmp(s, "end") == 0)
						{
						was_end = true;
						}
					else
						{
						was_end = false;
						}
					}
			}
		}

		if (foldComment && (style == SCE_C_COMMENTLINE)) {
			if ((ch == '/') && (chNext == '/')) {
				char chNext2 = styler.SafeGetCharAt(i + 2);
				if (chNext2 == '{') {
					levelCurrent++;
				} else if (chNext2 == '}') {
					levelCurrent--;
				}
			}
		}

		if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
			if (ch == '{' && chNext == '$') {
				unsigned int j=i+2; // skip {$
				while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
					j++;
				}
				if (styler.Match(j, "region") || styler.Match(j, "if")) {
					levelCurrent++;
				} else if (styler.Match(j, "end")) {
					levelCurrent--;
				}
			}
		}

		if (foldComment && IsStreamCommentStyle(style)) {
			if (!IsStreamCommentStyle(stylePrev)) {
				levelCurrent++;
			} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
				// Comments don't end at end of line and the next character may be unstyled.
				levelCurrent--;
			}
		}

		if (atEOL) {
			int lev = levelPrev | SC_FOLDLEVELBASE;
//.........这里部分代码省略.........
开发者ID:6VV,项目名称:NewTeachingBox,代码行数:101,代码来源:LexTAL.cpp

示例6: FoldNoBoxVHDLDoc


//.........这里部分代码省略.........
              }while(pos>0 &&
                     (chAtPos == ' ' || chAtPos == '\t' ||
                      chAtPos == '\n' || chAtPos == '\r' ||
                      IsCommentStyle(styleAtPos)));

              // check for a colon (':') before the instantiated units "entity", "component" or "configuration". Don't fold thereafter.
              if (chAtPos != ':')
              {
                if (levelMinCurrentElse > levelNext) {
                  levelMinCurrentElse = levelNext;
                }
                levelNext++;
              }
            }
          } else if (
            strcmp(s, "procedure") == 0     ||
            strcmp(s, "function") == 0)
          {
            if (strcmp(prevWord, "end") != 0) // check for "end procedure" etc.
            { // This code checks to see if the procedure / function is a definition within a "package"
              // rather than the actual code in the body.
              int BracketLevel = 0;
              for(int pos=i+1; pos<styler.Length(); pos++)
              {
                int styleAtPos = styler.StyleAt(pos);
                char chAtPos = styler.SafeGetCharAt(pos);
                if(chAtPos == '(') BracketLevel++;
                if(chAtPos == ')') BracketLevel--;
                if(
                  (BracketLevel == 0) &&
                  (!IsCommentStyle(styleAtPos)) &&
                  (styleAtPos != SCE_VHDL_STRING) &&
                  !iswordchar(styler.SafeGetCharAt(pos-1)) &&
                  styler.Match(pos, "is") &&
                  !iswordchar(styler.SafeGetCharAt(pos+2)))
                {
                  if (levelMinCurrentElse > levelNext) {
                    levelMinCurrentElse = levelNext;
                  }
                  levelNext++;
                  break;
                }
                if((BracketLevel == 0) && (chAtPos == ';'))
                {
                  break;
                }
              }
            }

          } else if (strcmp(s, "end") == 0) {
            levelNext--;
          }  else if(strcmp(s, "elsif") == 0) { // elsif is followed by then so folding occurs correctly
            levelNext--;
          } else if (strcmp(s, "else") == 0) {
            if(strcmp(prevWord, "when") != 0)  // ignore a <= x when y else z;
            {
              levelMinCurrentElse = levelNext - 1;  // VHDL else is all on its own so just dec. the min level
            }
          } else if(
            ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "architecture") == 0)) ||
            ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "function") == 0)) ||
            ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0)))
          {
            levelMinCurrentBegin = levelNext - 1;
          }
          //Platform::DebugPrintf("Line[%04d] Prev[%20s] Cur[%20s] Level[%x]\n", lineCurrent+1, prevWord, s, levelCurrent);
开发者ID:6VV,项目名称:NewTeachingBox,代码行数:67,代码来源:LexVHDL.cpp

示例7: FoldPowerShellDoc

// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
static void FoldPowerShellDoc(unsigned int startPos, int length, int initStyle,
                           WordList *[], Accessor &styler) {
  bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
  bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
  bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
  unsigned int endPos = startPos + length;
  int visibleChars = 0;
  int lineCurrent = styler.GetLine(startPos);
  int levelCurrent = SC_FOLDLEVELBASE;
  if (lineCurrent > 0)
    levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
  int levelMinCurrent = levelCurrent;
  int levelNext = levelCurrent;
  char chNext = styler[startPos];
  int styleNext = styler.StyleAt(startPos);
  int style = initStyle;
  for (unsigned int i = startPos; i < endPos; i++) {
    char ch = chNext;
    chNext = styler.SafeGetCharAt(i + 1);
    int stylePrev = style;
    style = styleNext;
    styleNext = styler.StyleAt(i + 1);
    bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
    if (style == SCE_POWERSHELL_OPERATOR) {
      if (ch == '{') {
        // Measure the minimum before a '{' to allow
        // folding on "} else {"
        if (levelMinCurrent > levelNext) {
          levelMinCurrent = levelNext;
        }
        levelNext++;
      } else if (ch == '}') {
        levelNext--;
      }
    } else if (foldComment && style == SCE_POWERSHELL_COMMENTSTREAM) {
      if (stylePrev != SCE_POWERSHELL_COMMENTSTREAM && stylePrev != SCE_POWERSHELL_COMMENTDOCKEYWORD) {
        levelNext++;
      } else if (styleNext != SCE_POWERSHELL_COMMENTSTREAM && styleNext != SCE_POWERSHELL_COMMENTDOCKEYWORD) {
        levelNext--;
      }
    } else if (foldComment && style == SCE_POWERSHELL_COMMENT) {
      if (ch == '#') {
        unsigned int j = i + 1;
        while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
          j++;
        }
        if (styler.Match(j, "region")) {
          levelNext++;
        } else if (styler.Match(j, "endregion")) {
          levelNext--;
        }
      }
    }
    if (!IsASpace(ch))
      visibleChars++;
    if (atEOL || (i == endPos-1)) {
      int levelUse = levelCurrent;
      if (foldAtElse) {
        levelUse = levelMinCurrent;
      }
      int lev = levelUse | levelNext << 16;
      if (visibleChars == 0 && foldCompact)
        lev |= SC_FOLDLEVELWHITEFLAG;
      if (levelUse < levelNext)
        lev |= SC_FOLDLEVELHEADERFLAG;
      if (lev != styler.LevelAt(lineCurrent)) {
        styler.SetLevel(lineCurrent, lev);
      }
      lineCurrent++;
      levelCurrent = levelNext;
      levelMinCurrent = levelCurrent;
      visibleChars = 0;
    }
  }
}
开发者ID:Snake174,项目名称:PipmakAssistant,代码行数:78,代码来源:LexPowerShell.cpp

示例8: FoldNoBoxMAXScriptDoc


//.........这里部分代码省略.........
					strcmp(s, "entity") == 0        ||
					strcmp(s, "generate") == 0      ||
					strcmp(s, "loop") == 0          ||
					strcmp(s, "package") ==0        ||
					strcmp(s, "process") == 0       ||
					strcmp(s, "record") == 0        ||
					strcmp(s, "then") == 0)
				{
					if (strcmp(prevWord, "end") != 0)
					{
						if (levelMinCurrentElse > levelNext)
						{
							levelMinCurrentElse = levelNext;
						}
						levelNext++;
					}
				}
				else if (strcmp(s, "procedure") == 0 || strcmp(s, "function") == 0)
				{		
					if (strcmp(prevWord, "end") != 0) // check for "end procedure" etc.
					{ 	// This code checks to see if the procedure / function is a definition within a "package"
						// rather than the actual code in the body.
						int BracketLevel = 0;
						for(int j=i+1; j<styler.Length(); j++)
						{
							int LocalStyle = styler.StyleAt(j);
							char LocalCh = styler.SafeGetCharAt(j);
							if(LocalCh == '(') BracketLevel++;
							if(LocalCh == ')') BracketLevel--;
							if( (BracketLevel == 0) &&
								(LocalStyle != SCE_VHDL_COMMENT) &&
								(LocalStyle != SCE_VHDL_STRING) &&
								!iswordchar(styler.SafeGetCharAt(j-1)) &&
								styler.Match(j, "is") &&
								!iswordchar(styler.SafeGetCharAt(j+2)))
							{	
								if (levelMinCurrentElse > levelNext)
								{
									levelMinCurrentElse = levelNext;
								}
								levelNext++;
								break;
							}
							if((BracketLevel == 0) && (LocalCh == ';'))
							{
								break;
							}
						}
					}

				}
				else if (strcmp(s, "end") == 0)
				{
					levelNext--;
				}
				else if(strcmp(s, "elsif") == 0)
				{ // elsif is followed by then so folding occurs correctly
					levelNext--;
				}
				else if (strcmp(s, "else") == 0)
				{
					if(strcmp(prevWord, "when") != 0)  // ignore a <= x when y else z;
					{
					  levelMinCurrentElse = levelNext - 1;  // VHDL else is all on its own so just dec. the min level
					}
				 }
开发者ID:jzsun,项目名称:MaxscriptEditor,代码行数:67,代码来源:LexMAXscript.cpp

示例9: FoldHexDoc

static void FoldHexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
	unsigned int endPos = startPos + length;
	int lineCurrent = styler.GetLine(startPos);

	char chNext = styler[startPos];
	int styleNext = styler.StyleAt(startPos);
	int sectionDelta = 0;
	int lev;

	for (unsigned int i = startPos; i < endPos; i++) {
		char ch = chNext;
		chNext = styler[i+1];

		int style = styleNext;
		styleNext = styler.StyleAt(i + 1);
		bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');

		if (style == SCE_PROPS_SECTION) {
			if (!sectionDelta)
				sectionDelta = styler.Match(i + 1, "End") ? -1 : 1;
		}

		if (atEOL) {
			lev = SC_FOLDLEVELBASE;

			if (lineCurrent > 0) {
				int levelPrevious = styler.LevelAt(lineCurrent - 1);

				if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
					lev = SC_FOLDLEVELBASE + 1;
				} else {
					lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
				}
			}

			if (sectionDelta == 1) {
				lev = SC_FOLDLEVELBASE;
			} else if (sectionDelta == -1) {
				lev = SC_FOLDLEVELBASE | SC_FOLDLEVELWHITEFLAG;
			}

			if (sectionDelta == 1) {
				lev |= SC_FOLDLEVELHEADERFLAG;
			}
			if (lev != styler.LevelAt(lineCurrent)) {
				styler.SetLevel(lineCurrent, lev);
			}

			lineCurrent++;
			sectionDelta = 0;
		}
	}

	if (lineCurrent > 0) {
		int levelPrevious = styler.LevelAt(lineCurrent - 1);
		if (levelPrevious & SC_FOLDLEVELHEADERFLAG) {
			lev = SC_FOLDLEVELBASE + 1;
		} else {
			lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
		}
	} else {
		lev = SC_FOLDLEVELBASE;
	}
	int flagsNext = styler.LevelAt(lineCurrent);
	styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK);
}
开发者ID:Deledrius,项目名称:PlasmaShop,代码行数:66,代码来源:LexOthers.cpp

示例10: ColouriseHexLine

static void ColouriseHexLine(
    char *lineBuffer,
    unsigned int lengthLine,
    unsigned int startLine,
    unsigned int endPos,
    Accessor &styler) {

    unsigned int i = 0;
    while ((i < lengthLine) && isspacechar(lineBuffer[i]))	// Skip initial spaces
        i++;
    if (i < lengthLine) {
        if (lineBuffer[i] == '#') {
            styler.ColourTo(endPos, SCE_PROPS_COMMENT);
        } else if (lineBuffer[i] == '[') {
            styler.ColourTo(endPos, SCE_PROPS_SECTION);
        } else {
            // Search for the '=' character
            unsigned int lnstart = i;
            while ((i < lengthLine) && (lineBuffer[i] != '='))
                i++;
            if ((i < lengthLine) && (lineBuffer[i] == '=')) {
                styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
                styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
            } else {
                i = lnstart;
            }

            // Colourize the value of the assignment
            // Not error-proof, but should be good enough
            while (i < lengthLine) {
                if (lineBuffer[i] == '#') {
                    // In-line comment, goes to end of line
                    styler.ColourTo(endPos, SCE_PROPS_COMMENT);
                    i = lengthLine;
                } else if (Is0To9(lineBuffer[i])) {
                    // Number
                    while (Is0To9(lineBuffer[i]))
                        i++;
                    styler.ColourTo(startLine + i - 1, SCE_HEX_NUMBER);
                } else if (lineBuffer[i] == '"') {
                    // String
                    i++;
                    while ((i < lengthLine) && (lineBuffer[i] != '"'))
                        i++;
                    styler.ColourTo(startLine + i - 1, SCE_HEX_STRING);
                } else {
                    // Check for keywords...
                    // They're hard-coded; deal with it :(
                    if (styler.Match(startLine + i, "target")) {
                        i += strlen("target");
                        styler.ColourTo(startLine + i - 1, SCE_HEX_KEYWORD);
                    } else if (styler.Match(startLine + i, "ease")) {
                        i += strlen("ease");
                        styler.ColourTo(startLine + i - 1, SCE_HEX_KEYWORD);
                    } else if (styler.Match(startLine + i, "Sec")) {
                        i += strlen("Sec");
                        styler.ColourTo(startLine + i - 1, SCE_HEX_KEYWORD);
                    } else if (styler.Match(startLine + i, "sec")) {
                        i += strlen("sec");
                        styler.ColourTo(startLine + i - 1, SCE_HEX_KEYWORD);
                    } else {
                        // Nothing matched, just move along
                        styler.ColourTo(startLine + i, SCE_PROPS_DEFAULT);
                        i++;
                    }
                }
            }
        }
    } else {
        styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
    }
}
开发者ID:Deledrius,项目名称:PlasmaShop,代码行数:72,代码来源:LexOthers.cpp


注:本文中的Accessor::Match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。