diff options
Diffstat (limited to 'lexers/LexVerilog.cxx')
-rw-r--r-- | lexers/LexVerilog.cxx | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lexers/LexVerilog.cxx b/lexers/LexVerilog.cxx index cee736492..9b5e9cd83 100644 --- a/lexers/LexVerilog.cxx +++ b/lexers/LexVerilog.cxx @@ -40,12 +40,12 @@ namespace { // Use an unnamed namespace to protect the functions and classes from name conflicts struct PPDefinition { - int line; + Sci_Position line; std::string key; std::string value; bool isUndef; std::string arguments; - PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : + PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { } }; @@ -101,14 +101,14 @@ public: class PPStates { std::vector<LinePPState> vlls; public: - LinePPState ForLine(int line) const { + LinePPState ForLine(Sci_Position line) const { if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) { return vlls[line]; } else { return LinePPState(); } } - void Add(int line, LinePPState lls) { + void Add(Sci_Position line, LinePPState lls) { vlls.resize(line+1); vlls[line] = lls; } @@ -209,7 +209,7 @@ class LexerVerilog : public ILexerWithSubStyles { // typdefFlag: EOL while parsing typedef statement, terminated by ';' enum {foldExternFlag = 0x01, foldWaitDisableFlag = 0x02, typedefFlag = 0x04, protectedFlag = 0x08}; // map using line number as key to store fold state information - std::map<int, int> foldState; + std::map<Sci_Position, int> foldState; public: LexerVerilog() : @@ -307,7 +307,7 @@ Sci_Position SCI_METHOD LexerVerilog::WordListSet(int n, const char *wl) { wordListN = &ppDefinitions; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -363,18 +363,18 @@ static inline bool AllUpperCase(const char *a) { // Functor used to truncate history struct After { - int line; - explicit After(int line_) : line(line_) {} + Sci_Position line; + explicit After(Sci_Position line_) : line(line_) {} bool operator()(PPDefinition &p) const { return p.line > line; } }; -static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { +static std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { std::string restOfLine; - int i =0; + Sci_Position i =0; char ch = styler.SafeGetCharAt(start, '\n'); - int endLine = styler.LineEnd(styler.GetLine(start)); + Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); while (((start+i) < endLine) && (ch != '\r')) { char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); if (ch == '/' && (chNext == '/' || chNext == '*')) @@ -399,7 +399,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i int lineState = kwOther; bool continuationLine = false; - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); if (curLine > 0) lineState = styler.GetLineState(curLine - 1); // Do not leak onto next line @@ -411,7 +411,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i (MaskActive(initStyle) == SCE_V_COMMENTLINEBANG)) { // Set continuationLine if last character of previous line is '\' if (curLine > 0) { - int endLinePrevious = styler.LineEnd(curLine - 1); + Sci_Position endLinePrevious = styler.LineEnd(curLine - 1); if (endLinePrevious > 0) { continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; } @@ -443,7 +443,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i } int activitySet = preproc.IsInactive() ? activeFlag : 0; - int lineEndNext = styler.LineEnd(curLine); + Sci_Position lineEndNext = styler.LineEnd(curLine); bool isEscapedId = false; // true when parsing an escaped Identifier bool isProtected = (lineState&kwProtected) != 0; // true when parsing a protected region @@ -473,7 +473,7 @@ void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, i // Handle line continuation generically. if (sc.ch == '\\') { - if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) { + if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) { curLine++; lineEndNext = styler.LineEnd(curLine); vlls.Add(curLine, preproc); @@ -764,10 +764,10 @@ static bool IsStreamCommentStyle(int style) { return style == SCE_V_COMMENT; } -static bool IsCommentLine(int line, LexAccessor &styler) { - int pos = styler.LineStart(line); - int eolPos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eolPos; i++) { +static bool IsCommentLine(Sci_Position line, LexAccessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eolPos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); @@ -790,11 +790,11 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, bool foldAtBrace = 1; bool foldAtParenthese = 1; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); // Move back one line to be compatible with LexerModule::Fold behavior, fixes problem with foldComment behavior if (lineCurrent > 0) { lineCurrent--; - int newStartPos = styler.LineStart(lineCurrent); + Sci_Position newStartPos = styler.LineStart(lineCurrent); length += startPos - newStartPos; startPos = newStartPos; initStyle = 0; @@ -802,7 +802,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, initStyle = styler.StyleAt(startPos - 1); } } - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) @@ -815,7 +815,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, // restore fold state (if it exists) for prior line int stateCurrent = 0; - std::map<int,int>::iterator foldStateIterator = foldState.find(lineCurrent-1); + std::map<Sci_Position,int>::iterator foldStateIterator = foldState.find(lineCurrent-1); if (foldStateIterator != foldState.end()) { stateCurrent = foldStateIterator->second; } @@ -826,7 +826,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, foldState.erase(foldStateIterator, foldState.end()); } - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -863,7 +863,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, } } if (ch == '`') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -943,7 +943,7 @@ void SCI_METHOD LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, } } if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) { - unsigned int j = i; + Sci_PositionU j = i; if (styler.Match(j, "case") || styler.Match(j, "casex") || styler.Match(j, "casez") || |