Add explicit initialization for return values

Plain types were automatically initialized to NULL up to and including
ANTLR 3.2, but this changed (for the better) in later versions.
This commit is contained in:
Julien BLACHE 2011-06-24 18:32:35 +02:00
parent 59c0547d28
commit 55d6205cf8
2 changed files with 5 additions and 0 deletions

View File

@ -48,6 +48,7 @@ options {
}
query returns [ pANTLR3_STRING result ]
@init { $result = NULL; }
: e = expr
{
if (!$e.valid)

View File

@ -54,6 +54,7 @@ options {
}
query returns [ pANTLR3_STRING result ]
@init { $result = NULL; }
: e = expr
{
if (!$e.valid)
@ -225,6 +226,7 @@ strcrit returns [ pANTLR3_STRING result, int valid ]
;
strop returns [ pANTLR3_COMMON_TOKEN op ]
@init { $op = NULL; }
: n = EQUAL
{ $op = $n->getToken($n); }
| n = INCLUDES
@ -297,6 +299,7 @@ intcrit returns [ pANTLR3_STRING result, int valid ]
;
intop returns [ pANTLR3_COMMON_TOKEN op ]
@init { $op = NULL; }
: n = EQUAL
{ $op = $n->getToken($n); }
| n = LESS
@ -369,6 +372,7 @@ datecrit returns [ pANTLR3_STRING result, int valid ]
;
dateop returns [ pANTLR3_COMMON_TOKEN op ]
@init { $op = NULL; }
: n = BEFORE
{ $op = $n->getToken($n); }
| n = AFTER