Skip to content

Commit 5eac407

Browse files
committed
Improve reading some of the syntax
1 parent c292cd5 commit 5eac407

File tree

2 files changed

+37
-33
lines changed

2 files changed

+37
-33
lines changed

src/rwl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* History
1515
*
16+
* bengsig 25-may-2023 - make rwlprogram known to tags/cscope
1617
* bengsig 15-may-2023 - statisticsonly
1718
* bengsig 1-may-2023 - $hostname: directive
1819
* bengsig 24-apr-2023 - Fix bug with plain every after queue every
@@ -1996,6 +1997,8 @@ extern const char rwlexecbanner[];
19961997
#define RWL_VERSION_DATE // undef to not include compile date
19971998
extern ub4 rwlpatch;
19981999

2000+
// make rwlprogram a known symbol to tags/cscope
2001+
#define rwlprogram rwlyparse
19992002

20002003
#define rwlcomp(s,x) const char s[] = "rwlwatermark: " rwlxstr(x) " " __FILE__ ;
20012004
#define rwlxstr(x) #x

src/rwlparser.y

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
* History
1313
*
14+
* bengsig 25-may-2023 - Improve syntax understanding
1415
* bengsig 15-may-2023 - statisticsonly
1516
* bengsig 24-apr-2023 - Fix bug when every follows queue every
1617
* bengsig 3-apr-2023 - Allow 0 cursorcache
@@ -509,8 +510,38 @@ programelementlist:
509510

510511
programelement:
511512
statement
512-
// Here are declarations that are only available globally
513+
| globaldeclaration
514+
| threadexecution
515+
// printvar
516+
| RWL_T_PRINTVAR RWL_T_ALL
517+
terminator
518+
{ rwlprintallvars(rwm); }
519+
| RWL_T_PRINTVAR printvarlist
520+
terminator
521+
522+
;
523+
/* end of programelement */
524+
525+
globaldeclaration:
513526
// this is everything except integer, double, string, clob, sql
527+
databasedeclaration
528+
529+
| subroutinedeclaration codeterminator
530+
{
531+
if (bit(rwm->m3flags, RWL_P3_BNOXPROC|RWL_P3_BNOXFUNC))
532+
rwlcodetail(rwm);
533+
bic(rwm->m3flags, RWL_P3_BNOXPROC|RWL_P3_BNOXFUNC);
534+
/* Is is crucial to set codename to 0 here as this means we
535+
are no longer compiling code. rwm->codename is used in many
536+
places as argument to rwlfindvar2 to mean that we are compiling
537+
code and therefore need rwlfindvar2 to local for potential
538+
local variables
539+
*/
540+
541+
rwm->codename = 0; // we are no longer compiling code
542+
rwm->codeguess = RWL_VAR_NOGUESS;
543+
}
544+
514545
| RWL_T_PRIVATE RWL_T_RANDOM RWL_T_STRING RWL_T_ARRAY RWL_T_IDENTIFIER
515546
{
516547
rwm->raname = rwm->inam;
@@ -544,37 +575,7 @@ programelement:
544575
rwlrastbeg(rwm, rwm->raname, RWL_TYPE_RAPROC);
545576
}
546577
ranidentifierspec
547-
548-
// more complex declarations
549-
| database
550-
//
551-
| subroutinedeclaration codeterminator
552-
{
553-
if (bit(rwm->m3flags, RWL_P3_BNOXPROC|RWL_P3_BNOXFUNC))
554-
rwlcodetail(rwm);
555-
bic(rwm->m3flags, RWL_P3_BNOXPROC|RWL_P3_BNOXFUNC);
556-
/* Is is crucial to set codename to 0 here as this means we
557-
are no longer compiling code. rwm->codename is used in many
558-
places as argument to rwlfindvar2 to mean that we are compiling
559-
code and therefore need rwlfindvar2 to local for potential
560-
local variables
561-
*/
562-
563-
rwm->codename = 0; // we are no longer compiling code
564-
rwm->codeguess = RWL_VAR_NOGUESS;
565-
}
566-
567-
// printvar
568-
| RWL_T_PRINTVAR RWL_T_ALL
569-
terminator
570-
{ rwlprintallvars(rwm); }
571-
| RWL_T_PRINTVAR printvarlist
572-
terminator
573-
574-
| threadexecution
575-
576-
;
577-
/* end of programelement */
578+
;
578579

579580
ranstringspec:
580581
'(' ranstringlist ')'
@@ -625,7 +626,7 @@ ranidentifierentry:
625626
{rwlrastadd(rwm, rwm->raentry, rwm->pval.dval); }
626627
;
627628

628-
database:
629+
databasedeclaration:
629630
RWL_T_DATABASE RWL_T_IDENTIFIER
630631
{
631632
// add identifier

0 commit comments

Comments
 (0)