Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLReadlnBuiltin.java @ 22251:8dddde8b20d4
Truffle/SL: provide an "unavailable" SourceSection for every RootNode, using a newly defined static name that identifies "SL Builtin" RootNodes.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Thu, 24 Sep 2015 13:16:52 -0700 |
parents | dc83cc1f94f2 |
children |
comparison
equal
deleted
inserted
replaced
22250:0fb3522e5b72 | 22251:8dddde8b20d4 |
---|---|
43 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; | 43 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
44 import com.oracle.truffle.api.dsl.Specialization; | 44 import com.oracle.truffle.api.dsl.Specialization; |
45 import com.oracle.truffle.api.nodes.NodeInfo; | 45 import com.oracle.truffle.api.nodes.NodeInfo; |
46 import com.oracle.truffle.api.source.SourceSection; | 46 import com.oracle.truffle.api.source.SourceSection; |
47 import com.oracle.truffle.sl.SLException; | 47 import com.oracle.truffle.sl.SLException; |
48 import com.oracle.truffle.sl.SLLanguage; | |
48 import com.oracle.truffle.sl.runtime.SLContext; | 49 import com.oracle.truffle.sl.runtime.SLContext; |
50 | |
49 import java.io.BufferedReader; | 51 import java.io.BufferedReader; |
50 import java.io.IOException; | 52 import java.io.IOException; |
51 | 53 |
52 /** | 54 /** |
53 * Builtin function that reads a String from the {@link SLContext#getInput() standard input}. | 55 * Builtin function that reads a String from the {@link SLContext#getInput() standard input}. |
54 */ | 56 */ |
55 @NodeInfo(shortName = "readln") | 57 @NodeInfo(shortName = "readln") |
56 public abstract class SLReadlnBuiltin extends SLBuiltinNode { | 58 public abstract class SLReadlnBuiltin extends SLBuiltinNode { |
57 | 59 |
58 public SLReadlnBuiltin() { | 60 public SLReadlnBuiltin() { |
59 super(SourceSection.createUnavailable("SL builtin", "readln")); | 61 super(SourceSection.createUnavailable(SLLanguage.builtinKind, "readln")); |
60 } | 62 } |
61 | 63 |
62 @Specialization | 64 @Specialization |
63 public String readln() { | 65 public String readln() { |
64 String result = doRead(getContext().getInput()); | 66 String result = doRead(getContext().getInput()); |