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

Method ClassifyIdentifier

scintilla/lexers/LexOScript.cxx:131–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129 {}
130
131 void ClassifyIdentifier(StyleContext &sc) {
132 // Opening parenthesis following an identifier makes it a possible
133 // function call.
134 // KNOWN PROBLEM: If some whitespace is inserted between the
135 // identifier and the parenthesis they will not be able to be
136 // recognized as a function call. This should not occur; at
137 // least not often. Such coding style would be weird.
138 if (sc.Match('(')) {
139 char s[100];
140 sc.GetCurrentLowered(s, sizeof(s));
141 // Before an opening brace can be control statements and
142 // operators too; function call is the last option.
143 if (keywords.InList(s)) {
144 sc.ChangeState(SCE_OSCRIPT_KEYWORD);
145 } else if (operators.InList(s)) {
146 sc.ChangeState(SCE_OSCRIPT_OPERATOR);
147 } else if (functions.InList(s)) {
148 sc.ChangeState(SCE_OSCRIPT_FUNCTION);
149 } else {
150 sc.ChangeState(SCE_OSCRIPT_METHOD);
151 }
152 sc.SetState(SCE_OSCRIPT_OPERATOR);
153 } else {
154 char s[100];
155 sc.GetCurrentLowered(s, sizeof(s));
156 // A dot following an identifier means an access to an object
157 // member. The related object identifier can be special.
158 // KNOWN PROBLEM: If there is whitespace between the identifier
159 // and the following dot, the identifier will not be recognized
160 // as an object in an object member access. If it is one of the
161 // listed static objects it will not be styled.
162 if (sc.Match('.') && objects.InList(s)) {
163 sc.ChangeState(SCE_OSCRIPT_OBJECT);
164 sc.SetState(SCE_OSCRIPT_OPERATOR);
165 } else {
166 if (keywords.InList(s)) {
167 sc.ChangeState(SCE_OSCRIPT_KEYWORD);
168 } else if (constants.InList(s)) {
169 sc.ChangeState(SCE_OSCRIPT_CONSTANT);
170 } else if (operators.InList(s)) {
171 sc.ChangeState(SCE_OSCRIPT_OPERATOR);
172 } else if (types.InList(s)) {
173 sc.ChangeState(SCE_OSCRIPT_TYPE);
174 } else if (functions.InList(s)) {
175 sc.ChangeState(SCE_OSCRIPT_FUNCTION);
176 }
177 sc.SetState(SCE_OSCRIPT_DEFAULT);
178 }
179 }
180 }
181};
182
183// ------------------------------------------------

Callers 1

ColouriseOScriptDocFunction · 0.80

Calls 5

GetCurrentLoweredMethod · 0.80
InListMethod · 0.80
ChangeStateMethod · 0.80
SetStateMethod · 0.80
MatchMethod · 0.45

Tested by

no test coverage detected