Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added explanation about value type initialisation

...

Johannes Luber (Maintainer)
jaluber AT gmx.de

Contents

...

You can specify that your generated recognizer should be declared within a specific namespace as ahown shown below. By default all recognizers are generated as top-level types with no enclosing namespace.

...

Java Syntax

C# Syntax

Notes

text

Text

 

start

Start

Untested

stop

Stop

Untested

tree

Tree

Untested tree


st

st

 

type

Type

Untested

line

Line

Untested

pos

Pos

Untested

channel

Channel

Untested

$x.size()

$x.Count

 

Another problem, you may encounter, is that value types are initialized with null (happens e.g. while using labels). The cause lies in the following definition of CSharp.stg:

Code Block

csharpTypeInitMap ::= [
    "int":"0",
    "uint":"0",
    "long":"0",
    "ulong":"0",
    "float":"0.0",
    "double":"0.0",
    "bool":"false",
    "byte":"0",
    "sbyte":"0",
    "short":"0",
    "ushort":"0",
    "char":"char.MinValue",
    default:"null" // anything other than an atomic type
]  

As you can see, only the inbuilt value types are supported. As adding value types to this map is an open-ended task, the maintainer is reluctant to make any changes in that structure. Until a new syntax to overwrite the default value explicitly is introduced, a private build along with the changed map is recommended.

Debugging with ANTLRWorks

...