From d1cdd0f610004e12fc7f1f8731d99a1f5dd4d80a Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 12:11:24 +0200 Subject: [PATCH 01/11] [maven-release-plugin] prepare release v0.38.0-BOOT1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1b51a28146a..1b728cd0495 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ org.rascalmpl rascal - 0.37.0-BOOT2-SNAPSHOT + 0.38.0-BOOT1 jar scm:git:ssh://git@github.com/usethesource/rascal.git - SNAPSHOT + v0.38.0-BOOT1 From 2987894b69c3fbd64b5e9cd98eaffa63d2cd63f0 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 12:11:43 +0200 Subject: [PATCH 02/11] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1b728cd0495..f9fe38109a5 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ org.rascalmpl rascal - 0.38.0-BOOT1 + 0.38.0-BOOT2-SNAPSHOT jar scm:git:ssh://git@github.com/usethesource/rascal.git - v0.38.0-BOOT1 + SNAPSHOT From 71be70279bdb6537f6b944fb94aebe5bc49f1451 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 12:45:58 +0200 Subject: [PATCH 03/11] added implicit jansi dependency --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index f9fe38109a5..3e3cef6542e 100644 --- a/pom.xml +++ b/pom.xml @@ -452,5 +452,10 @@ icu4j 74.2 + + org.fusesource.jansi + jansi + 1.11 + From 33fa24761390ba60589c548a01e7114677d49c9c Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 13:05:28 +0200 Subject: [PATCH 04/11] jansi bump to 2.4.0 with ARM support --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3e3cef6542e..fd215a1b3a3 100644 --- a/pom.xml +++ b/pom.xml @@ -455,7 +455,7 @@ org.fusesource.jansi jansi - 1.11 + 2.4.0 From e5a8143452adbf2c7e1385af5757655e5ad01552 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 13:47:56 +0200 Subject: [PATCH 05/11] removed CLibrary usage --- src/org/rascalmpl/debug/IRascalMonitor.java | 2 +- src/org/rascalmpl/repl/IsTTY.java | 25 --------------------- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 src/org/rascalmpl/repl/IsTTY.java diff --git a/src/org/rascalmpl/debug/IRascalMonitor.java b/src/org/rascalmpl/debug/IRascalMonitor.java index 124ece36592..78e33a1426a 100644 --- a/src/org/rascalmpl/debug/IRascalMonitor.java +++ b/src/org/rascalmpl/debug/IRascalMonitor.java @@ -159,7 +159,7 @@ default void jobStep(String name, String message) { * @return */ public static IRascalMonitor buildConsoleMonitor(InputStream in, OutputStream out) { - return IsTTY.isTTY() + return System.console() != null ? new TerminalProgressBarMonitor(out, in, TerminalFactory.get()) : new ConsoleRascalMonitor(new PrintStream(out)) ; diff --git a/src/org/rascalmpl/repl/IsTTY.java b/src/org/rascalmpl/repl/IsTTY.java deleted file mode 100644 index 69ceb60b3b0..00000000000 --- a/src/org/rascalmpl/repl/IsTTY.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.rascalmpl.repl; - -import java.util.Locale; - -import org.fusesource.jansi.internal.CLibrary; -import org.fusesource.jansi.internal.Kernel32; - -public class IsTTY { - - /** - * Until we switch to jline 3 we will need this - * @return - */ - public static boolean isTTY() { - // TODO definitely does not work for CYGWIN - if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win")) { - long console = Kernel32.GetStdHandle(Kernel32.STD_OUTPUT_HANDLE); - return Kernel32.GetConsoleMode(console, new int[1]) != 0; - } - else { - int fd = CLibrary.STDOUT_FILENO; - return CLibrary.isatty(fd) != 0; - } - } -} From 6979a915a83b9d78e72f2ebe08f595068c62d61b Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 15:52:51 +0200 Subject: [PATCH 06/11] removed dead import --- src/org/rascalmpl/debug/IRascalMonitor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/org/rascalmpl/debug/IRascalMonitor.java b/src/org/rascalmpl/debug/IRascalMonitor.java index 78e33a1426a..d8a10e815b1 100644 --- a/src/org/rascalmpl/debug/IRascalMonitor.java +++ b/src/org/rascalmpl/debug/IRascalMonitor.java @@ -22,7 +22,6 @@ import org.rascalmpl.interpreter.ConsoleRascalMonitor; import org.rascalmpl.interpreter.NullRascalMonitor; -import org.rascalmpl.repl.IsTTY; import org.rascalmpl.repl.TerminalProgressBarMonitor; import io.usethesource.vallang.ISourceLocation; From cf749113e3630fee6889e07c68d6880114faed37 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 15:53:36 +0200 Subject: [PATCH 07/11] removed dead dependency --- pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pom.xml b/pom.xml index fd215a1b3a3..f9fe38109a5 100644 --- a/pom.xml +++ b/pom.xml @@ -452,10 +452,5 @@ icu4j 74.2 - - org.fusesource.jansi - jansi - 2.4.0 - From 0b4e57f28b9192370f00dacb32ee0675756f4e41 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 16:22:33 +0200 Subject: [PATCH 08/11] [maven-release-plugin] prepare release v0.38.1-BOOT1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f9fe38109a5..41f61685b2e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ org.rascalmpl rascal - 0.38.0-BOOT2-SNAPSHOT + 0.38.1-BOOT1 jar scm:git:ssh://git@github.com/usethesource/rascal.git - SNAPSHOT + v0.38.1-BOOT1 From c642e2fbe38fa4b76ff4586d08d5802701d8c58f Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Mon, 8 Apr 2024 16:22:57 +0200 Subject: [PATCH 09/11] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 41f61685b2e..6cf51d5ff36 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ org.rascalmpl rascal - 0.38.1-BOOT1 + 0.38.1-BOOT2-SNAPSHOT jar scm:git:ssh://git@github.com/usethesource/rascal.git - v0.38.1-BOOT1 + SNAPSHOT From 4476e3c71cc1363a0c8ab4ed7c5d93818866f7c5 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Tue, 9 Apr 2024 10:39:29 +0200 Subject: [PATCH 10/11] fixed static errors and documentation strings in JDBC --- .../rascalmpl/library/resource/jdbc/JDBC.java | 6 +- .../rascalmpl/library/resource/jdbc/JDBC.rsc | 74 ++++++++++--------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/org/rascalmpl/library/resource/jdbc/JDBC.java b/src/org/rascalmpl/library/resource/jdbc/JDBC.java index 1a5a9511173..df6e28ea670 100644 --- a/src/org/rascalmpl/library/resource/jdbc/JDBC.java +++ b/src/org/rascalmpl/library/resource/jdbc/JDBC.java @@ -100,7 +100,7 @@ public class JDBC { public static final Type table = TF.constructor(TS, Table, "table", TF.stringType(), "tableName", TF.listType(Column), "columns"); public static final Type nullableT = TF.parameterType("T"); - public static final Type Nullable = TF.abstractDataType(TS, "Nullable", nullableT); + public static final Type Nullable = TF.abstractDataType(TS, "NULLable", nullableT); private final IValueFactory vf; private final ClassLoader loader; @@ -705,10 +705,10 @@ public static IValue jdbc2pdbValue(ResultSet rs, int idx, IValueFactory vf) { Type resType = jdbc2pdbType(jdbcColumnType, true); if (rs.wasNull()) { - Type nullT = TF.constructor(TS, resType, "null"); + Type nullT = TF.constructor(TS, resType, "NULL"); res = vf.constructor(nullT); } else { - Type notnullT = TF.constructor(TS, resType, "notnull", resType, "item"); + Type notnullT = TF.constructor(TS, resType, "notNULL", resType, "item"); res = vf.constructor(notnullT, res); } } diff --git a/src/org/rascalmpl/library/resource/jdbc/JDBC.rsc b/src/org/rascalmpl/library/resource/jdbc/JDBC.rsc index 4d30ef56b4d..821782f6d3c 100644 --- a/src/org/rascalmpl/library/resource/jdbc/JDBC.rsc +++ b/src/org/rascalmpl/library/resource/jdbc/JDBC.rsc @@ -8,14 +8,11 @@ @contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)} module resource::jdbc::JDBC -import Exception; import Type; import Map; import String; import List; import Set; -import IO; -import lang::rascal::types::AbstractType; @synopsis{Given the name of a JDBC driver class, register it so it can be used in connections.} @javaClass{org.rascalmpl.library.resource.jdbc.JDBC} @@ -120,7 +117,6 @@ public java set[Table] getViews(Connection connection); public java Table getTable(Connection connection, str tableName); @synopsis{Get the Table metadata for a named view.} -@javaClass{org.rascalmpl.library.resource.jdbc.JDBC} public Table getView(Connection connection, str viewName) = getTable(connection, viewName); @synopsis{An exception thrown when we try to translate (or otherwise use) a JDBC type with no Rascal equivalent.} @@ -165,39 +161,50 @@ public Symbol jdbc2RascalType(varBinary()) = \list(\int()); public Symbol jdbc2RascalType(varChar()) = \str(); @synopsis{Represents values which may or may not be null.} -data Nullable[&T] = null() | notnull(&T item); +data NULLable[&T] = NULL() | notNULL(&T item); -@synopsis{Load the contents of a table. This will turn the contents into a set, which by its nature will remove any - duplicates and discard any order. To maintain duplicates, or the order inherent in the table, - use loadTableOrdered instead.} +@synopsis{Load the contents of a table.} +@description{ +This will turn the contents into a set, which by its nature will remove any +duplicates and discard any order. To maintain duplicates, or the order inherent in the table, +use loadTableOrdered instead. +} @javaClass{org.rascalmpl.library.resource.jdbc.JDBC} public java set[&T] loadTable(type[&T] resType, Connection connection, str tableName); -@synopsis{Load the contents of a table. This will turn the contents into a set, which by its nature will remove any - duplicates and discard any order. To maintain duplicates, or the order inherent in the table, use - loadTableOrdered instead. This versions uses no type information, meaning that it returns a set of values.} +@synopsis{Load the contents of a table.} +@description{ +This will turn the contents into a set, which by its nature will remove any +duplicates and discard any order. To maintain duplicates, or the order inherent in the table, use +loadTableOrdered instead. This versions uses no type information, meaning that it returns a set of values. +} @javaClass{org.rascalmpl.library.resource.jdbc.JDBC} public java set[value] loadTable(Connection connection, str tableName); -@synopsis{Load the contents of a table. This maintains order and duplicates, but does not provide access to the - relational operations provided by loadTable.} +@synopsis{Load the contents of a table.} +@description{ +This maintains order and duplicates, but does not provide access to the +relational operations provided by loadTable. +} @javaClass{org.rascalmpl.library.resource.jdbc.JDBC} public java list[&T] loadTableOrdered(type[&T] resType, Connection connection, str tableName); -@synopsis{Load the contents of a table. This maintains order and duplicates, but does not provide access to the - relational operations provided by loadTable. Also, with no type information, this version returns a list - of values.} +@synopsis{Load the contents of a table.} +@description{ +This maintains order and duplicates, but does not provide access to the +relational operations provided by loadTable. Also, with no type information, this version returns a list +of values. +} @javaClass{org.rascalmpl.library.resource.jdbc.JDBC} public java list[value] loadTableOrdered(Connection connection, str tableName); -@resource{ -jdbctables +@resource{jdbctables} +@synopsis{Prints all available schemas.} +@description{ +The JDBC tables schema should be given as: `jdbctables+connect-string` +where `connect-string` is the database-specific information needed to connect, +encoded as a URI, for instance: `jdbctables+mysql://localhost/bugs?user=my_user_name&password=my_password` } -@synopsis{The JDBC tables schema should be given as: - jdbctables+connect-string - where connect-string is the database-specific information needed to connect, - encoded as a URI, for instance: - jdbctables+mysql://localhost/bugs?user=my_user_name&password=my_password} public str allTableSchemas(str moduleName, loc uri) { // This indicates which driver we need (MySQL, Oracle, etc) driverType = uri.scheme; @@ -228,16 +235,16 @@ public str allTableSchemas(str moduleName, loc uri) { // Then, generate the accessor function for each list[str] tfuns = [ ]; for (Table t <- ts) { - columnTypes = [ nullable ? \label("\\",\adt("Nullable",[rt])) : \label("\\",rt) | table(tn,cl) := t, column(cn,ct,nullable) <- cl, rt := jdbc2RascalType(ct) ]; + columnTypes = [ nullable ? \label("\\",\adt("NULLable",[rt])) : \label("\\",rt) | table(_tn,cl) := t, column(cn,ct,nullable) <- cl, rt := jdbc2RascalType(ct) ]; columnTuple = \tuple(columnTypes); - tfun = "alias \\RowType = ; - 'alias \\Type = rel[]; + tfun = "alias \\RowType = ; + 'alias \\Type = rel[]; ' 'public \\Type \\() { ' registerJDBCClass(\"\"); ' con = createConnection(\"\"); - ' \\Type res = loadTable(#,con,\"\"); + ' \\Type res = loadTable(#,con,\"\"); ' closeConnection(con); ' return res; '} @@ -260,8 +267,7 @@ public str allTableSchemas(str moduleName, loc uri) { return mbody; } -@resource{ -jdbctable +@resource{jdbctable } public str tableSchema(str moduleName, loc uri) { // This indicates which driver we need (MySQL, Oracle, etc) @@ -297,7 +303,7 @@ public str tableSchema(str moduleName, loc uri) { con = createConnection(connectString); t = getTable(con,tableName); - columnTypes = [ nullable ? \label("\\",\adt("Nullable",[rt])) : \label("\\",rt) | table(tn,cl) := t, column(cn,ct,nullable) <- cl, rt := jdbc2RascalType(ct) ]; + columnTypes = [ nullable ? \label("\\",\adt("Nullable",[rt])) : \label("\\",rt) | table(_tn,cl) := t, column(cn,ct,nullable) <- cl, rt := jdbc2RascalType(ct) ]; columnTuple = \tuple(columnTypes); closeConnection(con); @@ -305,13 +311,13 @@ public str tableSchema(str moduleName, loc uri) { mbody = "module 'import resource::jdbc::JDBC; ' - 'alias \\RowType = ; - 'alias \\Type = rel[]; + 'alias \\RowType = ; + 'alias \\Type = rel[]; ' 'public \\Type () { ' registerJDBCClass(\"\"); ' con = createConnection(\"\"); - ' \\Type res = loadTable(#,con,\"\"); + ' \\Type res = loadTable(#,con,\"\"); ' closeConnection(con); ' return res; '} @@ -319,3 +325,5 @@ public str tableSchema(str moduleName, loc uri) { return mbody; } + +private str format(Symbol s) = ""; From ce8769756c5c0ede98666358ba08b9e70820f604 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Tue, 9 Apr 2024 10:56:43 +0200 Subject: [PATCH 11/11] fixed broken implodeTests and also removed the use of annotations --- .../lang/rascal/syntax/tests/ImplodeTests.rsc | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/src/org/rascalmpl/library/lang/rascal/syntax/tests/ImplodeTests.rsc b/src/org/rascalmpl/library/lang/rascal/syntax/tests/ImplodeTests.rsc index ab88b810b37..476897ea5e6 100644 --- a/src/org/rascalmpl/library/lang/rascal/syntax/tests/ImplodeTests.rsc +++ b/src/org/rascalmpl/library/lang/rascal/syntax/tests/ImplodeTests.rsc @@ -12,24 +12,14 @@ import lang::rascal::\syntax::tests::ImplodeTestGrammar; import ParseTree; import Exception; -public data Num = \int(str n); -public data Exp = id(str name) | eq(Exp e1, Exp e2) | number(Num n); +public data Num(loc src=|unknown:///|, map[int,list[str]] comments = ()) = \int(str n); +public data Exp(loc src=|unknown:///|, map[int,list[str]] comments = ()) = id(str name) | eq(Exp e1, Exp e2) | number(Num n); public Exp number(Num::\int("0")) = Exp::number(Num::\int("01")); -public anno loc Num@location; -public anno loc Exp@location; -public anno map[int,list[str]] Num@comments; -public anno map[int,list[str]] Exp@comments; - -public data Number = \int(str n); -public data Expr = id(str name) | eq(Expr e1, Expr e2) | number(Number n); +public data Number(loc src=|unknown:///|, map[int,list[str]] comments = ()) = \int(str n); +public data Expr(loc src=|unknown:///|, map[int,list[str]] comments = ()) = id(str name) | eq(Expr e1, Expr e2) | number(Number n); public Expr number(Number::\int("0")) = Expr::number(Number::\int("02")); -public anno loc Number@location; -public anno loc Expr@location; -public anno map[int,list[str]] Number@comments; -public anno map[int,list[str]] Expr@comments; - public Exp implodeExp(str s) = implode(#Exp, parseExp(s)); public Exp implodeExpLit1() = implode(#Exp, expLit1()); public Exp implodeExpLit2() = implode(#Exp, expLit2()); @@ -43,31 +33,23 @@ public Expr implodeExprLit2() = implode(#Expr, exprLit2()); test bool test11() { try return Exp::id(_) := implodeExp("a"); catch ImplodeError(_): return false;} -@IgnoreCompiler{ -TODO -} -test bool test12() { try return Exp::number(Num::\int("01")) := implodeExp("0"); catch ImplodeError(_): return false;} +@IgnoreCompiler{TODO} +test bool test12() { try return Exp::number(Num::\int("0")) := implodeExp("0"); catch ImplodeError(_): return false;} test bool test13() { try return Exp::eq(Exp::id(_),Exp::id(_)) := implodeExp("a == b"); catch ImplodeError(_): return false;} -@IgnoreCompiler{ -TODO -} -test bool test14() { try return Exp::eq(Exp::number(Num::\int("01")), Exp::number(Num::\int("1"))) := implodeExp("0 == 1"); catch ImplodeError(_): return false;} +@IgnoreCompiler{TODO} +test bool test14() { try return Exp::eq(Exp::number(Num::\int("0")), Exp::number(Num::\int("1"))) := implodeExp("0 == 1"); catch ImplodeError(_): return false;} test bool test15() { try return Expr::id(_) := implodeExpr("a"); catch ImplodeError(_): return false;} -@IgnoreCompiler{ -TODO -} -test bool test16() { try return Expr::number(Number::\int("02")) := implodeExpr("0"); catch ImplodeError(_): return false;} +@IgnoreCompiler{TODO} +test bool test16() { try return Expr::number(Number::\int("0")) := implodeExpr("0"); catch ImplodeError(_): return false;} test bool test17() { try return Expr::eq(Expr::id(_),Expr::id(_)) := implodeExpr("a == b"); catch ImplodeError(_): return false;} -@IgnoreCompiler{ -TODO -} -test bool test18() { try return Expr::eq(Expr::number(Number::\int("02")), Expr::number(Number::\int("1"))) := implodeExpr("0 == 1"); catch ImplodeError(_): return false;} +@IgnoreCompiler{TODO} +test bool test18() { try return Expr::eq(Expr::number(Number::\int("0")), Expr::number(Number::\int("1"))) := implodeExpr("0 == 1"); catch ImplodeError(_): return false;} // ---- test2 ----