Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLScript.java @ 13455:69d2e4baa215
Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 17 Dec 2013 20:22:45 -0800 |
parents | 71991b7a0f14 |
children | 3f27e57439ed |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLScript.java Thu Dec 12 14:56:52 2013 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLScript.java Tue Dec 17 20:22:45 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,6 @@ */ package com.oracle.truffle.sl; -import java.io.*; - import javax.script.*; import com.oracle.truffle.api.*; @@ -57,24 +55,11 @@ return main.toString(); } - public static SLScript create(SLContext context, String input) throws ScriptException { - return create(context, new ByteArrayInputStream(input.getBytes())); - - } - - public static SLScript create(SLContext context, InputStream input) throws ScriptException { + public static SLScript create(SLContext context, Source source) throws ScriptException { SLNodeFactory factory = new SLNodeFactory(context); - Parser parser = new Parser(new Scanner(input), factory); + Parser parser = new Parser(new Scanner(source.getInputStream()), factory); factory.setParser(parser); - factory.setSource(new Source() { - public String getName() { - return "Unknown"; - } - - public String getCode() { - return null; - } - }); + factory.setSource(source); String error = parser.ParseErrors(); if (!error.isEmpty()) { throw new ScriptException(String.format("Error(s) parsing script: %s", error));