Question

I'm following the tutorial here. Under the heading The Cradle, you can see the code:

const TAB = ^I;

well this is a pascal code, actually I'm trying to re-implement those pascal code to Java or groovy(so that I can build a kind of compiler using Java or groovy). But what does the above coding statement meant in pascal?

How I can represent it in Java or Groovy?

Thanks in advance.

Was it helpful?

Solution

The ^I is simply a short-hand for Control+I, which is a representation of ASCII tab character (code 9). On old terminals, pressing (and holding) the control key while pressing a character produced the characters from the ASCII control character range (e.g., Ctrl+A = ASCII 1, ..., Ctrl+M = ASCII 13 = Newline, etc.)

In Groovy, you should probably use final char Tab = '\t'

OTHER TIPS

In Groovy 1.8.4, I settled on simply:

def Tab = '\t'

as this kept giving errors:

final char Tab = '\t'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top