MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / EndsWithOperator

Method EndsWithOperator

source/script.cpp:2748–2769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2746
2747
2748bool Script::EndsWithOperator(LPTSTR aBuf, LPTSTR aBuf_marker)
2749// Returns true if aBuf_marker is the end of an operator, excluding ++ and --.
2750{
2751 LPTSTR cp = aBuf_marker; // Caller has omitted trailing whitespace.
2752 if (_tcschr(EXPR_OPERATOR_SYMBOLS, *cp) // It's a binary operator or ++ or --.
2753 && !((*cp == '+' || *cp == '-') && cp > aBuf && cp[-1] == *cp)) // Not ++ or --.
2754 return true;
2755 LPTSTR word;
2756 for (word = cp; word > aBuf && IS_IDENTIFIER_CHAR(word[-1]); --word);
2757 if (word > aBuf && word[-1] == '.')
2758 return false; // Reserved words are permitted as property names, so `a.as` isn't an operator.
2759 switch (ConvertWordOperator(word, cp - word + 1))
2760 {
2761 case SYM_OR:
2762 case SYM_AND:
2763 case SYM_IS:
2764 case SYM_LOWNOT:
2765 case SYM_RESERVED_OPERATOR:
2766 return true;
2767 }
2768 return false;
2769}
2770
2771
2772

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected