Diff of /lexers/LexPowerShell.cxx [322b0d] .. [4fb20e]  Maximize  Restore

Switch to unified view

a/lexers/LexPowerShell.cxx b/lexers/LexPowerShell.cxx
...
...
38
    WordList &keywords = *keywordlists[0];
38
    WordList &keywords = *keywordlists[0];
39
    WordList &keywords2 = *keywordlists[1];
39
    WordList &keywords2 = *keywordlists[1];
40
    WordList &keywords3 = *keywordlists[2];
40
    WordList &keywords3 = *keywordlists[2];
41
    WordList &keywords4 = *keywordlists[3];
41
    WordList &keywords4 = *keywordlists[3];
42
    WordList &keywords5 = *keywordlists[4];
42
    WordList &keywords5 = *keywordlists[4];
43
  WordList &keywords6 = *keywordlists[5];
43
44
44
    styler.StartAt(startPos);
45
    styler.StartAt(startPos);
45
46
46
    StyleContext sc(startPos, length, initStyle, styler);
47
    StyleContext sc(startPos, length, initStyle, styler);
47
48
...
...
50
        if (sc.state == SCE_POWERSHELL_COMMENT) {
51
        if (sc.state == SCE_POWERSHELL_COMMENT) {
51
            if (sc.atLineEnd) {
52
            if (sc.atLineEnd) {
52
                sc.SetState(SCE_POWERSHELL_DEFAULT);
53
                sc.SetState(SCE_POWERSHELL_DEFAULT);
53
            }
54
            }
54
        } else if (sc.state == SCE_POWERSHELL_COMMENTSTREAM) {
55
        } else if (sc.state == SCE_POWERSHELL_COMMENTSTREAM) {
56
          if(sc.atLineStart) {
57
              while(IsASpaceOrTab(sc.ch)) {
58
                  sc.Forward();
59
              }
60
              if (sc.ch == '.' && IsAWordChar(sc.chNext)) {
61
                  sc.SetState(SCE_POWERSHELL_COMMENTDOCKEYWORD);
62
              }
63
          }
55
            if (sc.ch == '>' && sc.chPrev == '#') {
64
            if (sc.ch == '>' && sc.chPrev == '#') {
56
                sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
65
                sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
66
          }
67
      } else if (sc.state == SCE_POWERSHELL_COMMENTDOCKEYWORD) {
68
          if(!IsAWordChar(sc.ch)) {
69
              char s[100];
70
              sc.GetCurrentLowered(s, sizeof(s));
71
              if (!keywords6.InList(s + 1)) {
72
                  sc.ChangeState(SCE_POWERSHELL_COMMENTSTREAM);
73
              }
74
              sc.SetState(SCE_POWERSHELL_COMMENTSTREAM);
57
            }
75
            }
58
        } else if (sc.state == SCE_POWERSHELL_STRING) {
76
        } else if (sc.state == SCE_POWERSHELL_STRING) {
59
            // This is a doubles quotes string
77
            // This is a doubles quotes string
60
            if (sc.ch == '\"') {
78
            if (sc.ch == '\"') {
61
                sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
79
                sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
62
            }
80
            }
63
        } else if (sc.state == SCE_POWERSHELL_CHARACTER) {
81
        } else if (sc.state == SCE_POWERSHELL_CHARACTER) {
64
            // This is a single quote string
82
            // This is a single quote string
65
            if (sc.ch == '\'') {
83
            if (sc.ch == '\'') {
66
                sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
84
                sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
85
          }
86
      } else if (sc.state == SCE_POWERSHELL_HERE_STRING) {
87
          // This is a doubles quotes here-string
88
          if (sc.atLineStart && sc.ch == '\"' && sc.chNext == '@') {
89
              sc.Forward(2);
90
              sc.SetState(SCE_POWERSHELL_DEFAULT);
91
          }
92
      } else if (sc.state == SCE_POWERSHELL_HERE_CHARACTER) {
93
          // This is a single quote here-string
94
          if (sc.atLineStart && sc.ch == '\'' && sc.chNext == '@') {
95
              sc.Forward(2);
96
              sc.SetState(SCE_POWERSHELL_DEFAULT);
67
            }
97
            }
68
        } else if (sc.state == SCE_POWERSHELL_NUMBER) {
98
        } else if (sc.state == SCE_POWERSHELL_NUMBER) {
69
            if (!IsADigit(sc.ch)) {
99
            if (!IsADigit(sc.ch)) {
70
                sc.SetState(SCE_POWERSHELL_DEFAULT);
100
                sc.SetState(SCE_POWERSHELL_DEFAULT);
71
            }
101
            }
...
...
105
                sc.SetState(SCE_POWERSHELL_COMMENTSTREAM);
135
                sc.SetState(SCE_POWERSHELL_COMMENTSTREAM);
106
            } else if (sc.ch == '\"') {
136
            } else if (sc.ch == '\"') {
107
                sc.SetState(SCE_POWERSHELL_STRING);
137
                sc.SetState(SCE_POWERSHELL_STRING);
108
            } else if (sc.ch == '\'') {
138
            } else if (sc.ch == '\'') {
109
                sc.SetState(SCE_POWERSHELL_CHARACTER);
139
                sc.SetState(SCE_POWERSHELL_CHARACTER);
140
          } else if (sc.ch == '@' && sc.chNext == '\"') {
141
              sc.SetState(SCE_POWERSHELL_HERE_STRING);
142
          } else if (sc.ch == '@' && sc.chNext == '\'') {
143
              sc.SetState(SCE_POWERSHELL_HERE_CHARACTER);
110
            } else if (sc.ch == '$') {
144
            } else if (sc.ch == '$') {
111
                sc.SetState(SCE_POWERSHELL_VARIABLE);
145
                sc.SetState(SCE_POWERSHELL_VARIABLE);
112
            } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
146
            } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
113
                sc.SetState(SCE_POWERSHELL_NUMBER);
147
                sc.SetState(SCE_POWERSHELL_NUMBER);
114
            } else if (isoperator(static_cast<char>(sc.ch))) {
148
            } else if (isoperator(static_cast<char>(sc.ch))) {
...
...
157
                levelNext++;
191
                levelNext++;
158
            } else if (ch == '}') {
192
            } else if (ch == '}') {
159
                levelNext--;
193
                levelNext--;
160
            }
194
            }
161
        } else if (foldComment && style == SCE_POWERSHELL_COMMENTSTREAM) {
195
        } else if (foldComment && style == SCE_POWERSHELL_COMMENTSTREAM) {
162
          if (stylePrev != SCE_POWERSHELL_COMMENTSTREAM) {
196
          if (stylePrev != SCE_POWERSHELL_COMMENTSTREAM && stylePrev != SCE_POWERSHELL_COMMENTDOCKEYWORD) {
163
                levelNext++;
197
                levelNext++;
164
          } else if (styleNext != SCE_POWERSHELL_COMMENTSTREAM) {
198
          } else if (styleNext != SCE_POWERSHELL_COMMENTSTREAM && styleNext != SCE_POWERSHELL_COMMENTDOCKEYWORD) {
165
                levelNext--;
199
                levelNext--;
200
          }
201
      } else if (foldComment && style == SCE_POWERSHELL_COMMENT) {
202
          if (ch == '#') {
203
              unsigned int j = i + 1;
204
              while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
205
                  j++;
206
              }
207
              if (styler.Match(j, "region")) {
208
                  levelNext++;
209
              } else if (styler.Match(j, "endregion")) {
210
                  levelNext--;
211
              }
166
            }
212
            }
167
        }
213
        }
168
        if (!IsASpace(ch))
214
        if (!IsASpace(ch))
169
            visibleChars++;
215
            visibleChars++;
170
        if (atEOL || (i == endPos-1)) {
216
        if (atEOL || (i == endPos-1)) {
...
...
192
    "Commands",
238
    "Commands",
193
    "Cmdlets",
239
    "Cmdlets",
194
    "Aliases",
240
    "Aliases",
195
    "Functions",
241
    "Functions",
196
    "User1",
242
    "User1",
243
  "DocComment",
197
    0
244
    0
198
};
245
};
199
246
200
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists);
247
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists);
201
248

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks