⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lexvhdl.cxx

📁 robocup rcssserver 运行防真机器人足球比赛所用的服务器端
💻 CXX
📖 第 1 页 / 共 2 页
字号:
      {        strcpy(prevWord, ";");      }    }  }  char  chNext          = styler[startPos];  char  chPrev          = '\0';  char  chNextNonBlank;  int   styleNext       = styler.StyleAt(startPos);  int   style           = initStyle;  //Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent);  /***************************************/  for (unsigned int i = startPos; i < endPos; i++)  {    char ch         = chNext;    chNext          = styler.SafeGetCharAt(i + 1);    chPrev          = styler.SafeGetCharAt(i - 1);    chNextNonBlank  = chNext;    unsigned int j  = i+1;    while(IsABlank(chNextNonBlank) && j<endPos)    {      j ++ ;      chNextNonBlank = styler.SafeGetCharAt(j);    }    style           = styleNext;    styleNext       = styler.StyleAt(i + 1);    bool atEOL      = (ch == '\r' && chNext != '\n') || (ch == '\n');		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 ((style == SCE_VHDL_OPERATOR) && foldAtParenthese)    {      if(ch == '(') {        levelNext++;      } else if (ch == ')') {        levelNext--;      }    }    if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING))    {      if((ch == ';') && (strcmp(prevWord, "end") == 0))      {        strcpy(prevWord, ";");      }      if(!IsAWordChar(chPrev) && IsAWordStart(ch))      {        lastStart = i;      }      if(iswordchar(ch) && !iswordchar(chNext)) {        char s[32];        unsigned int k;        for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {          s[k] = static_cast<char>(tolower(styler[lastStart+k]));        }        s[k] = '\0';        if(keywords.InList(s))        {          if (            strcmp(s, "architecture") == 0  ||            strcmp(s, "case") == 0          ||            strcmp(s, "component") == 0     ||            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            }          } 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);          strcpy(prevWord, s);        }      }    }    if (atEOL) {      int levelUse = levelCurrent;      if (foldAtElse && (levelMinCurrentElse < levelUse)) {        levelUse = levelMinCurrentElse;      }      if (foldAtBegin && (levelMinCurrentBegin < levelUse)) {        levelUse = levelMinCurrentBegin;      }      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);      }      //Platform::DebugPrintf("Line[%04d] ---------------------------------------------------- Level[%x]\n", lineCurrent+1, levelCurrent);      lineCurrent++;      levelCurrent = levelNext;      //levelMinCurrent = levelCurrent;      levelMinCurrentElse = levelCurrent;      levelMinCurrentBegin = levelCurrent;      visibleChars = 0;    }    /***************************************/    if (!isspacechar(ch)) visibleChars++;  }  /***************************************///  Platform::DebugPrintf("Line[%04d] ---------------------------------------------------- Level[%x]\n", lineCurrent+1, levelCurrent);}//=============================================================================static void FoldVHDLDoc(unsigned int startPos, int length, int initStyle, WordList *[],                       Accessor &styler) {  FoldNoBoxVHDLDoc(startPos, length, initStyle, styler);}//=============================================================================static const char * const VHDLWordLists[] = {            "Keywords",            "Operators",            "Attributes",            "Standard Functions",            "Standard Packages",            "Standard Types",            "User Words",            0,        };LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLists);// Keyword://    access after alias all architecture array assert attribute begin block body buffer bus case component //    configuration constant disconnect downto else elsif end entity exit file for function generate generic //    group guarded if impure in inertial inout is label library linkage literal loop map new next null of //    on open others out package port postponed procedure process pure range record register reject report //    return select severity shared signal subtype then to transport type unaffected units until use variable //    wait when while with//// Operators://    abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor//// Attributes://    left right low high ascending image value pos val succ pred leftof rightof base range reverse_range //    length delayed stable quiet transaction event active last_event last_active last_value driving //    driving_value simple_name path_name instance_name//// Std Functions://    now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector //    to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left //    rotate_right resize to_integer to_unsigned to_signed std_match to_01//// Std Packages://    std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed //    std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives //    vital_timing//// Std Types://    boolean bit character severity_level integer real time delay_length natural positive string bit_vector //    file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic //    std_logic_vector X01 X01Z UX01 UX01Z unsigned signed//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -