Search in sources :

Example 11 with Language

use of org.graalvm.polyglot.Language in project graal by oracle.

the class PolyglotEngineImpl method createLanguage.

private PolyglotLanguage createLanguage(LanguageCache cache, int index, RuntimeException initError) {
    PolyglotLanguage languageImpl = new PolyglotLanguage(this, cache, index, index == HOST_LANGUAGE_INDEX, initError);
    languageImpl.info = NODES.createLanguage(languageImpl, cache.getId(), cache.getName(), cache.getVersion(), cache.getMimeTypes(), cache.isInternal());
    Language language = impl.getAPIAccess().newLanguage(languageImpl);
    languageImpl.api = language;
    return languageImpl;
}
Also used : Language(org.graalvm.polyglot.Language)

Example 12 with Language

use of org.graalvm.polyglot.Language in project graal by oracle.

the class EngineAPITest method getLanguageMeta.

@Test
public void getLanguageMeta() {
    Engine engine = Engine.create();
    Language language = engine.getLanguages().get(EngineAPITestLanguage.ID);
    assertNotNull(language);
    assertEquals(EngineAPITestLanguage.ID, language.getId());
    assertEquals(EngineAPITestLanguage.NAME, language.getName());
    assertEquals(EngineAPITestLanguage.VERSION, language.getVersion());
    assertEquals(EngineAPITestLanguage.IMPL_NAME, language.getImplementationName());
    assertSame(language, engine.getLanguages().get(EngineAPITestLanguage.ID));
    engine.close();
}
Also used : Language(org.graalvm.polyglot.Language) Engine(org.graalvm.polyglot.Engine) Test(org.junit.Test)

Example 13 with Language

use of org.graalvm.polyglot.Language in project graal by oracle.

the class EngineAPITest method getLanguageOptions.

@Test
public void getLanguageOptions() {
    Engine engine = Engine.create();
    Language language = engine.getLanguages().get(EngineAPITestLanguage.ID);
    OptionDescriptor descriptor1 = language.getOptions().get(EngineAPITestLanguage.Option1_NAME);
    OptionDescriptor descriptor2 = language.getOptions().get(EngineAPITestLanguage.Option2_NAME);
    OptionDescriptor descriptor3 = language.getOptions().get(EngineAPITestLanguage.Option3_NAME);
    assertSame(EngineAPITestLanguage.Option1, descriptor1.getKey());
    assertEquals(EngineAPITestLanguage.Option1_NAME, descriptor1.getName());
    assertEquals(EngineAPITestLanguage.Option1_CATEGORY, descriptor1.getCategory());
    assertEquals(EngineAPITestLanguage.Option1_DEPRECATED, descriptor1.isDeprecated());
    assertEquals(EngineAPITestLanguage.Option1_HELP, descriptor1.getHelp());
    assertSame(EngineAPITestLanguage.Option2, descriptor2.getKey());
    assertEquals(EngineAPITestLanguage.Option2_NAME, descriptor2.getName());
    assertEquals(EngineAPITestLanguage.Option2_CATEGORY, descriptor2.getCategory());
    assertEquals(EngineAPITestLanguage.Option2_DEPRECATED, descriptor2.isDeprecated());
    assertEquals(EngineAPITestLanguage.Option2_HELP, descriptor2.getHelp());
    assertSame(EngineAPITestLanguage.Option3, descriptor3.getKey());
    assertEquals(EngineAPITestLanguage.Option3_NAME, descriptor3.getName());
    assertEquals(EngineAPITestLanguage.Option3_CATEGORY, descriptor3.getCategory());
    assertEquals(EngineAPITestLanguage.Option3_DEPRECATED, descriptor3.isDeprecated());
    assertEquals(EngineAPITestLanguage.Option3_HELP, descriptor3.getHelp());
    engine.close();
}
Also used : Language(org.graalvm.polyglot.Language) OptionDescriptor(org.graalvm.options.OptionDescriptor) Engine(org.graalvm.polyglot.Engine) Test(org.junit.Test)

Aggregations

Language (org.graalvm.polyglot.Language)13 Engine (org.graalvm.polyglot.Engine)6 ArrayList (java.util.ArrayList)3 OptionDescriptor (org.graalvm.options.OptionDescriptor)3 Instrument (org.graalvm.polyglot.Instrument)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Test (org.junit.Test)2 TruffleLanguage (com.oracle.truffle.api.TruffleLanguage)1 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)1 LanguageInfo (com.oracle.truffle.api.nodes.LanguageInfo)1 RootNode (com.oracle.truffle.api.nodes.RootNode)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 PrintWriter (java.io.PrintWriter)1 Field (java.lang.reflect.Field)1