本文整理汇总了Java中gnu.expr.Language类的典型用法代码示例。如果您正苦于以下问题:Java Language类的具体用法?Java Language怎么用?Java Language使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Language类属于gnu.expr包,在下文中一共展示了Language类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serve
import gnu.expr.Language; //导入依赖的package包/类
/** Run a Kawa repl as a telnet server.
* @param client A client that has connected to us,
* and that wants to use the telnet protocol to talk to a
* Scheme read-eval-print-loop.
*/
public static Thread serve (Language language, java.net.Socket client)
throws java.io.IOException {
Telnet conn = new Telnet(client, true);
java.io.OutputStream sout = conn.getOutputStream();
java.io.InputStream sin = conn.getInputStream();
OutPort out = new OutPort(sout, FilePath.valueOf("/dev/stdout"));
TtyInPort in = new TtyInPort(sin, FilePath.valueOf("/dev/stdin"), out);
// The following was commented out in the original code - markf
/*
conn.request(Telnet.DO, Telnet.EOF);
conn.request(Telnet.DO, Telnet.NAWS);
conn.request(Telnet.DO, Telnet.TTYPE);
conn.request(Telnet.DO, Telnet.LINEMODE);
*/
Thread thread =
new BiggerFuture(new TelnetRepl(language, client),
in, out, out, "Telnet Repl Thread", REPL_STACK_SIZE);
thread.start();
return thread;
}
示例2: getCurrent
import gnu.expr.Language; //导入依赖的package包/类
public static ReadTable getCurrent()
{
ReadTable table = (ReadTable) current.get(null);
if (table == null)
{
Language language = Language.getDefaultLanguage();
if (language instanceof LispLanguage)
{
LispLanguage llanguage = (LispLanguage) language;
synchronized (llanguage)
{
table = llanguage.defaultReadTable;
if (table == null)
{
table = llanguage.createReadTable();
llanguage.defaultReadTable = table;
}
}
}
else
table = ReadTable.createInitial();
current.set(table);
}
return table;
}
示例3: getMemberPart
import gnu.expr.Language; //导入依赖的package包/类
public static Object getMemberPart(Object container, String name)
throws Exception
{
try
{
return gnu.kawa.reflect.SlotGet.field(container, name);
}
catch (Exception ex)
{
// FIXME!
}
MethodProc methods = ClassMethods.apply((ObjectType) ClassType.make(container.getClass()),
Compilation.mangleName(name), '\0',
Language.getDefaultLanguage());
if (methods != null)
return new NamedPart(container, name, 'M', methods);
throw new RuntimeException("no part '"+name+"' in "+container);
}
示例4: parse
import gnu.expr.Language; //导入依赖的package包/类
public ParsedLine parse(String line, int cursor,
ParseContext context) throws SyntaxError {
if (context == ParseContext.COMPLETE)
return parseForComplete(line, cursor);
CharArrayInPort cin = CharArrayInPort.make(line, "\n");
cin.setLineNumber(this.getLineNumber());
cin.setPath(this.getPath());
try {
Lexer lexer = language.getLexer(cin, this.messages);
lexer.setInteractive(true);
Compilation comp =
language.parse(lexer,
Language.PARSE_FOR_EVAL|Language.PARSE_INTERACTIVE_MODULE,
null);
if (comp == null)
throw new EndOfFileException();
if (comp.getState() == Compilation.ERROR_SEEN && cin.eofSeen()) {
messages.clear();
throw new EOFError(-1, -1, "unexpected end-of-file", "");
}
return new KawaParsedLine(this, comp, line, cursor);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
示例5: ReplMode
import gnu.expr.Language; //导入依赖的package包/类
public ReplMode (Buffer buffer, Language language, Environment environment)
throws java.io.IOException
{
lineMode = true;
this.buffer = buffer;
processMark = new Marker(buffer.pointMarker);
processWriter = new BufferWriter(processMark, true);
out = new OutPort(processWriter, true, true);
err = new OutPort(processWriter, true, true);
PipedReader preader = new PipedReader();
toInferior = new PipedWriter(preader);
in = new TtyInPort(preader, Path.valueOf("/dev/stdin"), out);
thread = Future.make(new kawa.repl(language),
environment, in, out, err);
thread.setPriority(Thread.currentThread().getPriority() + 1);
thread.start();
}
示例6: calculateType
import gnu.expr.Language; //导入依赖的package包/类
@Override
protected Type calculateType() {
Type t;
CaseClause clause = clauses.length > 0 ? clauses[0] : null;
if (clause != null) {
t = clause.exp.getType();
for (int i = 1; i < clauses.length; i++) {
clause = clauses[i];
t = Language.unionType(t, clause.exp.getType());
}
t = (elseClause != null) ?
Language.unionType(t, elseClause.exp.getType()) :
Language.unionType(t, Type.voidType);
} else if (elseClause != null)
t = elseClause.exp.getType();
else
throw new Error(
"Syntax Error: Case without any clause, at least a default clause is required");
return t;
}
示例7: calculateDatumsType
import gnu.expr.Language; //导入依赖的package包/类
/**
* Computes the union type of the case expression datums.
* Useful to know if the datums are all integer values.
*/
protected Type calculateDatumsType() {
Type t;
boolean atLeastOne = clauses.length > 0 ? true : false;
if (atLeastOne) {
t = calculateDatumType(clauses[0].datums);
for (int i = 1; i < clauses.length; i++) {
t = Language
.unionType(t, calculateDatumType(clauses[i].datums));
}
} else if (elseClause != null)
return Type.voidType;
else
throw new Error();
return t;
}
示例8: apply1
import gnu.expr.Language; //导入依赖的package包/类
public Object apply1 (Object arg)
{
if (! (arg instanceof Procedure))
{
/* #ifdef JAVA2 */
if (arg instanceof java.util.List)
return new SetList((java.util.List) arg);
/* #else */
// if (arg instanceof gnu.lists.Sequence)
// return new SetList((gnu.lists.Sequence) arg);
/* #endif */
Class cl = arg.getClass();
if (cl.isArray())
return new SetArray(arg, Language.getDefaultLanguage()/*FIXME*/);
}
return ((Procedure)arg).getSetter();
}
示例9: getMemberPart
import gnu.expr.Language; //导入依赖的package包/类
public static Object getMemberPart(Object container, String name)
throws Throwable
{
try
{
return gnu.kawa.reflect.SlotGet.field(container, name);
}
catch (Throwable ex)
{
// FIXME!
}
MethodProc methods = ClassMethods.apply((ClassType) ClassType.make(container.getClass()),
Compilation.mangleName(name), '\0',
Language.getDefaultLanguage());
if (methods != null)
return new NamedPart(container, name, 'M', methods);
throw new RuntimeException("no part '"+name+"' in "+container);
}
示例10: GuiConsole
import gnu.expr.Language; //导入依赖的package包/类
public GuiConsole(Language language, Environment penvironment, boolean shared)
{
super("Kawa");
repl.getLanguage(); // In case a new GuiConsole is created from Java.
init(new ReplDocument(language, penvironment, shared));
// Uncomment to test same ReplDocument in two JFrames.
// new GuiConsole(document);
}
示例11: ReplDocument
import gnu.expr.Language; //导入依赖的package包/类
private ReplDocument (SwingContent content, Language language,
Environment penvironment, final boolean shared)
{
super(content, styles);
this.content = content;
ModuleBody.exitIncrement();
addDocumentListener(this);
this.language = language;
in_r = new QueueReader() {
@Override
public void checkAvailable()
{
checkingPendingInput();
};
};
out_stream = new ReplPaneOutPort(this, "/dev/stdout", defaultStyle);
err_stream = new ReplPaneOutPort(this, "/dev/stderr", redStyle);
in_p = new GuiInPort(in_r, Path.valueOf("/dev/stdin"),
out_stream, this);
thread = Future.make(new kawa.repl(language) {
@Override
public Object apply0 ()
{
Environment env = Environment.getCurrent();
if (shared)
env.setIndirectDefines();
environment = env;
Shell.run(language, env);
SwingUtilities.invokeLater(new Runnable() {
public void run() { ReplDocument.this.fireDocumentClosed(); }
});
return Values.empty;
}
}, penvironment, in_p, out_stream, err_stream);
thread.start();
}
示例12: Not
import gnu.expr.Language; //导入依赖的package包/类
public Not(Language language)
{
this.language = language;
setProperty(Procedure.validateApplyKey,
"gnu.kawa.functions.CompileMisc:validateApplySimpleBoolean");
setProperty(Procedure.compilerXKey,
"gnu.kawa.functions.CompileMisc:compileNot");
}
示例13: apply1
import gnu.expr.Language; //导入依赖的package包/类
public Object apply1(Object arg){
if (! (arg instanceof Procedure)) {
if (arg instanceof java.util.List)
return new SetList((java.util.List) arg);
if (arg instanceof Array)
return new SetGArray((Array) arg);
Class cl = arg.getClass();
if (cl.isArray())
return new SetArray(arg,
Language.getDefaultLanguage()/*FIXME*/);
}
return ((Procedure)arg).getSetter();
}
示例14: IsEqv
import gnu.expr.Language; //导入依赖的package包/类
public IsEqv(Language language, String name, IsEq isEq)
{
this.language = language;
this.isEq = isEq;
setName(name);
setProperty(Procedure.validateApplyKey,
"gnu.kawa.functions.CompilationHelpers:validateIsEqv");
}
示例15: ApplyToArgs
import gnu.expr.Language; //导入依赖的package包/类
public ApplyToArgs (String name, Language language)
{
super(name);
this.language = language;
setProperty(Procedure.validateXApplyKey,
"gnu.kawa.functions.CompilationHelpers:validateApplyToArgs");
}