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

Function FollowsPostfixOperator

scintilla/lexers/LexCoffeeScript.cxx:53–62  ·  view source on GitHub ↗

Preconditions: sc.currentPos points to a character after '+' or '-'. The test for pos reaching 0 should be redundant, and is in only for safety measures. Limitation: this code will give the incorrect answer for code like a = b+++/ptn/... Putting a space between the '++' post-inc operator and the '+' binary op fixes this, and is highly recommended for readability anyway.

Source from the content-addressed store, hash-verified

51// Putting a space between the '++' post-inc operator and the '+' binary op
52// fixes this, and is highly recommended for readability anyway.
53static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
54 int pos = (int) sc.currentPos;
55 while (--pos > 0) {
56 char ch = styler[pos];
57 if (ch == '+' || ch == '-') {
58 return styler[pos - 1] == ch;
59 }
60 }
61 return false;
62}
63
64static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) {
65 // Don't look at styles, so no need to flush.

Callers 1

ColouriseCoffeeScriptDocFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected