diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2023-02-08 18:15:20 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2023-02-10 14:38:44 +0000 |
commit | 311ca5baa9210d88e6008e4989d0907e2b5e4982 (patch) | |
tree | 1ccdeeaf0527c5d77a68e80f9dc751476b0f6232 /perly.y | |
parent | 054ceeebc7f6acad2772faa4fa88617c35f4a88a (diff) | |
download | perl-311ca5baa9210d88e6008e4989d0907e2b5e4982.tar.gz |
Parse an optional attribute list for fields; currently no attributes are defined
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -111,7 +111,7 @@ %type <opval> list_of_scalars my_list_of_scalars refgen_topic formblock %type <opval> subattrlist myattrlist myattrterm myterm %type <pval> fieldvar /* pval is PADNAME */ -%type <opval> fielddecl +%type <opval> optfieldattrlist fielddecl %type <opval> termbinop termunop anonymous termdo %type <opval> termrelop relopchain termeqop eqopchain %type <ival> sigslurpsigil @@ -1544,15 +1544,27 @@ fieldvar: scalar %prec PERLY_PAREN_OPEN { $$ = PadnamelistARRAY(PL_comppad_name)[$ary->op_targ]; } ; +optfieldattrlist: + COLONATTR THING + { $$ = $THING; } + | COLONATTR + { $$ = NULL; } + | empty + ; + fielddecl - : KW_FIELD fieldvar + : KW_FIELD fieldvar optfieldattrlist { parser->in_my = 0; + if($optfieldattrlist) + class_apply_field_attributes((PADNAME *)$fieldvar, $optfieldattrlist); $$ = newOP(OP_NULL, 0); } - | KW_FIELD fieldvar ASSIGNOP + | KW_FIELD fieldvar optfieldattrlist ASSIGNOP { parser->in_my = 0; + if($optfieldattrlist) + class_apply_field_attributes((PADNAME *)$fieldvar, $optfieldattrlist); ENTER; class_prepare_initfield_parse(); } |