History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-295
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Rodrigo B. de Oliveira
Reporter: Doug H
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

allow \a and other special characters

Created: 17/Apr/05 12:10 PM   Updated: 06/Aug/05 11:32 PM
Component/s: Parser
Affects Version/s: None
Fix Version/s: 0.7

Time Tracking:
Not Specified


 Description  « Hide
Some special characters allowed in C# are not allowed in boo currently, such as \a (a console beep).

Add these lines to the SESC section of boo.g and booel.g:

( 'a'! {text.Length = _begin; text.Append("\a"); }) |
( 'b'! {text.Length = _begin; text.Append("\b"); }) |
( 'f'! {text.Length = _begin; text.Append("\f"); }) |
( '0'! {text.Length = _begin; text.Append("\0"); }) |

I had to use that code instead of $setText because these special characters are not recognized by ANTLR's java runtime.

Test with:
print "here is a beep: \a"
print "hello\b backspace"

According to the C# specification, "\v" (vertical tab) should be allowed too:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_C.asp
but I could not get it to work with ANTLR, unless I used
v instead and manually changed the string in the generated BooLexer.cs file back to \v. It is not important to me.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Ayende Rahien - 05/Aug/05 04:55 AM
\v is still not working, any plans to fix this/

Doug H - 06/Aug/05 11:32 PM
I think I found a workaround. The ascii code for \v is 0x0B (13), so I added this to boo.g and booel.g:

( 'v'! {text.Length = _begin; text.Append((char)0x0B); }) |

And testing showed it printed the same output as C#.