Single quotes not accepted by `print()` inside strings

62 views
Skip to first unread message

Marcos Cruz

unread,
Mar 24, 2024, 5:39:17 AMMar 24
to ring...@googlegroups.com

Hello.

I'm trying Ring 1.19 on Debian 12.5.

While I was writting a program, I got some errors because somehow single quotes
(') are not accepted by `print()` in strings delimited by double quotes (") or
backticks (`).

This is a confirmation test done using the REPL:

--------
ring:> print("he'llo")
Error (S1) In file: eval
In Line (1) Literal not closed
Called from other source code fileError (R42) : Error in eval() function
ring:> print(`he'llo`)
Error (S1) In file: eval
In Line (1) Literal not closed
Called from other source code fileError (R42) : Error in eval() function
ring:> print(`he'll'o`)
heError (R24) : Using uninitialized variable: l
ring:> c = `he'llo'`
ring:> print(c)
heError (R24) : Using uninitialized variable: l
--------

Double quotes are parsed as expected:

--------
ring:> print(`he"ll"o`)
he"ll"o
ring:> print(`he"llo`)
he"llo
ring:> print('he"llo')
he"llo
ring:> c = `he"llo`
ring:> print(c)
he"llo
--------

Single and double quotes work fine with `put`:

--------
ring:> put `ho"la`
ho"la
ring:> put `ho'la`
ho'la
ring:> put 'ho"la'
ho"la
ring:> put "ho'la"
ho'la
--------

The examples included in sections 6.1 ("Print() function") and 18.1 ("String
Literals") of the documentation make me think this is a bug. Or am I missing
something?

Thank you.


--
Marcos Cruz
http://programandala.net

Mahmoud Fayed

unread,
Mar 24, 2024, 6:07:28 AMMar 24
to The Ring Programming Language
Hello Marcos

Thanks for the report :D

This is already reported before by Gary in 2024.01.16 and fixed in Ring 1.20


You can get Ring 1.20 from GitHub and build Ring from source code.

Greetings,
Mahmoud

Marcos Cruz

unread,
Mar 24, 2024, 6:29:34 AMMar 24
to ring...@googlegroups.com
Mahmoud Fayed escribió/skribis/wrote/scrit (2024-03-24T03:07:28-0700):

> This is already reported before by Gary in 2024.01.16 and fixed in Ring 1.20
>
> Original post/report: String Interpolation error (google.com)
> <https://groups.google.com/g/ring-lang/c/9JIxN8Az8Ck/m/T8A-2z7PBAAJ>

I see. Sorry I didn't search the group before reporting. Glad to know
the bug has been fixed.

> You can get Ring 1.20 from GitHub and build Ring from source code.

I'll do it. Thank you.

Mahmoud Fayed

unread,
Mar 24, 2024, 5:15:51 PMMar 24
to The Ring Programming Language
Hello Marcos

>> "Glad to know the bug has been fixed."

You are welcome :D

>> "I'll do it. Thank you."

To do this quickly
1 - Get a copy from Ring source code from GitHub 

2 - Instal dependency
cd ring/language/build
./installdep.sh

3 - Build all of the extensions/tools & Ring compiler/vm
cd ring/build
./buildgcc.sh

4 - Final Step
cd ring/bin
sudo ./install.sh 

Now Ring is installed and you can run Ring Notepad
ringpm run ringnotepad

Note: We will improve these steps along the time

Greetings,
Mahmoud

Marcos Cruz

unread,
Apr 9, 2024, 9:12:59 AMApr 9
to ring...@googlegroups.com
Mahmoud Fayed escribió/skribis/wrote/scrit (2024-03-24T14:15:51-0700):

> To do this quickly
> 1 - Get a copy from Ring source code from GitHub
> 2 - Instal dependency
> 3 - Build all of the extensions/tools & Ring compiler/vm
> 4 - Final Step
> Note: We will improve these steps along the time

Thank you.

One year ago, when I tried Ring for the first time, I was surprised that
the compilation and installation process needed several specific steps,
not just the usual `make` or similar.

Then I wrote a fish shell script in order to automate the steps and fix
some issues. For example: some script names were outdated in the
instructions I found in the website; some Linux scripts didn't run on
Debian because they were written in bash but didn't have a shebang,
while my default shell is fish, so I had to execute them with an
explicit `bash`; other scripts didn't run on my system because they
contained Windows end-of-line codes, and my script had to convert them
first.

My script worked fine with the light release of Ring, which was the
first one I tried; later I modified it in order to detect and support
also the Ubuntu full release, which was simpler to compile; finally,
following your kind instructions, I have updated my script to detect and
compile also the repo, what made the process even simpler.

Mahmoud Fayed

unread,
Apr 9, 2024, 10:01:18 AMApr 9
to The Ring Programming Language
Hello Marcos

>> "finally, following your kind instructions, I have updated my script to detect and compile also the repo, what made the process even simpler"

This is very nice, Thanks for the useful feedback.

Greetings,
Mahmoud

Marcos Cruz

unread,
Jul 21, 2024, 7:05:20 PM (14 hours ago) Jul 21
to ring...@googlegroups.com
Marcos Cruz escribió/skribis/wrote/scrit (2024-04-09T15:12:49+0200):

> One year ago, when I tried Ring for the first time, I was surprised that
> the compilation and installation process needed several specific steps,
> not just the usual `make` or similar.
>
> Then I wrote a fish shell script in order to automate the steps and fix
> some issues.

I have used my script again, without any change, in order to update Ring
from version 1.20 to 1.21, compiling from my repo clone.

I think my script could be useful to others. Anyway, it's interesting
because it shows how peculiar the installation process is, at least in
my case…

Here you are:

[I sent this message 7 days ago, which the code pasted, but it didn't
arrive; now I send it again with the code attached.]
build_ring.fish

Marcos Cruz

unread,
Jul 21, 2024, 7:05:30 PM (14 hours ago) Jul 21
to ring...@googlegroups.com
Marcos Cruz escribió/skribis/wrote/scrit (2024-04-09T15:12:49+0200):

> One year ago, when I tried Ring for the first time, I was surprised that
> the compilation and installation process needed several specific steps,
> not just the usual `make` or similar.
>
> Then I wrote a fish shell script in order to automate the steps and fix
> some issues.

I have used my script again, without any change, in order to update Ring
from version 1.20 to 1.21, compiling from my repo clone.

I think my script could be useful to others. Anyway, it's interesting
because it shows how peculiar the installation process is, at least in
my case…

Here you are:

```fish

#!/usr/bin/env fish

# build_ring

# A Ring language installer for Debian

# By Marcos Cruz (programandala.net), 2023, 2024.

# References:
# <https://ring-lang.github.io/doc1.17/sourcecode.html>
# <https://ring-lang.github.io/doc1.19/sourcecode.html>
# <https://groups.google.com/d/msgid/ring-lang/153bc518-5652-4e34-8df8-cb33940094c9n%40googlegroups.com>

# Last modified 20240409T1746+0200.

# Config # {{{1
# ==============================================================

# Set the absolute path to the Ring release.
set RING ~/PATH-TO-RING-SOURCE # XXX ADAPT TO YOUR NEEDS

# Guess the type of release.
if test -d $RING/build
# The <build> directory exists; therefore we are compiling the repository.
set repo
else if ! test -d $RING/samples
# The <samples> directory does not exist; therefore we are compiling a light
# release.
set light_release
else
# Otherwise, we are compiling the full release.
set full_release
end

if ! set --query repo
# Convert the format of the Linux scripts and make them executable.
for script in (find $RING -name "*.sh")
sudo dos2unix $script
sudo chmod u+x $script
end
end

# Install Libraries # {{{1
# ==============================================================

# The following command is an updated version of the content of <./language/src/installdep.sh>
# ("libmysqlclient-dev" is renamed to "default-libmysqlclient-dev";
# "apache2" is removed):

sudo apt-get install \
default-libmysqlclient-dev \
freeglut3-dev \
g++ \
g++-multilib \
liballegro-acodec5-dev \
liballegro-audio5-dev \
liballegro-dialog5-dev \
liballegro-image5-dev \
liballegro-physfs5-dev \
liballegro-ttf5-dev \
liballegro5-dev \
libcurl4-gnutls-dev \
libpng-dev \
libpq-dev \
libqt5charts5 \
libqt5charts5-dev \
libqt5opengl5-dev \
libqt5serialport5-dev \
libqt5texttospeech5-dev \
libqt5webkit5-dev \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-net-dev \
libsdl2-ttf-dev \
libssl-dev \
make \
mesa-common-dev \
qt3d5-dev \
qt3d5-dev-tools \
qt5-qmake \
qtbase5-dev \
qtbase5-dev-tools \
qtchooser \
qtconnectivity5-dev \
qtdeclarative5-dev \
qtmultimedia5-dev \
qtpositioning5-dev \
qtwebengine5-dev \
unixodbc \
unixodbc-dev

or exit 1

# Build # {{{1
# ==============================================================

if set --query repo

# Build from the repository.

cd $RING/build
bash ./buildgcc.sh

else

# Build a light release or an Ubuntu release.

if ! set --query light_release

cd $RING/language/src
bash ./buildgcc.sh
or exit 1

end

cd $RING/tools/ring2exe
sudo sh ./build.sh
or exit 1

# XXX FIXME
cd $RING/extensions/ringconsolecolors
sh ./gencode.sh
or exit 1
sh ./buildgcc.sh
or exit 1

cd $RING/extensions/ringinternet
sh ./buildgcc.sh
or exit 1

cd $RING/extensions/ringcurl
sh ./gencode.sh
sh ./buildgcc.sh
or exit 1

if ! set --query light_release

cd $RING/extensions/ringzip
sh ./gencode.sh
sh ./buildgcc.sh

end

cd $RING/tools/ringpm
sudo sh ./build.sh

if ! set --query light_release

cd $RING/extensions/ringodbc
sh ./buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringmysql
sh ./buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringsqlite
sh ./buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringopenssl
sh ./buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringmurmurhash
sh ./buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringallegro
sh ./gencode.sh
sh ./buildgcc.sh

end

if ! set --query light_release

# Build Libuv first.
cd $RING/extensions/ringlibuv/libuv
sudo apt-get install libtool m4 automake
sh autogen.sh
sh ./configure
make
make check
sudo make install

# Then build RingLibuv.
cd $RING/extensions/ringlibuv
sh ./gencode.sh
sh ./buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringfreeglut
sh ./gencode.sh
sh ./buildgcc.sh

end

if ! set --query light_release

# The ringopengl folder contains many sub folders for different OpenGL versions
# starting from OpenGL 1.1 to OpenGL 4.6.

cd $RING/extensions/ringopengl/opengl21
sh gencode.sh
sh buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringpostgresql
sh gencode.sh
sh buildgcc.sh

end

if ! set --query light_release

cd $RING/extensions/ringqt
sh ./gencode.sh
sh ./buildgcc.sh

end

end

# Install # {{{1
# ==============================================================

cd $RING/bin
sudo sh ./install.sh
or exit 1

# vim: filetype=fish

```

Mahmoud Fayed

unread,
Jul 21, 2024, 7:09:20 PM (14 hours ago) Jul 21
to The Ring Programming Language
Hello Marcos

>> " I think my script could be useful to others."

Thank you very much for sharing :D

Note: we have new scripts that build everything on Linux like this one: ring/build/buildgcc.sh at master · ring-lang/ring (github.com)

Greetings,
Mahmoud 
Reply all
Reply to author
Forward
0 new messages