summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2019-12-28 12:46:04 +0200
committerAdrian Thurston <thurston@colm.net>2019-12-28 12:50:43 +0200
commitf2bbad18a77fc52ba64d6bf4a14338fec8061d1f (patch)
treee278b7bb6e01c84c2a271bc28419b9a69a8ea8fa
parentef54b3ad76f7b10142e26ad6c2eb5e19f6534588 (diff)
downloadcolm-f2bbad18a77fc52ba64d6bf4a14338fec8061d1f.tar.gz
ragel julia: upgrades tests to 1.0 of julia language
The string class is no longer containing uints, now signed. Convert the input strings to vectors of uint8s, since the julia code generator currently supports only uint8. Use numerical representation of 'a' since we have no way to separate single lits from double lits and cast them in the julia test case translator Don't try to construct AbstractString, use String. Array constructor Array{Int, 1}(undef, 20) must take undef as first arg. Verify we have julia 1.0 or later in configure script. refs #91
-rw-r--r--configure.ac38
-rw-r--r--test/ragel.d/gotocallret1.rl2
-rw-r--r--test/ragel.d/julia1.rl3
-rw-r--r--test/ragel.d/trans-julia.lm11
4 files changed, 35 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index fdb99f5f..e9ff3652 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,13 +264,6 @@ if test "x$D_BIN" = x; then
fi
AC_PATH_PROG([JAVAC_BIN], [javac])
-AC_PATH_PROG([RUBY_BIN], [ruby])
-AC_PATH_PROG([CSHARP_BIN], [mcs])
-AC_PATH_PROG([GO_BIN], [go])
-AC_PATH_PROG([OCAML_BIN], [ocaml])
-AC_PATH_PROG([RUST_BIN], [rustc])
-AC_PATH_PROG([JULIA_BIN], [julia])
-AC_PATH_PROG([GNUSTEP_CONFIG], [gnustep-config])
dnl
dnl Java test cases are now requring a large virtual address space. On systems
@@ -289,6 +282,12 @@ if test "x$JAVAC_BIN" != x; then
rm -f conftest.java conftest.class
fi
+AC_PATH_PROG([RUBY_BIN], [ruby])
+AC_PATH_PROG([CSHARP_BIN], [mcs])
+AC_PATH_PROG([GO_BIN], [go])
+AC_PATH_PROG([OCAML_BIN], [ocaml])
+AC_PATH_PROG([RUST_BIN], [rustc])
+AC_PATH_PROG([JULIA_BIN], [julia])
dnl
dnl Julia requires a large virtual address space. On systems where this is
@@ -307,11 +306,26 @@ if test "x$JULIA_BIN" != x; then
rm -f conftest.jl
fi
-dnl
-dnl Disable julia tests until we can sort out how to adapt to the changes to
-dnl the language that are in more recent distros.
-dnl
-JULIA_BIN=""
+dnl We can run julia, now make sure we have 1.0
+if test "x$JULIA_BIN" != x; then
+ echo -n "checking if julia is version 1.0 or later ... "
+
+ dnl We assume the form "julia version X.X.X"
+ dnl 1. everything before the version number.
+ dnl 2. Remove trailing version.
+ dnl 3. Verify it is plain number greater than 1.
+ dnl Any failure comes out as empty string. Note the sed command is wrapped
+ dnl in [] so autotools do not interpret anything in it.
+ JULIA1="`$JULIA_BIN -v | sed ['s/[A-Za-z ]\+//g; s/\.[0-9\.]*//; /^[1-9][0-9]*/!d;']`"
+ if test "x$JULIA1" != x; then
+ echo "yes"
+ else
+ JULIA_BIN=""
+ echo "no"
+ fi
+fi
+
+AC_PATH_PROG([GNUSTEP_CONFIG], [gnustep-config])
dnl
dnl The ASM tests have been based off of sources that are non-relocatable
diff --git a/test/ragel.d/gotocallret1.rl b/test/ragel.d/gotocallret1.rl
index 869349b6..92ebb983 100644
--- a/test/ragel.d/gotocallret1.rl
+++ b/test/ragel.d/gotocallret1.rl
@@ -44,7 +44,7 @@ int stack[32];
# Choose which to machine to call into based on the command.
action comm_arg {
- if ( comm >= 'a' ) {
+ if ( comm >= 97 ) {
fcall alp_comm;
} else {
fcall dig_comm;
diff --git a/test/ragel.d/julia1.rl b/test/ragel.d/julia1.rl
index df11994f..4b349908 100644
--- a/test/ragel.d/julia1.rl
+++ b/test/ragel.d/julia1.rl
@@ -10,7 +10,8 @@
%% write data;
-function test( data::AbstractString )
+function test( data_string::AbstractString )
+ data = Vector{UInt8}( data_string )
p = 0
pe = length(data)
eof = length(data)
diff --git a/test/ragel.d/trans-julia.lm b/test/ragel.d/trans-julia.lm
index d67635bf..cf153c64 100644
--- a/test/ragel.d/trans-julia.lm
+++ b/test/ragel.d/trans-julia.lm
@@ -175,7 +175,7 @@ int print_stmt( Stmt: indep::print_stmt )
case [`print_token `;]
{
send Out
- "print( data\[(ts+1) : (te)\] );
+ "print( String( data\[(ts+1) : (te)\] ) );
}
case [`print_off `;]
{
@@ -193,7 +193,7 @@ void buf_stmt( BufStmt: indep::buf_stmt )
}
case [`buf_append `( `) `;] {
send Out
- " buffer = buffer * AbstractString(Char\[fc\]);
+ " buffer = buffer * String(Char\[fc\]);
}
}
@@ -284,7 +284,8 @@ void julia( Output: stream )
"
"%% write data;
"
- "function m( data::AbstractString )
+ "function m( data_string::AbstractString )
+ " data = Vector{UInt8}( data_string )
" p = 0
" pe = length(data)
" eof = length(data)
@@ -292,8 +293,8 @@ void julia( Output: stream )
" buffer = \"\"
" nfa_len = 0
" nfa_count = 0
- " nfa_bp_state = Array{Int, 1}(20)
- " nfa_bp_p = Array{Int, 1}(20)
+ " nfa_bp_state = Array{Int, 1}(undef, 20)
+ " nfa_bp_p = Array{Int, 1}(undef, 20)
Init: indep::stmt* = RagelTree.Init
for Stmt: indep::stmt in Init {