~ubuntu-branches/ubuntu/raring/verilator/raring-proposed

« back to all changes in this revision

Viewing changes to src/verilog.y

  • Committer: Package Import Robot
  • Author(s): أحمد المحمودي (Ahmed El-Mahmoudy)
  • Date: 2013-01-13 11:25:29 UTC
  • mfrom: (1.2.16)
  • Revision ID: package-import@ubuntu.com-20130113112529-1jn3n8rbf8glvu2c
Tags: 3.844-1
* New upstream release.
* debian/copyright: Updated copyright years.
* Refresh patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
//
7
7
//*************************************************************************
8
8
//
9
 
// Copyright 2003-2012 by Wilson Snyder.  This program is free software; you can
 
9
// Copyright 2003-2013 by Wilson Snyder.  This program is free software; you can
10
10
// redistribute it and/or modify it under the terms of either the GNU
11
11
// Lesser General Public License Version 3 or the Perl Artistic License
12
12
// Version 2.0.
499
499
%token<fl>              yP_WILDNOTEQUAL "!=?"
500
500
%token<fl>              yP_GTE          ">="
501
501
%token<fl>              yP_LTE          "<="
 
502
%token<fl>              yP_LTE__IGNORE  "<=-ignored"    // Used when expr:<= means assignment
502
503
%token<fl>              yP_SLEFT        "<<"
503
504
%token<fl>              yP_SRIGHT       ">>"
504
505
%token<fl>              yP_SSRIGHT      ">>>"
560
561
%left           '^' yP_XNOR
561
562
%left           '&' yP_NAND
562
563
%left           yP_EQUAL yP_NOTEQUAL yP_CASEEQUAL yP_CASENOTEQUAL yP_WILDEQUAL yP_WILDNOTEQUAL
563
 
%left           '>' '<' yP_GTE yP_LTE
 
564
%left           '>' '<' yP_GTE yP_LTE yP_LTE__IGNORE
564
565
%left           yP_SLEFT yP_SRIGHT yP_SSRIGHT
565
566
%left           '+' '-'
566
567
%left           '*' '/' '%'
600
601
//  Blank lines for type insertion
601
602
//  Blank lines for type insertion
602
603
//  Blank lines for type insertion
 
604
//  Blank lines for type insertion
 
605
//  Blank lines for type insertion
 
606
//  Blank lines for type insertion
 
607
//  Blank lines for type insertion
 
608
//  Blank lines for type insertion
603
609
 
604
610
%start source_text
605
611
 
641
647
        |       package_item                            { if ($1) GRAMMARP->unitPackage($1->fileline())->addStmtp($1); }
642
648
        //UNSUP bind_directive                          { }
643
649
        //      unsupported     // IEEE: config_declaration
644
 
                                // Verilator only
 
650
        //                      // Verilator only
645
651
        |       vltItem                                 { }
646
652
        |       error                                   { }
647
653
        ;
1051
1057
        //UNSUP yWOR                                    { VARDECL(WOR); }
1052
1058
        ;
1053
1059
 
1054
 
varRESET:
1055
 
                /* empty */                             { VARRESET_NONLIST(VAR); }
1056
 
        ;
1057
 
 
1058
1060
varGParamReset:
1059
1061
                yPARAMETER                              { VARRESET_NONLIST(GPARAM); }
1060
1062
        ;
1409
1411
 
1410
1412
data_declarationVar<nodep>:     // IEEE: part of data_declaration
1411
1413
        //                      // The first declaration has complications between assuming what's the type vs ID declaring
1412
 
                varRESET data_declarationVarFront list_of_variable_decl_assignments ';' { $$ = $3; }
 
1414
                data_declarationVarFront list_of_variable_decl_assignments ';'  { $$ = $2; }
1413
1415
        ;
1414
1416
 
1415
1417
data_declarationVarFront:       // IEEE: part of data_declaration
1416
1418
        //                      // Expanded: "constE yVAR lifetimeE data_type"
1417
1419
        //                      // implicit_type expanded into /*empty*/ or "signingE rangeList"
1418
 
                /**/        yVAR lifetimeE data_type    { /*VARRESET-in-ddVar*/ VARDTYPE($3); }
1419
 
        |       /**/        yVAR lifetimeE              { /*VARRESET-in-ddVar*/ VARDTYPE(new AstBasicDType($<fl>1, LOGIC_IMPLICIT)); }
 
1420
                /**/        yVAR lifetimeE data_type    { VARRESET_NONLIST(VAR); VARDTYPE($3); }
 
1421
        |       /**/        yVAR lifetimeE              { VARRESET_NONLIST(VAR); VARDTYPE(new AstBasicDType($<fl>1, LOGIC_IMPLICIT)); }
1420
1422
        |       /**/        yVAR lifetimeE signingE rangeList { /*VARRESET-in-ddVar*/ VARDTYPE(GRAMMARP->addRange(new AstBasicDType($<fl>1, LOGIC_IMPLICIT, $3), $4,false)); }
1421
1423
        //
1422
1424
        //                      // implicit_type expanded into /*empty*/ or "signingE rangeList"
1423
 
        |       yCONST__ETC yVAR lifetimeE data_type    { /*VARRESET-in-ddVar*/ VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), $4)); }
1424
 
        |       yCONST__ETC yVAR lifetimeE              { /*VARRESET-in-ddVar*/ VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), new AstBasicDType($<fl>2, LOGIC_IMPLICIT))); }
1425
 
        |       yCONST__ETC yVAR lifetimeE signingE rangeList { /*VARRESET-in-ddVar*/ VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), GRAMMARP->addRange(new AstBasicDType($<fl>2, LOGIC_IMPLICIT, $4), $5,false))); }
 
1425
        |       yCONST__ETC yVAR lifetimeE data_type    { VARRESET_NONLIST(VAR); VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), $4)); }
 
1426
        |       yCONST__ETC yVAR lifetimeE              { VARRESET_NONLIST(VAR); VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), new AstBasicDType($<fl>2, LOGIC_IMPLICIT))); }
 
1427
        |       yCONST__ETC yVAR lifetimeE signingE rangeList { VARRESET_NONLIST(VAR); VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), GRAMMARP->addRange(new AstBasicDType($<fl>2, LOGIC_IMPLICIT, $4), $5,false))); }
1426
1428
        //
1427
1429
        //                      // Expanded: "constE lifetimeE data_type"
1428
 
        |       /**/                  data_type         { /*VARRESET-in-ddVar*/ VARDTYPE($1); }
1429
 
        |       /**/        lifetime  data_type         { /*VARRESET-in-ddVar*/ VARDTYPE($2); }
1430
 
        |       yCONST__ETC lifetimeE data_type         { /*VARRESET-in-ddVar*/ VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), $3)); }
 
1430
        |       /**/                  data_type         { VARRESET_NONLIST(VAR); VARDTYPE($1); }
 
1431
        |       /**/        lifetime  data_type         { VARRESET_NONLIST(VAR); VARDTYPE($2); }
 
1432
        |       yCONST__ETC lifetimeE data_type         { VARRESET_NONLIST(VAR); VARDTYPE(new AstConstDType($<fl>1, VFlagChildDType(), $3)); }
1431
1433
        //                      // = class_new is in variable_decl_assignment
1432
1434
        ;
1433
1435
 
2022
2024
        //UNSUP fexprLvalue '=' dynamic_array_new ';'   { UNSUP }
2023
2025
        //
2024
2026
        //                      // IEEE: nonblocking_assignment
2025
 
        |       idClassSel yP_LTE delayE expr ';'       { $$ = new AstAssignDly($2,$1,$4); }
2026
 
        |       '{' variable_lvalueConcList '}' yP_LTE delayE expr ';' { $$ = new AstAssignDly($4,$2,$6); }
 
2027
        |       fexprLvalue yP_LTE delayE expr ';'      { $$ = new AstAssignDly($2,$1,$4); }
2027
2028
        //UNSUP fexprLvalue yP_LTE delay_or_event_controlE expr ';'     { UNSUP }
2028
2029
        //
2029
2030
        //                      // IEEE: procedural_continuous_assignment
2064
2065
        //                      // Expr here must result in a subroutine_call
2065
2066
        |       task_subroutine_callNoMethod ';'        { $$ = $1; }
2066
2067
        //UNSUP fexpr '.' array_methodNoRoot ';'        { UNSUP }
2067
 
        //UNSUP fexpr '.' task_subroutine_callNoMethod ';'      { UNSUP }
 
2068
        |       fexpr '.' task_subroutine_callNoMethod ';'      { $$ = new AstDot($<fl>2,$1,$3); }
2068
2069
        //UNSUP fexprScope ';'                          { UNSUP }
2069
2070
        //                      // Not here in IEEE; from class_constructor_declaration
2070
2071
        //                      // Because we've joined class_constructor_declaration into generic functions
2139
2140
        ;
2140
2141
 
2141
2142
foperator_assignment<nodep>:    // IEEE: operator_assignment (for first part of expression)
2142
 
                idClassSel '=' delayE expr      { $$ = new AstAssign($2,$1,$4); }
2143
 
        |       idClassSel '=' yD_FOPEN '(' expr ',' expr ')'   { $$ = new AstFOpen($3,$1,$5,$7); }
2144
 
        |       '{' variable_lvalueConcList '}' '=' delayE expr { $$ = new AstAssign($4,$2,$6); }
 
2143
                fexprLvalue '=' delayE expr     { $$ = new AstAssign($2,$1,$4); }
 
2144
        |       fexprLvalue '=' yD_FOPEN '(' expr ',' expr ')'  { $$ = new AstFOpen($3,$1,$5,$7); }
2145
2145
        //
2146
2146
        //UNSUP ~f~exprLvalue '=' delay_or_event_controlE expr { UNSUP }
2147
2147
        //UNSUP ~f~exprLvalue yP_PLUS(etc) expr         { UNSUP }
2148
 
        |       idClassSel yP_PLUSEQ    expr            { $$ = new AstAssign($2,$1,new AstAdd    ($2,$1->cloneTree(true),$3)); }
2149
 
        |       idClassSel yP_MINUSEQ   expr            { $$ = new AstAssign($2,$1,new AstSub    ($2,$1->cloneTree(true),$3)); }
2150
 
        |       idClassSel yP_TIMESEQ   expr            { $$ = new AstAssign($2,$1,new AstMul    ($2,$1->cloneTree(true),$3)); }
2151
 
        |       idClassSel yP_DIVEQ     expr            { $$ = new AstAssign($2,$1,new AstDiv    ($2,$1->cloneTree(true),$3)); }
2152
 
        |       idClassSel yP_MODEQ     expr            { $$ = new AstAssign($2,$1,new AstModDiv ($2,$1->cloneTree(true),$3)); }
2153
 
        |       idClassSel yP_ANDEQ     expr            { $$ = new AstAssign($2,$1,new AstAnd    ($2,$1->cloneTree(true),$3)); }
2154
 
        |       idClassSel yP_OREQ      expr            { $$ = new AstAssign($2,$1,new AstOr     ($2,$1->cloneTree(true),$3)); }
2155
 
        |       idClassSel yP_XOREQ     expr            { $$ = new AstAssign($2,$1,new AstXor    ($2,$1->cloneTree(true),$3)); }
2156
 
        |       idClassSel yP_SLEFTEQ   expr            { $$ = new AstAssign($2,$1,new AstShiftL ($2,$1->cloneTree(true),$3)); }
2157
 
        |       idClassSel yP_SRIGHTEQ  expr            { $$ = new AstAssign($2,$1,new AstShiftR ($2,$1->cloneTree(true),$3)); }
2158
 
        |       idClassSel yP_SSRIGHTEQ expr            { $$ = new AstAssign($2,$1,new AstShiftRS($2,$1->cloneTree(true),$3)); }
2159
 
        //
2160
 
        |       '{' variable_lvalueConcList '}' yP_PLUSEQ    expr       { $$ = new AstAssign($4,$2,new AstAdd    ($4,$2->cloneTree(true),$5)); }
2161
 
        |       '{' variable_lvalueConcList '}' yP_MINUSEQ   expr       { $$ = new AstAssign($4,$2,new AstSub    ($4,$2->cloneTree(true),$5)); }
2162
 
        |       '{' variable_lvalueConcList '}' yP_TIMESEQ   expr       { $$ = new AstAssign($4,$2,new AstMul    ($4,$2->cloneTree(true),$5)); }
2163
 
        |       '{' variable_lvalueConcList '}' yP_DIVEQ     expr       { $$ = new AstAssign($4,$2,new AstDiv    ($4,$2->cloneTree(true),$5)); }
2164
 
        |       '{' variable_lvalueConcList '}' yP_MODEQ     expr       { $$ = new AstAssign($4,$2,new AstModDiv ($4,$2->cloneTree(true),$5)); }
2165
 
        |       '{' variable_lvalueConcList '}' yP_ANDEQ     expr       { $$ = new AstAssign($4,$2,new AstAnd    ($4,$2->cloneTree(true),$5)); }
2166
 
        |       '{' variable_lvalueConcList '}' yP_OREQ      expr       { $$ = new AstAssign($4,$2,new AstOr     ($4,$2->cloneTree(true),$5)); }
2167
 
        |       '{' variable_lvalueConcList '}' yP_XOREQ     expr       { $$ = new AstAssign($4,$2,new AstXor    ($4,$2->cloneTree(true),$5)); }
2168
 
        |       '{' variable_lvalueConcList '}' yP_SLEFTEQ   expr       { $$ = new AstAssign($4,$2,new AstShiftL ($4,$2->cloneTree(true),$5)); }
2169
 
        |       '{' variable_lvalueConcList '}' yP_SRIGHTEQ  expr       { $$ = new AstAssign($4,$2,new AstShiftR ($4,$2->cloneTree(true),$5)); }
2170
 
        |       '{' variable_lvalueConcList '}' yP_SSRIGHTEQ expr       { $$ = new AstAssign($4,$2,new AstShiftRS($4,$2->cloneTree(true),$5)); }
 
2148
        |       fexprLvalue yP_PLUSEQ    expr           { $$ = new AstAssign($2,$1,new AstAdd    ($2,$1->cloneTree(true),$3)); }
 
2149
        |       fexprLvalue yP_MINUSEQ   expr           { $$ = new AstAssign($2,$1,new AstSub    ($2,$1->cloneTree(true),$3)); }
 
2150
        |       fexprLvalue yP_TIMESEQ   expr           { $$ = new AstAssign($2,$1,new AstMul    ($2,$1->cloneTree(true),$3)); }
 
2151
        |       fexprLvalue yP_DIVEQ     expr           { $$ = new AstAssign($2,$1,new AstDiv    ($2,$1->cloneTree(true),$3)); }
 
2152
        |       fexprLvalue yP_MODEQ     expr           { $$ = new AstAssign($2,$1,new AstModDiv ($2,$1->cloneTree(true),$3)); }
 
2153
        |       fexprLvalue yP_ANDEQ     expr           { $$ = new AstAssign($2,$1,new AstAnd    ($2,$1->cloneTree(true),$3)); }
 
2154
        |       fexprLvalue yP_OREQ      expr           { $$ = new AstAssign($2,$1,new AstOr     ($2,$1->cloneTree(true),$3)); }
 
2155
        |       fexprLvalue yP_XOREQ     expr           { $$ = new AstAssign($2,$1,new AstXor    ($2,$1->cloneTree(true),$3)); }
 
2156
        |       fexprLvalue yP_SLEFTEQ   expr           { $$ = new AstAssign($2,$1,new AstShiftL ($2,$1->cloneTree(true),$3)); }
 
2157
        |       fexprLvalue yP_SRIGHTEQ  expr           { $$ = new AstAssign($2,$1,new AstShiftR ($2,$1->cloneTree(true),$3)); }
 
2158
        |       fexprLvalue yP_SSRIGHTEQ expr           { $$ = new AstAssign($2,$1,new AstShiftRS($2,$1->cloneTree(true),$3)); }
2171
2159
        ;
2172
2160
 
2173
2161
finc_or_dec_expression<nodep>:  // ==IEEE: inc_or_dec_expression
2287
2275
// "datatype id = x {, id = x }"  |  "yaId = x {, id=x}" is legal
2288
2276
for_initialization<nodep>:      // ==IEEE: for_initialization + for_variable_declaration + extra terminating ";"
2289
2277
        //                      // IEEE: for_variable_declaration
2290
 
                varRESET data_type idAny/*new*/ '=' expr ';'
2291
 
                        { VARDTYPE($2);
2292
 
                          $$ = VARDONEA($<fl>3,*$3,NULL,NULL);
2293
 
                          $$->addNext(new AstAssign($4,new AstVarRef($4,*$3,true),$5));}
 
2278
                data_type idAny/*new*/ '=' expr ';'
 
2279
                        { VARRESET_NONLIST(VAR); VARDTYPE($1);
 
2280
                          $$ = VARDONEA($<fl>2,*$2,NULL,NULL);
 
2281
                          $$->addNext(new AstAssign($3,new AstVarRef($3,*$2,true),$4));}
2294
2282
        |       varRefBase '=' expr ';'                 { $$ = new AstAssign($2,$1,$3); }
2295
2283
        //UNSUP: List of initializations
2296
2284
        ;
2308
2296
//************************************************
2309
2297
// Functions/tasks
2310
2298
 
2311
 
taskRef<parserefp>:             // IEEE: part of tf_call
2312
 
                idDotted                                { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_FTASK, "", $1, new AstTaskRef($1->fileline(),"",NULL)); $$->start(true); }
2313
 
        |       idDotted '(' list_of_argumentsE ')'     { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_FTASK, "", $1, new AstTaskRef($1->fileline(),"",$3)); $$->start(true); }
2314
 
        //UNSUP: package_scopeIdFollows idDotted                { }
2315
 
        //UNSUP: package_scopeIdFollows idDotted '(' list_of_argumentsE ')'     { }
2316
 
        //UNSUP: idDotted is really just id to allow dotted method calls
 
2299
taskRef<nodep>:                 // IEEE: part of tf_call
 
2300
                id                              { $$ = new AstTaskRef($<fl>1,*$1,NULL); }
 
2301
        |       id '(' list_of_argumentsE ')'   { $$ = new AstTaskRef($<fl>1,*$1,$3); }
 
2302
        |       package_scopeIdFollows id '(' list_of_argumentsE ')'    { $$ = AstDot::newIfPkg($<fl>2, $1, new AstTaskRef($<fl>2,*$2,$4)); }
2317
2303
        ;
2318
2304
 
2319
 
funcRef<parserefp>:             // IEEE: part of tf_call
 
2305
funcRef<nodep>:                 // IEEE: part of tf_call
2320
2306
        //                      // package_scope/hierarchical_... is part of expr, so just need ID
2321
2307
        //                      //      making-a                id-is-a
2322
2308
        //                      //      -----------------       ------------------
2325
2311
        //                      //      property_instance       property_identifier     property_actual_arg
2326
2312
        //                      //      sequence_instance       sequence_identifier     sequence_actual_arg
2327
2313
        //                      //      let_expression          let_identifier          let_actual_arg
2328
 
                idDotted '(' list_of_argumentsE ')'     { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_FTASK, "", $1, new AstFuncRef($2, "", $3)); $$->start(true); }
2329
 
        |       package_scopeIdFollows idDotted '(' list_of_argumentsE ')'      { AstFuncRef* f=new AstFuncRef($3,"",$4); f->packagep($1); $$ = new AstParseRef($2->fileline(), AstParseRefExp::PX_FTASK, "", $2, f); $$->start(true); }
 
2314
                id '(' list_of_argumentsE ')'           { $$ = new AstFuncRef($2, *$1, $3); }
 
2315
        |       package_scopeIdFollows id '(' list_of_argumentsE ')'    { $$ = AstDot::newIfPkg($<fl>2, $1, new AstFuncRef($<fl>2,*$2,$4)); }
2330
2316
        //UNSUP: idDotted is really just id to allow dotted method calls
2331
2317
        ;
2332
2318
 
2384
2370
        |       yD_FATAL    '(' expr ')'                                { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL,  "", NULL,NULL); $$->addNext(new AstStop($1)); DEL($3); }
2385
2371
        |       yD_FATAL    '(' expr ',' str commaEListE ')'            { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL,  *$5,NULL,$6);   $$->addNext(new AstStop($1)); DEL($3); }
2386
2372
        //
2387
 
        |       yD_READMEMB '(' expr ',' varRefMem ')'                          { $$ = new AstReadMem($1,false,$3,$5,NULL,NULL); }
2388
 
        |       yD_READMEMB '(' expr ',' varRefMem ',' expr ')'                 { $$ = new AstReadMem($1,false,$3,$5,$7,NULL); }
2389
 
        |       yD_READMEMB '(' expr ',' varRefMem ',' expr ',' expr ')'        { $$ = new AstReadMem($1,false,$3,$5,$7,$9); }
2390
 
        |       yD_READMEMH '(' expr ',' varRefMem ')'                          { $$ = new AstReadMem($1,true, $3,$5,NULL,NULL); }
2391
 
        |       yD_READMEMH '(' expr ',' varRefMem ',' expr ')'                 { $$ = new AstReadMem($1,true, $3,$5,$7,NULL); }
2392
 
        |       yD_READMEMH '(' expr ',' varRefMem ',' expr ',' expr ')'        { $$ = new AstReadMem($1,true, $3,$5,$7,$9); }
 
2373
        |       yD_READMEMB '(' expr ',' idClassSel ')'                         { $$ = new AstReadMem($1,false,$3,$5,NULL,NULL); }
 
2374
        |       yD_READMEMB '(' expr ',' idClassSel ',' expr ')'                { $$ = new AstReadMem($1,false,$3,$5,$7,NULL); }
 
2375
        |       yD_READMEMB '(' expr ',' idClassSel ',' expr ',' expr ')'       { $$ = new AstReadMem($1,false,$3,$5,$7,$9); }
 
2376
        |       yD_READMEMH '(' expr ',' idClassSel ')'                         { $$ = new AstReadMem($1,true, $3,$5,NULL,NULL); }
 
2377
        |       yD_READMEMH '(' expr ',' idClassSel ',' expr ')'                { $$ = new AstReadMem($1,true, $3,$5,$7,NULL); }
 
2378
        |       yD_READMEMH '(' expr ',' idClassSel ',' expr ',' expr ')'       { $$ = new AstReadMem($1,true, $3,$5,$7,$9); }
2393
2379
        ;
2394
2380
 
2395
2381
system_f_call<nodep>:           // IEEE: system_tf_call (as func)
2744
2730
        //
2745
2731
        |       function_subroutine_callNoMethod        { $$ = $1; }
2746
2732
        //                      // method_call
2747
 
        //UNSUP ~l~expr '.' function_subroutine_callNoMethod    { UNSUP }
 
2733
        |       ~l~expr '.' function_subroutine_callNoMethod    { $$ = new AstDot($2,$1,$3); }
2748
2734
        //                      // method_call:array_method requires a '.'
2749
2735
        //UNSUP ~l~expr '.' array_methodNoRoot          { UNSUP }
2750
2736
        //
2780
2766
        //
2781
2767
        //----------------------
2782
2768
        //
 
2769
        //                      // Part of expr that may also be used as lvalue
2783
2770
        |       ~l~exprOkLvalue                         { $$ = $1; }
2784
2771
        //
2785
2772
        //----------------------
2799
2786
        //UNSUP ~l~expr yDIST '{' dist_list '}'         { UNSUP }
2800
2787
        ;
2801
2788
 
 
2789
fexpr<nodep>:                   // For use as first part of statement (disambiguates <=)
 
2790
                BISONPRE_COPY(expr,{s/~l~/f/g; s/~r~/f/g; s/~f__IGNORE~/__IGNORE/g;})   // {copied}
 
2791
        ;
 
2792
 
2802
2793
exprNoStr<nodep>:               // expression with string removed
2803
2794
                BISONPRE_COPY(expr,{s/~noStr__IGNORE~/Ignore/g;})       // {copied}
2804
2795
        ;
2817
2808
        //UNSUP streaming_concatenation                 { UNSUP }
2818
2809
        ;
2819
2810
 
 
2811
fexprOkLvalue<nodep>:           // exprOkLValue, For use as first part of statement (disambiguates <=)
 
2812
                BISONPRE_COPY(exprOkLvalue,{s/~l~/f/g}) // {copied}
 
2813
        ;
 
2814
 
 
2815
fexprLvalue<nodep>:             // For use as first part of statement (disambiguates <=)
 
2816
                fexprOkLvalue                           { $<fl>$=$<fl>1; $$ = $1; }
 
2817
        ;
 
2818
 
2820
2819
exprScope<nodep>:               // scope and variable for use to inside an expression
2821
2820
        //                      // Here we've split method_call_root | implicit_class_handle | class_scope | package_scope
2822
2821
        //                      // from the object being called and let expr's "." deal with resolving it.
2826
2825
        //                      // Or method_call_body without parenthesis
2827
2826
        //                      // See also varRefClassBit, which is the non-expr version of most of this
2828
2827
        //UNSUP yTHIS                                   { UNSUP }
2829
 
                idClassSel                              { $$ = $1; }
2830
 
        //UNSUP: idArrayed instead of idClassSel
2831
 
        //UNSUP package_scopeIdFollows idArrayed        { UNSUP }
 
2828
                idArrayed                               { $$ = $1; }
 
2829
        |       package_scopeIdFollows idArrayed        { $$ = AstDot::newIfPkg($2->fileline(), $1, $2); }
2832
2830
        //UNSUP class_scopeIdFollows idArrayed          { UNSUP }
2833
 
        //UNSUP ~l~expr '.' idArrayed                   { UNSUP }
 
2831
        |       ~l~expr '.' idArrayed                   { $$ = new AstDot($<fl>2,$1,$3); }
2834
2832
        //                      // expr below must be a "yTHIS"
2835
2833
        //UNSUP ~l~expr '.' ySUPER                      { UNSUP }
2836
2834
        //                      // Part of implicit_class_handle
2837
2835
        //UNSUP ySUPER                                  { UNSUP }
2838
2836
        ;
2839
2837
 
 
2838
fexprScope<nodep>:              // exprScope, For use as first part of statement (disambiguates <=)
 
2839
                BISONPRE_COPY(exprScope,{s/~l~/f/g})    // {copied}
 
2840
        ;
 
2841
 
2840
2842
// Psl excludes {}'s by lexer converting to different token
2841
2843
exprPsl<nodep>:
2842
2844
                expr                                    { $$ = $1; }
3161
3163
        |       variable_lvalueConcList ',' variable_lvalue     { $$ = new AstConcat($2,$1,$3); }
3162
3164
        ;
3163
3165
 
3164
 
// VarRef to a Memory
3165
 
varRefMem<parserefp>:
3166
 
                idDotted                                { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_VAR_MEM, "", $1, NULL); $$->start(true); }
3167
 
        ;
3168
 
 
3169
3166
// VarRef to dotted, and/or arrayed, and/or bit-ranged variable
3170
 
idClassSel<parserefp>:                  // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable
3171
 
                idDotted                                { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_VAR_ANY, "", $1, NULL); $$->start(true); }
 
3167
idClassSel<nodep>:                      // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable
 
3168
                idDotted                                { $$ = $1; }
3172
3169
        //                      // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
3173
3170
        //UNSUP yTHIS '.' idDotted                      { UNSUP }
3174
3171
        //UNSUP ySUPER '.' idDotted                     { UNSUP }
3185
3182
 
3186
3183
idDottedMore<nodep>:
3187
3184
                idArrayed                               { $$ = $1; }
3188
 
        |       idDotted '.' idArrayed                  { $$ = new AstDot($2,$1,$3); }
 
3185
        |       idDottedMore '.' idArrayed              { $$ = new AstDot($2,$1,$3); }
3189
3186
        ;
3190
3187
 
3191
3188
// Single component of dotted path, maybe [#].