Warning: session_start(): open(/var/lib/php/sessions/sess_ha4inscvcr8t63h4vc5uq5l2cv, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
srecord noeq LeftArrowScriptAutoCompleter(GazelleV_LeftArrowScriptParser parser) > Meta {
LS tok;
CharInToken cursor;
S typedCharacters;
ScoredStringSearcher searcher;
settable new G22Utils g22utils;
*(G22Utils *g22utils, GazelleV_LeftArrowScriptParser *parser) {}
void seek(S text, int iChar) {
parser.setText(text);
parser.init();
tok = parser.tok;
cursor = charIndexToCharInToken(tok, iChar);
// pointing to space? move left to code token
if (even(cursor.iTok) && cursor.iTok > 0 && cursor.iChar == 0) {
cursor.iTok--;
cursor.iChar = l(token());
}
// move one token left if necessary
if (cursor.iTok > 1 && cursor.iChar == 0 &&
empty(space()))) {
cursor.iTok -= 2;
cursor.iChar = l(token());
}
typedCharacters = takeFirst(cursor.token(), cursor.iChar);
}
S typedCharacters() {
ret typedCharacters;
}
S space() { ret get(tok, cursor.iTok-1); }
S token() { ret get(tok, cursor.iTok); }
S prevToken() { ret get(tok, cursor.iTok-2); }
bool beginningOfCmd() {
ret eqOneOf(prevToken(), ";", "{", "}")
|| containsNewLine(space());
}
Cl getCompletions() {
//ret searcher()!;
ret searcher().get_transformListWithinScore(l1 stringsSortedByLength);
}
ScoredStringSearcher searcher() {
searcher = new ScoredStringSearcher(typedCharacters);
if (empty(typedCharacters)) searcher.returnAll = true;
S prev = prevToken();
if (scaffoldingEnabled(this))
printVars LeftArrowScriptAutoCompleter(+beginningOfCmd(), +prev, +cursor, +typedCharacters, globalClassNames := l(globalClassNames()));
if (beginningOfCmd() || !isIdentifier(prev) || eq(prev, "new")) {
addToSearcher(globalMethodNames());
addToSearcher(globalClassNames());
}
addToSearcher("true", "false", "null");
ret searcher;
}
swappable Cl globalMethodNames() {
ret concatMap methodNames(parser.functionContainers);
}
swappable Cl importedPackages() {
ret itemPlus("java.lang", standardImports_fullyImportedPackages());
}
simplyCached Cl globalClassNames() {
var packages = mapToTreeSet(importedPackages(), pkg -> pkg + ".");
LS filtered = filter(g22utils.classNameResolver().allFullyQualifiedClassNames(),
className -> !contains(className, '$')
&& startsWithOneOf_treeSet(className, packages));
ret mapToSet afterLastDot(filtered);
}
void addToSearcher(Iterable or S... l) {
fOr (s : l)
if (!eq(s, typedCharacters))
searcher.add(s);
}
}