Mercurial > hg > jslab
view src/samer/silk/SilkCompleter.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
line wrap: on
line source
package samer.silk; import samer.core.*; import java.util.*; import org.gnu.readline.*; import jsint.*; public class SilkCompleter implements ReadlineCompleter { Iterator it; public String completer(String text, int state) { if (state == 0) { // first call to completer(): initialize iterator // it=Symbol.symbolTable.entrySet().iterator(); it=Symbol.symbolTable.values().iterator(); } while (it.hasNext()) { // Map.Entry entry = (Map.Entry)it.next(); // Symbol symbol=(Symbol)entry.getValue(); // String name=(String)entry.getKey(); Symbol symbol=(Symbol)it.next(); String name=(String)symbol.toString(); if (name.startsWith(text) && symbol.isDefined()) return name; } return null; // we reached the last choice. } }