CTRL+Z not working in Windows 10

736 views
Skip to first unread message

wireplay CO

unread,
Jun 26, 2017, 4:10:28 PM6/26/17
to antlr-discussion
Guys,

I am new to ANTLR but an experienced C#\Windows developer. When I follow the instructions in the book, and managed to fix all of the small items such as CLASSPATH, lib path, etc., I finally made it to the stdin. I have used CTRL+Z many, many times in the past creating files but it is not working on my system for the examples.

I got the example to work by doing this:

grun Hello r -tokens HelloWorld.txt

However, CTRL+Z is not being recognized as an EOF:

X:\Data\projects\Antlr\Book\Tests\HelloWorld>java org.antlr.v4.gui.TestRig Hello r -tokens
hello world
^Z
Terminate batch job (Y/N)? y

The Terminate command is due to the fact that I pressed CTRL+C when the CTRL+Z failed.

Environment:
  • Windows 10, 64-bit, latest preview
  • Java 8.0.1310
  • Antlr4.7

I can move forward using the file name but any ideas on the CTRL+Z?

Mike Lischke

unread,
Jun 27, 2017, 3:48:14 AM6/27/17
to antlr-di...@googlegroups.com
grun Hello r -tokens HelloWorld.txt

However, CTRL+Z is not being recognized as an EOF:

X:\Data\projects\Antlr\Book\Tests\HelloWorld>java org.antlr.v4.gui.TestRig Hello r -tokens
hello world
^Z
Terminate batch job (Y/N)? y

The Terminate command is due to the fact that I pressed CTRL+C when the CTRL+Z failed.

Why do you believe Ctrl+Z should work? Because it did with other (terminal) programs? That's no guarantee that it works "everywhere". Probably the Java implementation listening on stdin doesn't interpret Ctrl+Z as EOI command. Can't say for sure, however.


Alan Churchill

unread,
Jun 27, 2017, 10:27:57 AM6/27/17
to antlr-di...@googlegroups.com

Following the example in the book is not doable in my current environment. Why? Not sure, but that is my research to do.

 

When I searched the forum, I did not see a mention of this particular issue. My post is more for future searchers that may encounter the same issue and also to see if someone has seen it. If not, I will dig and see if I can track it down.

 

Thanks,

Alan Churchill

 

719-310-4870

--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Lischke

unread,
Jun 27, 2017, 10:58:45 AM6/27/17
to antlr-di...@googlegroups.com

Following the example in the book is not doable in my current environment. Why? Not sure, but that is my research to do.
 
When I searched the forum, I did not see a mention of this particular issue. My post is more for future searchers that may encounter the same issue and also to see if someone has seen it. If not, I will dig and see if I can track it down.

I'm sorry for my unhelpful comment. I was thinking about something different.

Indeed the book explicitly mentions the EOF shortcuts (Ctrl+D, Ctrl+Z) and I don't know why they don't work for you (nor did I try them myself). Probably the only way to find out is to debug that keyboard handling, yes.

Norman Dunbar

unread,
Jun 27, 2017, 3:12:40 PM6/27/17
to antlr-di...@googlegroups.com
Maybe the ctrl shortcuts have been, or, are disabled in windows 10?

This link might help, if not, apologies.

https://www.isunshare.com/windows-10/disable-or-enable-ctrl-key-shortcuts-in-cmd-on-windows-10.html

Cheers,
Norm.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Alan Churchill

unread,
Jun 27, 2017, 3:37:05 PM6/27/17
to antlr-di...@googlegroups.com

Thanks Norman, no apologies needed. Shots in the dark on something weird like this.

 

That is not it. My shortcuts are enabled and CTRL+Z works for copy con. I think it may be a Java issue but I haven’t had time to code up tests on it yet.

 

This is my main dev machine as well so god knows what all has been done to it over the years.

 

Thanks,

Alan Churchill

 

719-310-4870

 

From: antlr-di...@googlegroups.com [mailto:antlr-di...@googlegroups.com] On Behalf Of Norman Dunbar
Sent: Tuesday, June 27, 2017 1:13 PM
To: antlr-di...@googlegroups.com
Subject: Re: [antlr-discussion] CTRL+Z not working in Windows 10

 

Maybe the ctrl shortcuts have been, or, are disabled in windows 10?

--

Message has been deleted

Burt_...@hotmail.com

unread,
Jun 28, 2017, 1:28:31 PM6/28/17
to antlr-discussion
Note:  After Ctrl+Z I had to press ENTER!   Could that be it?

On Wednesday, June 28, 2017 at 10:23:21 AM UTC-7, burt_...@hotmail.com wrote:
For me on Windows 10, Ctrl+Z works as expected.   You should not have to enable any shortcut key to make it work.   Are you using something other than cmd.exe as your shell?

C:\try\antlr4>type Hello.g4
// Define a grammar called Hello
grammar Hello;
r  : 'hello' ID ;         // match keyword hello followed by an identifier
ID : [a-z]+ ;             // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
C:\try\antlr4>antlr4 Hello.g4
C:\try\antlr4>javac Hello*.java
C:\try\antlr4>grun Hello r -tree
C:\try\antlr4>java org.antlr.v4.gui.TestRig Hello r -tree
hello parrt
^Z
(r hello parrt)
C:\try\antlr4>

Alan Churchill

unread,
Jun 28, 2017, 2:15:38 PM6/28/17
to antlr-di...@googlegroups.com

Nah, I have tried numerous ways of tackling it. Enter is standard for copy con so I did that out of the gate.

 

I have tried cmd as well as the VS developer console app, both to no avail.

 

However, I just found out what is causing it. A new ‘feature’ in the cmd.exe (thank you Redmond). If you open a cmd window, left-click on the upper-left, select Properties. There is a new checkbox called:

 

Use legacy console.

 

Check that and then relaunch cmd. It then works. Not sure when it was added or what it does but it fixed the CTRL+Z.

 

I am going to document it in my blog in case it trips someone else up.

 

Thanks,

Alan Churchill

 

719-310-4870

 

From: antlr-di...@googlegroups.com [mailto:antlr-di...@googlegroups.com] On Behalf Of Burt_...@hotmail.com
Sent: Wednesday, June 28, 2017 11:29 AM
To: antlr-discussion <antlr-di...@googlegroups.com>
Subject: Re: [antlr-discussion] CTRL+Z not working in Windows 10

 

Note:  After Ctrl+Z I had to press ENTER!   Could that be it?

--

Burt Harris

unread,
Jun 28, 2017, 3:32:53 PM6/28/17
to antlr-di...@googlegroups.com

That’s odd, it works fine for me on the new console subsystem under Windows 10.0.15063 (Insider’s slow ring).   Perhaps you’ve gotten caught-up the unintentional release mentioned here:  https://blogs.windows.com/windowsexperience/2017/06/01/note-unintentional-release-builds-today/#TfW4qs75SfhkPpfQ.97   While I think build 16226 was intended as a fix, and I don’t see any specific mention of Ctrl-Z problems, you may still be able to roll-back the latest update installed.

 

The new features you mention are part of the “console subsystem”, and independent of which shell you are using.   However cmder comes with its own console emulator which might not suffer the same problem.   A lot of people swear by it.

 

P.S.  In the future, I would recommend against the Windows Insider “fast ring” previews on your main development machine.   Personally I’ve never had a problem with “slow ring” or “insider preview” releases making my system unstable, but sometimes it depends on how mainstream your hardware is.   The combinatorial explosion of testing across so many combinations of hardware and software versions is impossible to cover completely during short test cycles the fast ring necessitates.  

--
You received this message because you are subscribed to a topic in the Google Groups "antlr-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antlr-discussion/itEwG7MjNFo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antlr-discussi...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages