This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Distinguish C- and perly- literals - PERLY_DOLLAR
[perl5.git] / perly.y
diff --git a/perly.y b/perly.y
index 2724f86..75a942e 100644 (file)
--- a/perly.y
+++ b/perly.y
@@ -51,6 +51,7 @@
 %token <ival> PERLY_BRACKET_OPEN
 %token <ival> PERLY_BRACKET_CLOSE
 %token <ival> PERLY_COMMA
+%token <ival> PERLY_DOLLAR
 %token <ival> PERLY_DOT
 %token <ival> PERLY_EQUAL_SIGN
 %token <ival> PERLY_MINUS
@@ -696,7 +697,7 @@ sigdefault: /* NULL */
 
 /* subroutine signature scalar element: e.g. '$x', '$=', '$x = $default' */
 sigscalarelem:
-                '$' sigvarname sigdefault
+                PERLY_DOLLAR sigvarname sigdefault
                         {
                             OP *var     = $sigvarname;
                             OP *defexpr = $sigdefault;
@@ -1247,7 +1248,7 @@ term[product]     :       termbinop
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                            op_append_elem(OP_LIST, $optlistexpr, scalar($subname)));
                        }
-       |       term[operand] ARROW '$' PERLY_STAR
+       |       term[operand] ARROW PERLY_DOLLAR PERLY_STAR
                        { $$ = newSVREF($operand); }
        |       term[operand] ARROW PERLY_SNAIL PERLY_STAR
                        { $$ = newAVREF($operand); }
@@ -1379,7 +1380,7 @@ amper     :       PERLY_AMPERSAND indirob
                        { $$ = newCVREF($PERLY_AMPERSAND,$indirob); }
        ;
 
-scalar :       '$' indirob
+scalar :       PERLY_DOLLAR indirob
                        { $$ = newSVREF($indirob); }
        ;