Boo
  1. Boo
  2. BOO-295

allow \a and other special characters

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.7
    • Component/s: Parser
    • Labels:
      None
    • Number of attachments :
      0

      Description

      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.

        Activity

        Hide
        Ayende Rahien added a comment -

        \v is still not working, any plans to fix this/

        Show
        Ayende Rahien added a comment - \v is still not working, any plans to fix this/
        Hide
        Doug H added a comment -

        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#.

        Show
        Doug H added a comment - 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#.

          People

          • Assignee:
            Rodrigo B. de Oliveira
            Reporter:
            Doug H
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: