MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / ColourisePowerShellDoc

Function ColourisePowerShellDoc

scintilla/lexers/LexPowerShell.cxx:35–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35static void ColourisePowerShellDoc(unsigned int startPos, int length, int initStyle,
36 WordList *keywordlists[], Accessor &styler) {
37
38 WordList &keywords = *keywordlists[0];
39 WordList &keywords2 = *keywordlists[1];
40 WordList &keywords3 = *keywordlists[2];
41 WordList &keywords4 = *keywordlists[3];
42 WordList &keywords5 = *keywordlists[4];
43 WordList &keywords6 = *keywordlists[5];
44
45 styler.StartAt(startPos);
46
47 StyleContext sc(startPos, length, initStyle, styler);
48
49 for (; sc.More(); sc.Forward()) {
50
51 if (sc.state == SCE_POWERSHELL_COMMENT) {
52 if (sc.atLineEnd) {
53 sc.SetState(SCE_POWERSHELL_DEFAULT);
54 }
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 }
64 if (sc.ch == '>' && sc.chPrev == '#') {
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);
75 }
76 } else if (sc.state == SCE_POWERSHELL_STRING) {
77 // This is a doubles quotes string
78 if (sc.ch == '\"') {
79 sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
80 }
81 } else if (sc.state == SCE_POWERSHELL_CHARACTER) {
82 // This is a single quote string
83 if (sc.ch == '\'') {
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) {

Callers

nothing calls this directly

Calls 13

IsASpaceOrTabFunction · 0.85
IsADigitFunction · 0.85
isoperatorFunction · 0.85
StartAtMethod · 0.80
MoreMethod · 0.80
ForwardMethod · 0.80
SetStateMethod · 0.80
ForwardSetStateMethod · 0.80
GetCurrentLoweredMethod · 0.80
InListMethod · 0.80
ChangeStateMethod · 0.80
CompleteMethod · 0.80

Tested by

no test coverage detected