[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4369-g71a50ec0
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4369-g71a50ec0 |
Date: |
Wed, 5 Jan 2022 14:26:12 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-5.1-stable has been updated
via 71a50ec092b75ce2b2f969892c6cd443d44777a5 (commit)
via 8bd2904afb35a19d48552b10d3215ba16fe4ce35 (commit)
from f285f960bdfb5acb50a8ec7ed4b98f17d0bd624a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=71a50ec092b75ce2b2f969892c6cd443d44777a5
commit 71a50ec092b75ce2b2f969892c6cd443d44777a5
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Jan 5 21:25:48 2022 +0200
Small doc update.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 28a596c1..1e406590 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.ini (Indirect Calls): Use `the_function' everywhere.
+ Thanks to John Naman, <gawker@703n.com> for the report.
+
2021-12-10 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Updated from GNULIB.
diff --git a/doc/gawk.info b/doc/gawk.info
index cf7167f6..664627c6 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -15320,8 +15320,8 @@ identifier immediately followed by an opening
parenthesis, any
arguments, and then a closing parenthesis, with the addition of a
leading '@' character:
- the_func = "sum"
- result = @the_func() # calls the sum() function
+ the_function = "sum"
+ result = @the_function() # calls the sum() function
Here is a full program that processes the previously shown data,
using indirect function calls:
@@ -15564,7 +15564,7 @@ functions indirectly, as follows.
example, in the following case:
for (i = 1; i <= n; i++)
- @the_func()
+ @the_function()
'gawk' looks up the actual function to call only once.
@@ -38885,323 +38885,323 @@ Ref: Function Caveats-Footnote-1636441
Node: Return Statement636561
Node: Dynamic Typing639540
Node: Indirect Calls640470
-Ref: Indirect Calls-Footnote-1650722
-Node: Functions Summary650850
-Node: Library Functions653555
-Ref: Library Functions-Footnote-1657162
-Ref: Library Functions-Footnote-2657305
-Node: Library Names657476
-Ref: Library Names-Footnote-1661143
-Ref: Library Names-Footnote-2661366
-Node: General Functions661452
-Node: Strtonum Function662634
-Node: Assert Function665656
-Node: Round Function668982
-Node: Cliff Random Function670522
-Node: Ordinal Functions671538
-Ref: Ordinal Functions-Footnote-1674601
-Ref: Ordinal Functions-Footnote-2674853
-Node: Join Function675063
-Ref: Join Function-Footnote-1676833
-Node: Getlocaltime Function677033
-Node: Readfile Function680775
-Node: Shell Quoting682752
-Node: Isnumeric Function684180
-Node: Data File Management685568
-Node: Filetrans Function686200
-Node: Rewind Function690296
-Node: File Checking692205
-Ref: File Checking-Footnote-1693539
-Node: Empty Files693740
-Node: Ignoring Assigns695719
-Node: Getopt Function697269
-Ref: Getopt Function-Footnote-1712566
-Node: Passwd Functions712766
-Ref: Passwd Functions-Footnote-1721605
-Node: Group Functions721693
-Ref: Group Functions-Footnote-1729591
-Node: Walking Arrays729798
-Node: Library Functions Summary732806
-Node: Library Exercises734212
-Node: Sample Programs734677
-Node: Running Examples735447
-Node: Clones736175
-Node: Cut Program737399
-Node: Egrep Program747539
-Node: Id Program756540
-Node: Split Program766475
-Ref: Split Program-Footnote-1776368
-Node: Tee Program776541
-Node: Uniq Program779331
-Node: Wc Program786919
-Node: Bytes vs. Characters787306
-Node: Using extensions788854
-Node: wc program789608
-Node: Miscellaneous Programs794473
-Node: Dupword Program795686
-Node: Alarm Program797716
-Node: Translate Program802571
-Ref: Translate Program-Footnote-1807136
-Node: Labels Program807406
-Ref: Labels Program-Footnote-1810757
-Node: Word Sorting810841
-Node: History Sorting814913
-Node: Extract Program817138
-Node: Simple Sed825151
-Node: Igawk Program828225
-Ref: Igawk Program-Footnote-1842556
-Ref: Igawk Program-Footnote-2842758
-Ref: Igawk Program-Footnote-3842880
-Node: Anagram Program842995
-Node: Signature Program846057
-Node: Programs Summary847304
-Node: Programs Exercises848518
-Ref: Programs Exercises-Footnote-1852648
-Node: Advanced Features852734
-Node: Nondecimal Data854801
-Node: Array Sorting856392
-Node: Controlling Array Traversal857092
-Ref: Controlling Array Traversal-Footnote-1865460
-Node: Array Sorting Functions865578
-Ref: Array Sorting Functions-Footnote-1870952
-Node: Two-way I/O871148
-Ref: Two-way I/O-Footnote-1878874
-Ref: Two-way I/O-Footnote-2879061
-Node: TCP/IP Networking879143
-Node: Profiling882219
-Node: Extension Philosophy891528
-Node: Advanced Features Summary893007
-Node: Internationalization895022
-Node: I18N and L10N896696
-Node: Explaining gettext897383
-Ref: Explaining gettext-Footnote-1903275
-Ref: Explaining gettext-Footnote-2903460
-Node: Programmer i18n903625
-Ref: Programmer i18n-Footnote-1908574
-Node: Translator i18n908623
-Node: String Extraction909417
-Ref: String Extraction-Footnote-1910549
-Node: Printf Ordering910635
-Ref: Printf Ordering-Footnote-1913421
-Node: I18N Portability913485
-Ref: I18N Portability-Footnote-1915941
-Node: I18N Example916004
-Ref: I18N Example-Footnote-1919279
-Ref: I18N Example-Footnote-2919352
-Node: Gawk I18N919461
-Node: I18N Summary920083
-Node: Debugger921424
-Node: Debugging922424
-Node: Debugging Concepts922865
-Node: Debugging Terms924674
-Node: Awk Debugging927249
-Ref: Awk Debugging-Footnote-1928194
-Node: Sample Debugging Session928326
-Node: Debugger Invocation928860
-Node: Finding The Bug930246
-Node: List of Debugger Commands936720
-Node: Breakpoint Control938053
-Node: Debugger Execution Control941747
-Node: Viewing And Changing Data945109
-Node: Execution Stack948650
-Node: Debugger Info950287
-Node: Miscellaneous Debugger Commands954358
-Node: Readline Support959420
-Node: Limitations960316
-Node: Debugging Summary962870
-Node: Namespaces964149
-Node: Global Namespace965260
-Node: Qualified Names966658
-Node: Default Namespace967657
-Node: Changing The Namespace968398
-Node: Naming Rules970012
-Node: Internal Name Management971860
-Node: Namespace Example972902
-Node: Namespace And Features975464
-Node: Namespace Summary976899
-Node: Arbitrary Precision Arithmetic978376
-Node: Computer Arithmetic979863
-Ref: table-numeric-ranges983629
-Ref: table-floating-point-ranges984123
-Ref: Computer Arithmetic-Footnote-1984782
-Node: Math Definitions984839
-Ref: table-ieee-formats988155
-Ref: Math Definitions-Footnote-1988759
-Node: MPFR features988864
-Node: FP Math Caution990582
-Ref: FP Math Caution-Footnote-1991654
-Node: Inexactness of computations992023
-Node: Inexact representation992983
-Node: Comparing FP Values994343
-Node: Errors accumulate995584
-Node: Getting Accuracy997017
-Node: Try To Round999727
-Node: Setting precision1000626
-Ref: table-predefined-precision-strings1001323
-Node: Setting the rounding mode1003154
-Ref: table-gawk-rounding-modes1003528
-Ref: Setting the rounding mode-Footnote-11007460
-Node: Arbitrary Precision Integers1007639
-Ref: Arbitrary Precision Integers-Footnote-11010814
-Node: Checking for MPFR1010963
-Node: POSIX Floating Point Problems1012437
-Ref: POSIX Floating Point Problems-Footnote-11016722
-Node: Floating point summary1016760
-Node: Dynamic Extensions1018950
-Node: Extension Intro1020503
-Node: Plugin License1021769
-Node: Extension Mechanism Outline1022566
-Ref: figure-load-extension1023005
-Ref: figure-register-new-function1024571
-Ref: figure-call-new-function1025664
-Node: Extension API Description1027727
-Node: Extension API Functions Introduction1029440
-Ref: table-api-std-headers1031276
-Node: General Data Types1035526
-Ref: General Data Types-Footnote-11044156
-Node: Memory Allocation Functions1044455
-Ref: Memory Allocation Functions-Footnote-11048956
-Node: Constructor Functions1049055
-Node: API Ownership of MPFR and GMP Values1052521
-Node: Registration Functions1053834
-Node: Extension Functions1054534
-Node: Exit Callback Functions1059856
-Node: Extension Version String1061106
-Node: Input Parsers1061769
-Node: Output Wrappers1074490
-Node: Two-way processors1079002
-Node: Printing Messages1081267
-Ref: Printing Messages-Footnote-11082438
-Node: Updating ERRNO1082591
-Node: Requesting Values1083330
-Ref: table-value-types-returned1084067
-Node: Accessing Parameters1085004
-Node: Symbol Table Access1086241
-Node: Symbol table by name1086753
-Ref: Symbol table by name-Footnote-11089778
-Node: Symbol table by cookie1089906
-Ref: Symbol table by cookie-Footnote-11094091
-Node: Cached values1094155
-Ref: Cached values-Footnote-11097691
-Node: Array Manipulation1097844
-Ref: Array Manipulation-Footnote-11098935
-Node: Array Data Types1098972
-Ref: Array Data Types-Footnote-11101630
-Node: Array Functions1101722
-Node: Flattening Arrays1106220
-Node: Creating Arrays1113196
-Node: Redirection API1117963
-Node: Extension API Variables1120796
-Node: Extension Versioning1121507
-Ref: gawk-api-version1121936
-Node: Extension GMP/MPFR Versioning1123668
-Node: Extension API Informational Variables1125296
-Node: Extension API Boilerplate1126369
-Node: Changes from API V11130343
-Node: Finding Extensions1131915
-Node: Extension Example1132474
-Node: Internal File Description1133272
-Node: Internal File Ops1137352
-Ref: Internal File Ops-Footnote-11148702
-Node: Using Internal File Ops1148842
-Ref: Using Internal File Ops-Footnote-11151225
-Node: Extension Samples1151499
-Node: Extension Sample File Functions1153028
-Node: Extension Sample Fnmatch1160677
-Node: Extension Sample Fork1162164
-Node: Extension Sample Inplace1163382
-Node: Extension Sample Ord1167008
-Node: Extension Sample Readdir1167844
-Ref: table-readdir-file-types1168733
-Node: Extension Sample Revout1169801
-Node: Extension Sample Rev2way1170390
-Node: Extension Sample Read write array1171130
-Node: Extension Sample Readfile1173072
-Node: Extension Sample Time1174167
-Node: Extension Sample API Tests1175919
-Node: gawkextlib1176411
-Node: Extension summary1179329
-Node: Extension Exercises1183031
-Node: Language History1184273
-Node: V7/SVR3.11185929
-Node: SVR41188081
-Node: POSIX1189515
-Node: BTL1190896
-Node: POSIX/GNU1191625
-Node: Feature History1197403
-Node: Common Extensions1214578
-Node: Ranges and Locales1215861
-Ref: Ranges and Locales-Footnote-11220477
-Ref: Ranges and Locales-Footnote-21220504
-Ref: Ranges and Locales-Footnote-31220739
-Node: Contributors1220962
-Node: History summary1226959
-Node: Installation1228339
-Node: Gawk Distribution1229283
-Node: Getting1229767
-Node: Extracting1230730
-Node: Distribution contents1232368
-Node: Unix Installation1239429
-Node: Quick Installation1240233
-Node: Compiling with MPFR1242653
-Node: Shell Startup Files1243343
-Node: Additional Configuration Options1244432
-Node: Configuration Philosophy1246747
-Node: Compiling from Git1249143
-Node: Building the Documentation1249698
-Node: Non-Unix Installation1251082
-Node: PC Installation1251542
-Node: PC Binary Installation1252380
-Node: PC Compiling1253253
-Node: PC Using1254370
-Node: Cygwin1257923
-Node: MSYS1259147
-Node: VMS Installation1259749
-Node: VMS Compilation1260468
-Ref: VMS Compilation-Footnote-11261697
-Node: VMS Dynamic Extensions1261755
-Node: VMS Installation Details1263440
-Node: VMS Running1265702
-Node: VMS GNV1269981
-Node: Bugs1270695
-Node: Bug definition1271607
-Node: Bug address1274543
-Node: Usenet1277931
-Node: Performance bugs1279120
-Node: Asking for help1282041
-Node: Maintainers1284008
-Node: Other Versions1285202
-Node: Installation summary1293366
-Node: Notes1294730
-Node: Compatibility Mode1295524
-Node: Additions1296306
-Node: Accessing The Source1297231
-Node: Adding Code1298668
-Node: New Ports1304860
-Node: Derived Files1309235
-Ref: Derived Files-Footnote-11314895
-Ref: Derived Files-Footnote-21314930
-Ref: Derived Files-Footnote-31315528
-Node: Future Extensions1315642
-Node: Implementation Limitations1316300
-Node: Extension Design1317510
-Node: Old Extension Problems1318654
-Ref: Old Extension Problems-Footnote-11320172
-Node: Extension New Mechanism Goals1320229
-Ref: Extension New Mechanism Goals-Footnote-11323593
-Node: Extension Other Design Decisions1323782
-Node: Extension Future Growth1325895
-Node: Notes summary1326501
-Node: Basic Concepts1327659
-Node: Basic High Level1328340
-Ref: figure-general-flow1328622
-Ref: figure-process-flow1329308
-Ref: Basic High Level-Footnote-11332610
-Node: Basic Data Typing1332795
-Node: Glossary1336123
-Node: Copying1368008
-Node: GNU Free Documentation License1405551
-Node: Index1430671
+Ref: Indirect Calls-Footnote-1650734
+Node: Functions Summary650862
+Node: Library Functions653567
+Ref: Library Functions-Footnote-1657174
+Ref: Library Functions-Footnote-2657317
+Node: Library Names657488
+Ref: Library Names-Footnote-1661155
+Ref: Library Names-Footnote-2661378
+Node: General Functions661464
+Node: Strtonum Function662646
+Node: Assert Function665668
+Node: Round Function668994
+Node: Cliff Random Function670534
+Node: Ordinal Functions671550
+Ref: Ordinal Functions-Footnote-1674613
+Ref: Ordinal Functions-Footnote-2674865
+Node: Join Function675075
+Ref: Join Function-Footnote-1676845
+Node: Getlocaltime Function677045
+Node: Readfile Function680787
+Node: Shell Quoting682764
+Node: Isnumeric Function684192
+Node: Data File Management685580
+Node: Filetrans Function686212
+Node: Rewind Function690308
+Node: File Checking692217
+Ref: File Checking-Footnote-1693551
+Node: Empty Files693752
+Node: Ignoring Assigns695731
+Node: Getopt Function697281
+Ref: Getopt Function-Footnote-1712578
+Node: Passwd Functions712778
+Ref: Passwd Functions-Footnote-1721617
+Node: Group Functions721705
+Ref: Group Functions-Footnote-1729603
+Node: Walking Arrays729810
+Node: Library Functions Summary732818
+Node: Library Exercises734224
+Node: Sample Programs734689
+Node: Running Examples735459
+Node: Clones736187
+Node: Cut Program737411
+Node: Egrep Program747551
+Node: Id Program756552
+Node: Split Program766487
+Ref: Split Program-Footnote-1776380
+Node: Tee Program776553
+Node: Uniq Program779343
+Node: Wc Program786931
+Node: Bytes vs. Characters787318
+Node: Using extensions788866
+Node: wc program789620
+Node: Miscellaneous Programs794485
+Node: Dupword Program795698
+Node: Alarm Program797728
+Node: Translate Program802583
+Ref: Translate Program-Footnote-1807148
+Node: Labels Program807418
+Ref: Labels Program-Footnote-1810769
+Node: Word Sorting810853
+Node: History Sorting814925
+Node: Extract Program817150
+Node: Simple Sed825163
+Node: Igawk Program828237
+Ref: Igawk Program-Footnote-1842568
+Ref: Igawk Program-Footnote-2842770
+Ref: Igawk Program-Footnote-3842892
+Node: Anagram Program843007
+Node: Signature Program846069
+Node: Programs Summary847316
+Node: Programs Exercises848530
+Ref: Programs Exercises-Footnote-1852660
+Node: Advanced Features852746
+Node: Nondecimal Data854813
+Node: Array Sorting856404
+Node: Controlling Array Traversal857104
+Ref: Controlling Array Traversal-Footnote-1865472
+Node: Array Sorting Functions865590
+Ref: Array Sorting Functions-Footnote-1870964
+Node: Two-way I/O871160
+Ref: Two-way I/O-Footnote-1878886
+Ref: Two-way I/O-Footnote-2879073
+Node: TCP/IP Networking879155
+Node: Profiling882231
+Node: Extension Philosophy891540
+Node: Advanced Features Summary893019
+Node: Internationalization895034
+Node: I18N and L10N896708
+Node: Explaining gettext897395
+Ref: Explaining gettext-Footnote-1903287
+Ref: Explaining gettext-Footnote-2903472
+Node: Programmer i18n903637
+Ref: Programmer i18n-Footnote-1908586
+Node: Translator i18n908635
+Node: String Extraction909429
+Ref: String Extraction-Footnote-1910561
+Node: Printf Ordering910647
+Ref: Printf Ordering-Footnote-1913433
+Node: I18N Portability913497
+Ref: I18N Portability-Footnote-1915953
+Node: I18N Example916016
+Ref: I18N Example-Footnote-1919291
+Ref: I18N Example-Footnote-2919364
+Node: Gawk I18N919473
+Node: I18N Summary920095
+Node: Debugger921436
+Node: Debugging922436
+Node: Debugging Concepts922877
+Node: Debugging Terms924686
+Node: Awk Debugging927261
+Ref: Awk Debugging-Footnote-1928206
+Node: Sample Debugging Session928338
+Node: Debugger Invocation928872
+Node: Finding The Bug930258
+Node: List of Debugger Commands936732
+Node: Breakpoint Control938065
+Node: Debugger Execution Control941759
+Node: Viewing And Changing Data945121
+Node: Execution Stack948662
+Node: Debugger Info950299
+Node: Miscellaneous Debugger Commands954370
+Node: Readline Support959432
+Node: Limitations960328
+Node: Debugging Summary962882
+Node: Namespaces964161
+Node: Global Namespace965272
+Node: Qualified Names966670
+Node: Default Namespace967669
+Node: Changing The Namespace968410
+Node: Naming Rules970024
+Node: Internal Name Management971872
+Node: Namespace Example972914
+Node: Namespace And Features975476
+Node: Namespace Summary976911
+Node: Arbitrary Precision Arithmetic978388
+Node: Computer Arithmetic979875
+Ref: table-numeric-ranges983641
+Ref: table-floating-point-ranges984135
+Ref: Computer Arithmetic-Footnote-1984794
+Node: Math Definitions984851
+Ref: table-ieee-formats988167
+Ref: Math Definitions-Footnote-1988771
+Node: MPFR features988876
+Node: FP Math Caution990594
+Ref: FP Math Caution-Footnote-1991666
+Node: Inexactness of computations992035
+Node: Inexact representation992995
+Node: Comparing FP Values994355
+Node: Errors accumulate995596
+Node: Getting Accuracy997029
+Node: Try To Round999739
+Node: Setting precision1000638
+Ref: table-predefined-precision-strings1001335
+Node: Setting the rounding mode1003166
+Ref: table-gawk-rounding-modes1003540
+Ref: Setting the rounding mode-Footnote-11007472
+Node: Arbitrary Precision Integers1007651
+Ref: Arbitrary Precision Integers-Footnote-11010826
+Node: Checking for MPFR1010975
+Node: POSIX Floating Point Problems1012449
+Ref: POSIX Floating Point Problems-Footnote-11016734
+Node: Floating point summary1016772
+Node: Dynamic Extensions1018962
+Node: Extension Intro1020515
+Node: Plugin License1021781
+Node: Extension Mechanism Outline1022578
+Ref: figure-load-extension1023017
+Ref: figure-register-new-function1024583
+Ref: figure-call-new-function1025676
+Node: Extension API Description1027739
+Node: Extension API Functions Introduction1029452
+Ref: table-api-std-headers1031288
+Node: General Data Types1035538
+Ref: General Data Types-Footnote-11044168
+Node: Memory Allocation Functions1044467
+Ref: Memory Allocation Functions-Footnote-11048968
+Node: Constructor Functions1049067
+Node: API Ownership of MPFR and GMP Values1052533
+Node: Registration Functions1053846
+Node: Extension Functions1054546
+Node: Exit Callback Functions1059868
+Node: Extension Version String1061118
+Node: Input Parsers1061781
+Node: Output Wrappers1074502
+Node: Two-way processors1079014
+Node: Printing Messages1081279
+Ref: Printing Messages-Footnote-11082450
+Node: Updating ERRNO1082603
+Node: Requesting Values1083342
+Ref: table-value-types-returned1084079
+Node: Accessing Parameters1085016
+Node: Symbol Table Access1086253
+Node: Symbol table by name1086765
+Ref: Symbol table by name-Footnote-11089790
+Node: Symbol table by cookie1089918
+Ref: Symbol table by cookie-Footnote-11094103
+Node: Cached values1094167
+Ref: Cached values-Footnote-11097703
+Node: Array Manipulation1097856
+Ref: Array Manipulation-Footnote-11098947
+Node: Array Data Types1098984
+Ref: Array Data Types-Footnote-11101642
+Node: Array Functions1101734
+Node: Flattening Arrays1106232
+Node: Creating Arrays1113208
+Node: Redirection API1117975
+Node: Extension API Variables1120808
+Node: Extension Versioning1121519
+Ref: gawk-api-version1121948
+Node: Extension GMP/MPFR Versioning1123680
+Node: Extension API Informational Variables1125308
+Node: Extension API Boilerplate1126381
+Node: Changes from API V11130355
+Node: Finding Extensions1131927
+Node: Extension Example1132486
+Node: Internal File Description1133284
+Node: Internal File Ops1137364
+Ref: Internal File Ops-Footnote-11148714
+Node: Using Internal File Ops1148854
+Ref: Using Internal File Ops-Footnote-11151237
+Node: Extension Samples1151511
+Node: Extension Sample File Functions1153040
+Node: Extension Sample Fnmatch1160689
+Node: Extension Sample Fork1162176
+Node: Extension Sample Inplace1163394
+Node: Extension Sample Ord1167020
+Node: Extension Sample Readdir1167856
+Ref: table-readdir-file-types1168745
+Node: Extension Sample Revout1169813
+Node: Extension Sample Rev2way1170402
+Node: Extension Sample Read write array1171142
+Node: Extension Sample Readfile1173084
+Node: Extension Sample Time1174179
+Node: Extension Sample API Tests1175931
+Node: gawkextlib1176423
+Node: Extension summary1179341
+Node: Extension Exercises1183043
+Node: Language History1184285
+Node: V7/SVR3.11185941
+Node: SVR41188093
+Node: POSIX1189527
+Node: BTL1190908
+Node: POSIX/GNU1191637
+Node: Feature History1197415
+Node: Common Extensions1214590
+Node: Ranges and Locales1215873
+Ref: Ranges and Locales-Footnote-11220489
+Ref: Ranges and Locales-Footnote-21220516
+Ref: Ranges and Locales-Footnote-31220751
+Node: Contributors1220974
+Node: History summary1226971
+Node: Installation1228351
+Node: Gawk Distribution1229295
+Node: Getting1229779
+Node: Extracting1230742
+Node: Distribution contents1232380
+Node: Unix Installation1239441
+Node: Quick Installation1240245
+Node: Compiling with MPFR1242665
+Node: Shell Startup Files1243355
+Node: Additional Configuration Options1244444
+Node: Configuration Philosophy1246759
+Node: Compiling from Git1249155
+Node: Building the Documentation1249710
+Node: Non-Unix Installation1251094
+Node: PC Installation1251554
+Node: PC Binary Installation1252392
+Node: PC Compiling1253265
+Node: PC Using1254382
+Node: Cygwin1257935
+Node: MSYS1259159
+Node: VMS Installation1259761
+Node: VMS Compilation1260480
+Ref: VMS Compilation-Footnote-11261709
+Node: VMS Dynamic Extensions1261767
+Node: VMS Installation Details1263452
+Node: VMS Running1265714
+Node: VMS GNV1269993
+Node: Bugs1270707
+Node: Bug definition1271619
+Node: Bug address1274555
+Node: Usenet1277943
+Node: Performance bugs1279132
+Node: Asking for help1282053
+Node: Maintainers1284020
+Node: Other Versions1285214
+Node: Installation summary1293378
+Node: Notes1294742
+Node: Compatibility Mode1295536
+Node: Additions1296318
+Node: Accessing The Source1297243
+Node: Adding Code1298680
+Node: New Ports1304872
+Node: Derived Files1309247
+Ref: Derived Files-Footnote-11314907
+Ref: Derived Files-Footnote-21314942
+Ref: Derived Files-Footnote-31315540
+Node: Future Extensions1315654
+Node: Implementation Limitations1316312
+Node: Extension Design1317522
+Node: Old Extension Problems1318666
+Ref: Old Extension Problems-Footnote-11320184
+Node: Extension New Mechanism Goals1320241
+Ref: Extension New Mechanism Goals-Footnote-11323605
+Node: Extension Other Design Decisions1323794
+Node: Extension Future Growth1325907
+Node: Notes summary1326513
+Node: Basic Concepts1327671
+Node: Basic High Level1328352
+Ref: figure-general-flow1328634
+Ref: figure-process-flow1329320
+Ref: Basic High Level-Footnote-11332622
+Node: Basic Data Typing1332807
+Node: Glossary1336135
+Node: Copying1368020
+Node: GNU Free Documentation License1405563
+Node: Index1430683
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index e956314f..6466698f 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -21954,8 +21954,8 @@ a closing parenthesis, with the addition of a leading
@samp{@@}
character:
@example
-the_func = "sum"
-result = @@the_func() # calls the sum() function
+the_function = "sum"
+result = @@the_function() # calls the sum() function
@end example
Here is a full program that processes the previously shown data,
@@ -22267,7 +22267,7 @@ For example, in the following case:
@example
for (i = 1; i <= n; i++)
- @@the_func()
+ @@the_function()
@end example
@noindent
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 63c853cc..283cb967 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -20866,8 +20866,8 @@ a closing parenthesis, with the addition of a leading
@samp{@@}
character:
@example
-the_func = "sum"
-result = @@the_func() # calls the sum() function
+the_function = "sum"
+result = @@the_function() # calls the sum() function
@end example
Here is a full program that processes the previously shown data,
@@ -21179,7 +21179,7 @@ For example, in the following case:
@example
for (i = 1; i <= n; i++)
- @@the_func()
+ @@the_function()
@end example
@noindent
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=8bd2904afb35a19d48552b10d3215ba16fe4ce35
commit 8bd2904afb35a19d48552b10d3215ba16fe4ce35
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Wed Jan 5 21:13:40 2022 +0200
Fix a namespace issue.
diff --git a/ChangeLog b/ChangeLog
index e2f179fe..6f89d610 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (change_namespace): New function. Extracted from
+ set_namespace.
+ (want_namespace): New variable.
+ [grammar]: Add explanatory comment about the change.
+ (yylex): Change the namespace immediately from the lexer.
+ (set_namespace): Adjust code.
+ * symbol.c (load_symbols): Strip off leading awk:: so that
+ PROCINFO["identifiers"] is like SYMTAB and FUNCTAB. This makes
+ the code match the documentation. Thanks to John Naman
+ <gawker@703n.com> for the bug report.
+
2021-12-17 Yuri Gribov <tetra2005@gmail.com>
Make a number of functions and variables static.
diff --git a/awkgram.c b/awkgram.c
index 30c207e1..6ad01d6c 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -102,6 +102,7 @@ static void dumpintlstr2(const char *str1, size_t len1,
const char *str2, size_t
static bool include_source(INSTRUCTION *file, void **srcfile_p);
static bool load_library(INSTRUCTION *file, void **srcfile_p);
static void set_namespace(INSTRUCTION *ns, INSTRUCTION *comment);
+static void change_namespace(const char *new_namespace);
static void next_sourcefile(void);
static char *tokexpand(void);
static NODE *set_profile_text(NODE *n, const char *str, size_t len);
@@ -157,6 +158,7 @@ static void add_sign_to_num(NODE *n, char sign);
static bool at_seen = false;
static bool want_source = false;
+static bool want_namespace = false;
static bool want_regexp = false; /* lexical scanning kludge */
static enum {
FUNC_HEADER,
@@ -233,7 +235,7 @@ extern double fmod(double x, double y);
#define YYSTYPE INSTRUCTION *
-#line 237 "awkgram.c"
+#line 239 "awkgram.c"
# ifndef YY_CAST
# ifdef __cplusplus
@@ -954,27 +956,27 @@ static const yytype_int8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
- 0, 233, 233, 234, 239, 249, 253, 265, 273, 287,
- 298, 308, 318, 331, 341, 343, 348, 358, 360, 365,
- 367, 369, 375, 379, 384, 414, 426, 438, 444, 453,
- 471, 472, 483, 489, 497, 498, 502, 502, 536, 535,
- 569, 584, 586, 591, 592, 612, 617, 618, 622, 633,
- 638, 645, 753, 804, 854, 980, 1002, 1023, 1033, 1043,
- 1053, 1064, 1077, 1095, 1094, 1111, 1129, 1129, 1231, 1231,
- 1264, 1294, 1302, 1303, 1309, 1310, 1317, 1322, 1335, 1350,
- 1352, 1360, 1367, 1369, 1377, 1386, 1388, 1397, 1398, 1406,
- 1411, 1411, 1424, 1431, 1444, 1448, 1470, 1471, 1477, 1478,
- 1487, 1488, 1493, 1498, 1515, 1517, 1519, 1526, 1527, 1533,
- 1534, 1539, 1541, 1548, 1550, 1558, 1563, 1574, 1575, 1580,
- 1582, 1589, 1591, 1599, 1604, 1614, 1615, 1620, 1621, 1626,
- 1633, 1637, 1639, 1641, 1654, 1671, 1681, 1688, 1690, 1695,
- 1697, 1699, 1707, 1709, 1714, 1716, 1721, 1723, 1725, 1782,
- 1784, 1786, 1788, 1790, 1792, 1794, 1796, 1810, 1815, 1820,
- 1846, 1852, 1854, 1856, 1858, 1860, 1862, 1867, 1871, 1903,
- 1911, 1917, 1923, 1936, 1937, 1938, 1943, 1948, 1952, 1956,
- 1971, 1992, 1997, 2034, 2071, 2072, 2078, 2079, 2084, 2086,
- 2093, 2110, 2127, 2129, 2136, 2141, 2147, 2158, 2170, 2179,
- 2183, 2188, 2192, 2196, 2200, 2205, 2206, 2210, 2214, 2218
+ 0, 235, 235, 236, 241, 251, 255, 267, 275, 289,
+ 300, 310, 320, 346, 356, 358, 363, 373, 375, 380,
+ 382, 384, 390, 394, 399, 429, 441, 453, 459, 468,
+ 486, 487, 498, 504, 512, 513, 517, 517, 551, 550,
+ 584, 599, 601, 606, 607, 627, 632, 633, 637, 648,
+ 653, 660, 768, 819, 869, 995, 1017, 1038, 1048, 1058,
+ 1068, 1079, 1092, 1110, 1109, 1126, 1144, 1144, 1246, 1246,
+ 1279, 1309, 1317, 1318, 1324, 1325, 1332, 1337, 1350, 1365,
+ 1367, 1375, 1382, 1384, 1392, 1401, 1403, 1412, 1413, 1421,
+ 1426, 1426, 1439, 1446, 1459, 1463, 1485, 1486, 1492, 1493,
+ 1502, 1503, 1508, 1513, 1530, 1532, 1534, 1541, 1542, 1548,
+ 1549, 1554, 1556, 1563, 1565, 1573, 1578, 1589, 1590, 1595,
+ 1597, 1604, 1606, 1614, 1619, 1629, 1630, 1635, 1636, 1641,
+ 1648, 1652, 1654, 1656, 1669, 1686, 1696, 1703, 1705, 1710,
+ 1712, 1714, 1722, 1724, 1729, 1731, 1736, 1738, 1740, 1797,
+ 1799, 1801, 1803, 1805, 1807, 1809, 1811, 1825, 1830, 1835,
+ 1861, 1867, 1869, 1871, 1873, 1875, 1877, 1882, 1886, 1918,
+ 1926, 1932, 1938, 1951, 1952, 1953, 1958, 1963, 1967, 1971,
+ 1986, 2007, 2012, 2049, 2086, 2087, 2093, 2094, 2099, 2101,
+ 2108, 2125, 2142, 2144, 2151, 2156, 2162, 2173, 2185, 2194,
+ 2198, 2203, 2207, 2211, 2215, 2220, 2221, 2225, 2229, 2233
};
#endif
@@ -1956,22 +1958,22 @@ yyreduce:
switch (yyn)
{
case 2: /* program: %empty */
-#line 233 "awkgram.y"
+#line 235 "awkgram.y"
{ yyval = NULL; }
-#line 1962 "awkgram.c"
+#line 1964 "awkgram.c"
break;
case 3: /* program: program rule */
-#line 235 "awkgram.y"
+#line 237 "awkgram.y"
{
rule = 0;
yyerrok;
}
-#line 1971 "awkgram.c"
+#line 1973 "awkgram.c"
break;
case 4: /* program: program nls */
-#line 240 "awkgram.y"
+#line 242 "awkgram.y"
{
if (yyvsp[0] != NULL) {
if (yyvsp[-1] == NULL)
@@ -1981,19 +1983,19 @@ yyreduce:
}
yyval = yyvsp[-1];
}
-#line 1985 "awkgram.c"
+#line 1987 "awkgram.c"
break;
case 5: /* program: program LEX_EOF */
-#line 250 "awkgram.y"
+#line 252 "awkgram.y"
{
next_sourcefile();
}
-#line 1993 "awkgram.c"
+#line 1995 "awkgram.c"
break;
case 6: /* program: program error */
-#line 254 "awkgram.y"
+#line 256 "awkgram.y"
{
rule = 0;
/*
@@ -2002,11 +2004,11 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 2006 "awkgram.c"
+#line 2008 "awkgram.c"
break;
case 7: /* rule: pattern action */
-#line 266 "awkgram.y"
+#line 268 "awkgram.y"
{
(void) append_rule(yyvsp[-1], yyvsp[0]);
if (pending_comment != NULL) {
@@ -2014,11 +2016,11 @@ yyreduce:
pending_comment = NULL;
}
}
-#line 2018 "awkgram.c"
+#line 2020 "awkgram.c"
break;
case 8: /* rule: pattern statement_term */
-#line 274 "awkgram.y"
+#line 276 "awkgram.y"
{
if (rule != Rule) {
msg(_("%s blocks must have an action part"),
ruletab[rule]);
@@ -2032,11 +2034,11 @@ yyreduce:
(void) append_rule(yyvsp[-1], NULL);
}
}
-#line 2036 "awkgram.c"
+#line 2038 "awkgram.c"
break;
case 9: /* rule: function_prologue action */
-#line 288 "awkgram.y"
+#line 290 "awkgram.y"
{
in_function = false;
(void) mk_function(yyvsp[-1], yyvsp[0]);
@@ -2047,11 +2049,11 @@ yyreduce:
}
yyerrok;
}
-#line 2051 "awkgram.c"
+#line 2053 "awkgram.c"
break;
case 10: /* rule: '@' LEX_INCLUDE source statement_term */
-#line 299 "awkgram.y"
+#line 301 "awkgram.y"
{
want_source = false;
at_seen = false;
@@ -2061,11 +2063,11 @@ yyreduce:
}
yyerrok;
}
-#line 2065 "awkgram.c"
+#line 2067 "awkgram.c"
break;
case 11: /* rule: '@' LEX_LOAD library statement_term */
-#line 309 "awkgram.y"
+#line 311 "awkgram.y"
{
want_source = false;
at_seen = false;
@@ -2075,13 +2077,26 @@ yyreduce:
}
yyerrok;
}
-#line 2079 "awkgram.c"
+#line 2081 "awkgram.c"
break;
case 12: /* rule: '@' LEX_NAMESPACE namespace statement_term */
-#line 319 "awkgram.y"
+#line 321 "awkgram.y"
{
+ /*
+ * 1/2022:
+ * We have an interesting isssue here. This production isn't
+ * reduced until after the token following the statement_term
+ * is seen. As a result, the change in namespace doesn't take
+ * effect until then. That's fine if the first token is
'function'
+ * or BEGIN or some such, but it's a disaster if it's an
identifer;
+ * that identifier will be in the previous namespace.
+ * Therefore, the actual setting of the namespace is done
immediately
+ * down in the scanner.
+ */
+
want_source = false;
+ want_namespace = false;
at_seen = false;
// this frees $3 storage in all cases
@@ -2089,11 +2104,11 @@ yyreduce:
yyerrok;
}
-#line 2093 "awkgram.c"
+#line 2108 "awkgram.c"
break;
case 13: /* source: FILENAME */
-#line 332 "awkgram.y"
+#line 347 "awkgram.y"
{
void *srcfile = NULL;
@@ -2103,23 +2118,23 @@ yyreduce:
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
-#line 2107 "awkgram.c"
+#line 2122 "awkgram.c"
break;
case 14: /* source: FILENAME error */
-#line 342 "awkgram.y"
+#line 357 "awkgram.y"
{ yyval = NULL; }
-#line 2113 "awkgram.c"
+#line 2128 "awkgram.c"
break;
case 15: /* source: error */
-#line 344 "awkgram.y"
+#line 359 "awkgram.y"
{ yyval = NULL; }
-#line 2119 "awkgram.c"
+#line 2134 "awkgram.c"
break;
case 16: /* library: FILENAME */
-#line 349 "awkgram.y"
+#line 364 "awkgram.y"
{
void *srcfile;
@@ -2129,58 +2144,58 @@ yyreduce:
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
-#line 2133 "awkgram.c"
+#line 2148 "awkgram.c"
break;
case 17: /* library: FILENAME error */
-#line 359 "awkgram.y"
+#line 374 "awkgram.y"
{ yyval = NULL; }
-#line 2139 "awkgram.c"
+#line 2154 "awkgram.c"
break;
case 18: /* library: error */
-#line 361 "awkgram.y"
+#line 376 "awkgram.y"
{ yyval = NULL; }
-#line 2145 "awkgram.c"
+#line 2160 "awkgram.c"
break;
case 19: /* namespace: FILENAME */
-#line 366 "awkgram.y"
+#line 381 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 2151 "awkgram.c"
+#line 2166 "awkgram.c"
break;
case 20: /* namespace: FILENAME error */
-#line 368 "awkgram.y"
+#line 383 "awkgram.y"
{ yyval = NULL; }
-#line 2157 "awkgram.c"
+#line 2172 "awkgram.c"
break;
case 21: /* namespace: error */
-#line 370 "awkgram.y"
+#line 385 "awkgram.y"
{ yyval = NULL; }
-#line 2163 "awkgram.c"
+#line 2178 "awkgram.c"
break;
case 22: /* pattern: %empty */
-#line 375 "awkgram.y"
+#line 390 "awkgram.y"
{
rule = Rule;
yyval = NULL;
}
-#line 2172 "awkgram.c"
+#line 2187 "awkgram.c"
break;
case 23: /* pattern: exp */
-#line 380 "awkgram.y"
+#line 395 "awkgram.y"
{
rule = Rule;
}
-#line 2180 "awkgram.c"
+#line 2195 "awkgram.c"
break;
case 24: /* pattern: exp comma exp */
-#line 385 "awkgram.y"
+#line 400 "awkgram.y"
{
INSTRUCTION *tp;
@@ -2210,11 +2225,11 @@ yyreduce:
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]),
tp);
rule = Rule;
}
-#line 2214 "awkgram.c"
+#line 2229 "awkgram.c"
break;
case 25: /* pattern: LEX_BEGIN */
-#line 415 "awkgram.y"
+#line 430 "awkgram.y"
{
static int begin_seen = 0;
@@ -2226,11 +2241,11 @@ yyreduce:
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2230 "awkgram.c"
+#line 2245 "awkgram.c"
break;
case 26: /* pattern: LEX_END */
-#line 427 "awkgram.y"
+#line 442 "awkgram.y"
{
static int end_seen = 0;
@@ -2242,31 +2257,31 @@ yyreduce:
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2246 "awkgram.c"
+#line 2261 "awkgram.c"
break;
case 27: /* pattern: LEX_BEGINFILE */
-#line 439 "awkgram.y"
+#line 454 "awkgram.y"
{
yyvsp[0]->in_rule = rule = BEGINFILE;
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2256 "awkgram.c"
+#line 2271 "awkgram.c"
break;
case 28: /* pattern: LEX_ENDFILE */
-#line 445 "awkgram.y"
+#line 460 "awkgram.y"
{
yyvsp[0]->in_rule = rule = ENDFILE;
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2266 "awkgram.c"
+#line 2281 "awkgram.c"
break;
case 29: /* action: l_brace statements r_brace opt_semi opt_nls */
-#line 454 "awkgram.y"
+#line 469 "awkgram.y"
{
INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3],
yyvsp[-2]);
@@ -2281,11 +2296,11 @@ yyreduce:
yyval = ip;
}
-#line 2285 "awkgram.c"
+#line 2300 "awkgram.c"
break;
case 31: /* func_name: FUNC_CALL */
-#line 473 "awkgram.y"
+#line 488 "awkgram.y"
{
const char *name = yyvsp[0]->lextok;
char *qname = qualify_name(name, strlen(name));
@@ -2296,36 +2311,36 @@ yyreduce:
}
yyval = yyvsp[0];
}
-#line 2300 "awkgram.c"
+#line 2315 "awkgram.c"
break;
case 32: /* func_name: lex_builtin */
-#line 484 "awkgram.y"
+#line 499 "awkgram.y"
{
yyerror(_("`%s' is a built-in function, it cannot be
redefined"),
tokstart);
YYABORT;
}
-#line 2310 "awkgram.c"
+#line 2325 "awkgram.c"
break;
case 33: /* func_name: '@' LEX_EVAL */
-#line 490 "awkgram.y"
+#line 505 "awkgram.y"
{
yyval = yyvsp[0];
at_seen = false;
}
-#line 2319 "awkgram.c"
+#line 2334 "awkgram.c"
break;
case 36: /* $@1: %empty */
-#line 502 "awkgram.y"
+#line 517 "awkgram.y"
{ want_param_names = FUNC_HEADER; }
-#line 2325 "awkgram.c"
+#line 2340 "awkgram.c"
break;
case 37: /* function_prologue: LEX_FUNCTION func_name '(' $@1 opt_param_list
r_paren opt_nls */
-#line 503 "awkgram.y"
+#line 518 "awkgram.y"
{
INSTRUCTION *func_comment = NULL;
// Merge any comments found in the parameter list with those
@@ -2351,17 +2366,17 @@ yyreduce:
yyval = yyvsp[-6];
want_param_names = FUNC_BODY;
}
-#line 2355 "awkgram.c"
+#line 2370 "awkgram.c"
break;
case 38: /* $@2: %empty */
-#line 536 "awkgram.y"
+#line 551 "awkgram.y"
{ want_regexp = true; }
-#line 2361 "awkgram.c"
+#line 2376 "awkgram.c"
break;
case 39: /* regexp: a_slash $@2 REGEXP */
-#line 538 "awkgram.y"
+#line 553 "awkgram.y"
{
NODE *n, *exp;
char *re;
@@ -2390,11 +2405,11 @@ yyreduce:
yyval->opcode = Op_match_rec;
yyval->memory = n;
}
-#line 2394 "awkgram.c"
+#line 2409 "awkgram.c"
break;
case 40: /* typed_regexp: TYPED_REGEXP */
-#line 570 "awkgram.y"
+#line 585 "awkgram.y"
{
char *re;
size_t len;
@@ -2407,23 +2422,23 @@ yyreduce:
yyval->opcode = Op_push_re;
yyval->memory = make_typed_regex(re, len);
}
-#line 2411 "awkgram.c"
+#line 2426 "awkgram.c"
break;
case 41: /* a_slash: '/' */
-#line 585 "awkgram.y"
+#line 600 "awkgram.y"
{ bcfree(yyvsp[0]); }
-#line 2417 "awkgram.c"
+#line 2432 "awkgram.c"
break;
case 43: /* statements: %empty */
-#line 591 "awkgram.y"
+#line 606 "awkgram.y"
{ yyval = NULL; }
-#line 2423 "awkgram.c"
+#line 2438 "awkgram.c"
break;
case 44: /* statements: statements statement */
-#line 593 "awkgram.y"
+#line 608 "awkgram.y"
{
if (yyvsp[0] == NULL) {
yyval = yyvsp[-1];
@@ -2443,29 +2458,29 @@ yyreduce:
yyerrok;
}
-#line 2447 "awkgram.c"
+#line 2462 "awkgram.c"
break;
case 45: /* statements: statements error */
-#line 613 "awkgram.y"
+#line 628 "awkgram.y"
{ yyval = NULL; }
-#line 2453 "awkgram.c"
+#line 2468 "awkgram.c"
break;
case 46: /* statement_term: nls */
-#line 617 "awkgram.y"
+#line 632 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 2459 "awkgram.c"
+#line 2474 "awkgram.c"
break;
case 47: /* statement_term: semi opt_nls */
-#line 618 "awkgram.y"
+#line 633 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 2465 "awkgram.c"
+#line 2480 "awkgram.c"
break;
case 48: /* statement: semi opt_nls */
-#line 623 "awkgram.y"
+#line 638 "awkgram.y"
{
if (yyvsp[0] != NULL) {
INSTRUCTION *ip;
@@ -2476,31 +2491,31 @@ yyreduce:
} else
yyval = NULL;
}
-#line 2480 "awkgram.c"
+#line 2495 "awkgram.c"
break;
case 49: /* statement: l_brace statements r_brace */
-#line 634 "awkgram.y"
+#line 649 "awkgram.y"
{
trailing_comment = yyvsp[0]; // NULL or comment
yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]);
}
-#line 2489 "awkgram.c"
+#line 2504 "awkgram.c"
break;
case 50: /* statement: if_statement */
-#line 639 "awkgram.y"
+#line 654 "awkgram.y"
{
if (do_pretty_print)
yyval = list_prepend(yyvsp[0],
instruction(Op_exec_count));
else
yyval = yyvsp[0];
}
-#line 2500 "awkgram.c"
+#line 2515 "awkgram.c"
break;
case 51: /* statement: LEX_SWITCH '(' exp r_paren opt_nls l_brace
case_statements opt_nls r_brace */
-#line 646 "awkgram.y"
+#line 661 "awkgram.y"
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2608,11 +2623,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2612 "awkgram.c"
+#line 2627 "awkgram.c"
break;
case 52: /* statement: LEX_WHILE '(' exp r_paren opt_nls statement */
-#line 754 "awkgram.y"
+#line 769 "awkgram.y"
{
/*
* -----------------
@@ -2663,11 +2678,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2667 "awkgram.c"
+#line 2682 "awkgram.c"
break;
case 53: /* statement: LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren
opt_nls */
-#line 805 "awkgram.y"
+#line 820 "awkgram.y"
{
/*
* -----------------
@@ -2717,11 +2732,11 @@ yyreduce:
/* else
$1 and $4 are NULLs */
}
-#line 2721 "awkgram.c"
+#line 2736 "awkgram.c"
break;
case 54: /* statement: LEX_FOR '(' NAME LEX_IN simple_variable r_paren
opt_nls statement */
-#line 855 "awkgram.y"
+#line 870 "awkgram.y"
{
INSTRUCTION *ip;
char *var_name = yyvsp[-5]->lextok;
@@ -2847,11 +2862,11 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2851 "awkgram.c"
+#line 2866 "awkgram.c"
break;
case 55: /* statement: LEX_FOR '(' opt_simple_stmt semi opt_nls exp semi
opt_nls opt_simple_stmt r_paren opt_nls statement */
-#line 981 "awkgram.y"
+#line 996 "awkgram.y"
{
if (yyvsp[-7] != NULL) {
merge_comments(yyvsp[-7], NULL);
@@ -2873,11 +2888,11 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2877 "awkgram.c"
+#line 2892 "awkgram.c"
break;
case 56: /* statement: LEX_FOR '(' opt_simple_stmt semi opt_nls semi opt_nls
opt_simple_stmt r_paren opt_nls statement */
-#line 1003 "awkgram.y"
+#line 1018 "awkgram.y"
{
if (yyvsp[-6] != NULL) {
merge_comments(yyvsp[-6], NULL);
@@ -2898,22 +2913,22 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2902 "awkgram.c"
+#line 2917 "awkgram.c"
break;
case 57: /* statement: non_compound_stmt */
-#line 1024 "awkgram.y"
+#line 1039 "awkgram.y"
{
if (do_pretty_print)
yyval = list_prepend(yyvsp[0],
instruction(Op_exec_count));
else
yyval = yyvsp[0];
}
-#line 2913 "awkgram.c"
+#line 2928 "awkgram.c"
break;
case 58: /* non_compound_stmt: LEX_BREAK statement_term */
-#line 1034 "awkgram.y"
+#line 1049 "awkgram.y"
{
if (! break_allowed)
error_ln(yyvsp[-1]->source_line,
@@ -2923,11 +2938,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2927 "awkgram.c"
+#line 2942 "awkgram.c"
break;
case 59: /* non_compound_stmt: LEX_CONTINUE statement_term */
-#line 1044 "awkgram.y"
+#line 1059 "awkgram.y"
{
if (! continue_allowed)
error_ln(yyvsp[-1]->source_line,
@@ -2937,11 +2952,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2941 "awkgram.c"
+#line 2956 "awkgram.c"
break;
case 60: /* non_compound_stmt: LEX_NEXT statement_term */
-#line 1054 "awkgram.y"
+#line 1069 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2952,11 +2967,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2956 "awkgram.c"
+#line 2971 "awkgram.c"
break;
case 61: /* non_compound_stmt: LEX_NEXTFILE statement_term */
-#line 1065 "awkgram.y"
+#line 1080 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2969,11 +2984,11 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2973 "awkgram.c"
+#line 2988 "awkgram.c"
break;
case 62: /* non_compound_stmt: LEX_EXIT opt_exp statement_term */
-#line 1078 "awkgram.y"
+#line 1093 "awkgram.y"
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2990,20 +3005,20 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2994 "awkgram.c"
+#line 3009 "awkgram.c"
break;
case 63: /* $@3: %empty */
-#line 1095 "awkgram.y"
+#line 1110 "awkgram.y"
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 3003 "awkgram.c"
+#line 3018 "awkgram.c"
break;
case 64: /* non_compound_stmt: LEX_RETURN $@3 opt_fcall_exp statement_term
*/
-#line 1098 "awkgram.y"
+#line 1113 "awkgram.y"
{
if (called_from_eval)
yyvsp[-3]->opcode = Op_K_return_from_eval;
@@ -3017,28 +3032,28 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 3021 "awkgram.c"
+#line 3036 "awkgram.c"
break;
case 65: /* non_compound_stmt: simple_stmt statement_term */
-#line 1112 "awkgram.y"
+#line 1127 "awkgram.y"
{
if (yyvsp[0] != NULL)
yyval = list_append(yyvsp[-1], yyvsp[0]);
else
yyval = yyvsp[-1];
}
-#line 3032 "awkgram.c"
+#line 3047 "awkgram.c"
break;
case 66: /* $@4: %empty */
-#line 1129 "awkgram.y"
+#line 1144 "awkgram.y"
{ in_print = true; in_parens = 0; }
-#line 3038 "awkgram.c"
+#line 3053 "awkgram.c"
break;
case 67: /* simple_stmt: print $@4 print_expression_list output_redir */
-#line 1130 "awkgram.y"
+#line 1145 "awkgram.y"
{
/*
* Optimization: plain `print' has no expression list, so $3 is
null.
@@ -3139,17 +3154,17 @@ regular_print:
}
}
}
-#line 3143 "awkgram.c"
+#line 3158 "awkgram.c"
break;
case 68: /* $@5: %empty */
-#line 1231 "awkgram.y"
+#line 1246 "awkgram.y"
{ sub_counter = 0; }
-#line 3149 "awkgram.c"
+#line 3164 "awkgram.c"
break;
case 69: /* simple_stmt: LEX_DELETE NAME $@5 delete_subscript_list */
-#line 1232 "awkgram.y"
+#line 1247 "awkgram.y"
{
char *arr = yyvsp[-2]->lextok;
@@ -3182,11 +3197,11 @@ regular_print:
yyval = list_append(list_append(yyvsp[0], yyvsp[-2]),
yyvsp[-3]);
}
}
-#line 3186 "awkgram.c"
+#line 3201 "awkgram.c"
break;
case 70: /* simple_stmt: LEX_DELETE '(' NAME ')' */
-#line 1269 "awkgram.y"
+#line 1284 "awkgram.y"
{
static bool warned = false;
char *arr = yyvsp[-1]->lextok;
@@ -3212,54 +3227,54 @@ regular_print:
fatal(_("`delete' is not allowed with
FUNCTAB"));
}
}
-#line 3216 "awkgram.c"
+#line 3231 "awkgram.c"
break;
case 71: /* simple_stmt: exp */
-#line 1295 "awkgram.y"
+#line 1310 "awkgram.y"
{
yyval = optimize_assignment(yyvsp[0]);
}
-#line 3224 "awkgram.c"
+#line 3239 "awkgram.c"
break;
case 72: /* opt_simple_stmt: %empty */
-#line 1302 "awkgram.y"
+#line 1317 "awkgram.y"
{ yyval = NULL; }
-#line 3230 "awkgram.c"
+#line 3245 "awkgram.c"
break;
case 73: /* opt_simple_stmt: simple_stmt */
-#line 1304 "awkgram.y"
+#line 1319 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3236 "awkgram.c"
+#line 3251 "awkgram.c"
break;
case 74: /* case_statements: %empty */
-#line 1309 "awkgram.y"
+#line 1324 "awkgram.y"
{ yyval = NULL; }
-#line 3242 "awkgram.c"
+#line 3257 "awkgram.c"
break;
case 75: /* case_statements: case_statements case_statement */
-#line 1311 "awkgram.y"
+#line 1326 "awkgram.y"
{
if (yyvsp[-1] == NULL)
yyval = list_create(yyvsp[0]);
else
yyval = list_prepend(yyvsp[-1], yyvsp[0]);
}
-#line 3253 "awkgram.c"
+#line 3268 "awkgram.c"
break;
case 76: /* case_statements: case_statements error */
-#line 1318 "awkgram.y"
+#line 1333 "awkgram.y"
{ yyval = NULL; }
-#line 3259 "awkgram.c"
+#line 3274 "awkgram.c"
break;
case 77: /* case_statement: LEX_CASE case_value colon opt_nls statements */
-#line 1323 "awkgram.y"
+#line 1338 "awkgram.y"
{
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL)
@@ -3272,11 +3287,11 @@ regular_print:
bcfree(yyvsp[-2]);
yyval = yyvsp[-4];
}
-#line 3276 "awkgram.c"
+#line 3291 "awkgram.c"
break;
case 78: /* case_statement: LEX_DEFAULT colon opt_nls statements */
-#line 1336 "awkgram.y"
+#line 1351 "awkgram.y"
{
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL)
@@ -3288,17 +3303,17 @@ regular_print:
yyvsp[-3]->comment = yyvsp[-1];
yyval = yyvsp[-3];
}
-#line 3292 "awkgram.c"
+#line 3307 "awkgram.c"
break;
case 79: /* case_value: YNUMBER */
-#line 1351 "awkgram.y"
+#line 1366 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3298 "awkgram.c"
+#line 3313 "awkgram.c"
break;
case 80: /* case_value: '-' YNUMBER */
-#line 1353 "awkgram.y"
+#line 1368 "awkgram.y"
{
NODE *n = yyvsp[0]->memory;
(void) force_number(n);
@@ -3306,28 +3321,28 @@ regular_print:
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
-#line 3310 "awkgram.c"
+#line 3325 "awkgram.c"
break;
case 81: /* case_value: '+' YNUMBER */
-#line 1361 "awkgram.y"
+#line 1376 "awkgram.y"
{
NODE *n = yyvsp[0]->lasti->memory;
bcfree(yyvsp[-1]);
add_sign_to_num(n, '+');
yyval = yyvsp[0];
}
-#line 3321 "awkgram.c"
+#line 3336 "awkgram.c"
break;
case 82: /* case_value: YSTRING */
-#line 1368 "awkgram.y"
+#line 1383 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3327 "awkgram.c"
+#line 3342 "awkgram.c"
break;
case 83: /* case_value: regexp */
-#line 1370 "awkgram.y"
+#line 1385 "awkgram.y"
{
if (yyvsp[0]->memory->type == Node_regex)
yyvsp[0]->opcode = Op_push_re;
@@ -3335,57 +3350,57 @@ regular_print:
yyvsp[0]->opcode = Op_push;
yyval = yyvsp[0];
}
-#line 3339 "awkgram.c"
+#line 3354 "awkgram.c"
break;
case 84: /* case_value: typed_regexp */
-#line 1378 "awkgram.y"
+#line 1393 "awkgram.y"
{
assert((yyvsp[0]->memory->flags & REGEX) == REGEX);
yyvsp[0]->opcode = Op_push_re;
yyval = yyvsp[0];
}
-#line 3349 "awkgram.c"
+#line 3364 "awkgram.c"
break;
case 85: /* print: LEX_PRINT */
-#line 1387 "awkgram.y"
+#line 1402 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3355 "awkgram.c"
+#line 3370 "awkgram.c"
break;
case 86: /* print: LEX_PRINTF */
-#line 1389 "awkgram.y"
+#line 1404 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3361 "awkgram.c"
+#line 3376 "awkgram.c"
break;
case 88: /* print_expression_list: '(' expression_list r_paren */
-#line 1399 "awkgram.y"
+#line 1414 "awkgram.y"
{
yyval = yyvsp[-1];
}
-#line 3369 "awkgram.c"
+#line 3384 "awkgram.c"
break;
case 89: /* output_redir: %empty */
-#line 1406 "awkgram.y"
+#line 1421 "awkgram.y"
{
in_print = false;
in_parens = 0;
yyval = NULL;
}
-#line 3379 "awkgram.c"
+#line 3394 "awkgram.c"
break;
case 90: /* $@6: %empty */
-#line 1411 "awkgram.y"
+#line 1426 "awkgram.y"
{ in_print = false; in_parens = 0; }
-#line 3385 "awkgram.c"
+#line 3400 "awkgram.c"
break;
case 91: /* output_redir: IO_OUT $@6 common_exp */
-#line 1412 "awkgram.y"
+#line 1427 "awkgram.y"
{
if (yyvsp[-2]->redir_type == redirect_twoway
&& yyvsp[0]->lasti->opcode == Op_K_getline_redir
@@ -3395,22 +3410,22 @@ regular_print:
lintwarn(_("concatenation as I/O `>' redirection target
is ambiguous"));
yyval = list_prepend(yyvsp[0], yyvsp[-2]);
}
-#line 3399 "awkgram.c"
+#line 3414 "awkgram.c"
break;
case 92: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement */
-#line 1425 "awkgram.y"
+#line 1440 "awkgram.y"
{
if (yyvsp[-1] != NULL)
yyvsp[-5]->comment = yyvsp[-1];
add_lint(yyvsp[-3], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL,
NULL);
}
-#line 3410 "awkgram.c"
+#line 3425 "awkgram.c"
break;
case 93: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE
opt_nls statement */
-#line 1433 "awkgram.y"
+#line 1448 "awkgram.y"
{
if (yyvsp[-4] != NULL)
yyvsp[-8]->comment = yyvsp[-4];
@@ -3419,19 +3434,19 @@ regular_print:
add_lint(yyvsp[-6], LINT_assign_in_cond);
yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3],
yyvsp[-2], yyvsp[0]);
}
-#line 3423 "awkgram.c"
+#line 3438 "awkgram.c"
break;
case 94: /* nls: NEWLINE */
-#line 1445 "awkgram.y"
+#line 1460 "awkgram.y"
{
yyval = yyvsp[0];
}
-#line 3431 "awkgram.c"
+#line 3446 "awkgram.c"
break;
case 95: /* nls: nls NEWLINE */
-#line 1449 "awkgram.y"
+#line 1464 "awkgram.y"
{
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) {
@@ -3449,59 +3464,59 @@ regular_print:
} else
yyval = NULL;
}
-#line 3453 "awkgram.c"
+#line 3468 "awkgram.c"
break;
case 96: /* opt_nls: %empty */
-#line 1470 "awkgram.y"
+#line 1485 "awkgram.y"
{ yyval = NULL; }
-#line 3459 "awkgram.c"
+#line 3474 "awkgram.c"
break;
case 97: /* opt_nls: nls */
-#line 1472 "awkgram.y"
+#line 1487 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3465 "awkgram.c"
+#line 3480 "awkgram.c"
break;
case 98: /* input_redir: %empty */
-#line 1477 "awkgram.y"
+#line 1492 "awkgram.y"
{ yyval = NULL; }
-#line 3471 "awkgram.c"
+#line 3486 "awkgram.c"
break;
case 99: /* input_redir: '<' simp_exp */
-#line 1479 "awkgram.y"
+#line 1494 "awkgram.y"
{
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
-#line 3480 "awkgram.c"
+#line 3495 "awkgram.c"
break;
case 100: /* opt_param_list: %empty */
-#line 1487 "awkgram.y"
+#line 1502 "awkgram.y"
{ yyval = NULL; }
-#line 3486 "awkgram.c"
+#line 3501 "awkgram.c"
break;
case 101: /* opt_param_list: param_list */
-#line 1489 "awkgram.y"
+#line 1504 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3492 "awkgram.c"
+#line 3507 "awkgram.c"
break;
case 102: /* param_list: NAME */
-#line 1494 "awkgram.y"
+#line 1509 "awkgram.y"
{
yyvsp[0]->param_count = 0;
yyval = list_create(yyvsp[0]);
}
-#line 3501 "awkgram.c"
+#line 3516 "awkgram.c"
break;
case 103: /* param_list: param_list comma NAME */
-#line 1499 "awkgram.y"
+#line 1514 "awkgram.y"
{
if (yyvsp[-2] != NULL && yyvsp[0] != NULL) {
yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count +
1;
@@ -3518,76 +3533,76 @@ regular_print:
} else
yyval = NULL;
}
-#line 3522 "awkgram.c"
+#line 3537 "awkgram.c"
break;
case 104: /* param_list: error */
-#line 1516 "awkgram.y"
+#line 1531 "awkgram.y"
{ yyval = NULL; }
-#line 3528 "awkgram.c"
+#line 3543 "awkgram.c"
break;
case 105: /* param_list: param_list error */
-#line 1518 "awkgram.y"
+#line 1533 "awkgram.y"
{ yyval = yyvsp[-1]; }
-#line 3534 "awkgram.c"
+#line 3549 "awkgram.c"
break;
case 106: /* param_list: param_list comma error */
-#line 1520 "awkgram.y"
+#line 1535 "awkgram.y"
{ yyval = yyvsp[-2]; }
-#line 3540 "awkgram.c"
+#line 3555 "awkgram.c"
break;
case 107: /* opt_exp: %empty */
-#line 1526 "awkgram.y"
+#line 1541 "awkgram.y"
{ yyval = NULL; }
-#line 3546 "awkgram.c"
+#line 3561 "awkgram.c"
break;
case 108: /* opt_exp: exp */
-#line 1528 "awkgram.y"
+#line 1543 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3552 "awkgram.c"
+#line 3567 "awkgram.c"
break;
case 109: /* opt_expression_list: %empty */
-#line 1533 "awkgram.y"
+#line 1548 "awkgram.y"
{ yyval = NULL; }
-#line 3558 "awkgram.c"
+#line 3573 "awkgram.c"
break;
case 110: /* opt_expression_list: expression_list */
-#line 1535 "awkgram.y"
+#line 1550 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3564 "awkgram.c"
+#line 3579 "awkgram.c"
break;
case 111: /* expression_list: exp */
-#line 1540 "awkgram.y"
+#line 1555 "awkgram.y"
{ yyval = mk_expression_list(NULL, yyvsp[0]); }
-#line 3570 "awkgram.c"
+#line 3585 "awkgram.c"
break;
case 112: /* expression_list: expression_list comma exp */
-#line 1542 "awkgram.y"
+#line 1557 "awkgram.y"
{
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok;
}
-#line 3581 "awkgram.c"
+#line 3596 "awkgram.c"
break;
case 113: /* expression_list: error */
-#line 1549 "awkgram.y"
+#line 1564 "awkgram.y"
{ yyval = NULL; }
-#line 3587 "awkgram.c"
+#line 3602 "awkgram.c"
break;
case 114: /* expression_list: expression_list error */
-#line 1551 "awkgram.y"
+#line 1566 "awkgram.y"
{
/*
* Returning the expression list instead of NULL lets
@@ -3595,66 +3610,66 @@ regular_print:
*/
yyval = yyvsp[-1];
}
-#line 3599 "awkgram.c"
+#line 3614 "awkgram.c"
break;
case 115: /* expression_list: expression_list error exp */
-#line 1559 "awkgram.y"
+#line 1574 "awkgram.y"
{
/* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
-#line 3608 "awkgram.c"
+#line 3623 "awkgram.c"
break;
case 116: /* expression_list: expression_list comma error */
-#line 1564 "awkgram.y"
+#line 1579 "awkgram.y"
{
/* Ditto */
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
-#line 3619 "awkgram.c"
+#line 3634 "awkgram.c"
break;
case 117: /* opt_fcall_expression_list: %empty */
-#line 1574 "awkgram.y"
+#line 1589 "awkgram.y"
{ yyval = NULL; }
-#line 3625 "awkgram.c"
+#line 3640 "awkgram.c"
break;
case 118: /* opt_fcall_expression_list: fcall_expression_list */
-#line 1576 "awkgram.y"
+#line 1591 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3631 "awkgram.c"
+#line 3646 "awkgram.c"
break;
case 119: /* fcall_expression_list: fcall_exp */
-#line 1581 "awkgram.y"
+#line 1596 "awkgram.y"
{ yyval = mk_expression_list(NULL, yyvsp[0]); }
-#line 3637 "awkgram.c"
+#line 3652 "awkgram.c"
break;
case 120: /* fcall_expression_list: fcall_expression_list comma fcall_exp */
-#line 1583 "awkgram.y"
+#line 1598 "awkgram.y"
{
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok;
}
-#line 3648 "awkgram.c"
+#line 3663 "awkgram.c"
break;
case 121: /* fcall_expression_list: error */
-#line 1590 "awkgram.y"
+#line 1605 "awkgram.y"
{ yyval = NULL; }
-#line 3654 "awkgram.c"
+#line 3669 "awkgram.c"
break;
case 122: /* fcall_expression_list: fcall_expression_list error */
-#line 1592 "awkgram.y"
+#line 1607 "awkgram.y"
{
/*
* Returning the expression list instead of NULL lets
@@ -3662,86 +3677,86 @@ regular_print:
*/
yyval = yyvsp[-1];
}
-#line 3666 "awkgram.c"
+#line 3681 "awkgram.c"
break;
case 123: /* fcall_expression_list: fcall_expression_list error fcall_exp */
-#line 1600 "awkgram.y"
+#line 1615 "awkgram.y"
{
/* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
-#line 3675 "awkgram.c"
+#line 3690 "awkgram.c"
break;
case 124: /* fcall_expression_list: fcall_expression_list comma error */
-#line 1605 "awkgram.y"
+#line 1620 "awkgram.y"
{
/* Ditto */
if (yyvsp[-1] != NULL)
yyvsp[-2]->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
-#line 3686 "awkgram.c"
+#line 3701 "awkgram.c"
break;
case 125: /* fcall_exp: exp */
-#line 1614 "awkgram.y"
+#line 1629 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3692 "awkgram.c"
+#line 3707 "awkgram.c"
break;
case 126: /* fcall_exp: typed_regexp */
-#line 1615 "awkgram.y"
+#line 1630 "awkgram.y"
{ yyval = list_create(yyvsp[0]); }
-#line 3698 "awkgram.c"
+#line 3713 "awkgram.c"
break;
case 127: /* opt_fcall_exp: %empty */
-#line 1620 "awkgram.y"
+#line 1635 "awkgram.y"
{ yyval = NULL; }
-#line 3704 "awkgram.c"
+#line 3719 "awkgram.c"
break;
case 128: /* opt_fcall_exp: fcall_exp */
-#line 1621 "awkgram.y"
+#line 1636 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3710 "awkgram.c"
+#line 3725 "awkgram.c"
break;
case 129: /* exp: variable assign_operator exp */
-#line 1627 "awkgram.y"
+#line 1642 "awkgram.y"
{
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of assignment"));
yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]);
}
-#line 3721 "awkgram.c"
+#line 3736 "awkgram.c"
break;
case 130: /* exp: variable ASSIGN typed_regexp */
-#line 1634 "awkgram.y"
+#line 1649 "awkgram.y"
{
yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]),
yyvsp[-1]);
}
-#line 3729 "awkgram.c"
+#line 3744 "awkgram.c"
break;
case 131: /* exp: exp LEX_AND exp */
-#line 1638 "awkgram.y"
+#line 1653 "awkgram.y"
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3735 "awkgram.c"
+#line 3750 "awkgram.c"
break;
case 132: /* exp: exp LEX_OR exp */
-#line 1640 "awkgram.y"
+#line 1655 "awkgram.y"
{ yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3741 "awkgram.c"
+#line 3756 "awkgram.c"
break;
case 133: /* exp: exp MATCHOP typed_regexp */
-#line 1642 "awkgram.y"
+#line 1657 "awkgram.y"
{
if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
@@ -3754,11 +3769,11 @@ regular_print:
bcfree(yyvsp[0]);
yyval = list_append(yyvsp[-2], yyvsp[-1]);
}
-#line 3758 "awkgram.c"
+#line 3773 "awkgram.c"
break;
case 134: /* exp: exp MATCHOP exp */
-#line 1655 "awkgram.y"
+#line 1670 "awkgram.y"
{
if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
@@ -3775,11 +3790,11 @@ regular_print:
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]),
yyvsp[-1]);
}
}
-#line 3779 "awkgram.c"
+#line 3794 "awkgram.c"
break;
case 135: /* exp: exp LEX_IN simple_variable */
-#line 1672 "awkgram.y"
+#line 1687 "awkgram.y"
{
if (do_lint_old)
lintwarn_ln(yyvsp[-1]->source_line,
@@ -3789,91 +3804,91 @@ regular_print:
yyvsp[-1]->expr_count = 1;
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
-#line 3793 "awkgram.c"
+#line 3808 "awkgram.c"
break;
case 136: /* exp: exp a_relop exp */
-#line 1682 "awkgram.y"
+#line 1697 "awkgram.y"
{
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of comparison"));
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
-#line 3804 "awkgram.c"
+#line 3819 "awkgram.c"
break;
case 137: /* exp: exp '?' exp ':' exp */
-#line 1689 "awkgram.y"
+#line 1704 "awkgram.y"
{ yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1],
yyvsp[0]); }
-#line 3810 "awkgram.c"
+#line 3825 "awkgram.c"
break;
case 138: /* exp: common_exp */
-#line 1691 "awkgram.y"
+#line 1706 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3816 "awkgram.c"
+#line 3831 "awkgram.c"
break;
case 139: /* assign_operator: ASSIGN */
-#line 1696 "awkgram.y"
+#line 1711 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3822 "awkgram.c"
+#line 3837 "awkgram.c"
break;
case 140: /* assign_operator: ASSIGNOP */
-#line 1698 "awkgram.y"
+#line 1713 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3828 "awkgram.c"
+#line 3843 "awkgram.c"
break;
case 141: /* assign_operator: SLASH_BEFORE_EQUAL ASSIGN */
-#line 1700 "awkgram.y"
+#line 1715 "awkgram.y"
{
yyvsp[0]->opcode = Op_assign_quotient;
yyval = yyvsp[0];
}
-#line 3837 "awkgram.c"
+#line 3852 "awkgram.c"
break;
case 142: /* relop_or_less: RELOP */
-#line 1708 "awkgram.y"
+#line 1723 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3843 "awkgram.c"
+#line 3858 "awkgram.c"
break;
case 143: /* relop_or_less: '<' */
-#line 1710 "awkgram.y"
+#line 1725 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3849 "awkgram.c"
+#line 3864 "awkgram.c"
break;
case 144: /* a_relop: relop_or_less */
-#line 1715 "awkgram.y"
+#line 1730 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3855 "awkgram.c"
+#line 3870 "awkgram.c"
break;
case 145: /* a_relop: '>' */
-#line 1717 "awkgram.y"
+#line 1732 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3861 "awkgram.c"
+#line 3876 "awkgram.c"
break;
case 146: /* common_exp: simp_exp */
-#line 1722 "awkgram.y"
+#line 1737 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3867 "awkgram.c"
+#line 3882 "awkgram.c"
break;
case 147: /* common_exp: simp_exp_nc */
-#line 1724 "awkgram.y"
+#line 1739 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 3873 "awkgram.c"
+#line 3888 "awkgram.c"
break;
case 148: /* common_exp: common_exp simp_exp */
-#line 1726 "awkgram.y"
+#line 1741 "awkgram.y"
{
int count = 2;
bool is_simple_var = false;
@@ -3927,47 +3942,47 @@ regular_print:
max_args = count;
}
}
-#line 3931 "awkgram.c"
+#line 3946 "awkgram.c"
break;
case 150: /* simp_exp: simp_exp '^' simp_exp */
-#line 1785 "awkgram.y"
+#line 1800 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3937 "awkgram.c"
+#line 3952 "awkgram.c"
break;
case 151: /* simp_exp: simp_exp '*' simp_exp */
-#line 1787 "awkgram.y"
+#line 1802 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3943 "awkgram.c"
+#line 3958 "awkgram.c"
break;
case 152: /* simp_exp: simp_exp '/' simp_exp */
-#line 1789 "awkgram.y"
+#line 1804 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3949 "awkgram.c"
+#line 3964 "awkgram.c"
break;
case 153: /* simp_exp: simp_exp '%' simp_exp */
-#line 1791 "awkgram.y"
+#line 1806 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3955 "awkgram.c"
+#line 3970 "awkgram.c"
break;
case 154: /* simp_exp: simp_exp '+' simp_exp */
-#line 1793 "awkgram.y"
+#line 1808 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3961 "awkgram.c"
+#line 3976 "awkgram.c"
break;
case 155: /* simp_exp: simp_exp '-' simp_exp */
-#line 1795 "awkgram.y"
+#line 1810 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3967 "awkgram.c"
+#line 3982 "awkgram.c"
break;
case 156: /* simp_exp: LEX_GETLINE opt_variable input_redir */
-#line 1797 "awkgram.y"
+#line 1812 "awkgram.y"
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3981,29 +3996,29 @@ regular_print:
_("non-redirected `getline' undefined inside
END action"));
yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0],
redirect_input);
}
-#line 3985 "awkgram.c"
+#line 4000 "awkgram.c"
break;
case 157: /* simp_exp: variable INCREMENT */
-#line 1811 "awkgram.y"
+#line 1826 "awkgram.y"
{
yyvsp[0]->opcode = Op_postincrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 3994 "awkgram.c"
+#line 4009 "awkgram.c"
break;
case 158: /* simp_exp: variable DECREMENT */
-#line 1816 "awkgram.y"
+#line 1831 "awkgram.y"
{
yyvsp[0]->opcode = Op_postdecrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 4003 "awkgram.c"
+#line 4018 "awkgram.c"
break;
case 159: /* simp_exp: '(' expression_list r_paren LEX_IN simple_variable */
-#line 1821 "awkgram.y"
+#line 1836 "awkgram.y"
{
if (do_lint_old) {
/* first one is warning so that second one comes out if
warnings are fatal */
@@ -4024,64 +4039,64 @@ regular_print:
yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]);
}
}
-#line 4028 "awkgram.c"
+#line 4043 "awkgram.c"
break;
case 160: /* simp_exp_nc: common_exp IO_IN LEX_GETLINE opt_variable */
-#line 1847 "awkgram.y"
+#line 1862 "awkgram.y"
{
yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3],
yyvsp[-2]->redir_type);
bcfree(yyvsp[-2]);
}
-#line 4037 "awkgram.c"
+#line 4052 "awkgram.c"
break;
case 161: /* simp_exp_nc: simp_exp_nc '^' simp_exp */
-#line 1853 "awkgram.y"
+#line 1868 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4043 "awkgram.c"
+#line 4058 "awkgram.c"
break;
case 162: /* simp_exp_nc: simp_exp_nc '*' simp_exp */
-#line 1855 "awkgram.y"
+#line 1870 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4049 "awkgram.c"
+#line 4064 "awkgram.c"
break;
case 163: /* simp_exp_nc: simp_exp_nc '/' simp_exp */
-#line 1857 "awkgram.y"
+#line 1872 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4055 "awkgram.c"
+#line 4070 "awkgram.c"
break;
case 164: /* simp_exp_nc: simp_exp_nc '%' simp_exp */
-#line 1859 "awkgram.y"
+#line 1874 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4061 "awkgram.c"
+#line 4076 "awkgram.c"
break;
case 165: /* simp_exp_nc: simp_exp_nc '+' simp_exp */
-#line 1861 "awkgram.y"
+#line 1876 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4067 "awkgram.c"
+#line 4082 "awkgram.c"
break;
case 166: /* simp_exp_nc: simp_exp_nc '-' simp_exp */
-#line 1863 "awkgram.y"
+#line 1878 "awkgram.y"
{ yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4073 "awkgram.c"
+#line 4088 "awkgram.c"
break;
case 167: /* non_post_simp_exp: regexp */
-#line 1868 "awkgram.y"
+#line 1883 "awkgram.y"
{
yyval = list_create(yyvsp[0]);
}
-#line 4081 "awkgram.c"
+#line 4096 "awkgram.c"
break;
case 168: /* non_post_simp_exp: '!' simp_exp */
-#line 1872 "awkgram.y"
+#line 1887 "awkgram.y"
{
if (yyvsp[0]->opcode == Op_match_rec) {
yyvsp[0]->opcode = Op_nomatch;
@@ -4113,11 +4128,11 @@ regular_print:
}
}
}
-#line 4117 "awkgram.c"
+#line 4132 "awkgram.c"
break;
case 169: /* non_post_simp_exp: '(' exp r_paren */
-#line 1904 "awkgram.y"
+#line 1919 "awkgram.y"
{
// Always include. Allows us to lint warn on
// print "foo" > "bar" 1
@@ -4125,31 +4140,31 @@ regular_print:
// print "foo" > ("bar" 1)
yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1,
sourceline));
}
-#line 4129 "awkgram.c"
+#line 4144 "awkgram.c"
break;
case 170: /* non_post_simp_exp: LEX_BUILTIN '(' opt_fcall_expression_list
r_paren */
-#line 1912 "awkgram.y"
+#line 1927 "awkgram.y"
{
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL)
YYABORT;
}
-#line 4139 "awkgram.c"
+#line 4154 "awkgram.c"
break;
case 171: /* non_post_simp_exp: LEX_LENGTH '(' opt_fcall_expression_list
r_paren */
-#line 1918 "awkgram.y"
+#line 1933 "awkgram.y"
{
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL)
YYABORT;
}
-#line 4149 "awkgram.c"
+#line 4164 "awkgram.c"
break;
case 172: /* non_post_simp_exp: LEX_LENGTH */
-#line 1924 "awkgram.y"
+#line 1939 "awkgram.y"
{
static bool warned = false;
@@ -4162,45 +4177,45 @@ regular_print:
if (yyval == NULL)
YYABORT;
}
-#line 4166 "awkgram.c"
+#line 4181 "awkgram.c"
break;
case 175: /* non_post_simp_exp: INCREMENT variable */
-#line 1939 "awkgram.y"
+#line 1954 "awkgram.y"
{
yyvsp[-1]->opcode = Op_preincrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
}
-#line 4175 "awkgram.c"
+#line 4190 "awkgram.c"
break;
case 176: /* non_post_simp_exp: DECREMENT variable */
-#line 1944 "awkgram.y"
+#line 1959 "awkgram.y"
{
yyvsp[-1]->opcode = Op_predecrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
}
-#line 4184 "awkgram.c"
+#line 4199 "awkgram.c"
break;
case 177: /* non_post_simp_exp: YNUMBER */
-#line 1949 "awkgram.y"
+#line 1964 "awkgram.y"
{
yyval = list_create(yyvsp[0]);
}
-#line 4192 "awkgram.c"
+#line 4207 "awkgram.c"
break;
case 178: /* non_post_simp_exp: YSTRING */
-#line 1953 "awkgram.y"
+#line 1968 "awkgram.y"
{
yyval = list_create(yyvsp[0]);
}
-#line 4200 "awkgram.c"
+#line 4215 "awkgram.c"
break;
case 179: /* non_post_simp_exp: '-' simp_exp */
-#line 1957 "awkgram.y"
+#line 1972 "awkgram.y"
{
if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0
@@ -4215,11 +4230,11 @@ regular_print:
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
-#line 4219 "awkgram.c"
+#line 4234 "awkgram.c"
break;
case 180: /* non_post_simp_exp: '+' simp_exp */
-#line 1972 "awkgram.y"
+#line 1987 "awkgram.y"
{
if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0
@@ -4237,20 +4252,20 @@ regular_print:
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
-#line 4241 "awkgram.c"
+#line 4256 "awkgram.c"
break;
case 181: /* func_call: direct_func_call */
-#line 1993 "awkgram.y"
+#line 2008 "awkgram.y"
{
func_use(yyvsp[0]->lasti->func_name, FUNC_USE);
yyval = yyvsp[0];
}
-#line 4250 "awkgram.c"
+#line 4265 "awkgram.c"
break;
case 182: /* func_call: '@' direct_func_call */
-#line 1998 "awkgram.y"
+#line 2013 "awkgram.y"
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -4284,11 +4299,11 @@ regular_print:
yyval = list_prepend(yyvsp[0], t);
at_seen = false;
}
-#line 4288 "awkgram.c"
+#line 4303 "awkgram.c"
break;
case 183: /* direct_func_call: FUNC_CALL '(' opt_fcall_expression_list
r_paren */
-#line 2035 "awkgram.y"
+#line 2050 "awkgram.y"
{
NODE *n;
char *name = yyvsp[-3]->func_name;
@@ -4321,49 +4336,49 @@ regular_print:
yyval = list_append(t, yyvsp[-3]);
}
}
-#line 4325 "awkgram.c"
+#line 4340 "awkgram.c"
break;
case 184: /* opt_variable: %empty */
-#line 2071 "awkgram.y"
+#line 2086 "awkgram.y"
{ yyval = NULL; }
-#line 4331 "awkgram.c"
+#line 4346 "awkgram.c"
break;
case 185: /* opt_variable: variable */
-#line 2073 "awkgram.y"
+#line 2088 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4337 "awkgram.c"
+#line 4352 "awkgram.c"
break;
case 186: /* delete_subscript_list: %empty */
-#line 2078 "awkgram.y"
+#line 2093 "awkgram.y"
{ yyval = NULL; }
-#line 4343 "awkgram.c"
+#line 4358 "awkgram.c"
break;
case 187: /* delete_subscript_list: delete_subscript SUBSCRIPT */
-#line 2080 "awkgram.y"
+#line 2095 "awkgram.y"
{ yyval = yyvsp[-1]; }
-#line 4349 "awkgram.c"
+#line 4364 "awkgram.c"
break;
case 188: /* delete_subscript: delete_exp_list */
-#line 2085 "awkgram.y"
+#line 2100 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4355 "awkgram.c"
+#line 4370 "awkgram.c"
break;
case 189: /* delete_subscript: delete_subscript delete_exp_list */
-#line 2087 "awkgram.y"
+#line 2102 "awkgram.y"
{
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
-#line 4363 "awkgram.c"
+#line 4378 "awkgram.c"
break;
case 190: /* delete_exp_list: bracketed_exp_list */
-#line 2094 "awkgram.y"
+#line 2109 "awkgram.y"
{
INSTRUCTION *ip = yyvsp[0]->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated
expressions */
@@ -4377,11 +4392,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
yyval = yyvsp[0];
}
-#line 4381 "awkgram.c"
+#line 4396 "awkgram.c"
break;
case 191: /* bracketed_exp_list: '[' expression_list ']' */
-#line 2111 "awkgram.y"
+#line 2126 "awkgram.y"
{
INSTRUCTION *t = yyvsp[-1];
if (yyvsp[-1] == NULL) {
@@ -4395,41 +4410,41 @@ regular_print:
yyvsp[0]->sub_count = count_expressions(&t, false);
yyval = list_append(t, yyvsp[0]);
}
-#line 4399 "awkgram.c"
+#line 4414 "awkgram.c"
break;
case 192: /* subscript: bracketed_exp_list */
-#line 2128 "awkgram.y"
+#line 2143 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4405 "awkgram.c"
+#line 4420 "awkgram.c"
break;
case 193: /* subscript: subscript bracketed_exp_list */
-#line 2130 "awkgram.y"
+#line 2145 "awkgram.y"
{
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
-#line 4413 "awkgram.c"
+#line 4428 "awkgram.c"
break;
case 194: /* subscript_list: subscript SUBSCRIPT */
-#line 2137 "awkgram.y"
+#line 2152 "awkgram.y"
{ yyval = yyvsp[-1]; }
-#line 4419 "awkgram.c"
+#line 4434 "awkgram.c"
break;
case 195: /* simple_variable: NAME */
-#line 2142 "awkgram.y"
+#line 2157 "awkgram.y"
{
yyvsp[0]->opcode = Op_push;
yyvsp[0]->memory = variable(yyvsp[0]->source_line,
yyvsp[0]->lextok, Node_var_new);
yyval = list_create(yyvsp[0]);
}
-#line 4429 "awkgram.c"
+#line 4444 "awkgram.c"
break;
case 196: /* simple_variable: NAME subscript_list */
-#line 2148 "awkgram.y"
+#line 2163 "awkgram.y"
{
char *arr = yyvsp[-1]->lextok;
@@ -4437,11 +4452,11 @@ regular_print:
yyvsp[-1]->opcode = Op_push_array;
yyval = list_prepend(yyvsp[0], yyvsp[-1]);
}
-#line 4441 "awkgram.c"
+#line 4456 "awkgram.c"
break;
case 197: /* variable: simple_variable */
-#line 2159 "awkgram.y"
+#line 2174 "awkgram.y"
{
INSTRUCTION *ip = yyvsp[0]->nexti;
if (ip->opcode == Op_push
@@ -4453,85 +4468,85 @@ regular_print:
} else
yyval = yyvsp[0];
}
-#line 4457 "awkgram.c"
+#line 4472 "awkgram.c"
break;
case 198: /* variable: '$' non_post_simp_exp opt_incdec */
-#line 2171 "awkgram.y"
+#line 2186 "awkgram.y"
{
yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != NULL)
mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 4467 "awkgram.c"
+#line 4482 "awkgram.c"
break;
case 199: /* opt_incdec: INCREMENT */
-#line 2180 "awkgram.y"
+#line 2195 "awkgram.y"
{
yyvsp[0]->opcode = Op_postincrement;
}
-#line 4475 "awkgram.c"
+#line 4490 "awkgram.c"
break;
case 200: /* opt_incdec: DECREMENT */
-#line 2184 "awkgram.y"
+#line 2199 "awkgram.y"
{
yyvsp[0]->opcode = Op_postdecrement;
}
-#line 4483 "awkgram.c"
+#line 4498 "awkgram.c"
break;
case 201: /* opt_incdec: %empty */
-#line 2188 "awkgram.y"
+#line 2203 "awkgram.y"
{ yyval = NULL; }
-#line 4489 "awkgram.c"
+#line 4504 "awkgram.c"
break;
case 202: /* l_brace: '{' opt_nls */
-#line 2192 "awkgram.y"
+#line 2207 "awkgram.y"
{ yyval = yyvsp[0]; }
-#line 4495 "awkgram.c"
+#line 4510 "awkgram.c"
break;
case 203: /* r_brace: '}' opt_nls */
-#line 2196 "awkgram.y"
+#line 2211 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; }
-#line 4501 "awkgram.c"
+#line 4516 "awkgram.c"
break;
case 204: /* r_paren: ')' */
-#line 2200 "awkgram.y"
+#line 2215 "awkgram.y"
{ yyerrok; }
-#line 4507 "awkgram.c"
+#line 4522 "awkgram.c"
break;
case 205: /* opt_semi: %empty */
-#line 2205 "awkgram.y"
+#line 2220 "awkgram.y"
{ yyval = NULL; }
-#line 4513 "awkgram.c"
+#line 4528 "awkgram.c"
break;
case 207: /* semi: ';' */
-#line 2210 "awkgram.y"
+#line 2225 "awkgram.y"
{ yyerrok; }
-#line 4519 "awkgram.c"
+#line 4534 "awkgram.c"
break;
case 208: /* colon: ':' */
-#line 2214 "awkgram.y"
+#line 2229 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; }
-#line 4525 "awkgram.c"
+#line 4540 "awkgram.c"
break;
case 209: /* comma: ',' opt_nls */
-#line 2218 "awkgram.y"
+#line 2233 "awkgram.y"
{ yyval = yyvsp[0]; yyerrok; }
-#line 4531 "awkgram.c"
+#line 4546 "awkgram.c"
break;
-#line 4535 "awkgram.c"
+#line 4550 "awkgram.c"
default: break;
}
@@ -4724,7 +4739,7 @@ yyreturnlab:
return yyresult;
}
-#line 2220 "awkgram.y"
+#line 2235 "awkgram.y"
struct token {
@@ -6586,6 +6601,9 @@ retry:
yylval = GET_INSTRUCTION(Op_token);
if (want_source) {
yylval->lextok = estrdup(tokstart, tok - tokstart);
+ // See the comment in the production for @namespace.
+ if (want_namespace)
+ change_namespace(yylval->lextok);
return lasttok = FILENAME;
}
@@ -6926,6 +6944,8 @@ retry:
switch (class) {
case LEX_NAMESPACE:
+ want_namespace = true;
+ // fall through
case LEX_INCLUDE:
case LEX_LOAD:
want_source = true;
@@ -9326,7 +9346,7 @@ done:
return i;
}
-/* set_namespace --- change the current namespace */
+/* set_namespace --- update namespace data structures */
static void
set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
@@ -9357,13 +9377,9 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
return;
}
- if (strcmp(ns->lextok, current_namespace) == 0)
- ; // nothing to do
- else if (strcmp(ns->lextok, awk_namespace) == 0) {
- set_current_namespace(awk_namespace);
- } else {
- set_current_namespace(estrdup(ns->lextok, strlen(ns->lextok)));
- }
+ // Actual changing of namespace is done earlier.
+ // See comments in the production and in yylex().
+
efree(ns->lextok);
// save info and push on front of list of namespaces seen
@@ -9376,11 +9392,35 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
ns->lextok = NULL;
bcfree(ns);
- namespace_changed = true;
-
return;
}
+/* change_namespace --- change the current namespace */
+
+static void
+change_namespace(const char *new_namespace)
+{
+ /* error messages will come from set_namespace(), above */
+
+ if (! is_valid_identifier(new_namespace))
+ return;
+
+ int mid = check_special(new_namespace);
+
+ if (mid >= 0)
+ return;
+
+ if (strcmp(new_namespace, current_namespace) == 0)
+ ; // nothing to do
+ else if (strcmp(new_namespace, awk_namespace) == 0) {
+ set_current_namespace(awk_namespace);
+ } else {
+ set_current_namespace(estrdup(new_namespace,
strlen(new_namespace)));
+ }
+
+ namespace_changed = true;
+}
+
/* qualify_name --- put name into namespace */
static char *
diff --git a/awkgram.y b/awkgram.y
index 0729d353..2ec91545 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -57,6 +57,7 @@ static void dumpintlstr2(const char *str1, size_t len1, const
char *str2, size_t
static bool include_source(INSTRUCTION *file, void **srcfile_p);
static bool load_library(INSTRUCTION *file, void **srcfile_p);
static void set_namespace(INSTRUCTION *ns, INSTRUCTION *comment);
+static void change_namespace(const char *new_namespace);
static void next_sourcefile(void);
static char *tokexpand(void);
static NODE *set_profile_text(NODE *n, const char *str, size_t len);
@@ -112,6 +113,7 @@ static void add_sign_to_num(NODE *n, char sign);
static bool at_seen = false;
static bool want_source = false;
+static bool want_namespace = false;
static bool want_regexp = false; /* lexical scanning kludge */
static enum {
FUNC_HEADER,
@@ -317,7 +319,20 @@ rule
}
| '@' LEX_NAMESPACE namespace statement_term
{
+ /*
+ * 1/2022:
+ * We have an interesting isssue here. This production isn't
+ * reduced until after the token following the statement_term
+ * is seen. As a result, the change in namespace doesn't take
+ * effect until then. That's fine if the first token is
'function'
+ * or BEGIN or some such, but it's a disaster if it's an
identifer;
+ * that identifier will be in the previous namespace.
+ * Therefore, the actual setting of the namespace is done
immediately
+ * down in the scanner.
+ */
+
want_source = false;
+ want_namespace = false;
at_seen = false;
// this frees $3 storage in all cases
@@ -4078,6 +4093,9 @@ retry:
yylval = GET_INSTRUCTION(Op_token);
if (want_source) {
yylval->lextok = estrdup(tokstart, tok - tokstart);
+ // See the comment in the production for @namespace.
+ if (want_namespace)
+ change_namespace(yylval->lextok);
return lasttok = FILENAME;
}
@@ -4418,6 +4436,8 @@ retry:
switch (class) {
case LEX_NAMESPACE:
+ want_namespace = true;
+ // fall through
case LEX_INCLUDE:
case LEX_LOAD:
want_source = true;
@@ -6818,7 +6838,7 @@ done:
return i;
}
-/* set_namespace --- change the current namespace */
+/* set_namespace --- update namespace data structures */
static void
set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
@@ -6849,13 +6869,9 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
return;
}
- if (strcmp(ns->lextok, current_namespace) == 0)
- ; // nothing to do
- else if (strcmp(ns->lextok, awk_namespace) == 0) {
- set_current_namespace(awk_namespace);
- } else {
- set_current_namespace(estrdup(ns->lextok, strlen(ns->lextok)));
- }
+ // Actual changing of namespace is done earlier.
+ // See comments in the production and in yylex().
+
efree(ns->lextok);
// save info and push on front of list of namespaces seen
@@ -6868,11 +6884,35 @@ set_namespace(INSTRUCTION *ns, INSTRUCTION *comment)
ns->lextok = NULL;
bcfree(ns);
- namespace_changed = true;
-
return;
}
+/* change_namespace --- change the current namespace */
+
+static void
+change_namespace(const char *new_namespace)
+{
+ /* error messages will come from set_namespace(), above */
+
+ if (! is_valid_identifier(new_namespace))
+ return;
+
+ int mid = check_special(new_namespace);
+
+ if (mid >= 0)
+ return;
+
+ if (strcmp(new_namespace, current_namespace) == 0)
+ ; // nothing to do
+ else if (strcmp(new_namespace, awk_namespace) == 0) {
+ set_current_namespace(awk_namespace);
+ } else {
+ set_current_namespace(estrdup(new_namespace,
strlen(new_namespace)));
+ }
+
+ namespace_changed = true;
+}
+
/* qualify_name --- put name into namespace */
static char *
diff --git a/pc/ChangeLog b/pc/ChangeLog
index d2b2c564..2ca19739 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2021-12-01 Arnold D. Robbins <arnold@skeeve.com>
* gawkmisc.pc (os_maybe_set_errno): Renamed from
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 97be2756..5569e571 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -202,7 +202,7 @@ GAWK_EXT_TESTS = \
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b \
nsawk1c nsawk2a nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse \
- nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
+ nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit
posix \
printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
@@ -3051,6 +3051,11 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/symbol.c b/symbol.c
index be01369c..300fa871 100644
--- a/symbol.c
+++ b/symbol.c
@@ -604,7 +604,10 @@ load_symbols()
|| r->type == Node_var
|| r->type == Node_var_array
|| r->type == Node_var_new) {
- tmp = make_string(r->vname, strlen(r->vname));
+ if (strncmp(r->vname, "awk::", 5) == 0)
+ tmp = make_string(r->vname + 5,
strlen(r->vname) - 5);
+ else
+ tmp = make_string(r->vname,
strlen(r->vname));
aptr = assoc_lookup(sym_array, tmp);
unref(tmp);
unref(*aptr);
diff --git a/test/ChangeLog b/test/ChangeLog
index 1fb76bab..7db73f3c 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): nsidentifier, new test.
+ * nsidentifier.awk, nsidentifier.ok: New files.
+
2021-12-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
* iolint.awk, iolint.ok: Reorder "cat" pipe/output file test to reduce
diff --git a/test/Makefile.am b/test/Makefile.am
index b74056ec..abd1fc00 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -848,6 +848,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1453,7 +1455,7 @@ GAWK_EXT_TESTS = \
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b \
nsawk1c nsawk2a nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse \
- nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
+ nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit
posix \
printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
diff --git a/test/Makefile.in b/test/Makefile.in
index d56e90d1..ab45c3aa 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1114,6 +1114,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1719,7 +1721,7 @@ GAWK_EXT_TESTS = \
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b \
nsawk1c nsawk2a nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse \
- nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
+ nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit
posix \
printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
@@ -4727,6 +4729,11 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 9e00cd57..4c4cfa62 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1790,6 +1790,11 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/nsidentifier.awk b/test/nsidentifier.awk
new file mode 100644
index 00000000..0c665289
--- /dev/null
+++ b/test/nsidentifier.awk
@@ -0,0 +1,36 @@
+# Overdocumented Test Case for FUNCTAB
+
+@namespace "ns"
+
+ns1 = 1 # ns::ns1
+ns::ns2 = 2 # ns::ns2
+awk::defined_in_ns3 = 3 # defined_in_ns3
+@namespace "awk"
+awkspace4 = 4 # awkspace4
+awk::awkspace5 = 5 # awkspace5
+
+BEGIN {
+ list = "awk::defined_in_ns3 awk::awkspace5 ns1 ns::ns1 ns::ns2
awkspace4 awkspace5" # list
+ n = split(list, test)
# n, test
+ for (i = 1; i <= n; i++) {
# i
+ var = test[i]
# var
+ sub(/awk::/, "", var) # no 'awk::' in SYMTAB or SYMTAB
+
+ yesno = (test[i] in FUNCTAB) ? "Yes" : "No "
# yesno
+ printf("%s %s in FUNCTAB\n", yesno, test[i])
+ yesno = (test[i] in PROCINFO["identifiers"]) ? "Yes" : "No "
+ printf("%s %s in PROCINFO[\"identifiers\"]\n", yesno, test[i])
+
+ yesno = (var in SYMTAB) ? "Yes" : "No "
+ printf("%s %s in SYMTAB\n", yesno, var)
+ yesno = (var in PROCINFO["identifiers"]) ? "Yes" :"No "
+ printf("%s %s in PROCINFO[\"identifiers\"]\n", yesno, var)
+ printf("\n")
+ }
+ print "------------------------------"
+ for (i in PROCINFO["identifiers"])
+ print i | "LC_ALL=C sort"
+ close("LC_ALL=C sort")
+
+ exit 0
+}
diff --git a/test/nsidentifier.ok b/test/nsidentifier.ok
new file mode 100644
index 00000000..5743f94c
--- /dev/null
+++ b/test/nsidentifier.ok
@@ -0,0 +1,118 @@
+No awk::defined_in_ns3 in FUNCTAB
+No awk::defined_in_ns3 in PROCINFO["identifiers"]
+Yes defined_in_ns3 in SYMTAB
+Yes defined_in_ns3 in PROCINFO["identifiers"]
+
+No awk::awkspace5 in FUNCTAB
+No awk::awkspace5 in PROCINFO["identifiers"]
+Yes awkspace5 in SYMTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+
+No ns1 in FUNCTAB
+No ns1 in PROCINFO["identifiers"]
+No ns1 in SYMTAB
+No ns1 in PROCINFO["identifiers"]
+
+No ns::ns1 in FUNCTAB
+Yes ns::ns1 in PROCINFO["identifiers"]
+Yes ns::ns1 in SYMTAB
+Yes ns::ns1 in PROCINFO["identifiers"]
+
+No ns::ns2 in FUNCTAB
+Yes ns::ns2 in PROCINFO["identifiers"]
+Yes ns::ns2 in SYMTAB
+Yes ns::ns2 in PROCINFO["identifiers"]
+
+No awkspace4 in FUNCTAB
+Yes awkspace4 in PROCINFO["identifiers"]
+Yes awkspace4 in SYMTAB
+Yes awkspace4 in PROCINFO["identifiers"]
+
+No awkspace5 in FUNCTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+Yes awkspace5 in SYMTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+
+------------------------------
+ARGC
+ARGIND
+ARGV
+BINMODE
+CONVFMT
+ENVIRON
+ERRNO
+FIELDWIDTHS
+FILENAME
+FNR
+FPAT
+FS
+FUNCTAB
+IGNORECASE
+LINT
+NF
+NR
+OFMT
+OFS
+ORS
+PREC
+PROCINFO
+RLENGTH
+ROUNDMODE
+RS
+RSTART
+RT
+SUBSEP
+SYMTAB
+TEXTDOMAIN
+and
+asort
+asorti
+atan2
+awkspace4
+awkspace5
+bindtextdomain
+close
+compl
+cos
+dcgettext
+dcngettext
+defined_in_ns3
+exp
+fflush
+gensub
+gsub
+i
+index
+int
+isarray
+length
+list
+log
+lshift
+match
+mktime
+n
+ns::ns1
+ns::ns2
+or
+patsplit
+rand
+rshift
+sin
+split
+sprintf
+sqrt
+srand
+strftime
+strtonum
+sub
+substr
+system
+systime
+test
+tolower
+toupper
+typeof
+var
+xor
+yesno
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 13 +
awkgram.c | 904 ++++++++++++++++++++++++++------------------------
awkgram.y | 60 +++-
doc/ChangeLog | 5 +
doc/gawk.info | 640 +++++++++++++++++------------------
doc/gawk.texi | 6 +-
doc/gawktexi.in | 6 +-
pc/ChangeLog | 4 +
pc/Makefile.tst | 7 +-
symbol.c | 5 +-
test/ChangeLog | 5 +
test/Makefile.am | 4 +-
test/Makefile.in | 9 +-
test/Maketests | 5 +
test/nsidentifier.awk | 36 ++
test/nsidentifier.ok | 118 +++++++
16 files changed, 1055 insertions(+), 772 deletions(-)
create mode 100644 test/nsidentifier.awk
create mode 100644 test/nsidentifier.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4369-g71a50ec0,
Arnold Robbins <=