multi-line statements in REBOL? - rebol

An annoying problem I'm having with the REBOL3 REPL is that it won't accept multi-line statements. For instance, I would like to type "some_obj: make obj! [" , hit enter, and then continue the statement.
This is relevant for me as I am using a Vim plugin that sends visually selected source code to the REPL.
I have read on another StackOverflow question that REBOL2 supports multi-line statements, while REBOL3 does not. Has anyone provided a fix for this, or is there a fork with a multi-line support in the REPL?

Unfortunately Rebol 3 Console doesn't support multi line statements.
I usually write my statements into a text editor, copy them to clipboard and then do in Rebol3 console:
do to string! read clipboard://
Better put that into a function:
do-clip: does [do to string! read clipboard://]

Related

How can I make a VS Code language extension insert an indent after a line ending in a colon, as in Python?

The VS Code documentation has a clear if short explanation of how to do custom indentation, but doing this has no effect — whatever I put in the "indentationRules", it fails to match the simplest patterns, and it doesn't even stop the built-in indentation from working, it goes right on using the default indentation described in the link above. All the other bits of the language extension are working, it's not a general problem, it's specific to trying to get these indentation rules to work. I've tried to find examples to copy from the internet but with no success. (I found an example of a grammar for Python but the only mention of indentation in it was as a possible kind of error, which is puzzling.)
Thanks for your help.

What does "Snippet Expansion" mean?

I often heard Snippet Expansion by an IDE, but I searched and couldn't figure out that it means. Could you explain what it is?
Snippet expansion allows you to type short sequences of characters, hit another key, and have it expanded out into a larger amount of code. This is useful for quickly writing common chunks of code.
The above image shows me writing a simple C++ program with the use of snippet expansion. I include the header, I just write inc and hit tab. To write the main function, I write main and hit tab. Similarly for the for loop and cout expression.
It means typing in a sequence of characters, e.g. "if()", pressing a keystroke, and having the IDE look up in a database for the replacement, e.g. "if(|) {\n}", and putting it in the editor in place of the sequence.
It is the feature of some ide's to expand on a certain sequence of keys which is useful to type something faster on not type it at all. Like when you start typing for and it expands to a for loop.
Personally, I use vim, and snipMate.vim enables just that. The example video is here.

Password input function in Lua

How to make CLI password masking in Lua? E.g. when I write password it changes into asterisk or nothing is shown at all? I need platform-independent solution as my script will be used in Java application.
In plain Lua, the answer is simple: you can't.
Since Lua is written in ANSI C you can not get characters from the command line without having to press enter. You can however make use of bindings to libraries like curses.lua which comes with luaposix.
Or if you can assume you'll have an ANSI VT, you can resort to a hack like this:
io.write("\027[s") -- save cursor position
l=io.read()
io.write('\027[u',('*'):rep(#l),"\n") -- rewind to where we were, and fill with the correct amount of stars
print("pst, I got", l, "but don't tell anyone!")
More info about ANSI terminal control
But if it'll be used for a Java application, why not use Java for the password prompt. I guess their support and control of the cli would be better and cross-platform...

MonoDevelop Code Wrapping C#

With MonoDevelop C#, when I press the Format Code button (CTRL+SHIFT+F) the IDE will take a multi line statement and create a long single one. For lambda and LINQ statements, this can be counter productive.
I am looking for a way to have the IDE format the code, but if a command is on seperate lines, to leave it on seperate lines.
I think this should get filed as a bug in MonoDevelop, not as a question on StackOverflow.

strange behavior

I wrote simple script test
echo hello #<-- inside test
if I press one time enter after hello, my script will run, if I don't press - it will not, if two times I'll receive my hello and + command was not found, can somebody please explain me this behavior thanks in advance
This is not a part of the code, this is actual code
and I run it on C-Shell, via editor of Windows
command:
source ./test
Some points:
You should not ask questions tagged with both the [csh] and [bash] tags - these are completely different programs and implement completely different script programming languages
You should never name a script (or any other program) test, as this is the name of a built-in feature of bash
Post the actual code you are asking about, without annotations and show how you run it.
I have tried a similar case. I wrote a script like yours, saved it using Windows Notepad (with CRLF line terminators) and run in bash with the same effect as yours in csh. The problem is bash (so csh as well) does not understand Windows' 2-byte line terminators, which are interpreted as commands, which obviously do not exist.
The solution is: change your editor or configure your current editor to use unix line terminators.
You can try for example Notepad++. Remember to change the line terminators to LF.