summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/VfrCompile/Pccts/antlr
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C/VfrCompile/Pccts/antlr')
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak233
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak239
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak101
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/README19
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1209
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c3564
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g2586
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r787
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt264
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c1025
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c813
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c67
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c423
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c328
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c538
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c123
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c1555
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c2250
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c4797
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h286
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c484
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c221
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h73
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c878
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c1747
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile221
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin219
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile196
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c1864
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h12
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c3030
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg1387
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c821
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h852
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c5735
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h31
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h390
-rw-r--r--BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h246
38 files changed, 0 insertions, 38514 deletions
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak b/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak
deleted file mode 100644
index 71b7c6b0b1..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrDDK.mak
+++ /dev/null
@@ -1,233 +0,0 @@
-# PCCTS directory
-
-# You will need to set the LIB variable similar to this.
-# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
-
-# PCCTS_HOME=<your PCCTS_HOME>
-PCCTS_HOME=$(WORKSPACE)\Tools\CCode\Source\Pccts
-ANTLR_SRC=$(PCCTS_HOME)\antlr
-PCCTS_H=$(PCCTS_HOME)\h
-
-
-# Support directories
-SET=$(PCCTS_HOME)\support\set
-
-
-# Compiler stuff
-CC = cl
-CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
- -D "ZZLEXBUFSIZE=65536" -D "LONGFILENAMES" /Zi /W3 -D__USE_PROTOS /wd4700
-
-ANTLR_OBJS = antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
- fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
- misc.obj pred.obj egman.obj mrhoist.obj fcache.obj
-
-SUPPORT_OBJS = set.obj
-
-# Dependencies
-
-$(WORKSPACE)\Tools\bin\antlr.exe: $(ANTLR_OBJS) $(SUPPORT_OBJS)
- $(CC) $(CFLAGS) -o antlr.exe bufferoverflowu.lib $(ANTLR_OBJS) $(SUPPORT_OBJS)
- del *.obj
- move antlr.exe $(WORKSPACE)\Tools\bin
-
-
-antlr.obj: $(ANTLR_SRC)\antlr.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\mode.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\antlr.c
-
-scan.obj: $(ANTLR_SRC)\scan.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgauto.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\mode.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\scan.c
-
-err.obj: $(ANTLR_SRC)\err.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(PCCTS_H)\err.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\err.c
-
-bits.obj: $(ANTLR_SRC)\bits.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\bits.c
-
-build.obj: $(ANTLR_SRC)\build.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\build.c
-
-fset2.obj: $(ANTLR_SRC)\fset2.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset2.c
-
-fset.obj: $(ANTLR_SRC)\fset.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset.c
-
-gen.obj: $(ANTLR_SRC)\gen.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\gen.c
-
-globals.obj: $(ANTLR_SRC)\globals.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\globals.c
-
-hash.obj: $(ANTLR_SRC)\hash.c \
- $(PCCTS_H)\config.h \
- $(ANTLR_SRC)\hash.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\hash.c
-
-lex.obj: $(ANTLR_SRC)\lex.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\lex.c
-
-main.obj: $(ANTLR_SRC)\main.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\mode.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\stdpccts.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\main.c
-
-misc.obj: $(ANTLR_SRC)\misc.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\misc.c
-
-pred.obj: $(ANTLR_SRC)\pred.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\pred.c
-
-egman.obj: $(ANTLR_SRC)\egman.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\egman.c
-
-mrhoist.obj: $(ANTLR_SRC)\mrhoist.c \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\mrhoist.c
-
-fcache.obj: $(ANTLR_SRC)\fcache.c \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fcache.c
-
-set.obj: $(SET)\set.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
-
- $(CC) -c $(CFLAGS) $(SET)\set.c
-
-clean:
- del *.obj
-
-distclean:
- del *.obj
- del $(WORKSPACE)\Tools\bin\antlr.exe
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak b/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak
deleted file mode 100644
index b30a73bb74..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrMS.mak
+++ /dev/null
@@ -1,239 +0,0 @@
-# PCCTS directory
-
-# You will need to set the LIB variable similar to this.
-# LIB="C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;c:/Microsoft Visual Studio .NET 2003/Vc7/PlatformSDK/Lib"
-
-# PCCTS_HOME=<your PCCTS_HOME>
-PCCTS_HOME=$(BASE_TOOLS_PATH)\Source\C\VfrCompile\Pccts
-ANTLR_SRC=$(PCCTS_HOME)\antlr
-PCCTS_H=$(PCCTS_HOME)\h
-
-
-# Support directories
-SET=$(PCCTS_HOME)\support\set
-
-
-# Compiler stuff
-CC = cl
-CFLAGS = /nologo -I "." -I "$(PCCTS_H)" -I "$(SET)" -D "USER_ZZSYN" -D "PC" \
- -D "ZZLEXBUFSIZE=65536" /D "LONGFILENAMES" /Zi /W3 -D__USE_PROTOS /wd4700 \
- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
-
-ANTLR_OBJS = antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
- fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
- misc.obj pred.obj egman.obj mrhoist.obj fcache.obj
-
-SUPPORT_OBJS = set.obj
-
-# Dependencies
-
-$(EDK_TOOLS_PATH)\Bin\Win32\antlr.exe: $(ANTLR_OBJS) $(SUPPORT_OBJS)
- $(CC) $(CFLAGS) -Feantlr.exe $(ANTLR_OBJS) $(SUPPORT_OBJS)
- -@if not exist $(EDK_TOOLS_PATH)\Bin\Win32 mkdir $(EDK_TOOLS_PATH)\Bin\Win32
- copy antlr.exe $(EDK_TOOLS_PATH)\Bin\Win32
-
-
-antlr.obj: $(ANTLR_SRC)\antlr.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\mode.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\antlr.c
-
-scan.obj: $(ANTLR_SRC)\scan.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgauto.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\mode.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\scan.c
-
-err.obj: $(ANTLR_SRC)\err.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(PCCTS_H)\err.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\err.c
-
-bits.obj: $(ANTLR_SRC)\bits.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\bits.c
-
-build.obj: $(ANTLR_SRC)\build.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\build.c
-
-fset2.obj: $(ANTLR_SRC)\fset2.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset2.c
-
-fset.obj: $(ANTLR_SRC)\fset.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fset.c
-
-gen.obj: $(ANTLR_SRC)\gen.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\gen.c
-
-globals.obj: $(ANTLR_SRC)\globals.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\globals.c
-
-hash.obj: $(ANTLR_SRC)\hash.c \
- $(PCCTS_H)\config.h \
- $(ANTLR_SRC)\hash.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\hash.c
-
-lex.obj: $(ANTLR_SRC)\lex.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\lex.c
-
-main.obj: $(ANTLR_SRC)\main.c \
- $(PCCTS_H)\antlr.h \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\mode.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\stdpccts.h \
- $(ANTLR_SRC)\syn.h \
- $(ANTLR_SRC)\tokens.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\main.c
-
-misc.obj: $(ANTLR_SRC)\misc.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\misc.c
-
-pred.obj: $(ANTLR_SRC)\pred.c \
- $(PCCTS_H)\config.h \
- $(PCCTS_H)\dlgdef.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\pred.c
-
-egman.obj: $(ANTLR_SRC)\egman.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\egman.c
-
-mrhoist.obj: $(ANTLR_SRC)\mrhoist.c \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\mrhoist.c
-
-fcache.obj: $(ANTLR_SRC)\fcache.c \
- $(ANTLR_SRC)\generic.h \
- $(ANTLR_SRC)\hash.h \
- $(ANTLR_SRC)\proto.h \
- $(ANTLR_SRC)\syn.h \
-
- $(CC) -c $(CFLAGS) $(ANTLR_SRC)\fcache.c
-
-set.obj: $(SET)\set.c \
- $(PCCTS_H)\config.h \
- $(SET)\set.h \
-
- $(CC) -c $(CFLAGS) $(SET)\set.c
-
-clean:
- -del *.obj
- -del *.ilk
- -del *.pdb
-
-cleanall:
- -del *.obj
- -del *.ilk
- -del *.pdb
- -del *.exe
- -del $(EDK_TOOLS_PATH)\Bin\Win32\antlr.exe
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak b/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak
deleted file mode 100644
index 9ede60d64c..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/AntlrPPC.mak
+++ /dev/null
@@ -1,101 +0,0 @@
-# Target: antlrPPC
-# Sources: ::support:set:set.c
-# antlr.c
-# bits.c
-# build.c
-# egman.c
-# err.c
-# fcache.c
-# fset2.c
-# fset.c
-# gen.c
-# globals.c
-# hash.c
-# lex.c
-# main.c
-# misc.c
-# mrhoist.c
-# pred.c
-# scan.c
-# Created: Sunday, May 17, 1998 10:24:53 PM
-# Author: Kenji Tanaka
-MAKEFILE = antlrPPC.make
-„MondoBuild„ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
-Includes = ¶
- -i "::h:" ¶
- -i "::support:set:"
-Sym„PPC =
-ObjDir„PPC = :Obj:
-PPCCOptions = {Includes} {Sym„PPC} -w off -d MPW -d __STDC__=1 -d USER_ZZSYN
-Objects„PPC = ¶
- "{ObjDir„PPC}set.c.x" ¶
- "{ObjDir„PPC}antlr.c.x" ¶
- "{ObjDir„PPC}bits.c.x" ¶
- "{ObjDir„PPC}build.c.x" ¶
- "{ObjDir„PPC}egman.c.x" ¶
- "{ObjDir„PPC}err.c.x" ¶
- "{ObjDir„PPC}fcache.c.x" ¶
- "{ObjDir„PPC}fset2.c.x" ¶
- "{ObjDir„PPC}fset.c.x" ¶
- "{ObjDir„PPC}gen.c.x" ¶
- "{ObjDir„PPC}globals.c.x" ¶
- "{ObjDir„PPC}hash.c.x" ¶
- "{ObjDir„PPC}lex.c.x" ¶
- "{ObjDir„PPC}main.c.x" ¶
- "{ObjDir„PPC}misc.c.x" ¶
- "{ObjDir„PPC}mrhoist.c.x" ¶
- "{ObjDir„PPC}pred.c.x" ¶
- "{ObjDir„PPC}scan.c.x"
-antlrPPC ÄÄ {„MondoBuild„} {Objects„PPC}
- PPCLink ¶
- -o {Targ} {Sym„PPC} ¶
- {Objects„PPC} ¶
- -t 'MPST' ¶
- -c 'MPS ' ¶
- "{SharedLibraries}InterfaceLib" ¶
- "{SharedLibraries}StdCLib" ¶
- #"{SharedLibraries}MathLib" ¶
- "{PPCLibraries}StdCRuntime.o" ¶
- "{PPCLibraries}PPCCRuntime.o" ¶
- "{PPCLibraries}PPCToolLibs.o"
-"{ObjDir„PPC}set.c.x" Ä {„MondoBuild„} "::support:set:set.c"
- {PPCC} "::support:set:set.c" -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}antlr.c.x" Ä {„MondoBuild„} antlr.c
- {PPCC} antlr.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}bits.c.x" Ä {„MondoBuild„} bits.c
- {PPCC} bits.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}build.c.x" Ä {„MondoBuild„} build.c
- {PPCC} build.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}egman.c.x" Ä {„MondoBuild„} egman.c
- {PPCC} egman.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}err.c.x" Ä {„MondoBuild„} err.c
- {PPCC} err.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}fcache.c.x" Ä {„MondoBuild„} fcache.c
- {PPCC} fcache.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}fset2.c.x" Ä {„MondoBuild„} fset2.c
- {PPCC} fset2.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}fset.c.x" Ä {„MondoBuild„} fset.c
- {PPCC} fset.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}gen.c.x" Ä {„MondoBuild„} gen.c
- {PPCC} gen.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}globals.c.x" Ä {„MondoBuild„} globals.c
- {PPCC} globals.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}hash.c.x" Ä {„MondoBuild„} hash.c
- {PPCC} hash.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}lex.c.x" Ä {„MondoBuild„} lex.c
- {PPCC} lex.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}main.c.x" Ä {„MondoBuild„} main.c
- {PPCC} main.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}misc.c.x" Ä {„MondoBuild„} misc.c
- {PPCC} misc.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}mrhoist.c.x" Ä {„MondoBuild„} mrhoist.c
- {PPCC} mrhoist.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}pred.c.x" Ä {„MondoBuild„} pred.c
- {PPCC} pred.c -o {Targ} {PPCCOptions}
-"{ObjDir„PPC}scan.c.x" Ä {„MondoBuild„} scan.c
- {PPCC} scan.c -o {Targ} {PPCCOptions}
-
-antlrPPC ÄÄ antlr.r
- Rez antlr.r -o antlrPPC -a
-Install Ä antlrPPC
- Duplicate -y antlrPPC "{MPW}"Tools:antlr
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/README b/BaseTools/Source/C/VfrCompile/Pccts/antlr/README
deleted file mode 100644
index d7fc95916e..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/README
+++ /dev/null
@@ -1,19 +0,0 @@
- ANTLR 1.33
-
-This directory contains the files necessary to build ANTLR.
-
-If you do a "make scrub", ANTLR will have to run on antlr.g and DLG
-will have to run on parser.dlg. Either
-
-(1) ANTLR uses the previous antlr in that directory to rebuild itself
-(2) Needs to find antlr on the search path
-
-You will find that running "antlr -gh antlr.g" will result in about
-10 ambiguity warnings. These are normal. Don't worry.
-
-If you do a "make clean" right after installation, ANTLR and DLG should
-not need to run; only the C files will compile.
-
-Don't forget to go into the makefile to uncomment the appropriate
-definitions for your OS/architecture/compiler or see the appropriate
-NOTES.?? file.
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1 b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1
deleted file mode 100644
index acfa85b066..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.1
+++ /dev/null
@@ -1,209 +0,0 @@
-.TH ANTLR 1 "September 1995" "ANTLR" "PCCTS Manual Pages"
-.SH NAME
-antlr \- ANother Tool for Language Recognition
-.SH SYNTAX
-.LP
-\fBantlr\fR [\fIoptions\fR] \fIgrammar_files\fR
-.SH DESCRIPTION
-.PP
-\fIAntlr\fP converts an extended form of context-free grammar into a
-set of C functions which directly implement an efficient form of
-deterministic recursive-descent LL(k) parser. Context-free grammars
-may be augmented with predicates to allow semantics to influence
-parsing; this allows a form of context-sensitive parsing. Selective
-backtracking is also available to handle non-LL(k) and even
-non-LALR(k) constructs. \fIAntlr\fP also produces a definition of a
-lexer which can be automatically converted into C code for a DFA-based
-lexer by \fIdlg\fR. Hence, \fIantlr\fR serves a function much like
-that of \fIyacc\fR, however, it is notably more flexible and is more
-integrated with a lexer generator (\fIantlr\fR directly generates
-\fIdlg\fR code, whereas \fIyacc\fR and \fIlex\fR are given independent
-descriptions). Unlike \fIyacc\fR which accepts LALR(1) grammars,
-\fIantlr\fR accepts LL(k) grammars in an extended BNF notation \(em
-which eliminates the need for precedence rules.
-.PP
-Like \fIyacc\fR grammars, \fIantlr\fR grammars can use
-automatically-maintained symbol attribute values referenced as dollar
-variables. Further, because \fIantlr\fR generates top-down parsers,
-arbitrary values may be inherited from parent rules (passed like
-function parameters). \fIAntlr\fP also has a mechanism for creating
-and manipulating abstract-syntax-trees.
-.PP
-There are various other niceties in \fIantlr\fR, including the ability to
-spread one grammar over multiple files or even multiple grammars in a single
-file, the ability to generate a version of the grammar with actions stripped
-out (for documentation purposes), and lots more.
-.SH OPTIONS
-.IP "\fB-ck \fIn\fR"
-Use up to \fIn\fR symbols of lookahead when using compressed (linear
-approximation) lookahead. This type of lookahead is very cheap to
-compute and is attempted before full LL(k) lookahead, which is of
-exponential complexity in the worst case. In general, the compressed
-lookahead can be much deeper (e.g, \f(CW-ck 10\fP) than the full
-lookahead (which usually must be less than 4).
-.IP \fB-CC\fP
-Generate C++ output from both ANTLR and DLG.
-.IP \fB-cr\fP
-Generate a cross-reference for all rules. For each rule, print a list
-of all other rules that reference it.
-.IP \fB-e1\fP
-Ambiguities/errors shown in low detail (default).
-.IP \fB-e2\fP
-Ambiguities/errors shown in more detail.
-.IP \fB-e3\fP
-Ambiguities/errors shown in excruciating detail.
-.IP "\fB-fe\fP file"
-Rename \fBerr.c\fP to file.
-.IP "\fB-fh\fP file"
-Rename \fBstdpccts.h\fP header (turns on \fB-gh\fP) to file.
-.IP "\fB-fl\fP file"
-Rename lexical output, \fBparser.dlg\fP, to file.
-.IP "\fB-fm\fP file"
-Rename file with lexical mode definitions, \fBmode.h\fP, to file.
-.IP "\fB-fr\fP file"
-Rename file which remaps globally visible symbols, \fBremap.h\fP, to file.
-.IP "\fB-ft\fP file"
-Rename \fBtokens.h\fP to file.
-.IP \fB-ga\fP
-Generate ANSI-compatible code (default case). This has not been
-rigorously tested to be ANSI XJ11 C compliant, but it is close. The
-normal output of \fIantlr\fP is currently compilable under both K&R,
-ANSI C, and C++\(emthis option does nothing because \fIantlr\fP
-generates a bunch of #ifdef's to do the right thing depending on the
-language.
-.IP \fB-gc\fP
-Indicates that \fIantlr\fP should generate no C code, i.e., only
-perform analysis on the grammar.
-.IP \fB-gd\fP
-C code is inserted in each of the \fIantlr\fR generated parsing functions to
-provide for user-defined handling of a detailed parse trace. The inserted
-code consists of calls to the user-supplied macros or functions called
-\fBzzTRACEIN\fR and \fBzzTRACEOUT\fP. The only argument is a
-\fIchar *\fR pointing to a C-style string which is the grammar rule
-recognized by the current parsing function. If no definition is given
-for the trace functions, upon rule entry and exit, a message will be
-printed indicating that a particular rule as been entered or exited.
-.IP \fB-ge\fP
-Generate an error class for each non-terminal.
-.IP \fB-gh\fP
-Generate \fBstdpccts.h\fP for non-ANTLR-generated files to include.
-This file contains all defines needed to describe the type of parser
-generated by \fIantlr\fP (e.g. how much lookahead is used and whether
-or not trees are constructed) and contains the \fBheader\fP action
-specified by the user.
-.IP \fB-gk\fP
-Generate parsers that delay lookahead fetches until needed. Without
-this option, \fIantlr\fP generates parsers which always have \fIk\fP
-tokens of lookahead available.
-.IP \fB-gl\fP
-Generate line info about grammar actions in C parser of the form
-\fB#\ \fIline\fP\ "\fIfile\fP"\fR which makes error messages from
-the C/C++ compiler make more sense as they will \*Qpoint\*U into the
-grammar file not the resulting C file. Debugging is easier as well,
-because you will step through the grammar not C file.
-.IP \fB-gs\fR
-Do not generate sets for token expression lists; instead generate a
-\fB||\fP-separated sequence of \fBLA(1)==\fItoken_number\fR. The
-default is to generate sets.
-.IP \fB-gt\fP
-Generate code for Abstract-Syntax Trees.
-.IP \fB-gx\fP
-Do not create the lexical analyzer files (dlg-related). This option
-should be given when the user wishes to provide a customized lexical
-analyzer. It may also be used in \fImake\fR scripts to cause only the
-parser to be rebuilt when a change not affecting the lexical structure
-is made to the input grammars.
-.IP "\fB-k \fIn\fR"
-Set k of LL(k) to \fIn\fR; i.e. set tokens of look-ahead (default==1).
-.IP "\fB-o\fP dir
-Directory where output files should go (default="."). This is very
-nice for keeping the source directory clear of ANTLR and DLG spawn.
-.IP \fB-p\fP
-The complete grammar, collected from all input grammar files and
-stripped of all comments and embedded actions, is listed to
-\fBstdout\fP. This is intended to aid in viewing the entire grammar
-as a whole and to eliminate the need to keep actions concisely stated
-so that the grammar is easier to read. Hence, it is preferable to
-embed even complex actions directly in the grammar, rather than to
-call them as subroutines, since the subroutine call overhead will be
-saved.
-.IP \fB-pa\fP
-This option is the same as \fB-p\fP except that the output is
-annotated with the first sets determined from grammar analysis.
-.IP "\fB-prc on\fR
-Turn on the computation and hoisting of predicate context.
-.IP "\fB-prc off\fR
-Turn off the computation and hoisting of predicate context. This
-option makes 1.10 behave like the 1.06 release with option \fB-pr\fR
-on. Context computation is off by default.
-.IP "\fB-rl \fIn\fR
-Limit the maximum number of tree nodes used by grammar analysis to
-\fIn\fP. Occasionally, \fIantlr\fP is unable to analyze a grammar
-submitted by the user. This rare situation can only occur when the
-grammar is large and the amount of lookahead is greater than one. A
-nonlinear analysis algorithm is used by PCCTS to handle the general
-case of LL(k) parsing. The average complexity of analysis, however, is
-near linear due to some fancy footwork in the implementation which
-reduces the number of calls to the full LL(k) algorithm. An error
-message will be displayed, if this limit is reached, which indicates
-the grammar construct being analyzed when \fIantlr\fP hit a
-non-linearity. Use this option if \fIantlr\fP seems to go out to
-lunch and your disk start thrashing; try \fIn\fP=10000 to start. Once
-the offending construct has been identified, try to remove the
-ambiguity that \fIantlr\fP was trying to overcome with large lookahead
-analysis. The introduction of (...)? backtracking blocks eliminates
-some of these problems\ \(em \fIantlr\fP does not analyze alternatives
-that begin with (...)? (it simply backtracks, if necessary, at run
-time).
-.IP \fB-w1\fR
-Set low warning level. Do not warn if semantic predicates and/or
-(...)? blocks are assumed to cover ambiguous alternatives.
-.IP \fB-w2\fR
-Ambiguous parsing decisions yield warnings even if semantic predicates
-or (...)? blocks are used. Warn if predicate context computed and
-semantic predicates incompletely disambiguate alternative productions.
-.IP \fB-\fR
-Read grammar from standard input and generate \fBstdin.c\fP as the
-parser file.
-.SH "SPECIAL CONSIDERATIONS"
-.PP
-\fIAntlr\fP works... we think. There is no implicit guarantee of
-anything. We reserve no \fBlegal\fP rights to the software known as
-the Purdue Compiler Construction Tool Set (PCCTS) \(em PCCTS is in the
-public domain. An individual or company may do whatever they wish
-with source code distributed with PCCTS or the code generated by
-PCCTS, including the incorporation of PCCTS, or its output, into
-commercial software. We encourage users to develop software with
-PCCTS. However, we do ask that credit is given to us for developing
-PCCTS. By "credit", we mean that if you incorporate our source code
-into one of your programs (commercial product, research project, or
-otherwise) that you acknowledge this fact somewhere in the
-documentation, research report, etc... If you like PCCTS and have
-developed a nice tool with the output, please mention that you
-developed it using PCCTS. As long as these guidelines are followed,
-we expect to continue enhancing this system and expect to make other
-tools available as they are completed.
-.SH FILES
-.IP *.c
-output C parser.
-.IP *.cpp
-output C++ parser when C++ mode is used.
-.IP \fBparser.dlg\fP
-output \fIdlg\fR lexical analyzer.
-.IP \fBerr.c\fP
-token string array, error sets and error support routines. Not used in
-C++ mode.
-.IP \fBremap.h\fP
-file that redefines all globally visible parser symbols. The use of
-the #parser directive creates this file. Not used in
-C++ mode.
-.IP \fBstdpccts.h\fP
-list of definitions needed by C files, not generated by PCCTS, that
-reference PCCTS objects. This is not generated by default. Not used in
-C++ mode.
-.IP \fBtokens.h\fP
-output \fI#defines\fR for tokens used and function prototypes for
-functions generated for rules.
-.SH "SEE ALSO"
-.LP
-dlg(1), pccts(1)
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c
deleted file mode 100644
index 8aaef794e1..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.c
+++ /dev/null
@@ -1,3564 +0,0 @@
-/*
- * A n t l r T r a n s l a t i o n H e a d e r
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- *
- * ..\bin\antlr -gh antlr.g
- *
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include "pcctscfg.h"
-#include "set.h"
-#include <ctype.h>
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#define zzcr_attr(attr,tok,t)
-#define zzSET_SIZE 20
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-#include "mode.h"
-
-/* MR23 In order to remove calls to PURIFY use the antlr -nopurify option */
-
-#ifndef PCCTS_PURIFY
-#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\0',(s));
-#endif
-
-ANTLR_INFO
-
-
-/* MR20 G. Hobbelt For Borland C++ 4.x & 5.x compiling with ALL warnings enabled */
-#if defined(__TURBOC__)
-#pragma warn -aus /* unused assignment of 'xxx' */
-#endif
-
-
-#ifdef __USE_PROTOS
-static void chkToken(char *, char *, char *, int);
-#else
-static void chkToken();
-#endif
-
-#ifdef __USE_PROTOS
-static int isDLGmaxToken(char *Token); /* MR3 */
-#else
-static int isDLGmaxToken(); /* MR3 */
-#endif
-
-static int class_nest_level = 0;
-
-/* MR20 G. Hobbelt extern definitions moved to antlr.h */
-
-
-
-void
-#ifdef __USE_PROTOS
-grammar(void)
-#else
-grammar()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- Graph g;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- for (;;) {
- if ( !((setwd1[LA(1)]&0x1))) break;
- if ( (LA(1)==94) ) {
- zzmatch(94); zzCONSUME;
- zzmatch(Action);
-
- if ( HdrAction==NULL ) {
- HdrAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(HdrAction!=NULL, "rule grammar: cannot allocate header action");
- strcpy(HdrAction, LATEXT(1));
- }
- else warn("additional #header statement ignored");
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==95) ) {
- zzmatch(95); zzCONSUME;
- zzmatch(Action);
-
- if ( FirstAction==NULL ) {
- FirstAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(FirstAction!=NULL, "rule grammar: cannot allocate #first action");
- strcpy(FirstAction, LATEXT(1));
- } else {
- warn("additional #first statement ignored");
- };
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==96) ) {
- zzmatch(96); zzCONSUME;
- zzmatch(QuotedTerm);
-
- if ( GenCC ) {
- warn("#parser meta-op incompatible with -CC; ignored");
- }
- else {
- if ( strcmp(ParserName,"zzparser")==0 ) {
- ParserName=StripQuotes(mystrdup(LATEXT(1)));
- if ( RulePrefix[0]!='\0' )
- {
- warn("#parser meta-op incompatible with '-gp prefix'; '-gp' ignored");
- RulePrefix[0]='\0';
- }
- }
- else warn("additional #parser statement ignored");
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==97) ) {
- zzmatch(97); zzCONSUME;
- zzmatch(QuotedTerm);
- {
- char *fname;
- zzantlr_state st; FILE *f; struct zzdlg_state dst;
- UserTokenDefsFile = mystrdup(LATEXT(1));
- zzsave_antlr_state(&st);
- zzsave_dlg_state(&dst);
- fname = mystrdup(LATEXT(1));
- f = fopen(StripQuotes(fname), "r");
- if ( f==NULL ) {warn(eMsg1("cannot open token defs file '%s'", fname+1));}
- else {
- ANTLRm(enum_file(fname+1), f, PARSE_ENUM_FILE);
- UserDefdTokens = 1;
- }
- zzrestore_antlr_state(&st);
- zzrestore_dlg_state(&dst);
- }
- zzCONSUME;
-
- }
- else break; /* MR6 code for exiting loop "for sure" */
- }
- }
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- for (;;) {
- if ( !((setwd1[LA(1)]&0x2))) break;
- if ( (LA(1)==Action) ) {
- zzmatch(Action);
- {
- UserAction *ua = newUserAction(LATEXT(1));
- ua->file = action_file; ua->line = action_line;
- if ( class_nest_level>0 ) list_add(&class_before_actions, ua);
- else list_add(&BeforeActions, ua);
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==108) ) {
- laction();
- }
- else {
- if ( (LA(1)==109) ) {
- lmember();
- }
- else {
- if ( (LA(1)==110) ) {
- lprefix();
- }
- else {
- if ( (LA(1)==116) ) {
- aLexclass();
- }
- else {
- if ( (LA(1)==120) ) {
- token();
- }
- else {
- if ( (LA(1)==117) ) {
- error();
- }
- else {
- if ( (LA(1)==118) ) {
- tclass();
- }
- else {
- if ( (LA(1)==111) ) {
- aPred();
- }
- else {
- if ( (LA(1)==133) ) {
- default_exception_handler();
- }
- else {
- if ( (LA(1)==99) ) {
- class_def();
- }
- else {
- if ( (LA(1)==98) ) {
- zzmatch(98);
-
- if ( class_nest_level==0 )
- warn("missing class definition for trailing '}'");
- class_nest_level--;
- zzCONSUME;
-
- }
- else break; /* MR6 code for exiting loop "for sure" */
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- rule();
- g=zzaArg(zztasp1,3); SynDiag = (Junction *) zzaArg(zztasp1,3 ).left;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- for (;;) {
- if ( !((setwd1[LA(1)]&0x4))) break;
- if ( (LA(1)==NonTerminal) ) {
- rule();
- if ( zzaArg(zztasp2,1 ).left!=NULL ) {
- g.right = NULL;
-
-/* MR21a */ /* Avoid use of a malformed graph when CannotContinue */
- /* MR21a */ /* is already set */
- /* MR21a */
- /* MR21a */ if (! (CannotContinue && g.left == NULL)) {
- /* MR21a */ g = Or(g, zzaArg(zztasp2,1));
- /* MR21a */ }
- /* MR21a */ }
- }
- else {
- if ( (LA(1)==116) ) {
- aLexclass();
- }
- else {
- if ( (LA(1)==120) ) {
- token();
- }
- else {
- if ( (LA(1)==117) ) {
- error();
- }
- else {
- if ( (LA(1)==118) ) {
- tclass();
- }
- else {
- if ( (LA(1)==111) ) {
- aPred();
- }
- else {
- if ( (LA(1)==99) ) {
- class_def();
- }
- else {
- if ( (LA(1)==98) ) {
- zzmatch(98);
-
- if ( class_nest_level==0 )
- warn("missing class definition for trailing '}'");
- class_nest_level--;
- zzCONSUME;
-
- }
- else break; /* MR6 code for exiting loop "for sure" */
- }
- }
- }
- }
- }
- }
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- for (;;) {
- if ( !((setwd1[LA(1)]&0x8))) break;
- if ( (LA(1)==Action) ) {
- zzmatch(Action);
- {
- UserAction *ua = newUserAction(LATEXT(1));
- ua->file = action_file; ua->line = action_line;
- if ( class_nest_level>0 ) list_add(&class_after_actions, ua);
- else list_add(&AfterActions, ua);
- }
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==108) ) {
- laction();
- }
- else {
- if ( (LA(1)==109) ) {
- lmember();
- }
- else {
- if ( (LA(1)==110) ) {
- lprefix();
- }
- else {
- if ( (LA(1)==117) ) {
- error();
- }
- else {
- if ( (LA(1)==118) ) {
- tclass();
- }
- else {
- if ( (LA(1)==99) ) {
- class_def();
- }
- else {
- if ( (LA(1)==111) ) {
- aPred();
- }
- else {
- if ( (LA(1)==98) ) {
- zzmatch(98);
-
- if ( class_nest_level==0 )
- warn("missing class definition for trailing '}'");
- class_nest_level--;
- zzCONSUME;
-
- }
- else break; /* MR6 code for exiting loop "for sure" */
- }
- }
- }
- }
- }
- }
- }
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(Eof); zzCONSUME;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x10);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-class_def(void)
-#else
-class_def()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- int go=1; char name[MaxRuleName+1];
- zzmatch(99); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==NonTerminal) ) {
- zzmatch(NonTerminal);
- if(go) strncpy(name,LATEXT(1),MaxRuleName);
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- if(go) strncpy(name,LATEXT(1),MaxRuleName);
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
-
- if ( CurrentClassName[0]!='\0' && strcmp(CurrentClassName,name)!=0
- && GenCC ) {
- err("only one grammar class allowed in this release");
- go = 0;
- }
- else strcpy(CurrentClassName, name);
- if ( !GenCC ) { err("class meta-op used without C++ option"); }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd1[LA(1)]&0x20) ) {
- zzsetmatch(zzerr2, zzerr3);
- if (ClassDeclStuff == NULL) {
- /* MR10 */ ClassDeclStuff=(char *)calloc(MaxClassDeclStuff+1,sizeof(char));
- /* MR10 */ };
- /* MR10 */ strncat(ClassDeclStuff," ",MaxClassDeclStuff);
- /* MR10 */ strncat(ClassDeclStuff,LATEXT(1),MaxClassDeclStuff);
- /* MR22 */ do {
- /* MR22 */ if (0 == strcmp(LATEXT(1),"public")) break;
- /* MR22 */ if (0 == strcmp(LATEXT(1),"private")) break;
- /* MR22 */ if (0 == strcmp(LATEXT(1),"protected")) break;
- /* MR22 */ if (0 == strcmp(LATEXT(1),"virtual")) break;
- /* MR22 */ if (0 == strcmp(LATEXT(1),",")) break;
- /* MR22 */ if (0 == strcmp(LATEXT(1),":")) break;
- /* MR22 */ if (BaseClassName != NULL) break;
- /* MR22 */ BaseClassName=(char *)calloc(strlen(LATEXT(1))+1,sizeof(char));
- /* MR22 */ require(BaseClassName!=NULL, "rule grammar: cannot allocate base class name");
- /* MR22 */ strcpy(BaseClassName,LATEXT(1));
- /* MR22 */ } while (0);
- /* MR10 */
- zzCONSUME;
-
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(102);
-
- no_classes_found = 0;
- if ( class_nest_level>=1 ) {warn("cannot have nested classes");}
- else class_nest_level++;
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x40);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-rule(void)
-#else
-rule()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
-
-
- ExceptionGroup *eg;
- RuleEntry *q; Junction *p; Graph r; int f, l; ECnode *e;
- set toksrefd, rulesrefd;
- char *pdecl=NULL, *ret=NULL, *a; CurRetDef = CurParmDef = NULL;
- CurExGroups = NULL;
- CurElementLabels = NULL;
- CurAstLabelsInActions = NULL; /* MR27 */
- /* We want a new element label hash table for each rule */
- if ( Elabel!=NULL ) killHashTable(Elabel);
- Elabel = newHashTable();
- attribsRefdFromAction = empty;
- zzmatch(NonTerminal);
- q=NULL;
- if ( hash_get(Rname, LATEXT(1))!=NULL ) {
- err(eMsg1("duplicate rule definition: '%s'",LATEXT(1)));
- CannotContinue=TRUE;
- }
- else
- {
- q = (RuleEntry *)hash_add(Rname,
- LATEXT(1),
- (Entry *)newRuleEntry(LATEXT(1)));
- CurRule = q->str;
- }
- CurRuleNode = q;
- f = CurFile; l = zzline;
- NumRules++;
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==103) ) {
- zzmatch(103);
- if ( q!=NULL ) q->noAST = TRUE;
- zzCONSUME;
-
- }
- else {
- if ( (setwd1[LA(1)]&0x80) ) {
- }
- else {zzFAIL(1,zzerr4,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- ;
- if ( (setwd2[LA(1)]&0x1) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==104) ) {
- zzmatch(104); zzCONSUME;
- }
- else {
- if ( (LA(1)==PassAction) ) {
- }
- else {zzFAIL(1,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- zzmatch(PassAction);
- pdecl = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(pdecl!=NULL, "rule rule: cannot allocate param decl");
- strcpy(pdecl, LATEXT(1));
- CurParmDef = pdecl;
- zzCONSUME;
-
- }
- else {
- if ( (setwd2[LA(1)]&0x2) ) {
- }
- else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==105) ) {
- zzmatch(105); zzCONSUME;
- zzmatch(PassAction);
- ret = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(ret!=NULL, "rule rule: cannot allocate ret type");
- strcpy(ret, LATEXT(1));
- CurRetDef = ret;
- zzCONSUME;
-
- }
- else {
- if ( (setwd2[LA(1)]&0x4) ) {
- }
- else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- if ( q!=NULL ) q->egroup=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==106) ) {
- }
- else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
-
- if ( GenEClasseForRules && q!=NULL ) {
- e = newECnode;
- require(e!=NULL, "cannot allocate error class node");
- if ( q->egroup == NULL ) {a = q->str; a[0] = (char)toupper(a[0]);}
- else a = q->egroup;
- if ( Tnum( a ) == 0 )
- {
- e->tok = addTname( a );
- list_add(&eclasses, (char *)e);
- if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
- /* refers to itself */
- list_add(&(e->elist), mystrdup(q->str));
- }
- else {
- warn(eMsg1("default errclass for '%s' would conflict with token/errclass/tokclass",a));
- if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
- free((char *)e);
- }
- }
- BlkLevel++;
- if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
- /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
- /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- zzmatch(106);
- inAlt=1;
- zzCONSUME;
-
- block( &toksrefd, &rulesrefd );
- r = makeBlk(zzaArg(zztasp1,7),0, NULL /* pFirstSetSymbol */ );
- CurRuleBlk = (Junction *)r.left;
- CurRuleBlk->blockid = CurBlockID;
- CurRuleBlk->jtype = RuleBlk;
- if ( q!=NULL ) CurRuleBlk->rname = q->str;
- CurRuleBlk->file = f;
- CurRuleBlk->line = l;
- CurRuleBlk->pdecl = pdecl;
- CurRuleBlk->ret = ret;
- CurRuleBlk->lock = makelocks();
- CurRuleBlk->pred_lock = makelocks();
- CurRuleBlk->tokrefs = toksrefd;
- CurRuleBlk->rulerefs = rulesrefd;
- p = newJunction(); /* add EndRule Node */
- ((Junction *)r.right)->p1 = (Node *)p;
- r.right = (Node *) p;
- p->jtype = EndRule;
- p->lock = makelocks();
- p->pred_lock = makelocks();
- CurRuleBlk->end = p;
- if ( q!=NULL ) q->rulenum = NumRules;
- zzaArg(zztasp1,7) = r;
-
- /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
- /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
- --BlkLevel;
- altFixup();leFixup();egFixup();
- zzmatch(107);
- inAlt=0;
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==Action) ) {
- zzmatch(Action);
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule rule: cannot allocate error action");
- strcpy(a, LATEXT(1));
- CurRuleBlk->erraction = a;
- zzCONSUME;
-
- }
- else {
- if ( (setwd2[LA(1)]&0x8) ) {
- }
- else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==133) ) {
- eg = exception_group();
-
- if ( eg!=NULL ) {
- list_add(&CurExGroups, (void *)eg);
- if (eg->label == NULL || *eg->label=='\0' ) q->has_rule_exception = 1;
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- if ( q==NULL ) zzaArg(zztasp1,0 ).left = NULL; else zzaArg(zztasp1,0) = zzaArg(zztasp1,7);
- CurRuleBlk->exceptions = CurExGroups;
- CurRuleBlk->el_labels = CurElementLabels;
- CurRuleNode->ast_labels_in_actions = CurAstLabelsInActions;
- CurRuleNode = NULL;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x10);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-laction(void)
-#else
-laction()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- char *a;
- zzmatch(108); zzCONSUME;
- zzmatch(Action);
-
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule laction: cannot allocate action");
- strcpy(a, LATEXT(1));
- list_add(&LexActions, a);
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x20);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-lmember(void)
-#else
-lmember()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- char *a;
- zzmatch(109); zzCONSUME;
- zzmatch(Action);
-
- /* MR1 */ if (! GenCC) {
- /* MR1 */ err("Use #lexmember only in C++ mode (to insert code in DLG class header");
- /* MR1 */ } else {
- /* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- /* MR1 */ require(a!=NULL, "rule lmember: cannot allocate action");
- /* MR1 */ strcpy(a, LATEXT(1));
- /* MR1 */ list_add(&LexMemberActions, a);
- /* MR1 */ };
- /* MR1 */
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x40);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-lprefix(void)
-#else
-lprefix()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- char *a;
- zzmatch(110); zzCONSUME;
- zzmatch(Action);
-
- /* MR1 */ if (! GenCC) {
- /* MR1 */ err("Use #lexprefix only in C++ mode (to insert code in DLG class header");
- /* MR1 */ } else {
- /* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- /* MR1 */ require(a!=NULL, "rule lprefix: cannot allocate action");
- /* MR1 */ strcpy(a, LATEXT(1));
- /* MR1 */ list_add(&LexPrefixActions, a);
- /* MR1 */ };
- /* MR1 */
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x80);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-aPred(void)
-#else
-aPred()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- PredEntry *predEntry=NULL;
- char *name=NULL;
- Predicate *predExpr=NULL;
- char *predLiteral=NULL;
- int save_file;
- int save_line;
- int predExprPresent=0;
- zzmatch(111);
-
- MR_usingPredNames=1; /* will need to use -mrhoist version of genPredTree */
- zzCONSUME;
-
- zzmatch(TokenTerm);
- name=mystrdup(LATEXT(1));
- zzCONSUME;
-
-
- /* don't free - referenced in predicates */
-
- CurPredName=(char *)calloc(1,strlen(name) + 10);
- strcat(CurPredName,"#pred ");
- strcat(CurPredName,name);
-
- predEntry=(PredEntry *) hash_get(Pname,name);
- if (predEntry != NULL) {
- warnFL(eMsg1("#pred %s previously defined - ignored",name),
- FileStr[action_file],action_line);
- name=NULL;
-};
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==Pred) ) {
- zzmatch(Pred);
- predLiteral=mystrdup(LATEXT(1));
- save_line=action_line;
- save_file=action_file;
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (setwd3[LA(1)]&0x1) ) {
- predExpr = predOrExpr();
-
- predExprPresent=1;
- }
- else {
- if ( (setwd3[LA(1)]&0x2) ) {
- }
- else {zzFAIL(1,zzerr10,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- if (predLiteral != NULL && name != NULL) {
-
- /*
- * predExpr may be NULL due to syntax errors
- * or simply omitted by the user
- */
-
- predEntry=newPredEntry(name);
- predEntry->file=save_file;
- predEntry->line=save_line;
- predExpr=MR_predFlatten(predExpr);
- predEntry->predLiteral=predLiteral;
- if (! predExprPresent || predExpr == NULL) {
- predExpr=new_pred();
- predExpr->expr=predLiteral;
- predExpr->source=newActionNode();
- predExpr->source->action=predExpr->expr;
- predExpr->source->rname=CurPredName;
- predExpr->source->line=action_line;
- predExpr->source->file=action_file;
- predExpr->source->is_predicate=1;
- predExpr->k=predicateLookaheadDepth(predExpr->source);
- };
- predEntry->pred=predExpr;
- hash_add(Pname,name,(Entry *)predEntry);
- predExpr=NULL;
- };
- predicate_free(predExpr);
- }
- else {
- if ( (setwd3[LA(1)]&0x4) ) {
- save_line=zzline; save_file=CurFile;
- predExpr = predOrExpr();
-
- if (predExpr != NULL && name != NULL) {
- predEntry=newPredEntry(name);
- predEntry->file=CurFile;
- predEntry->line=zzline;
- predExpr=MR_predFlatten(predExpr);
- predEntry->pred=predExpr;
- hash_add(Pname,name,(Entry *)predEntry);
- predExpr=NULL;
- };
- predicate_free(predExpr);
- }
- else {zzFAIL(1,zzerr11,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==107) ) {
- zzmatch(107); zzCONSUME;
- }
- else {
- if ( (setwd3[LA(1)]&0x8) ) {
- }
- else {zzFAIL(1,zzerr12,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- predicate_free(predExpr);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x10);
- }
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-predOrExpr(void)
-#else
-predOrExpr()
-#endif
-{
- Predicate * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(Predicate * ))
- zzMake0;
- {
- Predicate *ORnode;
- Predicate *predExpr;
- Predicate **tail=NULL;
- predExpr = predAndExpr();
-
-
- ORnode=new_pred();
- ORnode->expr=PRED_OR_LIST;
- if (predExpr != NULL) {
- ORnode->down=predExpr;
- tail=&predExpr->right;
- };
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==112) ) {
- zzmatch(112); zzCONSUME;
- predExpr = predAndExpr();
-
-
- if (predExpr != NULL) {
- *tail=predExpr;
- tail=&predExpr->right;
- };
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
-
- _retv=ORnode;
- ORnode=NULL;
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
- predicate_free(ORnode);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x20);
- return _retv;
- }
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-predAndExpr(void)
-#else
-predAndExpr()
-#endif
-{
- Predicate * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(Predicate * ))
- zzMake0;
- {
- Predicate *ANDnode;
- Predicate *predExpr;
- Predicate **tail=NULL;
- predExpr = predPrimary();
-
-
- ANDnode=new_pred();
- ANDnode->expr=PRED_AND_LIST;
- if (predExpr != NULL) {
- ANDnode->down=predExpr;
- tail=&predExpr->right;
- };
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==113) ) {
- zzmatch(113); zzCONSUME;
- predExpr = predPrimary();
-
-
- if (predExpr != NULL) {
- *tail=predExpr;
- tail=&predExpr->right;
- };
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
-
- _retv=ANDnode;
- ANDnode=NULL;
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
- predicate_free(ANDnode);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x40);
- return _retv;
- }
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-predPrimary(void)
-#else
-predPrimary()
-#endif
-{
- Predicate * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(Predicate * ))
- zzMake0;
- {
-
- char *name=NULL;
- PredEntry *predEntry=NULL;
- Predicate *predExpr=NULL;
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- name=mystrdup(LATEXT(1));
- zzCONSUME;
-
-
- predEntry=(PredEntry *) hash_get(Pname,name);
- if (predEntry == NULL) {
- warnFL(eMsg1("no previously defined #pred with name \"%s\"",name),
- FileStr[CurFile],zzline);
- name=NULL;
- _retv=NULL;
- } else {
- predExpr=predicate_dup(predEntry->pred);
- predExpr->predEntry=predEntry;
- _retv=predExpr;
- };
- }
- else {
- if ( (LA(1)==114) ) {
- zzmatch(114); zzCONSUME;
- predExpr = predOrExpr();
-
- zzmatch(115);
-
- _retv=predExpr;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==103) ) {
- zzmatch(103); zzCONSUME;
- predExpr = predPrimary();
-
-
- predExpr->inverted=!predExpr->inverted;
- _retv=predExpr;
- }
- else {zzFAIL(1,zzerr13,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
-
- predicate_free(predExpr);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x80);
- return _retv;
- }
-}
-
-void
-#ifdef __USE_PROTOS
-aLexclass(void)
-#else
-aLexclass()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- zzmatch(116); zzCONSUME;
- zzmatch(TokenTerm);
- lexclass(mystrdup(LATEXT(1)));
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd4, 0x1);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-error(void)
-#else
-error()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- char *t=NULL; ECnode *e; int go=1; TermEntry *p;
- zzmatch(117); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- ;
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr14,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- e = newECnode;
- require(e!=NULL, "cannot allocate error class node");
- e->lexclass = CurrentLexClass;
- if ( Tnum( (t=StripQuotes(t)) ) == 0 )
- {
- if ( hash_get(Texpr, t) != NULL )
- warn(eMsg1("errclass name conflicts with regular expression '%s'",t));
- e->tok = addTname( t );
- set_orel(e->tok, &imag_tokens);
- require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
- "hash table mechanism is broken");
- p->classname = 1; /* entry is errclass name, not token */
- list_add(&eclasses, (char *)e);
- }
- else
- {
- warn(eMsg1("redefinition of errclass or conflict w/token or tokclass '%s'; ignored",t));
- free( (char *)e );
- go=0;
-}
- zzmatch(102); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==NonTerminal) ) {
- zzmatch(NonTerminal);
- if ( go ) t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- if ( go ) t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- if ( go ) t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr15,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp2);
- }
- }
- if ( go ) list_add(&(e->elist), t);
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd4[LA(1)]&0x2) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==NonTerminal) ) {
- zzmatch(NonTerminal);
- if ( go ) t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- if ( go ) t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- if ( go ) t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr16,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp3);
- }
- }
- if ( go ) list_add(&(e->elist), t);
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(98); zzCONSUME;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd4, 0x4);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-tclass(void)
-#else
-tclass()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- char *t=NULL; TCnode *e; int go=1,tok,totok; TermEntry *p, *term, *toterm;
- char *akaString=NULL; int save_file; int save_line;
- char *totext=NULL;
- zzmatch(118); zzCONSUME;
- zzmatch(TokenTerm);
- t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- e = newTCnode;
- require(e!=NULL, "cannot allocate token class node");
- e->lexclass = CurrentLexClass;
- if ( Tnum( t ) == 0 )
- {
- e->tok = addTname( t );
- set_orel(e->tok, &imag_tokens);
- set_orel(e->tok, &tokclasses);
- require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
- "hash table mechanism is broken");
- p->classname = 1; /* entry is class name, not token */
- p->tclass = e; /* save ptr to this tclass def */
- list_add(&tclasses, (char *)e);
- }
- else
- {
- warn(eMsg1("redefinition of tokclass or conflict w/token '%s'; ignored",t));
- free( (char *)e );
- go=0;
-}
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==114) ) {
- zzmatch(114); zzCONSUME;
- zzmatch(QuotedTerm);
- akaString=mystrdup(StripQuotes(LATEXT(1)));
- /* MR11 */ save_file=CurFile;save_line=zzline;
- /* MR23 */
- zzCONSUME;
-
- zzmatch(115); zzCONSUME;
- }
- else {
- if ( (LA(1)==102) ) {
- }
- else {zzFAIL(1,zzerr17,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
-
- /* MR23 */ if (p!= NULL && akaString != NULL) {
- /* MR23 */ if (p->akaString != NULL) {
- /* MR23 */ if (strcmp(p->akaString,akaString) != 0) {
- /* MR23 */ warnFL(eMsg2("this #tokclass statment conflicts with a previous #tokclass %s(\"%s\") statement",
- /* MR23 */ t,p->akaString),
- /* MR23 */ FileStr[save_file],save_line);
- /* MR23 */ };
- /* MR23 */ } else {
- /* MR23 */ p->akaString=akaString;
- /* MR23 */ };
- /* MR23 */ };
- /* MR23 */
- zzmatch(102); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- int zzcnt=1;
- zzMake0;
- {
- do {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- if ( go ) {
- term = (TermEntry *) hash_get(Tname, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- go = 0;
- }
- else {t=mystrdup(LATEXT(1)); tok=addTname(LATEXT(1));}
- }
- zzCONSUME;
-
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==119) ) {
- zzmatch(119); zzCONSUME;
- zzmatch(TokenTerm);
- if ( go ) {
- toterm = (TermEntry *) hash_get(Tname, LATEXT(1));
- if ( toterm==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- go = 0;
- } else {
- totext=mystrdup(LATEXT(1)); totok=addTname(LATEXT(1));
- }
- }
- zzCONSUME;
-
- }
- else {
- if ( (setwd4[LA(1)]&0x8) ) {
- }
- else {zzFAIL(1,zzerr18,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
- }
- else {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- if ( go ) {
- term = (TermEntry *) hash_get(Texpr, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- go = 0;
- }
- else {t=mystrdup(LATEXT(1)); tok=addTexpr(LATEXT(1));}
- }
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr19,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- if ( go ) {
- if (totext == NULL) {
- list_add(&(e->tlist), t);
- } else {
- list_add(&(e->tlist),"..");
- list_add(&(e->tlist),t);
- list_add(&(e->tlist),totext);
- }
- totext=NULL;
- }
- zzLOOP(zztasp2);
- } while ( (setwd4[LA(1)]&0x10) );
- zzEXIT(zztasp2);
- }
- }
- zzmatch(98); zzCONSUME;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd4, 0x20);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-token(void)
-#else
-token()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- char *t=NULL, *e=NULL, *a=NULL; int tnum=0;
- char *akaString=NULL; TermEntry *te;int save_file=0,save_line=0;
- zzmatch(120);
- tokenActionActive=1;
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- t=mystrdup(LATEXT(1));
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==114) ) {
- zzmatch(114); zzCONSUME;
- zzmatch(QuotedTerm);
- akaString=mystrdup(StripQuotes(LATEXT(1)));
- /* MR11 */ save_file=CurFile;save_line=zzline;
- /* MR11 */
- zzCONSUME;
-
- zzmatch(115); zzCONSUME;
- }
- else {
- if ( (setwd4[LA(1)]&0x40) ) {
- }
- else {zzFAIL(1,zzerr20,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==121) ) {
- zzmatch(121); zzCONSUME;
- zzmatch(122);
- tnum = atoi(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd4[LA(1)]&0x80) ) {
- }
- else {zzFAIL(1,zzerr21,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (setwd5[LA(1)]&0x1) ) {
- }
- else {zzFAIL(1,zzerr22,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- e=mystrdup(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd5[LA(1)]&0x2) ) {
- }
- else {zzFAIL(1,zzerr23,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==Action) ) {
- zzmatch(Action);
-
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule token: cannot allocate action");
- strcpy(a, LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd5[LA(1)]&0x4) ) {
- }
- else {zzFAIL(1,zzerr24,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==107) ) {
- zzmatch(107); zzCONSUME;
- }
- else {
- if ( (setwd5[LA(1)]&0x8) ) {
- }
- else {zzFAIL(1,zzerr25,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- chkToken(t, e, a, tnum);
- if (t != NULL) {
- te=(TermEntry *)hash_get(Tname,t);
- if (te != NULL && akaString != NULL) {
- if (te->akaString != NULL) {
- if (strcmp(te->akaString,akaString) != 0) {
- warnFL(eMsg2("this #token statment conflicts with a previous #token %s(\"%s\") statement",
- t,te->akaString),
- FileStr[save_file],save_line);
- };
- } else {
- te->akaString=akaString;
- };
- };
- };
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x10);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-block(set * toksrefd,set * rulesrefd)
-#else
-block(toksrefd,rulesrefd)
- set *toksrefd;
-set *rulesrefd ;
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
-
- Graph g, b;
- set saveblah;
- int saveinalt = inAlt;
- ExceptionGroup *eg;
- * toksrefd = empty;
- * rulesrefd = empty;
- set_clr(AST_nodes_refd_in_actions);
- CurBlockID++;
- /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
- CurAltNum = 1;
- /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- saveblah = attribsRefdFromAction;
- attribsRefdFromAction = empty;
- alt( toksrefd,rulesrefd );
- b = g = zzaArg(zztasp1,1);
-
- if ( ((Junction *)g.left)->p1->ntype == nAction )
- {
- ActionNode *actionNode=(ActionNode *)
- ( ( (Junction *)g.left) ->p1);
- if (!actionNode->is_predicate )
- {
- actionNode->init_action = TRUE;
- /* MR12c */ if (actionNode->noHoist) {
- /* MR12c */ errFL("<<nohoist>> appears as init-action - use <<>> <<nohoist>>",
- /* MR12c */ FileStr[actionNode->file],actionNode->line);
- /* MR12c */ };
- }
- }
- ((Junction *)g.left)->blockid = CurBlockID;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==133) ) {
- eg = exception_group();
-
-
- if ( eg!=NULL ) {
- /* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
- /* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
- list_add(&CurExGroups, (void *)eg);
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- CurAltNum++;
- /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==123) ) {
- zzmatch(123);
- inAlt=1;
- zzCONSUME;
-
- alt( toksrefd,rulesrefd );
- g = Or(g, zzaArg(zztasp2,2));
-
- ((Junction *)g.left)->blockid = CurBlockID;
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- while ( (LA(1)==133) ) {
- eg = exception_group();
-
-
- if ( eg!=NULL ) {
- /* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
- /* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
- list_add(&CurExGroups, (void *)eg);
- }
- zzLOOP(zztasp3);
- }
- zzEXIT(zztasp3);
- }
- }
- CurAltNum++;
- /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzaArg(zztasp1,0) = b;
- attribsRefdFromAction = saveblah; inAlt = saveinalt;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x20);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-alt(set * toksrefd,set * rulesrefd)
-#else
-alt(toksrefd,rulesrefd)
- set *toksrefd;
-set *rulesrefd ;
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- int n=0; Graph g; int e_num=0, old_not=0; Node *node; set elems, dif;
- int first_on_line = 1, use_def_MT_handler = 0;
- g.left=NULL; g.right=NULL;
-
- CurAltStart = NULL;
- elems = empty;
- inAlt = 1;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==88) ) {
- zzmatch(88);
- use_def_MT_handler = 1;
- zzCONSUME;
-
- }
- else {
- if ( (setwd5[LA(1)]&0x40) ) {
- }
- else {zzFAIL(1,zzerr26,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- ;
- while ( (setwd5[LA(1)]&0x80) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- old_not=0;
- if ( (LA(1)==124) ) {
- zzmatch(124);
- old_not=1;
- zzCONSUME;
-
- }
- else {
- if ( (setwd6[LA(1)]&0x1) ) {
- }
- else {zzFAIL(1,zzerr27,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- node = element( old_not, first_on_line, use_def_MT_handler );
-
- if ( node!=NULL && node->ntype!=nAction ) first_on_line = 0;
-
- if ( zzaArg(zztasp2,2 ).left!=NULL ) {
- g = Cat(g, zzaArg(zztasp2,2));
- n++;
- if ( node!=NULL ) {
- if ( node->ntype!=nAction ) e_num++;
- /* record record number of all rule and token refs */
- if ( node->ntype==nToken ) {
- TokNode *tk = (TokNode *)((Junction *)zzaArg(zztasp2,2 ).left)->p1;
- tk->elnum = e_num;
- set_orel(e_num, &elems);
- }
- else if ( node->ntype==nRuleRef ) {
- RuleRefNode *rn = (RuleRefNode *)((Junction *)zzaArg(zztasp2,2 ).left)->p1;
- rn->elnum = e_num;
- set_orel(e_num, rulesrefd);
- }
- }
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- if ( n == 0 ) g = emptyAlt();
- zzaArg(zztasp1,0) = g;
- /* We want to reduce number of LT(i) calls and the number of
- * local attribute variables in C++ mode (for moment, later we'll
- * do for C also). However, if trees are being built, they
- * require most of the attrib variables to create the tree nodes
- * with; therefore, we gen a token ptr for each token ref in C++
- */
- if ( GenCC && !GenAST )
- {
- /* This now free's the temp set -ATG 5/6/95 */
- set temp;
- temp = set_and(elems, attribsRefdFromAction);
- set_orin( toksrefd, temp);
- set_free(temp);
-}
-else set_orin( toksrefd, elems);
-if ( GenCC ) {
- dif = set_dif(attribsRefdFromAction, elems);
- if ( set_deg(dif)>0 )
- err("one or more $i in action(s) refer to non-token elements");
- set_free(dif);
-}
-set_free(elems);
-set_free(attribsRefdFromAction);
-inAlt = 0;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd6, 0x2);
- }
-}
-
-LabelEntry *
-#ifdef __USE_PROTOS
-element_label(void)
-#else
-element_label()
-#endif
-{
- LabelEntry * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(LabelEntry * ))
- zzMake0;
- {
- TermEntry *t=NULL; LabelEntry *l=NULL; RuleEntry *r=NULL; char *lab;
- zzmatch(LABEL);
- lab = mystrdup(LATEXT(1));
- zzCONSUME;
-
-
- UsedNewStyleLabel = 1;
- if ( UsedOldStyleAttrib ) err("cannot mix with new-style labels with old-style $i");
- t = (TermEntry *) hash_get(Tname, lab);
- if ( t==NULL ) t = (TermEntry *) hash_get(Texpr, lab);
- if ( t==NULL ) r = (RuleEntry *) hash_get(Rname, lab);
- if ( t!=NULL ) {
- err(eMsg1("label definition clashes with token/tokclass definition: '%s'", lab));
- _retv = NULL;
- }
- else if ( r!=NULL ) {
- err(eMsg1("label definition clashes with rule definition: '%s'", lab));
- _retv = NULL;
- }
- else {
- /* we don't clash with anybody else */
- l = (LabelEntry *) hash_get(Elabel, lab);
- if ( l==NULL ) { /* ok to add new element label */
- l = (LabelEntry *)hash_add(Elabel,
- lab,
- (Entry *)newLabelEntry(lab));
- /* add to list of element labels for this rule */
- list_add(&CurElementLabels, (void *)lab);
- /* MR7 */ leAdd(l); /* list of labels waiting for exception group definitions */
- _retv = l;
- }
- else {
- err(eMsg1("label definitions must be unique per rule: '%s'", lab));
- _retv = NULL;
-}
-}
- zzmatch(106); zzCONSUME;
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd6, 0x4);
- return _retv;
- }
-}
-
-Node *
-#ifdef __USE_PROTOS
-element(int old_not,int first_on_line,int use_def_MT_handler)
-#else
-element(old_not,first_on_line,use_def_MT_handler)
- int old_not;
-int first_on_line;
-int use_def_MT_handler ;
-#endif
-{
- Node * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(Node * ))
- zzMake0;
- {
-
- Attrib blk;
- Predicate *pred = NULL;
- int local_use_def_MT_handler=0;
- ActionNode *act;
- RuleRefNode *rr;
- set toksrefd, rulesrefd;
- TermEntry *term;
- TokNode *p=NULL; RuleRefNode *q; int approx=0;
- LabelEntry *label=NULL;
- int predMsgDone=0;
- int semDepth=0;
- int ampersandStyle;
- int height; /* MR11 */
- int equal_height; /* MR11 */
-
- char* pFirstSetSymbol = NULL; /* MR21 */
-
- _retv = NULL;
- if ( (setwd6[LA(1)]&0x8) ) {
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==LABEL) ) {
- label = element_label();
-
- }
- else {
- if ( (setwd6[LA(1)]&0x10) ) {
- }
- else {zzFAIL(1,zzerr28,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
-
- term = (TermEntry *) hash_get(Tname, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- zzaRet.left = zzaRet.right = NULL;
- }
- else {
- zzaRet = buildToken(LATEXT(1));
- p=((TokNode *)((Junction *)zzaRet.left)->p1);
- term = (TermEntry *) hash_get(Tname, LATEXT(1));
- require( term!= NULL, "hash table mechanism is broken");
- p->tclass = term->tclass;
- p->complement = old_not;
- if ( label!=NULL ) {
- p->el_label = label->str;
- label->elem = (Node *)p;
- }
- }
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==119) ) {
- zzmatch(119); zzCONSUME;
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- if ( p!=NULL ) setUpperRange(p, LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- if ( p!=NULL ) setUpperRange(p, LATEXT(1));
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr29,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
- }
- else {
- if ( (setwd6[LA(1)]&0x20) ) {
- }
- else {zzFAIL(1,zzerr30,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
-
- if ( p!=NULL && (p->upper_range!=0 || p->tclass || old_not) )
- list_add(&MetaTokenNodes, (void *)p);
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==125) ) {
- zzmatch(125);
- if ( p!=NULL ) p->astnode=ASTroot;
- zzCONSUME;
-
- }
- else {
- if ( (setwd6[LA(1)]&0x40) ) {
- if ( p!=NULL ) p->astnode=ASTchild;
- }
- else {
- if ( (LA(1)==103) ) {
- zzmatch(103);
- if ( p!=NULL ) p->astnode=ASTexclude;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr31,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp3);
- }
- }
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==88) ) {
- zzmatch(88);
- local_use_def_MT_handler = 1;
- zzCONSUME;
-
- }
- else {
- if ( (setwd6[LA(1)]&0x80) ) {
- }
- else {zzFAIL(1,zzerr32,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
-
- if ( p!=NULL && first_on_line ) {
- CurAltStart = (Junction *)zzaRet.left;
- altAdd(CurAltStart); /* MR7 */
- p->altstart = CurAltStart;
- }
- if ( p!=NULL )
- p->use_def_MT_handler = use_def_MT_handler || local_use_def_MT_handler;
- _retv = (Node *)p;
- }
- else {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
-
- term = (TermEntry *) hash_get(Texpr, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- zzaRet.left = zzaRet.right = NULL;
- }
- else {
- zzaRet = buildToken(LATEXT(1)); p=((TokNode *)((Junction *)zzaRet.left)->p1);
- p->complement = old_not;
- if ( label!=NULL ) {
- p->el_label = label->str;
- label->elem = (Node *)p;
- }
- }
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==119) ) {
- zzmatch(119); zzCONSUME;
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==QuotedTerm) ) {
- zzmatch(QuotedTerm);
- if ( p!=NULL ) setUpperRange(p, LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
- if ( p!=NULL ) setUpperRange(p, LATEXT(1));
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr33,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
- }
- else {
- if ( (setwd7[LA(1)]&0x1) ) {
- }
- else {zzFAIL(1,zzerr34,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==125) ) {
- zzmatch(125);
- if ( p!=NULL ) p->astnode=ASTroot;
- zzCONSUME;
-
- }
- else {
- if ( (setwd7[LA(1)]&0x2) ) {
- if ( p!=NULL ) p->astnode=ASTchild;
- }
- else {
- if ( (LA(1)==103) ) {
- zzmatch(103);
- if ( p!=NULL ) p->astnode=ASTexclude;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr35,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp3);
- }
- }
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==88) ) {
- zzmatch(88);
- local_use_def_MT_handler = 1;
- zzCONSUME;
-
- }
- else {
- if ( (setwd7[LA(1)]&0x4) ) {
- }
- else {zzFAIL(1,zzerr36,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
-
- if ( p!=NULL && (p->upper_range!=0 || p->tclass || old_not) )
- list_add(&MetaTokenNodes, (void *)p);
-
- if ( first_on_line ) {
- CurAltStart = (Junction *)zzaRet.left;
- altAdd(CurAltStart); /* MR7 */
- p->altstart = CurAltStart;
- }
- if ( p!=NULL )
- p->use_def_MT_handler = use_def_MT_handler || local_use_def_MT_handler;
- _retv = (Node *)p;
- }
- else {
- if ( (LA(1)==WildCard) ) {
- if ( old_not ) warn("~ WILDCARD is an undefined operation (implies 'nothing')");
- zzmatch(WildCard);
- zzaRet = buildWildCard(LATEXT(1)); p=((TokNode *)((Junction *)zzaRet.left)->p1);
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==125) ) {
- zzmatch(125);
- p->astnode=ASTroot;
- zzCONSUME;
-
- }
- else {
- if ( (setwd7[LA(1)]&0x8) ) {
- p->astnode=ASTchild;
- }
- else {
- if ( (LA(1)==103) ) {
- zzmatch(103);
- p->astnode=ASTexclude;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr37,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp3);
- }
- }
- list_add(&MetaTokenNodes, (void *)p);
-
- if ( first_on_line ) {
- CurAltStart = (Junction *)zzaRet.left;
- altAdd(CurAltStart); /* MR7 */
- p->altstart = CurAltStart;
- if ( label!=NULL ) {
- p->el_label = label->str;
- label->elem = (Node *)p;
- }
- }
- _retv = (Node *)p;
- }
- else {
- if ( (LA(1)==NonTerminal) ) {
- if ( old_not ) warn("~ NONTERMINAL is an undefined operation");
- zzmatch(NonTerminal);
- zzaRet = buildRuleRef(LATEXT(1));
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==103) ) {
- zzmatch(103);
- q = (RuleRefNode *) ((Junction *)zzaRet.left)->p1;
- q->astnode=ASTexclude;
- zzCONSUME;
-
- }
- else {
- if ( (setwd7[LA(1)]&0x10) ) {
- }
- else {zzFAIL(1,zzerr38,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (setwd7[LA(1)]&0x20) ) {
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==104) ) {
- zzmatch(104); zzCONSUME;
- }
- else {
- if ( (LA(1)==PassAction) ) {
- }
- else {zzFAIL(1,zzerr39,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
- zzmatch(PassAction);
- addParm(((Junction *)zzaRet.left)->p1, LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd7[LA(1)]&0x40) ) {
- }
- else {zzFAIL(1,zzerr40,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- rr=(RuleRefNode *) ((Junction *)zzaRet.left)->p1;
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- char *a;
- if ( (LA(1)==105) ) {
- zzmatch(105); zzCONSUME;
- zzmatch(PassAction);
-
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule element: cannot allocate assignment");
- strcpy(a, LATEXT(1));
- rr->assign = a;
- zzCONSUME;
-
- }
- else {
- if ( (setwd7[LA(1)]&0x80) ) {
- }
- else {zzFAIL(1,zzerr41,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
-
- if ( label!=NULL ) {
- rr->el_label = label->str;
- label->elem = (Node *)rr;
- }
- if ( first_on_line ) {
- CurAltStart = (Junction *)zzaRet.left;
- altAdd(CurAltStart); /* MR7 */
- ((RuleRefNode *)((Junction *)zzaRet.left)->p1)->altstart = CurAltStart;
- }
- _retv = (Node *)rr;
- }
- else {zzFAIL(1,zzerr42,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (LA(1)==Action) ) {
- if ( old_not ) warn("~ ACTION is an undefined operation");
- zzmatch(Action);
- zzaArg(zztasp1,0) = buildAction(LATEXT(1),action_file,action_line, 0);
- zzCONSUME;
-
- if ( first_on_line ) { /* MR7 */
- CurAltStart = (Junction *)zzaArg(zztasp1,0 ).left; /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };
- _retv = (Node *) ((Junction *)zzaArg(zztasp1,0 ).left)->p1;
- }
- else {
- if ( (LA(1)==Pred) ) {
- if ( old_not ) warn("~ SEMANTIC-PREDICATE is an undefined operation");
- zzmatch(Pred);
- zzaArg(zztasp1,0) = buildAction(LATEXT(1),action_file,action_line, 1);
- zzCONSUME;
-
- act = (ActionNode *) ((Junction *)zzaArg(zztasp1,0 ).left)->p1;
- if (numericActionLabel) { /* MR10 */
- list_add(&NumericPredLabels,act); /* MR10 */
- numericActionLabel=0; /* MR10 */
- }; /* MR10 */
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- char *a;
- if ( (LA(1)==PassAction) ) {
- zzmatch(PassAction);
-
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule element: cannot allocate predicate fail action");
- strcpy(a, LATEXT(1));
- act->pred_fail = a;
- zzCONSUME;
-
- }
- else {
- if ( (setwd8[LA(1)]&0x1) ) {
- }
- else {zzFAIL(1,zzerr43,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- if ( first_on_line ) { /* MR7 */
- CurAltStart = (Junction *)zzaArg(zztasp1,0 ).left; /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };
- _retv = (Node *)act;
- }
- else {
- if ( (setwd8[LA(1)]&0x2) ) {
- if ( old_not ) warn("~ BLOCK is an undefined operation");
- BlkLevel++;
- if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
- /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
- /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==Pragma) ) {
- zzmatch(Pragma); zzCONSUME;
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==126) ) {
- zzmatch(126);
- approx=LL_k;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==127) ) {
- zzmatch(127);
- approx = 1;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==128) ) {
- zzmatch(128);
- approx = 2;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr44,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (setwd8[LA(1)]&0x4) ) {
- }
- else {zzFAIL(1,zzerr45,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==FirstSetSymbol) ) {
- zzmatch(FirstSetSymbol); zzCONSUME;
- zzmatch(114); zzCONSUME;
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==NonTerminal) ) {
- zzmatch(NonTerminal);
-
- /* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
- /* MR21 */ sizeof(char));
- /* MR21 */ require(pFirstSetSymbol!=NULL,
- /* MR21 */ "cannot allocate first set name");
- /* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
- /* MR21 */
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
-
- /* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
- /* MR21 */ sizeof(char));
- /* MR21 */ require(pFirstSetSymbol!=NULL,
- /* MR21 */ "cannot allocate first set name");
- /* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
- /* MR21 */
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr46,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- zzmatch(115); zzCONSUME;
- }
- else {
- if ( (setwd8[LA(1)]&0x8) ) {
- }
- else {zzFAIL(1,zzerr47,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==114) ) {
- zzmatch(114); zzCONSUME;
- block( &toksrefd,&rulesrefd );
- zzmatch(115);
- blk = zzaRet = zzaArg(zztasp2,2);
- /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
- /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
- --BlkLevel;
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==129) ) {
- zzmatch(129);
- zzaRet = makeLoop(zzaRet,approx,pFirstSetSymbol);
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==130) ) {
- zzmatch(130);
- zzaRet = makePlus(zzaRet,approx,pFirstSetSymbol);
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==131) ) {
- zzmatch(131); zzCONSUME;
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (setwd8[LA(1)]&0x10) ) {
- {
- zzBLOCK(zztasp5);
- zzMake0;
- {
- if ( (LA(1)==132) ) {
- zzmatch(132);
- ampersandStyle=0;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==113) ) {
- zzmatch(113);
- ampersandStyle=1;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr48,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp5);
- }
- }
- zzmatch(Pred);
- zzaRet = buildAction(LATEXT(1),action_file,action_line,1);
- zzCONSUME;
-
- act = (ActionNode *) ((Junction *)zzaRet.left)->p1;
- semDepth=predicateLookaheadDepth(act);
- if (numericActionLabel) { /* MR10 */
- list_add(&NumericPredLabels,act); /* MR10 */
- numericActionLabel=0; /* MR10 */
- }; /* MR10 */
- {
- zzBLOCK(zztasp5);
- zzMake0;
- {
- char *a;
- if ( (LA(1)==PassAction) ) {
- zzmatch(PassAction);
-
- a = (char *)calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule element: cannot allocate predicate fail action");
- strcpy(a, LATEXT(1));
- act->pred_fail = a;
- zzCONSUME;
-
- }
- else {
- if ( (setwd8[LA(1)]&0x20) ) {
- }
- else {zzFAIL(1,zzerr49,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp5);
- }
- }
- if ( first_on_line) { /* MR7 */
- CurAltStart=(Junction *)zzaRet.left; /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };
- _retv = (Node *)act;
-
- pred = computePredFromContextGuard(blk,&predMsgDone); /* MR10 */
- if ( pred==NULL) { /* MR10 */
- if ( !predMsgDone) err("invalid or missing context guard"); /* MR10 */
- predMsgDone=1; /* MR10 */
- } else { /* MR10 */
- act->guardNodes=(Junction *)blk.left; /* MR11 */
- pred->expr = act->action;
- pred->source = act;
- /* MR10 */ pred->ampersandStyle = ampersandStyle; /* 0 means (g)? => ... 1 means (g)? && ... */
- /* MR13 */ if (pred->tcontext != NULL) {
- /* MR13 */ height=MR_max_height_of_tree(pred->tcontext);
- /* MR13 */ equal_height=MR_all_leaves_same_height(pred->tcontext,height);
- /* MR13 */ if (! equal_height) {
- /* MR13 */ errFL("in guarded predicates all tokens in the guard must be at the same height",
- /* MR13 */ FileStr[act->file],act->line);
- /* MR13 */ };
- /* MR13 */ }
- /* MR10 */ if (ampersandStyle) {
- /* MR10 */ act->ampersandPred = pred;
- /* MR11 */ if (! HoistPredicateContext) {
- /* MR11 */ errFL("without \"-prc on\" (guard)? && <<pred>>? ... doesn't make sense",
- /* MR11 */ FileStr[act->file],act->line);
- /* MR11 */ };
- /* MR10 */ } else {
- /* MR10 */ act->guardpred = pred;
- /* MR10 */ };
- /* MR10 */ if (pred->k != semDepth) {
- /* MR10 */ warn(eMsgd2("length of guard (%d) does not match the length of semantic predicate (%d)",
- /* MR10 */ pred->k,semDepth));
- /* MR10 */ };
- }
- }
- else {
- if ( (setwd8[LA(1)]&0x40) ) {
- zzaRet = makeBlk(zzaRet,approx,pFirstSetSymbol);
- FoundGuessBlk = 1;
- ((Junction *) ((Junction *)zzaRet.left)->p1)->guess=1;
- if ( ! first_on_line ) {
- err("(...)? predicate must be first element of production");
- }
- }
- else {zzFAIL(1,zzerr50,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
- }
- else {
- if ( (setwd8[LA(1)]&0x80) ) {
- zzaRet = makeBlk(zzaRet,approx,pFirstSetSymbol);
- }
- else {zzFAIL(1,zzerr51,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- zzEXIT(zztasp3);
- }
- }
-
- if ( pred==NULL && !predMsgDone) { /* MR10 */
- ((Junction *)((Junction *)zzaRet.left)->p1)->blockid = CurBlockID;
- ((Junction *)((Junction *)zzaRet.left)->p1)->tokrefs = toksrefd;
- ((Junction *)((Junction *)zzaRet.left)->p1)->rulerefs = rulesrefd;
- if ( first_on_line ) { /* MR7 */
- CurAltStart = (Junction *)((Junction *)((Junction *)zzaRet.left)->p1); /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- }; /* MR7 */
- _retv = (Node *) ((Junction *)zzaRet.left)->p1;
- }
- }
- else {
- if ( (LA(1)==102) ) {
- zzmatch(102); zzCONSUME;
- block( &toksrefd,&rulesrefd );
- zzaRet = makeOpt(zzaArg(zztasp2,2),approx,pFirstSetSymbol);
- /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
- /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
- --BlkLevel;
- zzmatch(98);
-
- ((Junction *)((Junction *)zzaRet.left)->p1)->blockid = CurBlockID;
- ((Junction *)((Junction *)zzaRet.left)->p1)->tokrefs = toksrefd;
- ((Junction *)((Junction *)zzaRet.left)->p1)->rulerefs = rulesrefd;
- zzCONSUME;
-
- if ( first_on_line ) { /* MR7 */
- CurAltStart = (Junction *) ((Junction *)((Junction *)zzaRet.left)->p1); /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };
- _retv = (Node *) ((Junction *)zzaRet.left)->p1;
- }
- else {zzFAIL(1,zzerr52,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (LA(1)==129) ) {
- zzmatch(129);
- warn("don't you want a ')' with that '*'?"); CannotContinue=TRUE;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==130) ) {
- zzmatch(130);
- warn("don't you want a ')' with that '+'?"); CannotContinue=TRUE;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==105) ) {
- zzmatch(105);
- warn("'>' can only appear after a nonterminal"); CannotContinue=TRUE;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==PassAction) ) {
- zzmatch(PassAction);
- warn("[...] out of context 'rule > [...]'");
- CannotContinue=TRUE;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr53,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- }
- }
- }
- }
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd9, 0x1);
- return _retv;
- }
-}
-
-void
-#ifdef __USE_PROTOS
-default_exception_handler(void)
-#else
-default_exception_handler()
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- DefaultExGroup = exception_group();
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd9, 0x2);
- }
-}
-
-ExceptionGroup *
-#ifdef __USE_PROTOS
-exception_group(void)
-#else
-exception_group()
-#endif
-{
- ExceptionGroup * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(ExceptionGroup * ))
- zzMake0;
- {
- ExceptionHandler *h; LabelEntry *label=NULL; /* MR6 */
- FoundException = 1; FoundExceptionGroup = 1;
- zzmatch(133);
- _retv = (ExceptionGroup *)calloc(1, sizeof(ExceptionGroup));
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- char *p;
- if ( (LA(1)==PassAction) ) {
- zzmatch(PassAction);
-
- p = LATEXT(1)+1;
- p[strlen(p)-1] = '\0'; /* kill trailing space */
- label = (LabelEntry *) hash_get(Elabel, LATEXT(1)+1);
- if ( label==NULL )
- {
- err(eMsg1("unknown label in exception handler: '%s'", LATEXT(1)+1));
- }
- zzCONSUME;
-
- }
- else {
- if ( (setwd9[LA(1)]&0x4) ) {
- }
- else {zzFAIL(1,zzerr54,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==135) ) {
- h = exception_handler();
-
- list_add(&(_retv->handlers), (void *)h);
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==134) ) {
- zzmatch(134); zzCONSUME;
- zzmatch(106); zzCONSUME;
- zzmatch(Action);
- {
- ExceptionHandler *eh = (ExceptionHandler *)
- calloc(1, sizeof(ExceptionHandler));
- char *a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(eh!=NULL, "exception: cannot allocate handler");
- require(a!=NULL, "exception: cannot allocate action");
- strcpy(a, LATEXT(1));
- eh->action = a;
- eh->signalname = (char *) calloc(strlen("default")+1, sizeof(char));
- require(eh->signalname!=NULL, "exception: cannot allocate sig name");
- strcpy(eh->signalname, "default");
- list_add(&(_retv->handlers), (void *)eh);
- }
- zzCONSUME;
-
- }
- else {
- if ( (setwd9[LA(1)]&0x8) ) {
- }
- else {zzFAIL(1,zzerr55,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
-
- if ( label!=NULL ) {
- /* Record ex group in sym tab for this label */
- if ( label->ex_group!=NULL ) {
- err(eMsg1("duplicate exception handler for label '%s'",label->str));
- } else {
- label->ex_group = _retv;
- /* Label the exception group itself */
- _retv->label = label->str;
- /* Make the labelled element pt to the exception also */
- /* MR6 */ if (label->elem == NULL) {
- /* MR6 */ err(eMsg1("reference in exception handler to undefined label '%s'",label->str));
- /* MR6 */ } else {
- switch ( label->elem->ntype ) {
- case nRuleRef :
- {
- RuleRefNode *r = (RuleRefNode *)label->elem;
- r->ex_group = _retv;
- break;
- }
- case nToken :
- {
- TokNode *t = (TokNode *)label->elem;
- t->ex_group = _retv;
- break;
- }
- } /* end switch */
- /* MR6 */ }; /* end test on label->elem */
- } /* end test on label->ex_group */
-
- } /* end test on exception label */
-
-/* MR7 */
- /* MR7 */ if (BlkLevel == 1 && label == NULL) {
- /* MR7 */ _retv->forRule=1;
- /* MR7 */ } else if (label == NULL) {
- /* MR7 */ _retv->altID = makeAltID(CurBlockID_array[BlkLevel], CurAltNum_array[BlkLevel]);
- /* MR7 */ egAdd(_retv);
- /* MR7 */ } else {
- /* MR7 */ _retv->labelEntry=label;
- /* MR7 */ };
- /* MR7 */
- /* MR7 */ /* You may want to remove this exc from the rule list */
- /* MR7 */ /* and handle at the labeled element site. */
- /* MR7 */
- /* MR7 */ if (label != NULL) {
- /* MR7 */ _retv = NULL;
- /* MR7 */ };
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd9, 0x10);
- return _retv;
- }
-}
-
-ExceptionHandler *
-#ifdef __USE_PROTOS
-exception_handler(void)
-#else
-exception_handler()
-#endif
-{
- ExceptionHandler * _retv;
- zzRULE;
- zzBLOCK(zztasp1);
- PCCTS_PURIFY(_retv,sizeof(ExceptionHandler * ))
- zzMake0;
- {
- ;
- zzmatch(135);
-
- _retv = (ExceptionHandler *)calloc(1, sizeof(ExceptionHandler));
- require(_retv!=NULL, "exception: cannot allocate handler");
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==NonTerminal) ) {
- zzmatch(NonTerminal);
-
- _retv->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(_retv->signalname!=NULL, "exception: cannot allocate sig name");
- strcpy(_retv->signalname, LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==TokenTerm) ) {
- zzmatch(TokenTerm);
-
- _retv->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(_retv->signalname!=NULL, "exception: cannot allocate sig name");
- strcpy(_retv->signalname, LATEXT(1));
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr56,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(106); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- _retv->action = NULL;
- if ( (LA(1)==Action) ) {
- zzmatch(Action);
-
- _retv->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(_retv->action!=NULL, "exception: cannot allocate action");
- strcpy(_retv->action, LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd9[LA(1)]&0x20) ) {
- }
- else {zzFAIL(1,zzerr57,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return _retv;
-fail:
- zzEXIT(zztasp1);
- CannotContinue=TRUE;
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd9, 0x40);
- return _retv;
- }
-}
-
-void
-#ifdef __USE_PROTOS
-enum_file(char * fname)
-#else
-enum_file(fname)
- char *fname ;
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (setwd9[LA(1)]&0x80) ) {
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==143) ) {
- zzmatch(143); zzCONSUME;
- zzmatch(ID); zzCONSUME;
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==149) ) {
- zzmatch(149); zzCONSUME;
- zzmatch(ID); zzCONSUME;
- }
- else {
- if ( (setwd10[LA(1)]&0x1) ) {
- }
- else {zzFAIL(1,zzerr58,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (setwd10[LA(1)]&0x2) ) {
- }
- else {zzFAIL(1,zzerr59,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==151) ) {
- {
- zzBLOCK(zztasp3);
- int zzcnt=1;
- zzMake0;
- {
- do {
- enum_def( fname );
- zzLOOP(zztasp3);
- } while ( (LA(1)==151) );
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (LA(1)==149) ) {
- defines( fname );
- }
- else {zzFAIL(1,zzerr60,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (LA(1)==Eof) ) {
- }
- else {zzFAIL(1,zzerr61,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd10, 0x4);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-defines(char * fname)
-#else
-defines(fname)
- char *fname ;
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- int v; int maxt=(-1); char *t;
- {
- zzBLOCK(zztasp2);
- int zzcnt=1;
- zzMake0;
- {
- do {
- zzmatch(149); zzCONSUME;
- zzmatch(ID);
- t = mystrdup(LATEXT(1));
- zzCONSUME;
-
- zzmatch(INT);
-
- v = atoi(LATEXT(1));
- /* fprintf(stderr, "#token %s=%d\n", t, v);*/
-
- /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
- /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
- /* MR2 Don't let #tokdefs be confused by */
- /* MR2 DLGminToken and DLGmaxToken */
-
- if ( ! isDLGmaxToken(t)) { /* MR2 */
- TokenNum = v;
- if ( v>maxt ) maxt=v;
- if ( Tnum( t ) == 0 ) {
- addForcedTname( t, v );
- } else {
- warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline);
- };
-};
- zzCONSUME;
-
- zzLOOP(zztasp2);
- } while ( (LA(1)==149) );
- zzEXIT(zztasp2);
- }
- }
- TokenNum = maxt + 1;
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd10, 0x8);
- }
-}
-
-void
-#ifdef __USE_PROTOS
-enum_def(char * fname)
-#else
-enum_def(fname)
- char *fname ;
-#endif
-{
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- int v= 0; int maxt=(-1); char *t;
- zzmatch(151); zzCONSUME;
- zzmatch(ID); zzCONSUME;
- zzmatch(152); zzCONSUME;
- zzmatch(ID);
- t = mystrdup(LATEXT(1));
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==153) ) {
- zzmatch(153); zzCONSUME;
- zzmatch(INT);
- v=atoi(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd10[LA(1)]&0x10) ) {
- v++;
- }
- else {zzFAIL(1,zzerr62,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
-
- /* fprintf(stderr, "#token %s=%d\n", t, v);*/
- TokenNum = v;
- if ( v>maxt ) maxt=v; /* MR3 */
- if ( Tnum( t ) == 0 ) addForcedTname( t, v );
- else {
- warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline);
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==154) ) {
- zzmatch(154); zzCONSUME;
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==ID)&&(isDLGmaxToken(LATEXT(1))) ) {
- if (!(isDLGmaxToken(LATEXT(1))) ) {zzfailed_pred(" isDLGmaxToken(LATEXT(1))",0 /* report */, { 0; /* no user action */ } );}
- zzmatch(ID); zzCONSUME;
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==153) ) {
- zzmatch(153); zzCONSUME;
- zzmatch(INT); zzCONSUME;
- }
- else {
- if ( (setwd10[LA(1)]&0x20) ) {
- }
- else {zzFAIL(1,zzerr63,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
- }
- else {
- if ( (LA(1)==ID) ) {
- zzmatch(ID);
- t = mystrdup(LATEXT(1));
- zzCONSUME;
-
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==153) ) {
- zzmatch(153); zzCONSUME;
- zzmatch(INT);
- v=atoi(LATEXT(1));
- zzCONSUME;
-
- }
- else {
- if ( (setwd10[LA(1)]&0x40) ) {
- v++;
- }
- else {zzFAIL(1,zzerr64,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp4);
- }
- }
-
- /* fprintf(stderr, "#token %s=%d\n", t, v);*/
- TokenNum = v;
- if ( v>maxt ) maxt=v; /* MR3 */
- if ( Tnum( t ) == 0 ) addForcedTname( t, v );
- else {
- warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline);
- }
- }
- else {
- if ( (setwd10[LA(1)]&0x80) ) {
- }
- else {zzFAIL(1,zzerr65,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp3);
- }
- }
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(155); zzCONSUME;
- zzmatch(156);
- TokenNum = maxt + 1;
- zzCONSUME;
-
- zzEXIT(zztasp1);
- return;
-fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd11, 0x1);
- }
-}
-
-
-/* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
-/* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
-/* MR2 Don't let #tokdefs be confused by */
-/* MR2 DLGminToken and DLGmaxToken */
-
-/* semantic check on DLGminToken and DLGmaxmaxToken in #tokdefs */
-
-#ifdef __USE_PROTOS
-static int isDLGmaxToken(char *Token)
-#else
-static int isDLGmaxToken(Token)
-char * Token;
-#endif
-{
-static char checkStr1[] = "DLGmaxToken";
-static char checkStr2[] = "DLGminToken";
-
- if (strcmp(Token, checkStr1) == 0)
-return 1;
-else if (strcmp(Token, checkStr2) == 0)
-return 1;
-else
-return 0;
-}
-
-/* semantics of #token */
-static void
-#ifdef __USE_PROTOS
-chkToken(char *t, char *e, char *a, int tnum)
-#else
-chkToken(t,e,a,tnum)
-char *t, *e, *a;
-int tnum;
-#endif
-{
-TermEntry *p;
-
- /* check to see that they don't try to redefine a token as a token class */
-if ( t!=NULL ) {
-p = (TermEntry *) hash_get(Tname, t);
-if ( p!=NULL && p->classname ) {
- err(eMsg1("redefinition of #tokclass '%s' to #token not allowed; ignored",t));
- if ( a!=NULL ) free((char *)a);
- return;
-}
-}
-
- if ( t==NULL && e==NULL ) { /* none found */
-err("#token requires at least token name or rexpr");
-}
-else if ( t!=NULL && e!=NULL ) { /* both found */
-if ( UserDefdTokens ) { /* if #tokdefs, must not define new */
- p = (TermEntry *) hash_get(Tname, t);
- if ( p == NULL) {
- err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
- return;
- };
-}
-Tklink(t, e);
-if ( a!=NULL ) {
- if ( hasAction(e) ) {
- err(eMsg1("redefinition of action for %s; ignored",e));
- }
- else setHasAction(e, a);
-}
-}
-else if ( t!=NULL ) { /* only one found */
-if ( UserDefdTokens ) {
- p = (TermEntry *) hash_get(Tname, t);
- if (p == NULL) {
- err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
- };
- return;
-}
-if ( Tnum( t ) == 0 ) addTname( t );
-else {
- err(eMsg1("redefinition of token %s; ignored",t));
-}
-if ( a!=NULL ) {
- err(eMsg1("action cannot be attached to a token name (%s); ignored",t));
- free((char *)a);
-}
-}
-else if ( e!=NULL ) {
-if ( Tnum( e ) == 0 ) addTexpr( e );
-else {
- if ( hasAction(e) ) {
- err(eMsg1("redefinition of action for expr %s; ignored",e));
- }
- else if ( a==NULL ) {
- err(eMsg1("redefinition of expr %s; ignored",e));
- }
-}
-if ( a!=NULL ) setHasAction(e, a);
-}
-
- /* if a token type number was specified, then add the token ID and 'tnum'
-* pair to the ForcedTokens list. (only applies if an id was given)
-*/
-if ( t!=NULL && tnum>0 )
-{
-if ( set_el(tnum, reserved_positions) )
-{
- err(eMsgd("a token has already been forced to token number %d; ignored", tnum));
-}
-else
-{
- list_add(&ForcedTokens, newForcedToken(t,tnum));
- set_orel(tnum, &reserved_positions);
-}
-}
-}
-
-static int
-#ifdef __USE_PROTOS
-match_token(char *s, char **nxt)
-#else
-match_token(s,nxt)
-char *s;
-char **nxt;
-#endif
-{
- if ( !(*s>='A' && *s<='Z') ) return 0;
- s++;
- while ( (*s>='a' && *s<='z') ||
- (*s>='A' && *s<='Z') ||
- (*s>='0' && *s<='9') ||
- *s=='_' )
- {
- s++;
- }
- if ( *s!=' ' && *s!='}' ) return 0;
- *nxt = s;
- return 1;
-}
-
-static int
-#ifdef __USE_PROTOS
-match_rexpr(char *s, char **nxt)
-#else
-match_rexpr(s,nxt)
-char *s;
-char **nxt;
-#endif
-{
- if ( *s!='"' ) return 0;
- s++;
- while ( *s!='"' )
- {
- if ( *s=='\n' || *s=='\r' ) /* MR13 */
- warn("eoln found in regular expression");
- if ( *s=='\\' ) s++;
- s++;
- }
- *nxt = s+1;
- return 1;
-}
-
-/*
-* Walk a string "{ A .. Z }" where A..Z is a space separated list
-* of token references (either labels or reg exprs). Return a
-* string "inlineX_set" for some unique integer X. Basically,
-* we pretend as if we had seen "#tokclass inlineX { A .. Z }"
-* on the input stream outside of an action.
-*/
-char *
-#ifdef __USE_PROTOS
-inline_set(char *s)
-#else
-inline_set(s)
-char *s;
-#endif
-{
- char *nxt;
- fprintf(stderr, "found consumeUntil( {...} )\n");
- while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
- if ( *s!='{' )
- {
- err("malformed consumeUntil( {...} ); missing '{'");
- return "bad_set";
- }
- s++;
- while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
- while ( *s!='}' )
- {
- if ( match_token(s,&nxt) ) fprintf(stderr, "found token %s\n", s);
- else if ( match_rexpr(s,&nxt) ) fprintf(stderr, "found rexpr %s\n", s);
- else {
- err("invalid element in consumeUntil( {...} )");
- return "bad_set";
- }
- s = nxt;
- while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
- }
- return "inlineX_set";
-}
-
-/* ANTLR-specific syntax error message generator
-* (define USER_ZZSYN when compiling so don't get 2 definitions)
-*/
-void
-#ifdef __USE_PROTOS
-zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok,
-int k, char *bad_text)
-#else
-zzsyn(text, tok, egroup, eset, etok, k, bad_text)
-char *text, *egroup, *bad_text;
-int tok;
-int etok;
-int k;
-SetWordType *eset;
-#endif
-{
-fprintf(stderr, ErrHdr, FileStr[CurFile]!=NULL?FileStr[CurFile]:"stdin", zzline);
-fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
-if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
-if ( k==1 ) fprintf(stderr, " missing");
-else
-{
-fprintf(stderr, "; \"%s\" not", bad_text);
-if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
-}
-if ( zzset_deg(eset)>0 ) zzedecode(eset);
-else fprintf(stderr, " %s", zztokens[etok]);
-if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
-fprintf(stderr, "\n");
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g
deleted file mode 100644
index e6eda6010c..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.g
+++ /dev/null
@@ -1,2586 +0,0 @@
-/*
- * antlr.g -- PCCTS Version 1.xx ANTLR
- *
- * Parse an antlr input grammar and build a syntax-diagram.
- *
- * Written in itself (needs at least 1.06 to work)
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-1995
- */
-
-/* MR1 */
-/* MR1 10-Apr-97 MR1 Replace #if logic with #include "pcctscfg.h" */
-/* MR1 */
-
-#header <<
- #include "pcctscfg.h"
- #include "set.h"
- #include <ctype.h>
- #include "syn.h"
- #include "hash.h"
- #include "generic.h"
- #define zzcr_attr(attr,tok,t)
- >>
-
-<<
-
-/* MR20 G. Hobbelt For Borland C++ 4.x & 5.x compiling with ALL warnings enabled */
-#if defined(__TURBOC__)
-#pragma warn -aus /* unused assignment of 'xxx' */
-#endif
-
-
-#ifdef __USE_PROTOS
-static void chkToken(char *, char *, char *, int);
-#else
-static void chkToken();
-#endif
-
-#ifdef __USE_PROTOS
-static int isDLGmaxToken(char *Token); /* MR3 */
-#else
-static int isDLGmaxToken(); /* MR3 */
-#endif
-
-static int class_nest_level = 0;
-
-/* MR20 G. Hobbelt extern definitions moved to antlr.h */
-
->>
-
-#lexaction <<
-/* maintained, but not used for now */
-set AST_nodes_refd_in_actions = set_init;
-int inAlt = 0;
-set attribsRefdFromAction = set_init; /* MR20 */
-int UsedOldStyleAttrib = 0;
-int UsedNewStyleLabel = 0;
-#ifdef __USE_PROTOS
-char *inline_set(char *);
-#else
-char *inline_set();
-#endif
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
-/* MR1 in DLG action */
-
-int tokenActionActive=0; /* MR1 */
-
->>
-
-#lexclass STRINGS
-#token QuotedTerm "\"" << zzmode(START); >>
-#token "\n|\r|\r\n" <<
- zzline++;
- warn("eoln found in string");
- zzskip();
- >>
-#token "\\(\n|\r|\r\n)" << zzline++; zzmore(); >>
-#token "\\~[]" << zzmore(); >>
-#token "~[\n\r\"\\]+" << zzmore(); >>
-
-#lexclass ACTION_STRINGS
-#token "\"" << zzmode(ACTIONS); zzmore(); >>
-#token "\n|\r|\r\n" <<
- zzline++;
- warn("eoln found in string (in user action)");
- zzskip();
- >>
-#token "\\(\n|\r|\r\n)" << zzline++; zzmore(); >>
-#token "\\~[]" << zzmore(); >>
-#token "~[\n\r\"\\]+" << zzmore(); >>
-
-#lexclass ACTION_CHARS
-#token "'" << zzmode(ACTIONS); zzmore(); >>
-#token "\n|\r|\r\n" <<
- zzline++;
- warn("eoln found in char literal (in user action)");
- zzskip();
- >>
-#token "\\~[]" << zzmore(); >>
-#token "~[\n\r'\\]+" << zzmore(); >>
-
-#lexclass ACTION_COMMENTS
-#token "\*/" << zzmode(ACTIONS); zzmore(); >>
-#token "\*" << zzmore(); >>
-#token "\n|\r|\r\n" << zzline++; zzmore(); DAWDLE; >>
-#token "~[\n\r\*]+" << zzmore(); >>
-
-#lexclass TOK_DEF_COMMENTS
-#token "\*/" << zzmode(PARSE_ENUM_FILE);
- zzmore(); >>
-#token "\*" << zzmore(); >>
-#token "\n|\r|\r\n" << zzline++; zzmore(); DAWDLE; >>
-#token "~[\n\r\*]+" << zzmore(); >>
-
-#lexclass TOK_DEF_CPP_COMMENTS
-#token "\n|\r|\r\n" << zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE; >>
-#token "~[\n\r]+" << zzskip(); >>
-
-#lexclass ACTION_CPP_COMMENTS
-#token "\n|\r|\r\n" << zzline++; zzmode(ACTIONS); zzmore(); DAWDLE; >>
-#token "~[\n\r]+" << zzmore(); >>
-
-#lexclass CPP_COMMENTS
-#token "\n|\r|\r\n" << zzline++; zzmode(START); zzskip(); DAWDLE; >>
-#token "~[\n\r]+" << zzskip(); >>
-
-#lexclass COMMENTS
-#token "\*/" << zzmode(START); zzskip(); >>
-#token "\*" << zzskip(); >>
-#token "\n|\r|\r\n" << zzline++; zzskip(); DAWDLE; >>
-#token "~[\n\r\*]+" << zzskip(); >>
-
-/*
- * This lexical class accepts actions of type [..] and <<..>>
- *
- * It translates the following special items for C:
- *
- * $j --> "zzaArg(current zztasp, j)"
- * $i.j --> "zzaArg(zztaspi, j)"
- * $i.nondigit> "zzaArg(current zztasp, i).nondigit"
- * $$ --> "zzaRet"
- * $alnum --> "alnum" (used to ref parameters)
- * $rule --> "zzaRet"
- * $retval --> "_retv.retval" if > 1 return values else "_retv"
- * $[token, text] --> "zzconstr_attr(token, text)"
- * $[] --> "zzempty_attr()"
- *
- * It translates the following special items for C++:
- * (attributes are now stored with 'Token' and $i's are only
- * pointers to the Tokens. Rules don't have attributes now.)
- *
- * $j --> "_tbj" where b is the block level
- * $i.j --> "_tij"
- * $j->nondigit> "_tbj->nondigit"
- * $$ --> "$$"
- * $alnum --> "alnum" (used to ref parameters)
- * $rule --> "$rule"
- * $retval --> "_retv.retval" if > 1 return values else "_retv"
- * $[token, text] --> invalid
- * $[] --> invalid
- *
- * And, for trees:
- *
- * #0 --> "(*_root)"
- * #i --> "zzastArg(i)"
- * #[args] --> "zzmk_ast(zzastnew(), args)"
- * #[] --> "zzastnew()"
- * #( root, child1, ..., childn )
- * --> "zztmake(root, child1, ...., childn, NULL)"
- * #() --> "NULL"
- *
- * For C++, ...
- *
- * #0 --> "(*_root)"
- * #i --> "_astbi" where b is the block level
- * #alnum --> "alnum_ast" (used to ref #label)
- * #[args] --> "new AST(args)"
- * #[] --> "new AST"
- * #( root, child1, ..., childn )
- * --> "AST::tmake(root, child1, ...., childn, NULL)"
- * #() --> "NULL"
- *
- * To escape,
- *
- * \] --> ]
- * \) --> )
- * \$ --> $
- * \# --> #
- *
- * A stack is used to nest action terminators because they can be nested
- * like crazy: << #[$[..],..] >>
- */
-#lexclass ACTIONS
-#token Action "\>\>" << /* these do not nest */
- zzmode(START);
- NLATEXT[0] = ' ';
- NLATEXT[1] = ' ';
- zzbegexpr[0] = ' ';
- zzbegexpr[1] = ' ';
- if ( zzbufovf ) {
- err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE));
- }
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
-/* MR1 in DLG action */
-/* MR1 Doesn't matter what kind of action it is - reset*/
-
- tokenActionActive=0; /* MR1 */
- >>
-#token Pred "\>\>?" << /* these do not nest */
- zzmode(START);
- NLATEXT[0] = ' ';
- NLATEXT[1] = ' ';
- zzbegexpr[0] = '\0';
- if ( zzbufovf ) {
- err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE));
- };
-#ifdef __cplusplus__
-/* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-#ifdef __STDC__
-/* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-#ifdef __USE_PROTOS
-/* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-/* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);
-#endif
-#endif
-#endif
- >>
-#token PassAction "\]" << if ( topint() == ']' ) {
- popint();
- if ( istackempty() ) /* terminate action */
- {
- zzmode(START);
- NLATEXT[0] = ' ';
- zzbegexpr[0] = ' ';
- if ( zzbufovf ) {
- err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE));
- }
- }
- else {
- /* terminate $[..] and #[..] */
- if ( GenCC ) zzreplstr("))");
- else zzreplstr(")");
- zzmore();
- }
- }
- else if ( topint() == '|' ) { /* end of simple [...] */
- popint();
- zzmore();
- }
- else zzmore();
- >>
-#token "consumeUntil\( [\ \t]* \{~[\}]+\} [\ \t]* \)"
- <<
- zzmore();
- zzreplstr(inline_set(zzbegexpr+
- strlen("consumeUntil(")));
- >>
-#token "consumeUntil\( ~[\)]+ \)"
- << zzmore(); >>
-#token "\n|\r|\r\n" << zzline++; zzmore(); DAWDLE; >>
-#token "\>" << zzmore(); >>
-#token "$" << zzmore(); >>
-#token "$$" << if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();}
- else err("$$ use invalid in C++ mode"); >>
-
-#token "$\[\]" << if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();}
- else err("$[] use invalid in C++ mode"); >>
-#token "$\[" <<
- pushint(']');
- if ( !GenCC ) zzreplstr("zzconstr_attr(");
- else err("$[..] use invalid in C++ mode");
- zzmore();
- >>
-#token "$[0-9]+" <<{
- static char buf[100];
- numericActionLabel=1; /* MR10 */
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("$i attrib ref too big");
- set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)",
- BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"_t%d%s",
- BlkLevel-1,zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- >>
-#token "$[0-9]+." <<{
- static char buf[100];
- numericActionLabel=1; /* MR10 */
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("$i.field attrib ref too big");
- zzbegexpr[strlen(zzbegexpr)-1] = ' ';
- set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).",
- BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"_t%d%s.",
- BlkLevel-1,zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- >>
-#token "$[0-9]+.[0-9]+" <<{
- static char buf[100];
- static char i[20], j[20];
- char *p,*q;
- numericActionLabel=1; /* MR10 */
- if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big");
- for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) {
- if ( q == &i[20] )
- fatalFL("i of $i.j attrib ref too big",
- FileStr[CurFile], zzline );
- *q++ = *p;
- }
- *q = '\0';
- for (p++, q= &j[0]; *p!='\0'; p++) {
- if ( q == &j[20] )
- fatalFL("j of $i.j attrib ref too big",
- FileStr[CurFile], zzline );
- *q++ = *p;
- }
- *q = '\0';
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j);
- else sprintf(buf,"_t%s%s",i,j);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- >>
-#token "$[_a-zA-Z][_a-zA-Z0-9]*"
- <<{ static char buf[300]; LabelEntry *el;
- zzbegexpr[0] = ' ';
- if ( CurRule != NULL &&
- strcmp(CurRule, &zzbegexpr[1])==0 ) {
- if ( !GenCC ) zzreplstr("zzaRet");
- }
- else if ( CurRetDef != NULL &&
- strmember(CurRetDef, &zzbegexpr[1])) {
- if ( hasMultipleOperands( CurRetDef ) ) {
- require (strlen(zzbegexpr)<=(size_t)285,
- "$retval attrib ref too big");
- sprintf(buf,"_retv.%s",&zzbegexpr[1]);
- zzreplstr(buf);
- }
- else zzreplstr("_retv");
- }
- else if ( CurParmDef != NULL &&
- strmember(CurParmDef, &zzbegexpr[1])) {
- ;
- }
- else if ( Elabel==NULL ) {
- { err("$-variables in actions outside of rules are not allowed"); }
- } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) {
-/* MR10 */
-/* MR10 */ /* element labels might exist without an elem when */
-/* MR10 */ /* it is a forward reference (to a rule) */
-/* MR10 */
-/* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) )
-/* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); }
-/* MR10 */
-/* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) {
-/* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs");
-/* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...\>\>\")");
-/* MR10 */ };
-/* MR10 */
-/* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */
-/* MR10 */ /* element labels contain pointer to the owners node */
-/* MR10 */
-/* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) {
-/* MR10 */ list_add(&CurActionLabels,el);
-/* MR10 */ };
- }
- else
- warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));
- }
- zzmore();
- >>
-#token "#0" << zzreplstr("(*_root)"); zzmore(); chkGTFlag(); >>
-#token "#\[\]" << if ( GenCC ) {
- if (NewAST) zzreplstr("(newAST)");
- else zzreplstr("(new AST)");}
- else {zzreplstr("zzastnew()");} zzmore();
- chkGTFlag();
- >>
-#token "#\(\)" << zzreplstr("NULL"); zzmore(); chkGTFlag(); >>
-#token "#[0-9]+" <<{
- static char buf[100];
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("#i AST ref too big");
- if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"zzastArg(%s)",zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions);
- chkGTFlag();
- }
- >>
-
-/* MR14 Arpad Beszedes 26-May-98
- Add support for #line directives when antlr source is pre-processed
- #lexclass ACTIONS
-*/
-
-#token "#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)"
- <<
- zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
- getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
- >>
-
-#token "#line ~[\n\r]* (\n|\r|\r\n)"
- <<
- zzline++; zzmore();
- >>
-
-/* MR14 end of a block to support #line in antlr source code */
-
-#token "#[_a-zA-Z][_a-zA-Z0-9]*"
- <<
- if ( !(strcmp(zzbegexpr, "#ifdef")==0 ||
- strcmp(zzbegexpr, "#if")==0 ||
- strcmp(zzbegexpr, "#else")==0 ||
- strcmp(zzbegexpr, "#endif")==0 ||
- strcmp(zzbegexpr, "#ifndef")==0 ||
- strcmp(zzbegexpr, "#define")==0 ||
- strcmp(zzbegexpr, "#pragma")==0 ||
- strcmp(zzbegexpr, "#undef")==0 ||
- strcmp(zzbegexpr, "#import")==0 ||
- strcmp(zzbegexpr, "#line")==0 ||
- strcmp(zzbegexpr, "#include")==0 ||
- strcmp(zzbegexpr, "#error")==0) )
- {
- static char buf[100];
- sprintf(buf, "%s_ast", zzbegexpr+1);
-/* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1));
- zzreplstr(buf);
- chkGTFlag();
- }
- zzmore();
- >>
-#token "#\[" <<
- pushint(']');
- if ( GenCC ) {
- if (NewAST) zzreplstr("(newAST(");
- else zzreplstr("(new AST("); }
- else zzreplstr("zzmk_ast(zzastnew(),");
- zzmore();
- chkGTFlag();
- >>
-#token "#\(" <<
- pushint('}');
- if ( GenCC ) {
- if (tmakeInParser) {
- zzreplstr("tmake(");
- }
- else {
- zzreplstr("ASTBase::tmake(");
- }
- }
- else {
- zzreplstr("zztmake(");
- }
- zzmore();
- chkGTFlag();
- >>
-#token "#" << zzmore(); >>
-#token "\)" <<
- if ( istackempty() )
- zzmore();
- else if ( topint()==')' ) {
- popint();
- }
- else if ( topint()=='}' ) {
- popint();
- /* terminate #(..) */
- zzreplstr(", NULL)");
- }
- zzmore();
- >>
-#token "\[" <<
- pushint('|'); /* look for '|' to terminate simple [...] */
- zzmore();
- >>
-#token "\(" <<
- pushint(')');
- zzmore();
- >>
-
-#token "\\\]" << zzreplstr("]"); zzmore(); >>
-#token "\\\)" << zzreplstr(")"); zzmore(); >>
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
-/* MR1 in DLG action */
-
-#token "\\>" << if (! tokenActionActive) zzreplstr(">"); /* MR1 */
- zzmore(); /* MR1 */
- >> /* MR1 */
-
-
-#token "'" << zzmode(ACTION_CHARS); zzmore();>>
-#token "\"" << zzmode(ACTION_STRINGS); zzmore();>>
-#token "\\$" << zzreplstr("$"); zzmore(); >>
-#token "\\#" << zzreplstr("#"); zzmore(); >>
-#token "\\(\n|\r|\r\n)" << zzline++; zzmore(); >>
-#token "\\~[\]\)>$#]" << zzmore(); >> /* escaped char, always ignore */
-#token "/" << zzmore(); >>
-#token "/\*" << zzmode(ACTION_COMMENTS); zzmore(); >>
-#token "\*/" << warn("Missing /*; found dangling */ in action"); zzmore(); >>
-#token "//" << zzmode(ACTION_CPP_COMMENTS); zzmore(); >>
-#token "~[\n\r\)\(\\$#\>\]\[\"'/]+" << zzmore(); >>
-
-#lexclass START
-#token "[\t\ ]+" << zzskip(); >> /* Ignore White */
-#token "\n|\r|\r\n" << zzline++; zzskip(); >> /* Track Line # */
-#token "\[" << zzmode(ACTIONS); zzmore();
- istackreset();
- pushint(']'); >>
-#token "\<\<" << action_file=CurFile; action_line=zzline;
- zzmode(ACTIONS); zzmore();
- list_free(&CurActionLabels,0); /* MR10 */
- numericActionLabel=0; /* MR10 */
- istackreset();
- pushint('>'); >>
-#token "\"" << zzmode(STRINGS); zzmore(); >>
-#token "/\*" << zzmode(COMMENTS); zzskip(); >>
-#token "\*/" << warn("Missing /*; found dangling */"); zzskip(); >>
-#token "//" << zzmode(CPP_COMMENTS); zzskip(); >>
-
-/* MR14 Arpad Beszedes 26-May-98
- Add support for #line directives when antlr source is pre-processed
- #lexclass START
-*/
-
-#token "#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)"
- <<
- zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
- getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
- >>
-
-#token "#line ~[\n\r]* (\n|\r|\r\n)"
- <<
- zzline++; zzmore();
- >>
-
-/* MR14 end of a block to support #line in antlr source code */
-
-/* */
-/* 8-Apr-97 Regularize escape sequence for ">>" */
-/* appearing in string literals */
-/* */
-
-#token "\>\>" << warn("Missing <<; found dangling \>\>"); zzskip(); >> /* MR1 */
-#token WildCard "."
-#token "\@" <<FoundException = 1; /* MR6 */
- FoundAtOperator = 1;>> /* MR6 */
-#token Eof "@"
- << /* L o o k F o r A n o t h e r F i l e */
- {
- FILE *new_input;
- new_input = NextFile();
- if ( new_input == NULL ) { NLA=Eof; return; }
- fclose( input );
- input = new_input;
- zzrdstream( input );
- zzskip(); /* Skip the Eof (@) char i.e continue */
- }
- >>
-
-#token LABEL
-
-#errclass "grammar-element" { element }
-#errclass "meta-symbol" { "\}" "!" ";" "\|" "\~" "^" "\)" }
-
-#token Pragma "{\\}#pragma" /* MR21 */
-#token FirstSetSymbol "{\\}#FirstSetSymbol" /* MR21 */
-/*
- * Get a grammar -- Build a list of rules like:
- *
- * o-->Rule1--o
- * |
- * o-->Rule2--o
- * |
- * ...
- * |
- * o-->RuleN--o
- */
-
-/* rule grammar */
-
-grammar : <<Graph g;>>
- ( "{\\}#header" Action /* MR13 */
- <<
- if ( HdrAction==NULL ) {
- HdrAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(HdrAction!=NULL, "rule grammar: cannot allocate header action");
- strcpy(HdrAction, LATEXT(1));
- }
- else warn("additional #header statement ignored");
- >>
- | "{\\}#first" Action
- <<
- if ( FirstAction==NULL ) {
- FirstAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(FirstAction!=NULL, "rule grammar: cannot allocate #first action");
- strcpy(FirstAction, LATEXT(1));
- } else {
- warn("additional #first statement ignored");
- };
- >>
-
- | "{\\}#parser" QuotedTerm
- <<
- if ( GenCC ) {
- warn("#parser meta-op incompatible with -CC; ignored");
- }
- else {
- if ( strcmp(ParserName,"zzparser")==0 ) {
- ParserName=StripQuotes(mystrdup(LATEXT(1)));
- if ( RulePrefix[0]!='\0' )
- {
- warn("#parser meta-op incompatible with '-gp prefix'; '-gp' ignored");
- RulePrefix[0]='\0';
- }
- }
- else warn("additional #parser statement ignored");
- }
- >>
- | "{\\}#tokdefs" QuotedTerm
- <<{
- char *fname;
- zzantlr_state st; FILE *f; struct zzdlg_state dst;
- UserTokenDefsFile = mystrdup(LATEXT(1));
- zzsave_antlr_state(&st);
- zzsave_dlg_state(&dst);
- fname = mystrdup(LATEXT(1));
- f = fopen(StripQuotes(fname), "r");
- if ( f==NULL ) {warn(eMsg1("cannot open token defs file '%s'", fname+1));}
- else {
- ANTLRm(enum_file(fname+1), f, PARSE_ENUM_FILE);
- UserDefdTokens = 1;
- }
- zzrestore_antlr_state(&st);
- zzrestore_dlg_state(&dst);
- }>>
- )*
- ( Action
- <<{
- UserAction *ua = newUserAction(LATEXT(1));
- ua->file = action_file; ua->line = action_line;
- if ( class_nest_level>0 ) list_add(&class_before_actions, ua);
- else list_add(&BeforeActions, ua);
- }>>
- | laction
- | lmember /* MR1 */
- | lprefix /* MR1 */
- | aLexclass
- | token
- | error
- | tclass
- | aPred /* MR11 */
- | default_exception_handler
- | class_def
- | "\}"
- <<
- if ( class_nest_level==0 )
- warn("missing class definition for trailing '}'");
- class_nest_level--;
- >>
- )*
-
- rule <<g=$3; SynDiag = (Junction *) $3.left;>>
- ( rule
-
- <<if ( $1.left!=NULL ) {
- g.right = NULL;
-
-/* MR21a */ /* Avoid use of a malformed graph when CannotContinue */
-/* MR21a */ /* is already set */
-/* MR21a */
-/* MR21a */ if (! (CannotContinue && g.left == NULL)) {
-/* MR21a */ g = Or(g, $1);
-/* MR21a */ }
-/* MR21a */ }
- >>
-
- | aLexclass
- | token
- | error
- | tclass
- | aPred /* MR11 */
- | class_def
- | "\}"
- <<
- if ( class_nest_level==0 )
- warn("missing class definition for trailing '}'");
- class_nest_level--;
- >>
- )*
- ( Action
- <<{
- UserAction *ua = newUserAction(LATEXT(1));
- ua->file = action_file; ua->line = action_line;
- if ( class_nest_level>0 ) list_add(&class_after_actions, ua);
- else list_add(&AfterActions, ua);
- }>>
- | laction
- | lmember /* MR1 */
- | lprefix /* MR1 */
- | error
- | tclass
- | class_def
- | aPred /* MR11 */
- | "\}"
- <<
- if ( class_nest_level==0 )
- warn("missing class definition for trailing '}'");
- class_nest_level--;
- >>
- )*
- Eof
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule class_def */
-
-class_def
- : <<int go=1; char name[MaxRuleName+1];>>
- "class"
- ( NonTerminal <<if(go) strncpy(name,LATEXT(1),MaxRuleName);>>
- | TokenTerm <<if(go) strncpy(name,LATEXT(1),MaxRuleName);>>
- )
- <<
- if ( CurrentClassName[0]!='\0' && strcmp(CurrentClassName,name)!=0
- && GenCC ) {
- err("only one grammar class allowed in this release");
- go = 0;
- }
- else strcpy(CurrentClassName, name);
- >>
- <<if ( !GenCC ) { err("class meta-op used without C++ option"); }>>
-
-/* MR10 */ (~ "\{"
-/* MR10 */ <<if (ClassDeclStuff == NULL) {
-/* MR10 */ ClassDeclStuff=(char *)calloc(MaxClassDeclStuff+1,sizeof(char));
-/* MR10 */ };
-/* MR10 */ strncat(ClassDeclStuff," ",MaxClassDeclStuff);
-/* MR10 */ strncat(ClassDeclStuff,LATEXT(1),MaxClassDeclStuff);
-/* MR22 */ do {
-/* MR22 */ if (0 == strcmp(LATEXT(1),"public")) break;
-/* MR22 */ if (0 == strcmp(LATEXT(1),"private")) break;
-/* MR22 */ if (0 == strcmp(LATEXT(1),"protected")) break;
-/* MR22 */ if (0 == strcmp(LATEXT(1),"virtual")) break;
-/* MR22 */ if (0 == strcmp(LATEXT(1),",")) break;
-/* MR22 */ if (0 == strcmp(LATEXT(1),":")) break;
-/* MR22 */ if (BaseClassName != NULL) break;
-/* MR22 */ BaseClassName=(char *)calloc(strlen(LATEXT(1))+1,sizeof(char));
-/* MR22 */ require(BaseClassName!=NULL, "rule grammar: cannot allocate base class name");
-/* MR22 */ strcpy(BaseClassName,LATEXT(1));
-/* MR22 */ } while (0);
-/* MR10 */ >>
-/* MR10 */ )*
-
- "\{"
- <<
- no_classes_found = 0;
- if ( class_nest_level>=1 ) {warn("cannot have nested classes");}
- else class_nest_level++;
- >>
- ;
- <<CannotContinue=TRUE;>>
-
-/*
- * Build -o-->o-R-o-->o- where -o-R-o- is the block from rule 'block'.
- * Construct the RuleBlk front and EndRule node on the end of the
- * block. This is used to add FOLLOW pointers to the rule end. Add the
- * new rule name to the Rname hash table and sets its rulenum.
- * Store the parameter definitions if any are found.
- *
- * Note that locks are required on the RuleBlk and EndRule nodes to thwart
- * infinite recursion.
- *
- * Return the left graph pointer == NULL to indicate error/dupl rule def.
- */
-
-/* rule rule */
-
-rule : <<
-
- ExceptionGroup *eg;
- RuleEntry *q; Junction *p; Graph r; int f, l; ECnode *e;
- set toksrefd, rulesrefd;
- char *pdecl=NULL, *ret=NULL, *a; CurRetDef = CurParmDef = NULL;
- CurExGroups = NULL;
- CurElementLabels = NULL;
- CurAstLabelsInActions = NULL; /* MR27 */
- /* We want a new element label hash table for each rule */
- if ( Elabel!=NULL ) killHashTable(Elabel);
- Elabel = newHashTable();
- attribsRefdFromAction = empty;
- >>
- NonTerminal
- <<q=NULL;
- if ( hash_get(Rname, LATEXT(1))!=NULL ) {
- err(eMsg1("duplicate rule definition: '%s'",LATEXT(1)));
- CannotContinue=TRUE;
- }
- else
- {
- q = (RuleEntry *)hash_add(Rname,
- LATEXT(1),
- (Entry *)newRuleEntry(LATEXT(1)));
- CurRule = q->str;
- }
- CurRuleNode = q;
- f = CurFile; l = zzline;
- NumRules++;
- >>
- { "!" <<if ( q!=NULL ) q->noAST = TRUE;>> }
- { <<;>>
- {"\<"}
- PassAction
- << pdecl = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(pdecl!=NULL, "rule rule: cannot allocate param decl");
- strcpy(pdecl, LATEXT(1));
- CurParmDef = pdecl;
- >>
- }
- { "\>"
- PassAction
- << ret = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(ret!=NULL, "rule rule: cannot allocate ret type");
- strcpy(ret, LATEXT(1));
- CurRetDef = ret;
- >>
- }
- { QuotedTerm <<if ( q!=NULL ) q->egroup=mystrdup(LATEXT(1));>> }
- <<
- if ( GenEClasseForRules && q!=NULL ) {
- e = newECnode;
- require(e!=NULL, "cannot allocate error class node");
- if ( q->egroup == NULL ) {a = q->str; a[0] = (char)toupper(a[0]);}
- else a = q->egroup;
- if ( Tnum( a ) == 0 )
- {
- e->tok = addTname( a );
- list_add(&eclasses, (char *)e);
- if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
- /* refers to itself */
- list_add(&(e->elist), mystrdup(q->str));
- }
- else {
- warn(eMsg1("default errclass for '%s' would conflict with token/errclass/tokclass",a));
- if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]);
- free((char *)e);
- }
- }
- >>
- <<BlkLevel++;
- if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
-/* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
-/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- >>
-
- ":" <<inAlt=1;>>
- block[&toksrefd, &rulesrefd]
- <<r = makeBlk($7,0, NULL /* pFirstSetSymbol */ );
- CurRuleBlk = (Junction *)r.left;
- CurRuleBlk->blockid = CurBlockID;
- CurRuleBlk->jtype = RuleBlk;
- if ( q!=NULL ) CurRuleBlk->rname = q->str;
- CurRuleBlk->file = f;
- CurRuleBlk->line = l;
- CurRuleBlk->pdecl = pdecl;
- CurRuleBlk->ret = ret;
- CurRuleBlk->lock = makelocks();
- CurRuleBlk->pred_lock = makelocks();
- CurRuleBlk->tokrefs = toksrefd;
- CurRuleBlk->rulerefs = rulesrefd;
- p = newJunction(); /* add EndRule Node */
- ((Junction *)r.right)->p1 = (Node *)p;
- r.right = (Node *) p;
- p->jtype = EndRule;
- p->lock = makelocks();
- p->pred_lock = makelocks();
- CurRuleBlk->end = p;
- if ( q!=NULL ) q->rulenum = NumRules;
- $7 = r;
- >>
- <<
- /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
- /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
- --BlkLevel;
- >>
- <<altFixup();leFixup();egFixup();>> /* MR7 */
- ";" <<inAlt=0;>>
- { Action
- << a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule rule: cannot allocate error action");
- strcpy(a, LATEXT(1));
- CurRuleBlk->erraction = a;
- >>
- }
- ( exception_group > [eg]
- <<if ( eg!=NULL ) {
- list_add(&CurExGroups, (void *)eg);
- if (eg->label == NULL || *eg->label=='\0' ) q->has_rule_exception = 1;
- }
- >>
- )*
- <<if ( q==NULL ) $0.left = NULL; else $0 = $7;>>
- <<CurRuleBlk->exceptions = CurExGroups;>>
- <<CurRuleBlk->el_labels = CurElementLabels;>>
- <<CurRuleNode->ast_labels_in_actions = CurAstLabelsInActions;>> /* MR27 */
- <<CurRuleNode = NULL;>> /* MR27 Moved */
- ;
- <<CannotContinue=TRUE;>>
-
-/*
- * pragma : "{\\}#pragma" "dup\-labeled\-tokens"
- * <<Pragma_DupLabeledTokens=1;>>
- * ;
- */
-
-/* rule laction */
-
-laction : <<char *a;>>
-
- "{\\}#lexaction"
- Action
- <<
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule laction: cannot allocate action");
- strcpy(a, LATEXT(1));
- list_add(&LexActions, a);
- >>
- ;
- <<CannotContinue=TRUE;>>
-
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via #lexmember <<....>> & #lexprefix <<...>> */
-/* MR1 */
-
-/* rule lmember */
-
-lmember: <<char *a;>> /* MR1 */
-
-/* MR1 */ "{\\}#lexmember"
-/* MR1 */ Action
-/* MR1 */ <<
-/* MR1 */ if (! GenCC) {
-/* MR1 */ err("Use #lexmember only in C++ mode (to insert code in DLG class header");
-/* MR1 */ } else {
-/* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
-/* MR1 */ require(a!=NULL, "rule lmember: cannot allocate action");
-/* MR1 */ strcpy(a, LATEXT(1));
-/* MR1 */ list_add(&LexMemberActions, a);
-/* MR1 */ };
-/* MR1 */ >>
-/* MR1 */ ;
-/* MR1 */ <<CannotContinue=TRUE;>>
-
-/* rule lprefix */
-
-lprefix: <<char *a;>> /* MR1 */
-
-/* MR1 */ "{\\}#lexprefix"
-/* MR1 */ Action
-/* MR1 */ <<
-/* MR1 */ if (! GenCC) {
-/* MR1 */ err("Use #lexprefix only in C++ mode (to insert code in DLG class header");
-/* MR1 */ } else {
-/* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
-/* MR1 */ require(a!=NULL, "rule lprefix: cannot allocate action");
-/* MR1 */ strcpy(a, LATEXT(1));
-/* MR1 */ list_add(&LexPrefixActions, a);
-/* MR1 */ };
-/* MR1 */ >>
-/* MR1 */ ;
-/* MR1 */ <<CannotContinue=TRUE;>>
-
-/*
- * #pred upper <<isupper()>>? predicate literal
- * #pred lower <<islower()>>? predicate literal
- * #pred up_or_low upper || lower predicate expression
- * concealed interdependence
- * #pred up_or_low_2 <<isletter()>>? A || B predicate literal equals predicate expr
- * analyze using lower||upper
- * generate using isLetter()
- */
-
-/* rule aPref */
-
-aPred: <<PredEntry *predEntry=NULL;
- char *name=NULL;
- Predicate *predExpr=NULL;
- char *predLiteral=NULL;
- int save_file;
- int save_line;
- int predExprPresent=0;
- >>
-
- "{\\}#pred"
-
- <<
- MR_usingPredNames=1; /* will need to use -mrhoist version of genPredTree */
- >>
-
- /* used to allow NonTerminal but it caused problems
- when a rule name immediately followed a #pred statement */
-
- TokenTerm <<name=mystrdup(LATEXT(1));>>
-
- <<
- /* don't free - referenced in predicates */
-
- CurPredName=(char *)calloc(1,strlen(name) + 10);
- strcat(CurPredName,"#pred ");
- strcat(CurPredName,name);
-
- predEntry=(PredEntry *) hash_get(Pname,name);
- if (predEntry != NULL) {
- warnFL(eMsg1("#pred %s previously defined - ignored",name),
- FileStr[action_file],action_line);
- name=NULL;
- };
- >>
-
- (
-
- Pred <<predLiteral=mystrdup(LATEXT(1));
- save_line=action_line;
- save_file=action_file;
- >>
-
- {
- predOrExpr>[predExpr] <<predExprPresent=1;>>
- }
-
- <<if (predLiteral != NULL && name != NULL) {
-
- /*
- * predExpr may be NULL due to syntax errors
- * or simply omitted by the user
- */
-
- predEntry=newPredEntry(name);
- predEntry->file=save_file;
- predEntry->line=save_line;
- predExpr=MR_predFlatten(predExpr);
- predEntry->predLiteral=predLiteral;
- if (! predExprPresent || predExpr == NULL) {
- predExpr=new_pred();
- predExpr->expr=predLiteral;
- predExpr->source=newActionNode();
- predExpr->source->action=predExpr->expr;
- predExpr->source->rname=CurPredName;
- predExpr->source->line=action_line;
- predExpr->source->file=action_file;
- predExpr->source->is_predicate=1;
- predExpr->k=predicateLookaheadDepth(predExpr->source);
- };
- predEntry->pred=predExpr;
- hash_add(Pname,name,(Entry *)predEntry);
- predExpr=NULL;
- };
- predicate_free(predExpr);
- >>
-
- |
- <<save_line=zzline; save_file=CurFile;>>
-
- predOrExpr>[predExpr]
-
- <<if (predExpr != NULL && name != NULL) {
- predEntry=newPredEntry(name);
- predEntry->file=CurFile;
- predEntry->line=zzline;
- predExpr=MR_predFlatten(predExpr);
- predEntry->pred=predExpr;
- hash_add(Pname,name,(Entry *)predEntry);
- predExpr=NULL;
- };
- predicate_free(predExpr);
- >>
- )
- {";"}
-;
-
-/* fail */
-
-<<predicate_free(predExpr);
->>
-
-/* rule predOrExpr */
-
-predOrExpr>[Predicate *result] :
- <<Predicate *ORnode;
- Predicate *predExpr;
- Predicate **tail=NULL;
- >>
- predAndExpr>[predExpr]
- <<
- ORnode=new_pred();
- ORnode->expr=PRED_OR_LIST;
- if (predExpr != NULL) {
- ORnode->down=predExpr;
- tail=&predExpr->right;
- };
- >>
- ( "\|\|" predAndExpr>[predExpr]
- <<
- if (predExpr != NULL) {
- *tail=predExpr;
- tail=&predExpr->right;
- };
- >>
- )*
- <<
- $result=ORnode;
- ORnode=NULL;
- >>
-;
-
-/* fail */
-
-<<predicate_free(ORnode);>>
-
-/* rule predAndExpr */
-
-predAndExpr>[Predicate *result] :
- <<Predicate *ANDnode;
- Predicate *predExpr;
- Predicate **tail=NULL;
- >>
- predPrimary>[predExpr]
- <<
- ANDnode=new_pred();
- ANDnode->expr=PRED_AND_LIST;
- if (predExpr != NULL) {
- ANDnode->down=predExpr;
- tail=&predExpr->right;
- };
- >>
- ( "&&" predPrimary>[predExpr]
- <<
- if (predExpr != NULL) {
- *tail=predExpr;
- tail=&predExpr->right;
- };
- >>
- )*
- <<
- $result=ANDnode;
- ANDnode=NULL;
- >>
-;
-
-/* fail */
-
-<<predicate_free(ANDnode);>>
-
-
-/* rule predPrimary */
-
-predPrimary>[Predicate *result] :
- <<
- char *name=NULL;
- PredEntry *predEntry=NULL;
- Predicate *predExpr=NULL;
- >>
-
- TokenTerm <<name=mystrdup(LATEXT(1));>>
-
- <<
- predEntry=(PredEntry *) hash_get(Pname,name);
- if (predEntry == NULL) {
- warnFL(eMsg1("no previously defined #pred with name \"%s\"",name),
- FileStr[CurFile],zzline);
- name=NULL;
- $result=NULL;
- } else {
- predExpr=predicate_dup(predEntry->pred);
- predExpr->predEntry=predEntry;
- $result=predExpr;
- };
- >>
-
- | "\(" predOrExpr>[predExpr] "\)"
- <<
- $result=predExpr;
- >>
-
- | "!" predPrimary>[predExpr]
- <<
- predExpr->inverted=!predExpr->inverted;
- $result=predExpr;
- >>
-;
-
-/* fail */ <<
- predicate_free(predExpr);
- >>
-
-/* rule aLexclass */
-
-aLexclass: "{\\}#lexclass" TokenTerm <<lexclass(mystrdup(LATEXT(1)));>>
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule error */
-
-error : <<char *t=NULL; ECnode *e; int go=1; TermEntry *p;>>
- "{\\}#errclass"
- (<<;>> TokenTerm <<t=mystrdup(LATEXT(1));>>
- | QuotedTerm <<t=mystrdup(LATEXT(1));>>
- )
- <<e = newECnode;
- require(e!=NULL, "cannot allocate error class node");
- e->lexclass = CurrentLexClass;
- if ( Tnum( (t=StripQuotes(t)) ) == 0 )
- {
- if ( hash_get(Texpr, t) != NULL )
- warn(eMsg1("errclass name conflicts with regular expression '%s'",t));
- e->tok = addTname( t );
- set_orel(e->tok, &imag_tokens);
- require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
- "hash table mechanism is broken");
- p->classname = 1; /* entry is errclass name, not token */
- list_add(&eclasses, (char *)e);
- }
- else
- {
- warn(eMsg1("redefinition of errclass or conflict w/token or tokclass '%s'; ignored",t));
- free( (char *)e );
- go=0;
- }
- >>
- "\{"
- ( NonTerminal <<if ( go ) t=mystrdup(LATEXT(1));>>
- | TokenTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
- | QuotedTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
- )
- <<if ( go ) list_add(&(e->elist), t);>>
- (
- ( NonTerminal <<if ( go ) t=mystrdup(LATEXT(1));>>
- | TokenTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
- | QuotedTerm <<if ( go ) t=mystrdup(LATEXT(1));>>
- )
- <<if ( go ) list_add(&(e->elist), t);>>
- )*
- "\}"
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule tclass */
-
-tclass : <<char *t=NULL; TCnode *e; int go=1,tok,totok; TermEntry *p, *term, *toterm;>>
- <<char *akaString=NULL; int save_file; int save_line;>>
- <<char *totext=NULL; >>
- "{\\}#tokclass" TokenTerm <<t=mystrdup(LATEXT(1));>>
- <<e = newTCnode;
- require(e!=NULL, "cannot allocate token class node");
- e->lexclass = CurrentLexClass;
- if ( Tnum( t ) == 0 )
- {
- e->tok = addTname( t );
- set_orel(e->tok, &imag_tokens);
- set_orel(e->tok, &tokclasses);
- require((p=(TermEntry *)hash_get(Tname, t)) != NULL,
- "hash table mechanism is broken");
- p->classname = 1; /* entry is class name, not token */
- p->tclass = e; /* save ptr to this tclass def */
- list_add(&tclasses, (char *)e);
- }
- else
- {
- warn(eMsg1("redefinition of tokclass or conflict w/token '%s'; ignored",t));
- free( (char *)e );
- go=0;
- }
- >>
-/* MR23 */ {
-/* MR23 */ "\("
-/* MR23 */ QuotedTerm
-/* MR23 */ <<akaString=mystrdup(StripQuotes(LATEXT(1)));
-/* MR11 */ save_file=CurFile;save_line=zzline;
-/* MR23 */ >>
-/* MR23 */ "\)"
-/* MR23 */ }
-/* MR23 */
-/* MR23 */
-/* MR23 */ <<
-/* MR23 */ if (p!= NULL && akaString != NULL) {
-/* MR23 */ if (p->akaString != NULL) {
-/* MR23 */ if (strcmp(p->akaString,akaString) != 0) {
-/* MR23 */ warnFL(eMsg2("this #tokclass statment conflicts with a previous #tokclass %s(\"%s\") statement",
-/* MR23 */ t,p->akaString),
-/* MR23 */ FileStr[save_file],save_line);
-/* MR23 */ };
-/* MR23 */ } else {
-/* MR23 */ p->akaString=akaString;
-/* MR23 */ };
-/* MR23 */ };
-/* MR23 */ >>
-
- "\{"
- (
- ( TokenTerm
- <<if ( go ) {
- term = (TermEntry *) hash_get(Tname, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- go = 0;
- }
- else {t=mystrdup(LATEXT(1)); tok=addTname(LATEXT(1));}
- }>>
-
- {
- ".."
- TokenTerm
-
- <<if ( go ) {
- toterm = (TermEntry *) hash_get(Tname, LATEXT(1));
- if ( toterm==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- go = 0;
- } else {
- totext=mystrdup(LATEXT(1)); totok=addTname(LATEXT(1));
- }
- }
- >>
- }
-
- | QuotedTerm
- <<if ( go ) {
- term = (TermEntry *) hash_get(Texpr, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- go = 0;
- }
- else {t=mystrdup(LATEXT(1)); tok=addTexpr(LATEXT(1));}
- }>>
- )
- <<if ( go ) {
- if (totext == NULL) {
- list_add(&(e->tlist), t);
- } else {
- list_add(&(e->tlist),"..");
- list_add(&(e->tlist),t);
- list_add(&(e->tlist),totext);
- }
- totext=NULL;
- }
- >>
- )+ // MR15 Manfred Kogler - forbid empty #tokclass sets (was "+")
- "\}"
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule token */
-
-token : <<char *t=NULL, *e=NULL, *a=NULL; int tnum=0;>>
- <<char *akaString=NULL; TermEntry *te;int save_file=0,save_line=0;>> /* MR11 */
- "{\\}#token"
-
-/* MR1 10-Apr-97 MR1 Allow shift right operator in DLG actions */
-/* MR1 Danger when parser feedback to lexer */
-/* MR1 */
-
- <<tokenActionActive=1;>> /* MR1 */
- { TokenTerm <<t=mystrdup(LATEXT(1));>>
-
-/* MR11 */ {
-/* MR11 */ "\("
-/* MR11 */ QuotedTerm
-/* MR11 */ <<akaString=mystrdup(StripQuotes(LATEXT(1)));
-/* MR11 */ save_file=CurFile;save_line=zzline;
-/* MR11 */ >>
-/* MR11 */ "\)"
-/* MR11 */ }
-
- { "=" "[0-9]+" /* define the token type number */
- <<tnum = atoi(LATEXT(1));>>
- }
- }
- { QuotedTerm <<e=mystrdup(LATEXT(1));>> }
- { Action
- <<
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule token: cannot allocate action");
- strcpy(a, LATEXT(1));
- >>
- }
-
- { ";" } /* MR11 */
-
- <<chkToken(t, e, a, tnum);>>
-
- <<if (t != NULL) {
- te=(TermEntry *)hash_get(Tname,t);
- if (te != NULL && akaString != NULL) {
- if (te->akaString != NULL) {
- if (strcmp(te->akaString,akaString) != 0) {
- warnFL(eMsg2("this #token statment conflicts with a previous #token %s(\"%s\") statement",
- t,te->akaString),
- FileStr[save_file],save_line);
- };
- } else {
- te->akaString=akaString;
- };
- };
- };
- >>
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule block */
-
-block[set *toksrefd, set *rulesrefd]
- : <<
- Graph g, b;
- set saveblah;
- int saveinalt = inAlt;
- ExceptionGroup *eg;
- *$toksrefd = empty;
- *$rulesrefd = empty;
- set_clr(AST_nodes_refd_in_actions);
- CurBlockID++;
-/* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
- CurAltNum = 1;
-/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- saveblah = attribsRefdFromAction;
- attribsRefdFromAction = empty;
- >>
-
- alt[toksrefd,rulesrefd] <<b = g = $1;>>
-
- <<
- if ( ((Junction *)g.left)->p1->ntype == nAction )
- {
- ActionNode *actionNode=(ActionNode *)
- ( ( (Junction *)g.left) ->p1);
- if (!actionNode->is_predicate )
- {
- actionNode->init_action = TRUE;
-/* MR12c */ if (actionNode->noHoist) {
-/* MR12c */ errFL("<<nohoist>> appears as init-action - use <<>> <<nohoist>>",
-/* MR12c */ FileStr[actionNode->file],actionNode->line);
-/* MR12c */ };
- }
- }
- ((Junction *)g.left)->blockid = CurBlockID;
- >>
-
- ( exception_group > [eg]
- <<
- if ( eg!=NULL ) {
-/* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
-/* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
- list_add(&CurExGroups, (void *)eg);
- }
- >>
- )*
- <<CurAltNum++;
-/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- >>
-
- ( "\|" <<inAlt=1;>>
- alt[toksrefd,rulesrefd] <<g = Or(g, $2);>>
- <<
- ((Junction *)g.left)->blockid = CurBlockID;
- >>
-
- ( exception_group > [eg]
- <<
- if ( eg!=NULL ) {
-/* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/
-/* MR7 ***** CurAltStart->exception_label = eg->altID; *****/
- list_add(&CurExGroups, (void *)eg);
- }
- >>
- )*
-
- <<CurAltNum++;
-/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- >>
-
- )*
- <<$0 = b;>>
- <<attribsRefdFromAction = saveblah; inAlt = saveinalt;>>
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule alt */
-
-alt[set *toksrefd, set *rulesrefd]
- : <<int n=0; Graph g; int e_num=0, old_not=0; Node *node; set elems, dif;
- int first_on_line = 1, use_def_MT_handler = 0;
- g.left=NULL; g.right=NULL;
-
- CurAltStart = NULL;
- elems = empty;
- inAlt = 1;
- >>
- { "\@" /* handle MismatchedToken signals with default handler */
- <<use_def_MT_handler = 1;>>
- }
-
- ( <<;>> /* MR9 Removed unreferenced variable "tok" */
- { <<old_not=0;>> "\~" <<old_not=1;>> }
- element[old_not, first_on_line, use_def_MT_handler] > [node]
- <<if ( node!=NULL && node->ntype!=nAction ) first_on_line = 0;>>
- <<
- if ( $2.left!=NULL ) {
- g = Cat(g, $2);
- n++;
- if ( node!=NULL ) {
- if ( node->ntype!=nAction ) e_num++;
- /* record record number of all rule and token refs */
- if ( node->ntype==nToken ) {
- TokNode *tk = (TokNode *)((Junction *)$2.left)->p1;
- tk->elnum = e_num;
- set_orel(e_num, &elems);
- }
- else if ( node->ntype==nRuleRef ) {
- RuleRefNode *rn = (RuleRefNode *)((Junction *)$2.left)->p1;
- rn->elnum = e_num;
- set_orel(e_num, $rulesrefd);
- }
- }
- }
- >>
- )*
- <<if ( n == 0 ) g = emptyAlt();
- $0 = g;
- /* We want to reduce number of LT(i) calls and the number of
- * local attribute variables in C++ mode (for moment, later we'll
- * do for C also). However, if trees are being built, they
- * require most of the attrib variables to create the tree nodes
- * with; therefore, we gen a token ptr for each token ref in C++
- */
- if ( GenCC && !GenAST )
- {
- /* This now free's the temp set -ATG 5/6/95 */
- set temp;
- temp = set_and(elems, attribsRefdFromAction);
- set_orin($toksrefd, temp);
- set_free(temp);
- }
- else set_orin($toksrefd, elems);
- if ( GenCC ) {
- dif = set_dif(attribsRefdFromAction, elems);
- if ( set_deg(dif)>0 )
- err("one or more $i in action(s) refer to non-token elements");
- set_free(dif);
- }
- set_free(elems);
- set_free(attribsRefdFromAction);
- inAlt = 0;
- >>
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule element_label */
-
-element_label > [LabelEntry *label]
- : <<TermEntry *t=NULL; LabelEntry *l=NULL; RuleEntry *r=NULL; char *lab;>>
- LABEL <<lab = mystrdup(LATEXT(1));>>
- <<
- UsedNewStyleLabel = 1;
- if ( UsedOldStyleAttrib ) err("cannot mix with new-style labels with old-style $i");
- t = (TermEntry *) hash_get(Tname, lab);
- if ( t==NULL ) t = (TermEntry *) hash_get(Texpr, lab);
- if ( t==NULL ) r = (RuleEntry *) hash_get(Rname, lab);
- if ( t!=NULL ) {
- err(eMsg1("label definition clashes with token/tokclass definition: '%s'", lab));
- $label = NULL;
- }
- else if ( r!=NULL ) {
- err(eMsg1("label definition clashes with rule definition: '%s'", lab));
- $label = NULL;
- }
- else {
- /* we don't clash with anybody else */
- l = (LabelEntry *) hash_get(Elabel, lab);
- if ( l==NULL ) { /* ok to add new element label */
- l = (LabelEntry *)hash_add(Elabel,
- lab,
- (Entry *)newLabelEntry(lab));
- /* add to list of element labels for this rule */
- list_add(&CurElementLabels, (void *)lab);
-/* MR7 */ leAdd(l); /* list of labels waiting for exception group definitions */
- $label = l;
- }
- else {
- err(eMsg1("label definitions must be unique per rule: '%s'", lab));
- $label = NULL;
- }
- }
- >>
- ":"
- ;
-
-/* rule element */
-
-element[int old_not, int first_on_line, int use_def_MT_handler] > [Node *node]
- : <<
- Attrib blk;
- Predicate *pred = NULL;
- int local_use_def_MT_handler=0;
- ActionNode *act;
- RuleRefNode *rr;
- set toksrefd, rulesrefd;
- TermEntry *term;
- TokNode *p=NULL; RuleRefNode *q; int approx=0;
- LabelEntry *label=NULL;
- int predMsgDone=0;
- int semDepth=0;
- int ampersandStyle;
- int height; /* MR11 */
- int equal_height; /* MR11 */
-
- char* pFirstSetSymbol = NULL; /* MR21 */
-
- $node = NULL;
- >>
- {element_label>[label]}
- ( TokenTerm
- <<
- term = (TermEntry *) hash_get(Tname, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- $$.left = $$.right = NULL;
- }
- else {
- $$ = buildToken(LATEXT(1));
- p=((TokNode *)((Junction *)$$.left)->p1);
- term = (TermEntry *) hash_get(Tname, LATEXT(1));
- require( term!= NULL, "hash table mechanism is broken");
- p->tclass = term->tclass;
- p->complement = $old_not;
- if ( label!=NULL ) {
- p->el_label = label->str;
- label->elem = (Node *)p;
- }
- }
- >>
- { ".."
- ( QuotedTerm
- <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
- | TokenTerm
- <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
- )
- }
- <<
- if ( p!=NULL && (p->upper_range!=0 || p->tclass || $old_not) )
- list_add(&MetaTokenNodes, (void *)p);
- >>
- ( "^" <<if ( p!=NULL ) p->astnode=ASTroot;>>
- | <<if ( p!=NULL ) p->astnode=ASTchild;>>
- | "!" <<if ( p!=NULL ) p->astnode=ASTexclude;>>
- )
- { "\@" <<local_use_def_MT_handler = 1;>> }
- <<
- if ( p!=NULL && $first_on_line ) {
- CurAltStart = (Junction *)$$.left;
- altAdd(CurAltStart); /* MR7 */
- p->altstart = CurAltStart;
- }
- if ( p!=NULL )
- p->use_def_MT_handler = $use_def_MT_handler || local_use_def_MT_handler;
- $node = (Node *)p;
- >>
- | QuotedTerm
- <<
- term = (TermEntry *) hash_get(Texpr, LATEXT(1));
- if ( term==NULL && UserDefdTokens ) {
- err("implicit token definition not allowed with #tokdefs");
- $$.left = $$.right = NULL;
- }
- else {
- $$ = buildToken(LATEXT(1)); p=((TokNode *)((Junction *)$$.left)->p1);
- p->complement = $old_not;
- if ( label!=NULL ) {
- p->el_label = label->str;
- label->elem = (Node *)p;
- }
- }
- >>
- { ".."
- ( QuotedTerm
- <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
- | TokenTerm
- <<if ( p!=NULL ) setUpperRange(p, LATEXT(1));>>
- )
- }
- ( "^" <<if ( p!=NULL ) p->astnode=ASTroot;>>
- | <<if ( p!=NULL ) p->astnode=ASTchild;>>
- | "!" <<if ( p!=NULL ) p->astnode=ASTexclude;>>
- )
- { "\@" <<local_use_def_MT_handler = 1;>> }
- <<
- if ( p!=NULL && (p->upper_range!=0 || p->tclass || $old_not) )
- list_add(&MetaTokenNodes, (void *)p);
- >>
- <<
- if ( $first_on_line ) {
- CurAltStart = (Junction *)$$.left;
- altAdd(CurAltStart); /* MR7 */
- p->altstart = CurAltStart;
- }
- if ( p!=NULL )
- p->use_def_MT_handler = $use_def_MT_handler || local_use_def_MT_handler;
- $node = (Node *)p;
- >>
-
- | <<if ( $old_not ) warn("~ WILDCARD is an undefined operation (implies 'nothing')");>>
- "."
- <<$$ = buildWildCard(LATEXT(1)); p=((TokNode *)((Junction *)$$.left)->p1);>>
- ( "^" <<p->astnode=ASTroot;>>
- | <<p->astnode=ASTchild;>>
- | "!" <<p->astnode=ASTexclude;>>
- )
- <<list_add(&MetaTokenNodes, (void *)p);>>
- <<
- if ( $first_on_line ) {
- CurAltStart = (Junction *)$$.left;
- altAdd(CurAltStart); /* MR7 */
- p->altstart = CurAltStart;
- if ( label!=NULL ) {
- p->el_label = label->str;
- label->elem = (Node *)p;
- }
- }
- $node = (Node *)p;
- >>
-
- | <<if ( $old_not ) warn("~ NONTERMINAL is an undefined operation");>>
- NonTerminal
- <<$$ = buildRuleRef(LATEXT(1));>>
- { "!" <<q = (RuleRefNode *) ((Junction *)$$.left)->p1;
- q->astnode=ASTexclude;>>
- }
- { {"\<"}
- PassAction <<addParm(((Junction *)$$.left)->p1, LATEXT(1));>>
- }
- <<rr=(RuleRefNode *) ((Junction *)$$.left)->p1;>>
- { <<char *a;>>
- "\>"
- PassAction
- <<
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule element: cannot allocate assignment");
- strcpy(a, LATEXT(1));
- rr->assign = a;
- >>
- }
- <<
- if ( label!=NULL ) {
- rr->el_label = label->str;
- label->elem = (Node *)rr;
- }
- if ( $first_on_line ) {
- CurAltStart = (Junction *)$$.left;
- altAdd(CurAltStart); /* MR7 */
- ((RuleRefNode *)((Junction *)$$.left)->p1)->altstart = CurAltStart;
- }
- $node = (Node *)rr;
- >>
- )
-
- | <<if ( $old_not ) warn("~ ACTION is an undefined operation");>>
- Action <<$0 = buildAction(LATEXT(1),action_file,action_line, 0);>>
- <<if ( $first_on_line ) { /* MR7 */
- CurAltStart = (Junction *)$0.left; /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };>> /* MR7 */
- <<$node = (Node *) ((Junction *)$0.left)->p1;>>
-
- | <<if ( $old_not ) warn("~ SEMANTIC-PREDICATE is an undefined operation");>>
- Pred <<$0 = buildAction(LATEXT(1),action_file,action_line, 1);>>
- <<act = (ActionNode *) ((Junction *)$0.left)->p1;>>
- <<if (numericActionLabel) { /* MR10 */
- list_add(&NumericPredLabels,act); /* MR10 */
- numericActionLabel=0; /* MR10 */
- }; /* MR10 */
- >>
- { <<char *a;>>
- PassAction
- <<
- a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule element: cannot allocate predicate fail action");
- strcpy(a, LATEXT(1));
- act->pred_fail = a;
- >>
- }
- <<if ( $first_on_line ) { /* MR7 */
- CurAltStart = (Junction *)$0.left; /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };>> /* MR7 */
- <<$node = (Node *)act;>>
-
- | <<if ( $old_not ) warn("~ BLOCK is an undefined operation");>>
- <<BlkLevel++;
- if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply");
-/* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID;
-/* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum;
- >>
- { Pragma
- ( "approx" <<approx=LL_k;>>
- | "LL\(1\)" <<approx = 1;>> /* MR20 */
- | "LL\(2\)" <<approx = 2;>> /* MR20 */
- )
- }
-
-/* MR21 */ { FirstSetSymbol
-/* MR21 */ "\("
-/* MR21 */ ( NonTerminal
-/* MR21 */ <<
-/* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
-/* MR21 */ sizeof(char));
-/* MR21 */ require(pFirstSetSymbol!=NULL,
-/* MR21 */ "cannot allocate first set name");
-/* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
-/* MR21 */ >>
-/* MR21 */ | TokenTerm
-/* MR21 */ <<
-/* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1,
-/* MR21 */ sizeof(char));
-/* MR21 */ require(pFirstSetSymbol!=NULL,
-/* MR21 */ "cannot allocate first set name");
-/* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1));
-/* MR21 */ >>
-/* MR21 */ )
-/* MR21 */ "\)"
-/* MR21 */ }
-
- (
-
- "\(" block[&toksrefd,&rulesrefd] "\)"
- <<blk = $$ = $2;
- /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
- /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
- --BlkLevel;
- >>
-
- ( "\*" <<$$ = makeLoop($$,approx,pFirstSetSymbol);>>
- | "\+" <<$$ = makePlus($$,approx,pFirstSetSymbol);>>
- | "?"
- (
- ( "=>" <<ampersandStyle=0;>>
- | "&&" <<ampersandStyle=1;>> /* MR10 (g)? && <<p>>? */
- )
- Pred /* generalized predicate */
- /* first make into a predicate */
- <<$$ = buildAction(LATEXT(1),action_file,action_line,1);>>
- <<act = (ActionNode *) ((Junction *)$$.left)->p1;>>
- <<semDepth=predicateLookaheadDepth(act);>> /* MR10 */
- <<if (numericActionLabel) { /* MR10 */
- list_add(&NumericPredLabels,act); /* MR10 */
- numericActionLabel=0; /* MR10 */
- }; /* MR10 */
- >>
- { <<char *a;>>
- PassAction
- <<
- a = (char *)calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(a!=NULL, "rule element: cannot allocate predicate fail action");
- strcpy(a, LATEXT(1));
- act->pred_fail = a;
- >>
- }
- <<if ($first_on_line) { /* MR7 */
- CurAltStart=(Junction *)$$.left; /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };>>
- <<$node = (Node *)act;>>
-
- /* for now, just snag context */
- <<
- pred = computePredFromContextGuard(blk,&predMsgDone); /* MR10 */
- if ( pred==NULL) { /* MR10 */
- if ( !predMsgDone) err("invalid or missing context guard"); /* MR10 */
- predMsgDone=1; /* MR10 */
- } else { /* MR10 */
- act->guardNodes=(Junction *)blk.left; /* MR11 */
- pred->expr = act->action;
- pred->source = act;
-/* MR10 */ pred->ampersandStyle = ampersandStyle; /* 0 means (g)? => ... 1 means (g)? && ... */
-/* MR13 */ if (pred->tcontext != NULL) {
-/* MR13 */ height=MR_max_height_of_tree(pred->tcontext);
-/* MR13 */ equal_height=MR_all_leaves_same_height(pred->tcontext,height);
-/* MR13 */ if (! equal_height) {
-/* MR13 */ errFL("in guarded predicates all tokens in the guard must be at the same height",
-/* MR13 */ FileStr[act->file],act->line);
-/* MR13 */ };
-/* MR13 */ }
-/* MR10 */ if (ampersandStyle) {
-/* MR10 */ act->ampersandPred = pred;
-/* MR11 */ if (! HoistPredicateContext) {
-/* MR11 */ errFL("without \"-prc on\" (guard)? && <<pred>>? ... doesn't make sense",
-/* MR11 */ FileStr[act->file],act->line);
-/* MR11 */ };
-/* MR10 */ } else {
-/* MR10 */ act->guardpred = pred;
-/* MR10 */ };
-/* MR10 */ if (pred->k != semDepth) {
-/* MR10 */ warn(eMsgd2("length of guard (%d) does not match the length of semantic predicate (%d)",
-/* MR10 */ pred->k,semDepth));
-/* MR10 */ };
- }
- >>
- | <<$$ = makeBlk($$,approx,pFirstSetSymbol);
- FoundGuessBlk = 1;
- ((Junction *) ((Junction *)$$.left)->p1)->guess=1;
- if ( !$first_on_line ) {
- err("(...)? predicate must be first element of production");
- }
- >>
- )
- | <<$$ = makeBlk($$,approx,pFirstSetSymbol);>>
- )
- <<
- if ( pred==NULL && !predMsgDone) { /* MR10 */
- ((Junction *)((Junction *)$$.left)->p1)->blockid = CurBlockID;
- ((Junction *)((Junction *)$$.left)->p1)->tokrefs = toksrefd;
- ((Junction *)((Junction *)$$.left)->p1)->rulerefs = rulesrefd;
- if ( $first_on_line ) { /* MR7 */
- CurAltStart = (Junction *)((Junction *)((Junction *)$$.left)->p1); /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- }; /* MR7 */
- $node = (Node *) ((Junction *)$$.left)->p1;
- }
- >>
-
- | "\{" block[&toksrefd,&rulesrefd]
- <<$$ = makeOpt($2,approx,pFirstSetSymbol);
- /* MR23 */ CurBlockID_array[BlkLevel] = (-1);
- /* MR23 */ CurAltNum_array[BlkLevel] = (-1);
- --BlkLevel;
- >>
- "\}"
- <<
- ((Junction *)((Junction *)$$.left)->p1)->blockid = CurBlockID;
- ((Junction *)((Junction *)$$.left)->p1)->tokrefs = toksrefd;
- ((Junction *)((Junction *)$$.left)->p1)->rulerefs = rulesrefd;
- >>
- <<if ( $first_on_line ) { /* MR7 */
- CurAltStart = (Junction *) ((Junction *)((Junction *)$$.left)->p1); /* MR7 */
- altAdd(CurAltStart); /* MR7 */
- };
- >>
- <<$node = (Node *) ((Junction *)$$.left)->p1;>>
-
- )
-
-/* Error catching alternatives */
- | "\*" <<warn("don't you want a ')' with that '*'?"); CannotContinue=TRUE;>>
- | "\+" <<warn("don't you want a ')' with that '+'?"); CannotContinue=TRUE;>>
- | "\>" <<warn("'>' can only appear after a nonterminal"); CannotContinue=TRUE;>>
- | PassAction <<warn("[...] out of context 'rule > [...]'");
- CannotContinue=TRUE;>>
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule default_exception_handler */
-
-default_exception_handler
- : exception_group > [DefaultExGroup]
- ;
-
-/* rule exception_group */
-
-exception_group > [ExceptionGroup *eg]
- : <<ExceptionHandler *h; LabelEntry *label=NULL; /* MR6 */
- FoundException = 1; FoundExceptionGroup = 1;>> /* MR6 */
-
- "exception" <<$eg = (ExceptionGroup *)calloc(1, sizeof(ExceptionGroup));>>
- { <<char *p;>>
- PassAction /* did they attach a label? */
- <<
- p = LATEXT(1)+1;
- p[strlen(p)-1] = '\0'; /* kill trailing space */
- label = (LabelEntry *) hash_get(Elabel, LATEXT(1)+1);
- if ( label==NULL )
- {
- err(eMsg1("unknown label in exception handler: '%s'", LATEXT(1)+1));
- }
- >>
- }
- ( exception_handler > [h]
- <<list_add(&($eg->handlers), (void *)h);>>
- )*
- { "default" ":" Action
- <<{
- ExceptionHandler *eh = (ExceptionHandler *)
- calloc(1, sizeof(ExceptionHandler));
- char *a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require(eh!=NULL, "exception: cannot allocate handler");
- require(a!=NULL, "exception: cannot allocate action");
- strcpy(a, LATEXT(1));
- eh->action = a;
- eh->signalname = (char *) calloc(strlen("default")+1, sizeof(char));
- require(eh->signalname!=NULL, "exception: cannot allocate sig name");
- strcpy(eh->signalname, "default");
- list_add(&($eg->handlers), (void *)eh);
- }>>
- }
-
- <<
- if ( label!=NULL ) {
- /* Record ex group in sym tab for this label */
- if ( label->ex_group!=NULL ) {
- err(eMsg1("duplicate exception handler for label '%s'",label->str));
- } else {
- label->ex_group = $eg;
- /* Label the exception group itself */
- $eg->label = label->str;
- /* Make the labelled element pt to the exception also */
-/* MR6 */ if (label->elem == NULL) {
-/* MR6 */ err(eMsg1("reference in exception handler to undefined label '%s'",label->str));
-/* MR6 */ } else {
- switch ( label->elem->ntype ) {
- case nRuleRef :
- {
- RuleRefNode *r = (RuleRefNode *)label->elem;
- r->ex_group = $eg;
- break;
- }
- case nToken :
- {
- TokNode *t = (TokNode *)label->elem;
- t->ex_group = $eg;
- break;
- }
- } /* end switch */
-/* MR6 */ }; /* end test on label->elem */
- } /* end test on label->ex_group */
-
- } /* end test on exception label */
-
-/* MR7 */
-/* MR7 */ if (BlkLevel == 1 && label == NULL) {
-/* MR7 */ $eg->forRule=1;
-/* MR7 */ } else if (label == NULL) {
-/* MR7 */ $eg->altID = makeAltID(CurBlockID_array[BlkLevel], CurAltNum_array[BlkLevel]);
-/* MR7 */ egAdd($eg);
-/* MR7 */ } else {
-/* MR7 */ $eg->labelEntry=label;
-/* MR7 */ };
-/* MR7 */
-/* MR7 */ /* You may want to remove this exc from the rule list */
-/* MR7 */ /* and handle at the labeled element site. */
-/* MR7 */
-/* MR7 */ if (label != NULL) {
-/* MR7 */ $eg = NULL;
-/* MR7 */ };
-
- >>
- ;
- <<CannotContinue=TRUE;>>
-
-/* rule exception_handler */
-
-exception_handler > [ExceptionHandler *eh]
- : <<;>> /* MR9 Removed unreferenced variable "a" */
- "catch"
- <<
- $eh = (ExceptionHandler *)calloc(1, sizeof(ExceptionHandler));
- require($eh!=NULL, "exception: cannot allocate handler");
- >>
- ( NonTerminal
- <<
- $eh->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require($eh->signalname!=NULL, "exception: cannot allocate sig name");
- strcpy($eh->signalname, LATEXT(1));
- >>
- | TokenTerm
- <<
- $eh->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require($eh->signalname!=NULL, "exception: cannot allocate sig name");
- strcpy($eh->signalname, LATEXT(1));
- >>
- )
- ":"
- { <<$eh->action = NULL;>>
- Action
- <<
- $eh->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- require($eh->action!=NULL, "exception: cannot allocate action");
- strcpy($eh->action, LATEXT(1));
- >>
- }
- ;
- <<CannotContinue=TRUE;>>
-
-#token NonTerminal "[a-z] [A-Za-z0-9_]*"
- <<
- while ( zzchar==' ' || zzchar=='\t' ) {
- zzadvance();
- }
- if ( zzchar == ':' && inAlt ) NLA = LABEL;
- >>
-#token TokenTerm "[A-Z] [A-Za-z0-9_]*"
- <<
- while ( zzchar==' ' || zzchar=='\t' ) {
- zzadvance();
- }
- if ( zzchar == ':' && inAlt ) NLA = LABEL;
- >>
-#token "{\\}#[A-Za-z0-9_]*" <<warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip(); >>
-
-#lexclass PARSE_ENUM_FILE
-
-#token "[\t\ ]+" << zzskip(); >> /* Ignore White */
-#token "\n|\r|\r\n" << zzline++; zzskip(); >> /* Track Line # */
-#token "//" << zzmode(TOK_DEF_CPP_COMMENTS); zzmore(); >>
-#token "/\*" << zzmode(TOK_DEF_COMMENTS); zzskip(); >>
-#token "#ifdef" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
-#token "#if" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
-#token "#ifndef" << ; >>
-#token "#else" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
-#token "#endif" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
-#token "#undef" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
-#token "#import" << zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); >>
-#token "@" << ; >>
-
-/* rule enum_file */
-
-enum_file[char *fname]
- : { "#ifndef" ID
- { "#define" ID /* ignore if it smells like a gate */
- /* First #define after the first #ifndef (if any) is ignored */
- }
- }
- ( ( enum_def[$fname] )+
- | defines[$fname]
- )
- |
- ;
-
-/* rule defines */
-
-defines[char *fname]
- : <<int v; int maxt=(-1); char *t;>> /* MR3 */
- (
- "#define" ID
- <<t = mystrdup(LATEXT(1));>>
- INT
- <<
- v = atoi(LATEXT(1));
-/* fprintf(stderr, "#token %s=%d\n", t, v);*/
-
- /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
- /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
- /* MR2 Don't let #tokdefs be confused by */
- /* MR2 DLGminToken and DLGmaxToken */
-
- if ( ! isDLGmaxToken(t)) { /* MR2 */
- TokenNum = v;
- if ( v>maxt ) maxt=v;
- if ( Tnum( t ) == 0 ) {
- addForcedTname( t, v );
- } else {
- warnFL(eMsg1("redefinition of token %s; ignored",t),$fname,zzline);
- };
- };
- >>
- )+
- <<TokenNum = maxt + 1;>>
- ;
-
-/* rule enum_def */
-
-enum_def[char *fname]
- : <<int v= 0; int maxt=(-1); char *t;>> /* MR3 */
- "enum" ID
- "\{"
- ID
- <<t = mystrdup(LATEXT(1));>>
- ( "=" INT <<v=atoi(LATEXT(1));>>
- | <<v++;>>
- )
- <<
-/* fprintf(stderr, "#token %s=%d\n", t, v);*/
- TokenNum = v;
- if ( v>maxt ) maxt=v; /* MR3 */
- if ( Tnum( t ) == 0 ) addForcedTname( t, v );
- else {
- warnFL(eMsg1("redefinition of token %s; ignored",t),$fname,zzline);
- }
- >>
- ( ","
-
- /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
- /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
- /* MR2 Don't let #tokdefs be confused by */
- /* MR2 DLGminToken and DLGmaxToken */
-
- {
- <<isDLGmaxToken(LATEXT(1))>>? ID { "=" INT } /* MR2 */
- | ID /* MR2 */
- <<t = mystrdup(LATEXT(1));>>
- ( "=" INT <<v=atoi(LATEXT(1));>>
- | <<v++;>>
- )
- <<
-/* fprintf(stderr, "#token %s=%d\n", t, v);*/
- TokenNum = v;
- if ( v>maxt ) maxt=v; /* MR3 */
- if ( Tnum( t ) == 0 ) addForcedTname( t, v );
- else {
- warnFL(eMsg1("redefinition of token %s; ignored",t),$fname,zzline);
- }
- >>
- }
- )*
- "\}"
- ";"
- <<TokenNum = maxt + 1;>> /* MR3 */
- ;
-
-#token INT "[0-9]+"
-#token ID "[a-zA-Z_][_a-zA-Z0-9]*"
-
-#lexclass START
-
-/* MR14 Arpad Beszedes 26-May-98
- Add support for #line directives when antlr source is pre-processed
-*/
-
-#lexaction
-<<
-
-static char *
-#ifdef __USE_PROTOS
-getFileNameFromTheLineInfo(char *toStr, char *fromStr)
-#else
-getFileNameFromTheLineInfo(toStr, fromStr)
-char *toStr, *fromStr;
-#endif
-{
- int i, j, k;
-
- if (!fromStr || !toStr) return toStr;
-
- /* find the first " */
-
- for (i=0;
- (i<MaxFileName) &&
- (fromStr[i] != '\n') &&
- (fromStr[i] != '\r') &&
- (fromStr[i] != '\"');
- i++) /* nothing */ ;
-
- if ( (i == MaxFileName) ||
- (fromStr[i] == '\n') ||
- (fromStr[i] == '\r') ) {
- return toStr;
- }
-
- /* find the second " */
-
- for (j=i+1;
- (j<MaxFileName) &&
- (fromStr[j] != '\n') &&
- (fromStr[j] != '\r') &&
- (fromStr[j] != '\"');
- j++) /* nothing */ ;
-
- if ((j == MaxFileName) ||
- (fromStr[j] == '\n') ||
- (fromStr[j] == '\r') ) {
- return toStr;
- }
-
- /* go back until the last / or \ */
-
- for (k=j-1;
- (fromStr[k] != '\"') &&
- (fromStr[k] != '/') &&
- (fromStr[k] != '\\');
- k--) /* nothing */ ;
-
- /* copy the string after " / or \ into toStr */
-
- for (i=k+1; fromStr[i] != '\"'; i++) {
- toStr[i-k-1] = fromStr[i];
- }
-
- toStr[i-k-1] = '\0';
-
- return toStr;
-}
-
-/* MR14 end of a block to support #line in antlr source code */
-
->>
-
-<<
-
-/* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */
-/* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */
-/* MR2 Don't let #tokdefs be confused by */
-/* MR2 DLGminToken and DLGmaxToken */
-
-/* semantic check on DLGminToken and DLGmaxmaxToken in #tokdefs */
-
-#ifdef __USE_PROTOS
-static int isDLGmaxToken(char *Token)
-#else
-static int isDLGmaxToken(Token)
- char * Token;
-#endif
-{
- static char checkStr1[] = "DLGmaxToken";
- static char checkStr2[] = "DLGminToken";
-
- if (strcmp(Token, checkStr1) == 0)
- return 1;
- else if (strcmp(Token, checkStr2) == 0)
- return 1;
- else
- return 0;
-}
-
-/* semantics of #token */
-static void
-#ifdef __USE_PROTOS
-chkToken(char *t, char *e, char *a, int tnum)
-#else
-chkToken(t,e,a,tnum)
-char *t, *e, *a;
-int tnum;
-#endif
-{
- TermEntry *p;
-
- /* check to see that they don't try to redefine a token as a token class */
- if ( t!=NULL ) {
- p = (TermEntry *) hash_get(Tname, t);
- if ( p!=NULL && p->classname ) {
- err(eMsg1("redefinition of #tokclass '%s' to #token not allowed; ignored",t));
- if ( a!=NULL ) free((char *)a);
- return;
- }
- }
-
- if ( t==NULL && e==NULL ) { /* none found */
- err("#token requires at least token name or rexpr");
- }
- else if ( t!=NULL && e!=NULL ) { /* both found */
- if ( UserDefdTokens ) { /* if #tokdefs, must not define new */
- p = (TermEntry *) hash_get(Tname, t);
- if ( p == NULL) {
-err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
- return;
- };
- }
- Tklink(t, e);
- if ( a!=NULL ) {
- if ( hasAction(e) ) {
- err(eMsg1("redefinition of action for %s; ignored",e));
- }
- else setHasAction(e, a);
- }
- }
- else if ( t!=NULL ) { /* only one found */
- if ( UserDefdTokens ) {
- p = (TermEntry *) hash_get(Tname, t);
- if (p == NULL) {
-err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t));
- };
- return;
- }
- if ( Tnum( t ) == 0 ) addTname( t );
- else {
- err(eMsg1("redefinition of token %s; ignored",t));
- }
- if ( a!=NULL ) {
- err(eMsg1("action cannot be attached to a token name (%s); ignored",t));
- free((char *)a);
- }
- }
- else if ( e!=NULL ) {
- if ( Tnum( e ) == 0 ) addTexpr( e );
- else {
- if ( hasAction(e) ) {
- err(eMsg1("redefinition of action for expr %s; ignored",e));
- }
- else if ( a==NULL ) {
- err(eMsg1("redefinition of expr %s; ignored",e));
- }
- }
- if ( a!=NULL ) setHasAction(e, a);
- }
-
- /* if a token type number was specified, then add the token ID and 'tnum'
- * pair to the ForcedTokens list. (only applies if an id was given)
- */
- if ( t!=NULL && tnum>0 )
- {
- if ( set_el(tnum, reserved_positions) )
- {
- err(eMsgd("a token has already been forced to token number %d; ignored", tnum));
- }
- else
- {
- list_add(&ForcedTokens, newForcedToken(t,tnum));
- set_orel(tnum, &reserved_positions);
- }
- }
-}
->>
-
-<<
-static int
-#ifdef __USE_PROTOS
-match_token(char *s, char **nxt)
-#else
-match_token(s,nxt)
-char *s;
-char **nxt;
-#endif
-{
- if ( !(*s>='A' && *s<='Z') ) return 0;
- s++;
- while ( (*s>='a' && *s<='z') ||
- (*s>='A' && *s<='Z') ||
- (*s>='0' && *s<='9') ||
- *s=='_' )
- {
- s++;
- }
- if ( *s!=' ' && *s!='}' ) return 0;
- *nxt = s;
- return 1;
-}
-
-static int
-#ifdef __USE_PROTOS
-match_rexpr(char *s, char **nxt)
-#else
-match_rexpr(s,nxt)
-char *s;
-char **nxt;
-#endif
-{
- if ( *s!='"' ) return 0;
- s++;
- while ( *s!='"' )
- {
- if ( *s=='\n' || *s=='\r' ) /* MR13 */
- warn("eoln found in regular expression");
- if ( *s=='\\' ) s++;
- s++;
- }
- *nxt = s+1;
- return 1;
-}
-
-/*
- * Walk a string "{ A .. Z }" where A..Z is a space separated list
- * of token references (either labels or reg exprs). Return a
- * string "inlineX_set" for some unique integer X. Basically,
- * we pretend as if we had seen "#tokclass inlineX { A .. Z }"
- * on the input stream outside of an action.
- */
-char *
-#ifdef __USE_PROTOS
-inline_set(char *s)
-#else
-inline_set(s)
-char *s;
-#endif
-{
- char *nxt;
- fprintf(stderr, "found consumeUntil( {...} )\n");
- while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
- if ( *s!='{' )
- {
- err("malformed consumeUntil( {...} ); missing '{'");
- return "bad_set";
- }
- s++;
- while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
- while ( *s!='}' )
- {
- if ( match_token(s,&nxt) ) fprintf(stderr, "found token %s\n", s);
- else if ( match_rexpr(s,&nxt) ) fprintf(stderr, "found rexpr %s\n", s);
- else {
- err("invalid element in consumeUntil( {...} )");
- return "bad_set";
- }
- s = nxt;
- while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;}
- }
- return "inlineX_set";
-}
->>
-
-<<
-/* ANTLR-specific syntax error message generator
- * (define USER_ZZSYN when compiling so don't get 2 definitions)
- */
-void
-#ifdef __USE_PROTOS
-zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok,
-int k, char *bad_text)
-#else
-zzsyn(text, tok, egroup, eset, etok, k, bad_text)
-char *text, *egroup, *bad_text;
-int tok;
-int etok;
-int k;
-SetWordType *eset;
-#endif
-{
- fprintf(stderr, ErrHdr, FileStr[CurFile]!=NULL?FileStr[CurFile]:"stdin", zzline);
- fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text);
- if ( !etok && !eset ) {fprintf(stderr, "\n"); return;}
- if ( k==1 ) fprintf(stderr, " missing");
- else
- {
- fprintf(stderr, "; \"%s\" not", bad_text);
- if ( zzset_deg(eset)>1 ) fprintf(stderr, " in");
- }
- if ( zzset_deg(eset)>0 ) zzedecode(eset);
- else fprintf(stderr, " %s", zztokens[etok]);
- if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup);
- fprintf(stderr, "\n");
-}
->>
-
-#lexaction <<
-#ifdef __USE_PROTOS
-void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
-#else
-void mark_label_used_in_sem_pred(le) /* MR10 */
- LabelEntry *le;
-#endif
-{
- TokNode *tn;
- require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
- tn=(TokNode *)le->elem;
- require (tn->label != 0,"mark_label_used... TokNode has no label");
- tn->label_used_in_semantic_pred=1;
-}
->>
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r
deleted file mode 100644
index e3de38759f..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr.r
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- File: antlrMPW.r
- Target: antlr 133MR
- Created: Monday, June 15, 1998 4:41:11 AM
- Author: Kenji Tanaka (kentar@osa.att.ne.jp)
-*/
-
-#include "cmdo.r"
-
-resource 'cmdo' (128, "Antlr") {
- { /* array dialogs: 5 elements */
- /* [1] */
- 295,
- "ANTLR -- Purdue Compiler Construction To"
- "ol Set (PCCTS) LL(k) parser generator.",
- { /* array itemArray: 12 elements */
- /* [1] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {18, 23, 33, 223},
- "Read grammar from stdin",
- "-",
- "Read grammar from stdin."
- },
- /* [2] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {38, 23, 53, 310},
- "Send grammar.c/grammar.cpp to stdout",
- "-stdout",
- "Send grammar.c/grammar.cpp to stdout."
- },
- /* [3] */
- NotDependent {
-
- },
- MultiFiles {
- "Grammar File(s)É",
- "Choose the grammar specification files y"
- "ou wish to have ANTLR process.",
- {79, 22, 98, 152},
- "Grammar specification:",
- "",
- MultiInputFiles {
- { /* array MultiTypesArray: 1 elements */
- /* [1] */
- text
- },
- ".g",
- "Files ending in .g",
- "All text files"
- }
- },
- /* [4] */
- NotDependent {
-
- },
- Files {
- DirOnly,
- OptionalFile {
- {58, 168, 74, 298},
- {79, 169, 98, 299},
- "Output Directory",
- ":",
- "-o",
- "",
- "Choose the directory where ANTLR will pu"
- "t its output.",
- dim,
- "Output DirectoryÉ",
- "",
- ""
- },
- NoMore {
-
- }
- },
- /* [5] */
- NotDependent {
-
- },
- Redirection {
- StandardOutput,
- {126, 27}
- },
- /* [6] */
- NotDependent {
-
- },
- Redirection {
- DiagnosticOutput,
- {126, 178}
- },
- /* [7] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {117, 20, 167, 300},
- "Redirection"
- },
- /* [8] */
- NotDependent {
-
- },
- NestedDialog {
- 5,
- {20, 324, 40, 460},
- "Parse OptionsÉ",
- "Parse control options may be set with th"
- "is button."
- },
- /* [9] */
- NotDependent {
-
- },
- NestedDialog {
- 2,
- {50, 324, 70, 460},
- "Generate OptionsÉ",
- "Various command line options may be set "
- "with this button."
- },
- /* [10] */
- NotDependent {
-
- },
- NestedDialog {
- 3,
- {78, 324, 98, 460},
- "More OptionsÉ",
- "Antlr has ALOT of options. There are eve"
- "n more to be found with this button."
- },
- /* [11] */
- NotDependent {
-
- },
- NestedDialog {
- 4,
- {106, 324, 126, 460},
- "Rename OptionsÉ",
- "Options for renaming output files may be"
- " set with this button."
- },
- /* [12] */
- NotDependent {
-
- },
- VersionDialog {
- VersionString {
- "1.33MR"
- },
- "PCCTS was written by Terence Parr, Russe"
- "ll Quong, Will Cohen, and Hank Dietz: 19"
- "89-1998. MPW port by Scott Haney.",
- noDialog
- }
- },
- /* [2] */
- 295,
- "Use this dialog to specify command line "
- "Generate Options.",
- { /* array itemArray: 15 elements */
- /* [1] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {18, 25, 33, 225},
- "Generate C++ code",
- "-CC",
- "Generate C++ output from both ANTLR and "
- "DLG."
- },
- /* [2] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {38, 25, 53, 225},
- "Generate ASTs",
- "-gt",
- "Generate code for Abstract-Syntax-Trees "
- "(ASTs)."
- },
- /* [3] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {58, 25, 73, 225},
- "Generate line info",
- "-gl",
- "If this option is checked, ANTLR will ge"
- "nerate line info about grammaractions, t"
- "hereby making debugging easier since com"
- "pile errors will point to the grammar fi"
- "le."
- },
- /* [4] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {78, 25, 93, 225},
- "Generate error classes",
- "-ge",
- "If this option is checked, ANTLR will ge"
- "nerate an error class foreach non-termin"
- "al."
- },
- /* [5] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {98, 25, 113, 225},
- "Don't generate Code",
- "-gc",
- "If this option is checked, ANTLR will ge"
- "nerate no code, i.e. it will only perfor"
- "m analysis on the grammar."
- },
- /* [6] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {118, 25, 133, 225},
- "Delay lookahead fetches",
- "-gk",
- "If this option is checked, ANTLR will ge"
- "nerate a parser that delays lookahead fe"
- "tches until needed."
- },
- /* [7] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {138, 25, 153, 225},
- "Use newAST(...)",
- "-newAST",
- "In C++ mode use \"newAST(...)\" rather tha"
- "n \"new AST(...)\""
- },
- /* [8] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {18, 235, 33, 435},
- "Support parse traces",
- "-gd",
- "If this option is checked, ANTLR inserts"
- " code in each parsing function to provid"
- "e for user-defined handling of a detaile"
- "d parse trace. The code consists of call"
- "s to zzTRACEIN and zzTRACEOUT."
- },
- /* [9] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {38, 235, 53, 435},
- "Generate cross-references",
- "-cr",
- "If this option is checked, ANTLR will ge"
- "nerate a cross reference for all rules. "
- "For each rule it will print a list of al"
- "l other rules that refrence it."
- },
- /* [10] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {58, 235, 73, 435},
- "Don't create Lexer files",
- "-gx",
- "If this option is checked, ANTLR will no"
- "t generate DLG-related output files. Thi"
- "s option should be used if one wants a c"
- "ustom lexical analyzer or if one has mad"
- "e changes to the grammar not affecting t"
- "he lexical structure."
- },
- /* [11] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {78, 235, 93, 460},
- "Don't generate token expr sets",
- "-gs",
- "If this option is checked, ANTLR will no"
- "t generate sets for token expression set"
- "s; instead, it will generate a || separa"
- "ted sequence of LA(1)==token #. "
- },
- /* [12] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {98, 235, 113, 460},
- "Generate ANSI-compatible",
- "-ga",
- "Generate ANSI-compatible code (default=F"
- "ALSE)"
- },
- /* [13] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {118, 235, 133, 460},
- "Don't generate tokens.h",
- "-gxt",
- "Do not generate tokens.h (default=FALSE)"
- },
- /* [13] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {138, 235, 153, 460},
- "Provide \"(alpha)? beta\" info",
- "-alpha",
- "Provide additional information for \"(alpha)? beta\" error messages"
- },
- /* [14] */
- NotDependent {
-
- },
- RegularEntry {
- "Tabs(1 to 8):",
- {162, 23, 177, 117},
- {163, 125, 179, 196},
- "",
- keepCase,
- "-tab",
- "Width of tabs (1 to 8) for grammar.c/gra"
- "mmar.cpp files."
- },
- /* [15] */
- NotDependent {
-
- },
- RegularEntry {
- "Function Prefix:",
- {161, 236, 177, 342},
- {162, 345, 177, 454},
- "",
- keepCase,
- "-gp",
- "Prefix all generated rule functions with"
- " a string."
- }
- },
- /* [3] */
- 295,
- "Use this dialog to specify still more co"
- "mmand line options.",
- { /* array itemArray: 12 elements */
- /* [1] */
- NotDependent {
-
- },
- RadioButtons {
- { /* array radioArray: 3 elements */
- /* [1] */
- {38, 25, 53, 85}, "None", "", Set, "When this option is selected, ANTLR will"
- " not print the grammar to stdout.",
- /* [2] */
- {38, 100, 53, 160}, "Yes", "-p", NotSet, "When this option is selected, ANTLR will"
- " print the grammar, stripped of all acti"
- "ons and comments, to stdout.",
- /* [3] */
- {38, 175, 53, 235}, "More", "-pa", NotSet, "When this option is selected, ANTLR will"
- " print the grammar, stripped of all acti"
- "ons and comments, to stdout. It will als"
- "o annotate the output with the first set"
- "s determined from grammar analysis."
- }
- },
- /* [2] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {28, 15, 60, 250},
- "Grammar Printing"
- },
- /* [3] */
- NotDependent {
-
- },
- RadioButtons {
- { /* array radioArray: 3 elements */
- /* [1] */
- {88, 25, 103, 85}, "Low", "", Set, "When this option is selected, ANTLR will"
- " show ambiguities/errors in low detail.",
- /* [2] */
- {88, 100, 103, 160}, "Medium", "-e2", NotSet, "When this option is selected, ANTLR will"
- " show ambiguities/errors in more detail.",
- /* [3] */
- {88, 175, 103, 235}, "High", "-e3", NotSet, "When this option is selected, ANTLR will"
- " show ambiguities/errors in excruciating"
- " detail."
- }
- },
- /* [4] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {78, 15, 110, 250},
- "Error reporting"
- },
- /* [5] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {130, 22, 145, 222},
- "More warnings",
- "-w2",
- "If this option is checked, ANTLR will wa"
- "rn if semantic predicates and/or (É)? bl"
- "ocks are assumed to cover ambiguous alte"
- "rnatives."
- },
- /* [6] */
- NotDependent {
-
- },
- RegularEntry {
- "Report when tnode usage exceeds:",
- {162, 23, 180, 253},
- {162, 255, 178, 326},
- "",
- keepCase,
- "-treport",
- "Report when tnode usage exceeds value du"
- "ring ambiguity resolution."
- },
- /* [7] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {40, 292, 55, 431},
- "Predicate",
- "-info p",
- "With the antlr \"-info p\" switch the user"
- " will receive information about the pred"
- "icate suppression in the generated file."
- },
- /* [8] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {60, 292, 75, 430},
- "Tree Nodes",
- "-info t",
- "Using \"-info t\" gives information about "
- "the total number of tnodes created and t"
- "he peak number of tnodes."
- },
- /* [9] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {80, 292, 95, 425},
- "First/follow",
- "-info f",
- "first/follow set information."
- },
- /* [10] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {100, 292, 115, 425},
- "Monitor progress",
- "-info m",
- "prints name of each rule as it is starte"
- "d and flushes output at start of each rule."
- },
- /* [11] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {120, 292, 135, 416},
- "Orphan rules",
- "-info o",
- "If there is more than one rule which is "
- "not referenced by any other rule then al"
- "l such rules are listed."
- },
- /* [12] */
- NotDependent {
-
- },
- TextBox {
- gray,
- {28, 279, 147, 451},
- "Extra info"
- }
- },
- /* [4] */
- 295,
- "Use this dialog to specify command line "
- "options relating to renaming output file"
- "s.",
- { /* array itemArray: 7 elements */
- /* [1] */
- NotDependent {
-
- },
- RegularEntry {
- "Errors file name:",
- {35, 25, 50, 205},
- {35, 205, 51, 300},
- "err.c",
- keepCase,
- "-fe",
- "This entry specifies the name ANTLR uses"
- " for the errors file."
- },
- /* [2] */
- NotDependent {
-
- },
- RegularEntry {
- "Lexical output name:",
- {60, 25, 75, 205},
- {60, 205, 76, 300},
- "parser.dlg",
- keepCase,
- "-fl",
- "This entry specifies the name ANTLR uses"
- " for the lexical output file."
- },
- /* [3] */
- NotDependent {
-
- },
- RegularEntry {
- "Lexical modes name:",
- {85, 25, 100, 205},
- {85, 205, 101, 300},
- "mode.h",
- keepCase,
- "-fm",
- "This entry specifies the name ANTLR uses"
- " for the lexical mode definitions file."
- },
- /* [4] */
- NotDependent {
-
- },
- RegularEntry {
- "Remap file name:",
- {110, 25, 125, 205},
- {110, 205, 126, 300},
- "remap.h",
- keepCase,
- "-fr",
- "This entry specifies the name ANTLR uses"
- " for the file that remaps globally visib"
- "le symbols."
- },
- /* [5] */
- NotDependent {
-
- },
- RegularEntry {
- "Tokens file name:",
- {135, 25, 150, 205},
- {135, 205, 151, 300},
- "tokens.h",
- keepCase,
- "-ft",
- "This entry specifies the name ANTLR uses"
- " for the tokens file."
- },
- /* [6] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {160, 25, 175, 175},
- "Create std header",
- "-gh",
- "If this option is checked, ANTLR will cr"
- "eate a standard header file named, by de"
- "fault 'stdpccts.h'. This name can be alt"
- "ered using the entry right next door."
- },
- /* [7] */
- Or {
- { /* array OrArray: 1 elements */
- /* [1] */
- 6
- }
- },
- RegularEntry {
- "Std header file name:",
- {160, 175, 175, 355},
- {160, 355, 176, 450},
- "stdpccts.h",
- keepCase,
- "-fh",
- "This entry specifies the name ANTLR uses"
- " for the standard header file."
- }
- },
- /* [5] */
- 295,
- "Use this dialog to specify parse options"
- ".",
- { /* array itemArray: 9 elements */
- /* [1] */
- NotDependent {
-
- },
- RegularEntry {
- "Lookahead:",
- {23, 27, 38, 152},
- {46, 29, 62, 154},
- "1",
- keepCase,
- "-k",
- "This entry specifies the number of token"
- "s of lookahead."
- },
- /* [2] */
- NotDependent {
-
- },
- RegularEntry {
- "Compr lookahead:",
- {22, 167, 37, 292},
- {46, 172, 62, 297},
- "",
- keepCase,
- "-ck",
- "This entry specifies the number of token"
- "s of lookahead when using compressed (li"
- "near approximation) lookahead. In genera"
- "l, the compressed lookahead is much deep"
- "er than the full lookahead."
- },
- /* [3] */
- NotDependent {
-
- },
- RegularEntry {
- "Max tree nodes:",
- {22, 312, 37, 437},
- {46, 315, 62, 445},
- "",
- keepCase,
- "-rl",
- "This entry specifies the maximum number "
- "of tokens of tree nodes used by the gram"
- "mar analysis."
- },
- /* [4] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {76, 25, 91, 350},
- "Maintenance Release style hoisting",
- "-mrhoist",
- "Turn on/off k=1 Maintenance Release styl"
- "e hoisting."
- },
- /* [5] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {96, 25, 111, 431},
- "EXPERIMENTAL Maintenance Release style h"
- "oisting",
- "-mrhoistk",
- "Turn on/off k>1 EXPERIMENTAL Maintenance"
- " Release style hoisting."
- },
- /* [6] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {116, 25, 131, 363},
- "Compute context for hoisted predicates",
- "-prc on",
- "Turn on/off computation of context for h"
- "oisted predicates."
- },
- /* [7] */
- NotDependent {
-
- },
- RegularEntry {
- "Ambiguity aid:",
- {140, 27, 155, 125},
- {141, 135, 155, 209},
- "",
- keepCase,
- "-aa",
- "Ambiguity aid for a rule (rule name or l"
- "ine number)."
- },
- /* [8] */
- NotDependent {
-
- },
- RegularEntry {
- "Limits exp growth:",
- {140, 236, 155, 361},
- {139, 372, 155, 452},
- "",
- keepCase,
- "-aad",
- "Limits exp growth of -aa listing - defau"
- "lt=1 (max=ck value)."
- },
- /* [9] */
- NotDependent {
-
- },
- CheckOption {
- NotSet,
- {164, 26, 179, 366},
- "Lookahead token may appear multiple time"
- "s",
- "-aam",
- "Lookahead token may appear multiple time"
- "s in -aa listing."
- }
- }
- }
-};
-
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt b/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
deleted file mode 100644
index 4a7d22e7f2..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr1.txt
+++ /dev/null
@@ -1,264 +0,0 @@
-
-
-
-ANTLR(1) PCCTS Manual Pages ANTLR(1)
-
-
-
-NAME
- antlr - ANother Tool for Language Recognition
-
-SYNTAX
- antlr [_o_p_t_i_o_n_s] _g_r_a_m_m_a_r__f_i_l_e_s
-
-DESCRIPTION
- _A_n_t_l_r converts an extended form of context-free grammar into
- a set of C functions which directly implement an efficient
- form of deterministic recursive-descent LL(k) parser.
- Context-free grammars may be augmented with predicates to
- allow semantics to influence parsing; this allows a form of
- context-sensitive parsing. Selective backtracking is also
- available to handle non-LL(k) and even non-LALR(k) con-
- structs. _A_n_t_l_r also produces a definition of a lexer which
- can be automatically converted into C code for a DFA-based
- lexer by _d_l_g. Hence, _a_n_t_l_r serves a function much like that
- of _y_a_c_c, however, it is notably more flexible and is more
- integrated with a lexer generator (_a_n_t_l_r directly generates
- _d_l_g code, whereas _y_a_c_c and _l_e_x are given independent
- descriptions). Unlike _y_a_c_c which accepts LALR(1) grammars,
- _a_n_t_l_r accepts LL(k) grammars in an extended BNF notation -
- which eliminates the need for precedence rules.
-
- Like _y_a_c_c grammars, _a_n_t_l_r grammars can use automatically-
- maintained symbol attribute values referenced as dollar
- variables. Further, because _a_n_t_l_r generates top-down
- parsers, arbitrary values may be inherited from parent rules
- (passed like function parameters). _A_n_t_l_r also has a mechan-
- ism for creating and manipulating abstract-syntax-trees.
-
- There are various other niceties in _a_n_t_l_r, including the
- ability to spread one grammar over multiple files or even
- multiple grammars in a single file, the ability to generate
- a version of the grammar with actions stripped out (for
- documentation purposes), and lots more.
-
-OPTIONS
- -ck _n
- Use up to _n symbols of lookahead when using compressed
- (linear approximation) lookahead. This type of looka-
- head is very cheap to compute and is attempted before
- full LL(k) lookahead, which is of exponential complex-
- ity in the worst case. In general, the compressed loo-
- kahead can be much deeper (e.g, -ck 10) _t_h_a_n _t_h_e _f_u_l_l
- _l_o_o_k_a_h_e_a_d (_w_h_i_c_h _u_s_u_a_l_l_y _m_u_s_t _b_e _l_e_s_s _t_h_a_n _4).
-
- -CC Generate C++ output from both ANTLR and DLG.
-
- -cr Generate a cross-reference for all rules. For each
- rule, print a list of all other rules that reference
- it.
-
- -e1 Ambiguities/errors shown in low detail (default).
-
- -e2 Ambiguities/errors shown in more detail.
-
- -e3 Ambiguities/errors shown in excruciating detail.
-
- -fe file
- Rename err.c to file.
-
- -fh file
- Rename stdpccts.h header (turns on -gh) to file.
-
- -fl file
- Rename lexical output, parser.dlg, to file.
-
- -fm file
- Rename file with lexical mode definitions, mode.h, to
- file.
-
- -fr file
- Rename file which remaps globally visible symbols,
- remap.h, to file.
-
- -ft file
- Rename tokens.h to file.
-
- -ga Generate ANSI-compatible code (default case). This has
- not been rigorously tested to be ANSI XJ11 C compliant,
- but it is close. The normal output of _a_n_t_l_r is
- currently compilable under both K&R, ANSI C, and C++-
- this option does nothing because _a_n_t_l_r generates a
- bunch of #ifdef's to do the right thing depending on
- the language.
-
- -gc Indicates that _a_n_t_l_r should generate no C code, i.e.,
- only perform analysis on the grammar.
-
- -gd C code is inserted in each of the _a_n_t_l_r generated pars-
- ing functions to provide for user-defined handling of a
- detailed parse trace. The inserted code consists of
- calls to the user-supplied macros or functions called
- zzTRACEIN and zzTRACEOUT. The only argument is a _c_h_a_r
- * pointing to a C-style string which is the grammar
- rule recognized by the current parsing function. If no
- definition is given for the trace functions, upon rule
- entry and exit, a message will be printed indicating
- that a particular rule as been entered or exited.
-
- -ge Generate an error class for each non-terminal.
-
- -gh Generate stdpccts.h for non-ANTLR-generated files to
- include. This file contains all defines needed to
- describe the type of parser generated by _a_n_t_l_r (e.g.
- how much lookahead is used and whether or not trees are
- constructed) and contains the header action specified
- by the user.
-
- -gk Generate parsers that delay lookahead fetches until
- needed. Without this option, _a_n_t_l_r generates parsers
- which always have _k tokens of lookahead available.
-
- -gl Generate line info about grammar actions in C parser of
- the form # _l_i_n_e "_f_i_l_e" which makes error messages from
- the C/C++ compiler make more sense as they will point
- into the grammar file not the resulting C file.
- Debugging is easier as well, because you will step
- through the grammar not C file.
-
- -gs Do not generate sets for token expression lists;
- instead generate a ||-separated sequence of
- LA(1)==_t_o_k_e_n__n_u_m_b_e_r. The default is to generate sets.
-
- -gt Generate code for Abstract-Syntax Trees.
-
- -gx Do not create the lexical analyzer files (dlg-related).
- This option should be given when the user wishes to
- provide a customized lexical analyzer. It may also be
- used in _m_a_k_e scripts to cause only the parser to be
- rebuilt when a change not affecting the lexical struc-
- ture is made to the input grammars.
-
- -k _n Set k of LL(k) to _n; i.e. set tokens of look-ahead
- (default==1).
-
- -o dir
- Directory where output files should go (default=".").
- This is very nice for keeping the source directory
- clear of ANTLR and DLG spawn.
-
- -p The complete grammar, collected from all input grammar
- files and stripped of all comments and embedded
- actions, is listed to stdout. This is intended to aid
- in viewing the entire grammar as a whole and to elim-
- inate the need to keep actions concisely stated so that
- the grammar is easier to read. Hence, it is preferable
- to embed even complex actions directly in the grammar,
- rather than to call them as subroutines, since the sub-
- routine call overhead will be saved.
-
- -pa This option is the same as -p except that the output is
- annotated with the first sets determined from grammar
- analysis.
-
- -prc on
- Turn on the computation and hoisting of predicate con-
- text.
-
- -prc off
- Turn off the computation and hoisting of predicate con-
- text. This option makes 1.10 behave like the 1.06
- release with option -pr on. Context computation is off
- by default.
-
- -rl _n
- Limit the maximum number of tree nodes used by grammar
- analysis to _n. Occasionally, _a_n_t_l_r is unable to
- analyze a grammar submitted by the user. This rare
- situation can only occur when the grammar is large and
- the amount of lookahead is greater than one. A non-
- linear analysis algorithm is used by PCCTS to handle
- the general case of LL(k) parsing. The average com-
- plexity of analysis, however, is near linear due to
- some fancy footwork in the implementation which reduces
- the number of calls to the full LL(k) algorithm. An
- error message will be displayed, if this limit is
- reached, which indicates the grammar construct being
- analyzed when _a_n_t_l_r hit a non-linearity. Use this
- option if _a_n_t_l_r seems to go out to lunch and your disk
- start thrashing; try _n=10000 to start. Once the
- offending construct has been identified, try to remove
- the ambiguity that _a_n_t_l_r was trying to overcome with
- large lookahead analysis. The introduction of (...)?
- backtracking blocks eliminates some of these problems -
- _a_n_t_l_r does not analyze alternatives that begin with
- (...)? (it simply backtracks, if necessary, at run
- time).
-
- -w1 Set low warning level. Do not warn if semantic
- predicates and/or (...)? blocks are assumed to cover
- ambiguous alternatives.
-
- -w2 Ambiguous parsing decisions yield warnings even if
- semantic predicates or (...)? blocks are used. Warn if
- predicate context computed and semantic predicates
- incompletely disambiguate alternative productions.
-
- - Read grammar from standard input and generate stdin.c
- as the parser file.
-
-SPECIAL CONSIDERATIONS
- _A_n_t_l_r works... we think. There is no implicit guarantee of
- anything. We reserve no legal rights to the software known
- as the Purdue Compiler Construction Tool Set (PCCTS) - PCCTS
- is in the public domain. An individual or company may do
- whatever they wish with source code distributed with PCCTS
- or the code generated by PCCTS, including the incorporation
- of PCCTS, or its output, into commercial software. We
- encourage users to develop software with PCCTS. However, we
- do ask that credit is given to us for developing PCCTS. By
- "credit", we mean that if you incorporate our source code
- into one of your programs (commercial product, research pro-
- ject, or otherwise) that you acknowledge this fact somewhere
- in the documentation, research report, etc... If you like
- PCCTS and have developed a nice tool with the output, please
- mention that you developed it using PCCTS. As long as these
- guidelines are followed, we expect to continue enhancing
- this system and expect to make other tools available as they
- are completed.
-
-FILES
- *.c output C parser.
-
- *.cpp
- output C++ parser when C++ mode is used.
-
- parser.dlg
- output _d_l_g lexical analyzer.
-
- err.c
- token string array, error sets and error support rou-
- tines. Not used in C++ mode.
-
- remap.h
- file that redefines all globally visible parser sym-
- bols. The use of the #parser directive creates this
- file. Not used in C++ mode.
-
- stdpccts.h
- list of definitions needed by C files, not generated by
- PCCTS, that reference PCCTS objects. This is not gen-
- erated by default. Not used in C++ mode.
-
- tokens.h
- output #_d_e_f_i_n_e_s for tokens used and function prototypes
- for functions generated for rules.
-
-
-SEE ALSO
- dlg(1), pccts(1)
-
-
-
-
-
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
deleted file mode 100644
index 5cb657bb2e..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/* bits.c -- manage creation and output of bit sets used by the parser.
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include "pcctscfg.h"
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-
-/* char is only thing that is pretty much always known == 8 bits
- * This allows output of antlr (set stuff, anyway) to be androgynous (portable)
- */
-typedef unsigned char SetWordType;
-#define BitsPerByte 8
-#define BitsPerWord BitsPerByte*sizeof(SetWordType)
-
-static SetWordType *setwd = NULL;
-int setnum = -1;
-int wordnum = 0;
-
-int esetnum = 0;
-
-/* Used to convert native wordsize, which ANTLR uses (via set.c) to manipulate sets,
- to bytes that are most portable size-wise.
- */
-void
-#ifdef __USE_PROTOS
-DumpIntAsChars( FILE *f, char *format, unsigned wd )
-#else
-DumpIntAsChars( f, format, wd )
-FILE *f;
-char *format;
-unsigned wd;
-#endif
-{
- int i;
- /* uses max of 32 bit unsigned integer for the moment */
- static unsigned long byte_mask[sizeof(unsigned long)] =
- { 0xFF, 0xFF00UL, 0xFF0000UL, 0xFF000000UL }; /* MR20 G. Hobbelt */
-/* 0xFF00000000, 0xFF0000000000, 0xFF000000000000, 0xFF00000000000000 };*/
-
- /* for each byte in the word */
- assert(sizeof(unsigned) <= 4); /* M20 G. Hobbelt Sanity check */
- for (i=0; i<sizeof(unsigned); i++)
- {
- /* mask out the ith byte and shift down to the first 8 bits */
- fprintf(f, format, (wd&byte_mask[i])>>(i*BitsPerByte));
- if ( i<sizeof(unsigned)-1) fprintf(f, ",");
- }
-}
-
-/* Create a new setwd (ignoring [Ep] token on end) */
-void
-#ifdef __USE_PROTOS
-NewSetWd( void )
-#else
-NewSetWd( )
-#endif
-{
- SetWordType *p;
-
- if ( setwd == NULL )
- {
- setwd = (SetWordType *) calloc(TokenNum, sizeof(SetWordType));
- require(setwd!=NULL, "NewSetWd: cannot alloc set wd\n");
- }
- for (p = setwd; p<&(setwd[TokenNum]); p++) {*p=0;}
- wordnum++;
-}
-
-void
-#ifdef __USE_PROTOS
-DumpSetWd( void )
-#else
-DumpSetWd( )
-#endif
-{
- if ( GenCC ) DumpSetWdForCC();
- else DumpSetWdForC();
-}
-
-/* Dump the current setwd to ErrFile. 0..MaxTokenVal */
-void
-#ifdef __USE_PROTOS
-DumpSetWdForC( void )
-#else
-DumpSetWdForC( )
-#endif
-{
- int i,c=1;
-
- if ( setwd==NULL ) return;
- fprintf(DefFile, "extern SetWordType setwd%d[];\n", wordnum);
- fprintf(ErrFile,
- "SetWordType setwd%d[%d] = {", wordnum, TokenNum-1);
- for (i=0; i<TokenNum-1; i++)
- {
- DAWDLE;
- if ( i!=0 ) fprintf(ErrFile, ",");
- if ( c == 8 ) {fprintf(ErrFile, "\n\t"); c=1;} else c++;
- fprintf(ErrFile, "0x%x", setwd[i]);
- }
- fprintf(ErrFile, "};\n");
-}
-
-/* Dump the current setwd to Parser.C file. 0..MaxTokenVal;
- * Only used if -CC on.
- */
-void
-#ifdef __USE_PROTOS
-DumpSetWdForCC( void )
-#else
-DumpSetWdForCC( )
-#endif
-{
- int i,c=1;
-
- if ( setwd==NULL ) return;
- fprintf(Parser_h, "\tstatic SetWordType setwd%d[%d];\n", wordnum, TokenNum-1);
- fprintf(Parser_c,
- "SetWordType %s::setwd%d[%d] = {", CurrentClassName, wordnum,
- TokenNum-1);
- for (i=0; i<TokenNum-1; i++)
- {
- DAWDLE;
- if ( i!=0 ) fprintf(Parser_c, ",");
- if ( c == 8 ) {fprintf(Parser_c, "\n\t"); c=1;} else c++;
- fprintf(Parser_c, "0x%x", setwd[i]);
- }
- fprintf(Parser_c, "};\n");
-}
-
-/* Make a new set. Dump old setwd and create new setwd if current setwd is full */
-void
-#ifdef __USE_PROTOS
-NewSet( void )
-#else
-NewSet( )
-#endif
-{
- setnum++;
- if ( setnum==BitsPerWord ) /* is current setwd full? */
- {
- DumpSetWd(); NewSetWd(); setnum = 0;
- }
-}
-
-/* s is a set of tokens. Turn on bit at each token position in set 'setnum' */
-void
-#ifdef __USE_PROTOS
-FillSet( set s )
-#else
-FillSet( s )
-set s;
-#endif
-{
- SetWordType mask=(((unsigned)1)<<setnum);
- unsigned int e;
-
- while ( !set_nil(s) )
- {
- e = set_int(s);
- set_rm(e, s);
- setwd[e] |= mask;
- }
-}
-
- /* E r r o r C l a s s S t u f f */
-
-/* compute the FIRST of a rule for the error class stuff */
-static set
-#ifdef __USE_PROTOS
-Efirst( char *rule, ECnode *eclass )
-#else
-Efirst( rule, eclass )
-char *rule;
-ECnode *eclass;
-#endif
-{
- set rk, a;
- Junction *r;
- RuleEntry *q = (RuleEntry *) hash_get(Rname, rule);
-
- if ( q == NULL )
- {
- warnNoFL(eMsg2("undefined rule '%s' referenced in errclass '%s'; ignored",
- rule, TokenString(eclass->tok)));
- return empty;
- }
- r = RulePtr[q->rulenum];
- r->end->halt = TRUE; /* don't let reach fall off end of rule here */
- rk = empty;
- REACH(r, 1, &rk, a);
- r->end->halt = FALSE;
- return a;
-}
-
-/*
- * scan the list of tokens/eclasses/nonterminals filling the new eclass
- * with the set described by the list. Note that an eclass can be
- * quoted to allow spaces etc... However, an eclass must not conflict
- * with a reg expr found elsewhere. The reg expr will be taken over
- * the eclass name.
- */
-static void
-#ifdef __USE_PROTOS
-doEclass( char *eclass )
-#else
-doEclass( eclass )
-char *eclass;
-#endif
-{
- TermEntry *q;
- ECnode *p;
- TCnode *tcnode;
- ListNode *e;
- unsigned int t;
- unsigned deg=0;
- set a;
- require(eclass!=NULL, "doEclass: NULL eset");
-
- p = (ECnode *) eclass;
- lexmode(p->lexclass); /* switch to lexclass where errclass is defined */
- p->eset = empty;
- for (e = (p->elist)->next; e!=NULL; e=e->next)
- {
- q = NULL; /* MR23 */
-
- if ( islower( *((char *)e->elem) ) ) /* is it a rule ref? (alias FIRST request) */
- {
- a = Efirst((char *)e->elem, p);
- set_orin(&p->eset, a);
- deg += set_deg(a);
- set_free( a );
- continue;
- }
- else if ( *((char *)e->elem)=='"' )
- {
- t = 0;
- q = (TermEntry *) hash_get(Texpr, (char *) e->elem);
- if ( q == NULL )
- {
- /* if quoted and not an expr look for eclass name */
- q = (TermEntry *) hash_get(Tname, *((char **)&(e->elem))=StripQuotes((char *)e->elem));
- if ( q != NULL ) t = q->token;
- }
- else t = q->token;
- }
- else /* labelled token/eclass/tokclass */
- {
- q = (TermEntry *) hash_get(Tname, (char *)e->elem);
- if ( q != NULL )
- {
- if ( strcmp((char *)e->elem, TokenString(p->tok))==0 )
- {
- warnNoFL(eMsg1("self-referential error class '%s'; ignored",
- (char *)e->elem));
- continue;
- }
- else
- t = q->token;
- }
- else t=0;
- }
- if ( t!=0 )
- {
- if (isTermEntryTokClass(q)) { /* MR23 */
- tcnode = q->tclass; /* MR23 */
- set_orin(&p->eset, tcnode->tset); /* MR23 */
- deg = set_deg(p->eset); /* MR23 */
- } /* MR23 */
- else {
- set_orel(t, &p->eset);
- deg++;
- }
- }
- else warnNoFL(eMsg2("undefined token '%s' referenced in errclass '%s'; ignored",
- (char *)e->elem, TokenString(p->tok)));
- }
- p->setdeg = deg;
-}
-
-void
-#ifdef __USE_PROTOS
-ComputeErrorSets( void )
-#else
-ComputeErrorSets( )
-#endif
-{
-#ifdef __cplusplus
- list_apply(eclasses, (void (*)(void *)) doEclass);
-#else
-#ifdef __USE_PROTOS
- list_apply(eclasses, (void (*)(void *)) doEclass);
-#else
- list_apply(eclasses, doEclass);
-#endif
-#endif
-}
-
-void
-#ifdef __USE_PROTOS
-ComputeTokSets( void )
-#else
-ComputeTokSets( )
-#endif
-{
- ListNode *t, *e = NULL, *e1, *e2;
- int something_changed;
- int i;
- TCnode *p;
- TermEntry *q, *q1, *q2;
-
- if ( tclasses == NULL ) return;
-
- /* turn lists of token/tokclass references into sets */
- for (t = tclasses->next; t!=NULL; t=t->next)
- {
- p = (TCnode *) t->elem;
-
- /* if wild card, then won't have entries in tclass, assume all_tokens */
- if ( p->tok == WildCardToken )
- {
- p->tset = set_dup(all_tokens);
- continue;
- }
-
- lexmode(p->lexclass); /* switch to lexclass where tokclass is defined */
- p->tset = empty;
-
- /* instantiate all tokens/token_classes into the tset */
- for (e = (p->tlist)->next; e!=NULL; e=e->next)
- {
- char *tokstr;
- tokstr = (char *)e->elem;
- if ( *tokstr == '"' ) {
- q = (TermEntry *) hash_get(Texpr, tokstr);
- require(q!=NULL, "ComputeTokSets: no token def");
- set_orel(q->token, &p->tset);
- } else if (tokstr[0] == '.') {
- e1=e->next;
- e2=e1->next;
- e=e2;
- q1= (TermEntry *) hash_get(Tname, (char *)e1->elem);
- require(q1!=NULL, "ComputeTokSets: no token def");
- q2= (TermEntry *) hash_get(Tname, (char *)e2->elem);
- require(q2!=NULL, "ComputeTokSets: no token def");
-
- if (set_el(q1->token,imag_tokens)) {
-errNoFL(eMsg2("can't define #tokclass %s using #tokclass or #errclass %s",
- TokenString(p->tok),(char *)e1->elem) );
- }
- if (set_el(q2->token,imag_tokens)) {
-errNoFL(eMsg2("can't define #tokclass %s using #tokclass or #errclass %s",
- TokenString(p->tok),(char *)e2->elem) );
- }
- if (q1->token > q2->token) {
-errNoFL(eMsg3("for #tokclass %s %s..%s - first token number > second token number",
- TokenString(p->tok),(char *)e1->elem,(char *)e2->elem) );
- for (i=q2->token; i<=q1->token; i++) { set_orel(i, &p->tset); }
- } else {
- for (i=q1->token; i<=q2->token; i++) { set_orel(i, &p->tset); }
- }
- } else {
- q = (TermEntry *) hash_get(Tname, tokstr);
- require(q!=NULL, "ComputeTokSets: no token def");
- set_orel(q->token, &p->tset);
- }
- }
- }
-
- /* Go thru list of tokclasses again looking for tokclasses in sets */
-again:
- something_changed = 0;
- for (t = tclasses->next; t!=NULL; t=t->next)
- {
- set tcl;
- p = (TCnode *) t->elem;
- tcl = set_and(p->tset, tokclasses);
- if ( !set_nil(tcl) )
- {
- int tk;
- /* replace refs to tokclasses with the associated set of tokens */
- something_changed = 1;
- while ( !set_nil(tcl) )
- {
- tk = set_int(tcl); /* grab one of the tok class refs */
- set_rm(tk, tcl);
- if ( p->tok != tk ) /* tokclass ref to yourself? */
- {
- q = (TermEntry *) hash_get(Tname, TokenString(tk));
- require(q!=NULL, "#tokclass not in hash table");
- set_orin(&p->tset, q->tclass->tset);
- }
- set_rm(tk, p->tset); /* remove ref that we replaced */
- }
- }
- set_free(tcl);
- }
- if ( something_changed ) goto again;
-}
-
-void
-#ifdef __USE_PROTOS
-DumpRemainingTokSets(void)
-#else
-DumpRemainingTokSets()
-#endif
-{
- TCnode *p;
- ListNode *t;
-
- /* Go thru tclasses (for the last time) and dump the sets not dumped
- * during code gen; yes, this is a bogus way to do this, but ComputeTokSets()
- * can't dump the defs as the error file and tok file has not been created
- * yet etc...
- */
- if ( tclasses==NULL ) return;
- for (t = tclasses->next; t!=NULL; t=t->next)
- {
- unsigned e;
- p = (TCnode *) t->elem;
- if ( p->dumped ) continue;
- e = DefErrSet(&(p->tset), 0, TokenString(p->tok));
- p->dumped = 1;
- p->setnum = e;
- }
-}
-
-
-/* replace a subset of an error set with an error class name if a subset is found
- * repeat process until no replacements made
- */
-void
-#ifdef __USE_PROTOS
-SubstErrorClass( set *f )
-#else
-SubstErrorClass( f )
-set *f;
-#endif
-{
- int max, done = 0;
- ListNode *p;
- ECnode *ec, *maxclass = NULL;
- set a;
- require(f!=NULL, "SubstErrorClass: NULL eset");
-
- if ( eclasses == NULL ) return;
- while ( !done )
- {
- max = 0;
- maxclass = NULL;
- for (p=eclasses->next; p!=NULL; p=p->next) /* chk all error classes */
- {
- ec = (ECnode *) p->elem;
- if ( ec->setdeg > max )
- {
- if ( set_sub(ec->eset, *f) || set_equ(ec->eset, *f) )
- {maxclass = ec; max=ec->setdeg;}
- }
- }
- if ( maxclass != NULL ) /* if subset found, replace with token */
- {
- a = set_dif(*f, maxclass->eset);
- set_orel((unsigned)maxclass->tok, &a);
- set_free(*f);
- *f = a;
- }
- else done = 1;
- }
-}
-
-int
-#ifdef __USE_PROTOS
-DefErrSet1(int nilOK, set *f, int subst, char *name )
-#else
-DefErrSet1(nilOK, f, subst, name )
-int nilOK;
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-#endif
-{
- if ( GenCC ) return DefErrSetForCC1(nilOK, f, subst, name, "_set");
- else return DefErrSetForC1(nilOK, f, subst, name, "_set");
-}
-
-int
-#ifdef __USE_PROTOS
-DefErrSet( set *f, int subst, char *name )
-#else
-DefErrSet( f, subst, name )
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-#endif
-{
- return DefErrSet1(0,f,subst,name);
-}
-
-int
-#ifdef __USE_PROTOS
-DefErrSetWithSuffix(int nilOK, set *f, int subst, char *name, const char* suffix)
-#else
-DefErrSetWithSuffix(nilOK, f, subst, name, suffix )
-int nilOK;
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-char *suffix;
-#endif
-{
- if ( GenCC ) return DefErrSetForCC1(nilOK, f, subst, name, suffix );
- else return DefErrSetForC1(nilOK, f, subst, name, suffix);
-}
-
-/* Define a new error set. WARNING...set-implementation dependent.
- */
-int
-#ifdef __USE_PROTOS
-DefErrSetForC1(int nilOK, set *f, int subst, char * name, const char * suffix)
-#else
-DefErrSetForC1(nilOK, f, subst, name, suffix)
-int nilOK; /* MR13 */
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-const char *suffix;
-#endif
-{
- unsigned *p, *endp;
- int e=1;
-
- if (!nilOK) require(!set_nil(*f), "DefErrSetForC1: nil set to dump?");
-
- if ( subst ) SubstErrorClass(f);
- p = f->setword;
- endp = &(f->setword[f->n]);
- esetnum++;
- if ( name!=NULL )
- fprintf(DefFile, "extern SetWordType %s%s[];\n", name, suffix);
- else
- fprintf(DefFile, "extern SetWordType zzerr%d[];\n", esetnum);
- if ( name!=NULL ) {
- fprintf(ErrFile, "SetWordType %s%s[%lu] = {",
- name,
- suffix,
- NumWords(TokenNum-1)*sizeof(unsigned));
- }
- else {
- fprintf(ErrFile, "SetWordType zzerr%d[%lu] = {",
- esetnum,
- NumWords(TokenNum-1)*sizeof(unsigned));
- }
- while ( p < endp )
- {
- if ( e > 1 ) fprintf(ErrFile, ", ");
- DumpIntAsChars(ErrFile, "0x%x", *p++);
- if ( e == 3 )
- {
- DAWDLE;
- if ( p < endp ) fprintf(ErrFile, ",");
- fprintf(ErrFile, "\n\t");
- e=1;
- }
- else e++;
- }
- fprintf(ErrFile, "};\n");
-
- return esetnum;
-}
-
-int
-#ifdef __USE_PROTOS
-DefErrSetForC( set *f, int subst, char *name )
-#else
-DefErrSetForC( f, subst, name )
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-#endif
-{
- return DefErrSetForC1(0,f,subst,name, "_set");
-}
-
-/* Define a new error set. WARNING...set-implementation dependent;
- * Only used when -CC on.
- */
-
-int
-#ifdef __USE_PROTOS
-DefErrSetForCC1(int nilOK, set *f, int subst, char *name, const char *suffix )
-#else
-DefErrSetForCC1(nilOK, f, subst, name, suffix )
-int nilOK; /* MR13 */
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-const char *suffix;
-#endif
-{
- unsigned *p, *endp;
- int e=1;
-
- if (!nilOK) require(!set_nil(*f), "DefErrSetForCC1: nil set to dump?");
-
- if ( subst ) SubstErrorClass(f);
- p = f->setword;
- endp = &(f->setword[f->n]);
- esetnum++;
-
- if ( name!=NULL ) {
- fprintf(Parser_h, "\tstatic SetWordType %s%s[%lu];\n", name, suffix,
- NumWords(TokenNum-1)*sizeof(unsigned));
- fprintf(Parser_c, "SetWordType %s::%s%s[%lu] = {",
- CurrentClassName,
- name,
- suffix,
- NumWords(TokenNum-1)*sizeof(unsigned));
- }
- else {
- fprintf(Parser_c, "SetWordType %s::err%d[%lu] = {",
- CurrentClassName,
- esetnum,
- NumWords(TokenNum-1)*sizeof(unsigned));
- fprintf(Parser_h, "\tstatic SetWordType err%d[%lu];\n", esetnum,
- NumWords(TokenNum-1)*sizeof(unsigned));
- }
-
- while ( p < endp )
- {
- if ( e > 1 ) fprintf(Parser_c, ", ");
- DumpIntAsChars(Parser_c, "0x%x", *p++);
- if ( e == 3 )
- {
- if ( p < endp ) fprintf(Parser_c, ",");
- fprintf(Parser_c, "\n\t");
- e=1;
- }
- else e++;
- }
- fprintf(Parser_c, "};\n");
-
- return esetnum;
-}
-
-int
-#ifdef __USE_PROTOS
-DefErrSetForCC( set *f, int subst, char *name )
-#else
-DefErrSetForCC( f, subst, name )
-set *f;
-int subst; /* should be substitute error classes? */
-char *name;
-#endif
-{
- return DefErrSetForCC1(0,f,subst,name, "_set");
-}
-
-void
-#ifdef __USE_PROTOS
-GenParser_c_Hdr(void)
-#else
-GenParser_c_Hdr()
-#endif
-{
- int i,j;
- TermEntry *te;
- char * hasAkaName = NULL; /* MR23 */
-
- hasAkaName = (char *) malloc(TokenNum+1); /* MR23 */
- require(hasAkaName!=NULL, "Cannot alloc hasAkaName\n"); /* MR23 */
- for (i = 0; i < TokenNum; i++) hasAkaName[i]='0'; /* MR23 */
- hasAkaName[TokenNum] = 0; /* MR23 */
-
- fprintf(Parser_c, "/*\n");
- fprintf(Parser_c, " * %s: P a r s e r S u p p o r t\n", CurrentClassName);
- fprintf(Parser_c, " *\n");
- fprintf(Parser_c, " * Generated from:");
- for (i=0; i<NumFiles; i++) fprintf(Parser_c, " %s", FileStr[i]);
- fprintf(Parser_c, "\n");
- fprintf(Parser_c, " *\n");
- fprintf(Parser_c, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(Parser_c, " * Parr Research Corporation\n");
- fprintf(Parser_c, " * with Purdue University Electrical Engineering\n");
- fprintf(Parser_c, " * with AHPCRC, University of Minnesota\n");
- fprintf(Parser_c, " * ANTLR Version %s\n", Version);
- fprintf(Parser_c, " */\n\n");
-
- if ( FirstAction != NULL ) dumpAction(FirstAction,Parser_c, 0, -1, 0, 1); /* MR11 MR15b */
-
- fprintf(Parser_c, "#define ANTLR_VERSION %s\n", VersionDef);
-
- fprintf(Parser_c, "#include \"pcctscfg.h\"\n");
- fprintf(Parser_c, "#include \"pccts_stdio.h\"\n");
- fprintf(Parser_c, "#define ANTLR_SUPPORT_CODE\n");
- if ( UserTokenDefsFile != NULL )
- fprintf(Parser_c, "#include %s\n", UserTokenDefsFile);
- else
- fprintf(Parser_c, "#include \"%s\"\n", DefFileName);
-
- fprintf(Parser_c, "#include \"%s.h\"\n\n", CurrentClassName);
-
- fprintf(Parser_c, "const ANTLRChar *%s::tokenName(int tok) ", /* MR1 */
- CurrentClassName); /* MR1 */
- fprintf(Parser_c, " { return _token_tbl[tok]; }\n"); /* MR1 */ /* MR10 */
- /* Dump a Parser::tokens for each automaton */
- fprintf(Parser_c, "\nconst ANTLRChar *%s::_token_tbl[]={\n",
- CurrentClassName); /* MR20 */
- fprintf(Parser_c, "\t/* 00 */\t\"Invalid\"");
-
- for (i=1; i<TokenNum-1; i++)
- {
- DAWDLE;
- if ( i == EpToken ) continue;
- /* remapped to invalid token? */
- if ( TokenInd!=NULL && TokenInd[i]>=LastTokenCounted )
- {
- fprintf(Parser_c, ",\n\t/* %02d */\t\"invalid\"", i);
- continue;
- }
- if ( TokenString(i) != NULL ) {
- te=(TermEntry *) hash_get(Tname,TokenString(i)); /* MR11 */
- if (te == NULL || te->akaString == NULL) { /* MR11 */
- fprintf(Parser_c, ",\n\t/* %02d */\t\"%s\"", i, TokenString(i));
- } else {
- hasAkaName[i] = '1'; /* MR23 */
- fprintf(Parser_c, ",\n\t/* %02d */\t\"%s\"", i, te->akaString); /* MR11 */
- }
- }
- else
- {
- /* look in all lexclasses for the reg expr */
- for (j=0; j<NumLexClasses; j++)
- {
- lexmode(j);
- if ( ExprString(i) != NULL )
- {
- fprintf(Parser_c, ",\n\t/* %02d */\t", i);
- dumpExpr(Parser_c, ExprString(i));
- break;
- }
- }
- if ( j>=NumLexClasses )
- {
- if ( UserDefdTokens )
- {
- fprintf(Parser_c, ",\n\t/* %02d */\t\"\"", i);
- }
- else
- fatal_internal(eMsgd("No label or expr for token %d",i));
- }
- }
- }
- fprintf(Parser_c, "\n};\n");
-
- /* Build constructors */
- fprintf(Parser_c, "\n%s::", CurrentClassName);
- fprintf(Parser_c, "%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%lu)\n",
- CurrentClassName,
- (BaseClassName == NULL ? "ANTLRParser" : BaseClassName),
- OutputLL_k,
- FoundGuessBlk,
- DemandLookahead,
- NumWords(TokenNum-1)*sizeof(unsigned));
- fprintf(Parser_c, "{\n");
- fprintf(Parser_c, "\ttoken_tbl = _token_tbl;\n");
- if (TraceGen) {
- fprintf(Parser_c, "\ttraceOptionValueDefault=1;\t\t// MR10 turn trace ON\n");
- } else {
- fprintf(Parser_c, "\ttraceOptionValueDefault=0;\t\t// MR10 turn trace OFF\n");
- };
- fprintf(Parser_c, "}\n\n");
- free ( (void *) hasAkaName);
-}
-
-void
-#ifdef __USE_PROTOS
-GenParser_h_Hdr(void)
-#else
-GenParser_h_Hdr()
-#endif
-{
- int i;
-
- fprintf(Parser_h, "/*\n");
- fprintf(Parser_h, " * %s: P a r s e r H e a d e r \n", CurrentClassName);
- fprintf(Parser_h, " *\n");
- fprintf(Parser_h, " * Generated from:");
- for (i=0; i<NumFiles; i++) fprintf(Parser_h, " %s", FileStr[i]);
- fprintf(Parser_h, "\n");
- fprintf(Parser_h, " *\n");
- fprintf(Parser_h, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(Parser_h, " * Parr Research Corporation\n");
- fprintf(Parser_h, " * with Purdue University Electrical Engineering\n");
- fprintf(Parser_h, " * with AHPCRC, University of Minnesota\n");
- fprintf(Parser_h, " * ANTLR Version %s\n", Version);
- fprintf(Parser_h, " */\n\n");
-
- if ( FirstAction != NULL ) dumpAction( FirstAction, Parser_h, 0, -1, 0, 1); /* MR11 MR15b */
-
- fprintf(Parser_h, "#ifndef %s_h\n", CurrentClassName);
- fprintf(Parser_h, "#define %s_h\n\n", CurrentClassName);
-
- fprintf(Parser_h, "#ifndef ANTLR_VERSION\n");
- fprintf(Parser_h, "#define ANTLR_VERSION %s\n",VersionDef);
- fprintf(Parser_h, "#endif\n\n");
-
- if ( GenAST ) fprintf(Parser_h, "class ASTBase;\n");
- if (TraceGen) {
- fprintf(Parser_h,"#ifndef zzTRACE_RULES\n"); /* MR20 */
- fprintf(Parser_h,"#define zzTRACE_RULES\n"); /* MR20 */
- fprintf(Parser_h,"#endif\n"); /* MR22 */
- };
- fprintf(Parser_h, "#include \"%s\"\n\n", APARSER_H);
-
- if ( HdrAction != NULL ) dumpAction( HdrAction, Parser_h, 0, -1, 0, 1);
-
-/* MR10 */ if (ClassDeclStuff == NULL) {
-/* MR10 */ fprintf(Parser_h, "class %s : public ANTLRParser {\n", CurrentClassName);
-/* MR10 */ } else {
-/* MR10 */ fprintf(Parser_h, "class %s %s {\n",CurrentClassName,ClassDeclStuff);
-/* MR10 */ };
-
- fprintf(Parser_h, "public:\n"); /* MR1 */
- fprintf(Parser_h, "\tstatic const ANTLRChar *tokenName(int tk);\n");/* MR1 */
- fprintf(Parser_h, "\tenum { SET_SIZE = %i };\n",TokenNum-1); /* MR21 */
- fprintf(Parser_h, "protected:\n");
- fprintf(Parser_h, "\tstatic const ANTLRChar *_token_tbl[];\n"); /* MR20 */
- fprintf(Parser_h, "private:\n");
-}
-
-/* Currently, this is only used in !GenCC mode */
-void
-#ifdef __USE_PROTOS
-GenErrHdr( void )
-#else
-GenErrHdr( )
-#endif
-{
- int i, j;
- TermEntry *te;
-
- fprintf(ErrFile, "/*\n");
- fprintf(ErrFile, " * A n t l r S e t s / E r r o r F i l e H e a d e r\n");
- fprintf(ErrFile, " *\n");
- fprintf(ErrFile, " * Generated from:");
- for (i=0; i<NumFiles; i++) fprintf(ErrFile, " %s", FileStr[i]);
- fprintf(ErrFile, "\n");
- fprintf(ErrFile, " *\n");
- fprintf(ErrFile, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(ErrFile, " * Parr Research Corporation\n");
- fprintf(ErrFile, " * with Purdue University Electrical Engineering\n");
- fprintf(ErrFile, " * With AHPCRC, University of Minnesota\n");
- fprintf(ErrFile, " * ANTLR Version %s\n", Version);
- fprintf(ErrFile, " */\n\n");
-
- if ( FirstAction != NULL ) dumpAction( FirstAction, ErrFile, 0, -1, 0, 1); /* MR11 MR15b */
-
- fprintf(ErrFile, "#define ANTLR_VERSION %s\n", VersionDef);
-
- fprintf(ErrFile, "#include \"pcctscfg.h\"\n");
- fprintf(ErrFile, "#include \"pccts_stdio.h\"\n");
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- fprintf(ErrFile, "#define %s %s\n", DefaultParserName, ParserName);
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- fprintf(ErrFile, "#include \"%s\"\n", RemapFileName);
- if ( HdrAction != NULL ) dumpAction( HdrAction, ErrFile, 0, -1, 0, 1 );
- if ( FoundGuessBlk )
- {
- fprintf(ErrFile, "#define ZZCAN_GUESS\n");
- fprintf(ErrFile, "#include \"pccts_setjmp.h\"\n");
- }
- if (TraceGen) {
- fprintf(ErrFile,"#ifndef zzTRACE_RULES\n"); /* MR20 */
- fprintf(ErrFile,"#define zzTRACE_RULES\n"); /* MR20 */
- fprintf(ErrFile,"#endif\n"); /* MR22 */
- };
-
- if ( OutputLL_k > 1 ) fprintf(ErrFile, "#define LL_K %d\n", OutputLL_k);
-#ifdef DUM
- if ( LexGen ) fprintf(ErrFile, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
-#endif
- fprintf(ErrFile, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
- if ( DemandLookahead ) fprintf(ErrFile, "#define DEMAND_LOOK\n");
- fprintf(ErrFile, "#include \"antlr.h\"\n");
- if ( GenAST ) fprintf(ErrFile, "#include \"ast.h\"\n");
-
- if ( UserDefdTokens ) fprintf(ErrFile, "#include %s\n", UserTokenDefsFile);
- /* still need this one as it has the func prototypes */
- fprintf(ErrFile, "#include \"%s\"\n", DefFileName);
- fprintf(ErrFile, "#include \"dlgdef.h\"\n");
- fprintf(ErrFile, "#include \"err.h\"\n\n");
-
- /* Dump a zztokens for each automaton */
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- {
- fprintf(ErrFile, "ANTLRChar *%s_zztokens[%d]={\n", ParserName, TokenNum-1);
- }
- else
- {
- fprintf(ErrFile, "ANTLRChar *zztokens[%d]={\n", TokenNum-1);
- }
- fprintf(ErrFile, "\t/* 00 */\t\"Invalid\"");
- for (i=1; i<TokenNum-1; i++)
- {
- DAWDLE;
- if ( i == EpToken ) continue;
- /* remapped to invalid token? */
- if ( TokenInd!=NULL && TokenInd[i]>=LastTokenCounted )
- {
- fprintf(ErrFile, ",\n\t/* %02d */\t\"invalid\"", i);
- continue;
- }
- if ( TokenString(i) != NULL ) {
- te=(TermEntry *) hash_get(Tname,TokenString(i)); /* MR11 */
- if (te == NULL || te->akaString == NULL) { /* MR11 */
- fprintf(ErrFile, ",\n\t/* %02d */\t\"%s\"", i, TokenString(i));
- } else {
- fprintf(ErrFile, ",\n\t/* %02d */\t\"%s\"", i, te->akaString); /* MR11 */
- }
- }
- else
- {
- /* look in all lexclasses for the reg expr */
- for (j=0; j<NumLexClasses; j++)
- {
- lexmode(j);
- if ( ExprString(i) != NULL )
- {
- fprintf(ErrFile, ",\n\t/* %02d */\t", i);
- dumpExpr(ErrFile, ExprString(i));
- break;
- }
- }
- if ( j>=NumLexClasses )
- {
- if ( UserDefdTokens )
- {
- fprintf(ErrFile, ",\n\t/* %02d */\t\"\"", i);
- }
- else
- fatal_internal(eMsgd("No label or expr for token %d",i));
- }
- }
- }
- fprintf(ErrFile, "\n};\n");
-}
-
-void
-#ifdef __USE_PROTOS
-dumpExpr( FILE *f, char *e )
-#else
-dumpExpr( f, e )
-FILE *f;
-char *e;
-#endif
-{
- while ( *e!='\0' )
- {
- if ( *e=='\\' && *(e+1)=='\\' )
- {putc('\\', f); putc('\\', f); e+=2;}
- else if ( *e=='\\' && *(e+1)=='"' )
- {putc('\\', f); putc('"', f); e+=2;}
- else if ( *e=='\\' ) {putc('\\', f); putc('\\', f); e++;}
- else {putc(*e, f); e++;}
- }
-}
-
-int
-#ifdef __USE_PROTOS
-isTermEntryTokClass(TermEntry *te)
-#else
-isTermEntryTokClass(te)
-TermEntry *te;
-#endif
-{
- ListNode *t;
- TCnode *p;
- TermEntry *q;
- char *tokstr;
-
- if (tclasses == NULL) return 0;
-
- for (t = tclasses->next; t!=NULL; t=t->next)
- {
- p = (TCnode *) t->elem;
- tokstr = TokenString(p->tok);
- lexmode(p->lexclass); /* switch to lexclass where tokclass is defined */
- q = (TermEntry *) hash_get(Tname, tokstr);
- if (q == te) return 1;
- }
- return 0;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c
deleted file mode 100644
index 4eb3b02af1..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/build.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- * build.c -- functions associated with building syntax diagrams.
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "pcctscfg.h"
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-
-#define SetBlk(g, t, approx, first_set_symbol) { \
- ((Junction *)g.left)->jtype = t; \
- ((Junction *)g.left)->approx = approx; \
- ((Junction *)g.left)->pFirstSetSymbol = first_set_symbol; \
- ((Junction *)g.left)->end = (Junction *) g.right; \
- ((Junction *)g.right)->jtype = EndBlk;}
-
-/* Add the parameter string 'parm' to the parms field of a block-type junction
- * g.left points to the sentinel node on a block. i.e. g.left->p1 points to
- * the actual junction with its jtype == some block-type.
- */
-void
-#ifdef __USE_PROTOS
-addParm( Node *p, char *parm )
-#else
-addParm( p, parm )
-Node *p;
-char *parm;
-#endif
-{
- char *q = (char *) malloc( strlen(parm) + 1 );
- require(p!=NULL, "addParm: NULL object\n");
- require(q!=NULL, "addParm: unable to alloc parameter\n");
-
- strcpy(q, parm);
- if ( p->ntype == nRuleRef )
- {
- ((RuleRefNode *)p)->parms = q;
- }
- else if ( p->ntype == nJunction )
- {
- ((Junction *)p)->parm = q; /* only one parameter allowed on subrules */
- }
- else fatal_internal("addParm: invalid node for adding parm");
-}
-
-/*
- * Build an action node for the syntax diagram
- *
- * buildAction(ACTION) ::= --o-->ACTION-->o--
- *
- * Where o is a junction node.
- */
-Graph
-#ifdef __USE_PROTOS
-buildAction( char *action, int file, int line, int is_predicate )
-#else
-buildAction( action, file, line, is_predicate )
-char *action;
-int file;
-int line;
-int is_predicate;
-#endif
-{
- Junction *j1, *j2;
- Graph g;
- ActionNode *a;
- require(action!=NULL, "buildAction: invalid action");
-
- j1 = newJunction();
- j2 = newJunction();
- a = newActionNode();
- a->action = (char *) malloc( strlen(action)+1 );
- require(a->action!=NULL, "buildAction: cannot alloc space for action\n");
- strcpy(a->action, action);
- j1->p1 = (Node *) a;
- a->next = (Node *) j2;
- a->is_predicate = is_predicate;
-
- if (is_predicate) {
- PredEntry *predEntry;
- char *t;
- char *key;
- char *u;
- int inverted=0;
-
- t=key=(char *)calloc(1,strlen(a->action)+1);
-
- for (u=a->action; *u != '\0' ; u++) {
- if (*u != ' ') {
- if (t==key && *u=='!') {
- inverted=!inverted;
- } else {
- *t++=*u;
- };
- };
- };
-
- *t='\0';
-
-
- predEntry=(PredEntry *)hash_get(Pname,key);
- a->predEntry=predEntry;
- if (predEntry != NULL) a->inverted=inverted;
- } else {
-/* MR12c */ char *strStart=a->action;
-/* MR12c */ char *strEnd;
-/* MR12c */ strEnd=strStart+strlen(strStart)-1;
-/* MR12c */ for ( ; strEnd >= strStart && isspace(*strEnd); strEnd--) *strEnd=0;
-/* MR12c */ while (*strStart != '\0' && isspace(*strStart)) strStart++;
-/* MR12c */ if (ci_strequ(strStart,"nohoist")) {
-/* MR12c */ a->noHoist=1;
-/* MR12c */ }
- }
-
- g.left = (Node *) j1; g.right = (Node *) j2;
- a->file = file;
- a->line = line;
- a->rname = CurRule; /* MR10 */
- return g;
-}
-
-/*
- * Build a token node for the syntax diagram
- *
- * buildToken(TOKEN) ::= --o-->TOKEN-->o--
- *
- * Where o is a junction node.
- */
-Graph
-#ifdef __USE_PROTOS
-buildToken( char *text )
-#else
-buildToken( text )
-char *text;
-#endif
-{
- Junction *j1, *j2;
- Graph g;
- TokNode *t;
- require(text!=NULL, "buildToken: invalid token name");
-
- j1 = newJunction();
- j2 = newJunction();
- t = newTokNode();
- t->altstart = CurAltStart;
- if ( *text == '"' ) {t->label=FALSE; t->token = addTexpr( text );}
- else {t->label=TRUE; t->token = addTname( text );}
- j1->p1 = (Node *) t;
- t->next = (Node *) j2;
- g.left = (Node *) j1; g.right = (Node *) j2;
- return g;
-}
-
-/*
- * Build a wild-card node for the syntax diagram
- *
- * buildToken(TOKEN) ::= --o-->'.'-->o--
- *
- * Where o is a junction node.
- */
-Graph
-#ifdef __USE_PROTOS
-buildWildCard( char *text )
-#else
-buildWildCard( text )
-char *text;
-#endif
-{
- Junction *j1, *j2;
- Graph g;
- TokNode *t;
- TCnode *w;
- TermEntry *p;
- require(text!=NULL, "buildWildCard: invalid token name");
-
- j1 = newJunction();
- j2 = newJunction();
- t = newTokNode();
-
- /* If the ref a wild card, make a token class for it */
- if ( Tnum(WildCardString) == 0 )
- {
- w = newTCnode;
- w->tok = addTname( WildCardString );
- set_orel(w->tok, &imag_tokens);
- set_orel(w->tok, &tokclasses);
- WildCardToken = w->tok;
- require((p=(TermEntry *)hash_get(Tname, WildCardString)) != NULL,
- "hash table mechanism is broken");
- p->classname = 1; /* entry is class name, not token */
- p->tclass = w; /* save ptr to this tclass def */
- list_add(&tclasses, (char *)w);
- }
- else {
- p=(TermEntry *)hash_get(Tname, WildCardString);
- require( p!= NULL, "hash table mechanism is broken");
- w = p->tclass;
- }
-
- t->token = w->tok;
- t->wild_card = 1;
- t->tclass = w;
-
- t->altstart = CurAltStart;
- j1->p1 = (Node *) t;
- t->next = (Node *) j2;
- g.left = (Node *) j1; g.right = (Node *) j2;
- return g;
-}
-
-void
-#ifdef __USE_PROTOS
-setUpperRange(TokNode *t, char *text)
-#else
-setUpperRange(t, text)
-TokNode *t;
-char *text;
-#endif
-{
- require(t!=NULL, "setUpperRange: NULL token node");
- require(text!=NULL, "setUpperRange: NULL token string");
-
- if ( *text == '"' ) {t->upper_range = addTexpr( text );}
- else {t->upper_range = addTname( text );}
-}
-
-/*
- * Build a rule reference node of the syntax diagram
- *
- * buildRuleRef(RULE) ::= --o-->RULE-->o--
- *
- * Where o is a junction node.
- *
- * If rule 'text' has been defined already, don't alloc new space to store string.
- * Set r->text to point to old copy in string table.
- */
-Graph
-#ifdef __USE_PROTOS
-buildRuleRef( char *text )
-#else
-buildRuleRef( text )
-char *text;
-#endif
-{
- Junction *j1, *j2;
- Graph g;
- RuleRefNode *r;
- RuleEntry *p;
- require(text!=NULL, "buildRuleRef: invalid rule name");
-
- j1 = newJunction();
- j2 = newJunction();
- r = newRNode();
- r->altstart = CurAltStart;
- r->assign = NULL;
- if ( (p=(RuleEntry *)hash_get(Rname, text)) != NULL ) r->text = p->str;
- else r->text = mystrdup( text );
- j1->p1 = (Node *) r;
- r->next = (Node *) j2;
- g.left = (Node *) j1; g.right = (Node *) j2;
- return g;
-}
-
-/*
- * Or two subgraphs into one graph via:
- *
- * Or(G1, G2) ::= --o-G1-o--
- * | ^
- * v |
- * o-G2-o
- *
- * Set the altnum of junction starting G2 to 1 + altnum of junction starting G1.
- * If, however, the G1 altnum is 0, make it 1 and then
- * make G2 altnum = G1 altnum + 1.
- */
-Graph
-#ifdef __USE_PROTOS
-Or( Graph g1, Graph g2 )
-#else
-Or( g1, g2 )
-Graph g1;
-Graph g2;
-#endif
-{
- Graph g;
- require(g1.left != NULL, "Or: invalid graph");
- require(g2.left != NULL && g2.right != NULL, "Or: invalid graph");
-
- ((Junction *)g1.left)->p2 = g2.left;
- ((Junction *)g2.right)->p1 = g1.right;
- /* set altnums */
- if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1;
- ((Junction *)g2.left)->altnum = ((Junction *)g1.left)->altnum + 1;
- g.left = g2.left;
- g.right = g1.right;
- return g;
-}
-
-/*
- * Catenate two subgraphs
- *
- * Cat(G1, G2) ::= --o-G1-o-->o-G2-o--
- * Cat(NULL,G2)::= --o-G2-o--
- * Cat(G1,NULL)::= --o-G1-o--
- */
-Graph
-#ifdef __USE_PROTOS
-Cat( Graph g1, Graph g2 )
-#else
-Cat( g1, g2 )
-Graph g1;
-Graph g2;
-#endif
-{
- Graph g;
-
- if ( g1.left == NULL && g1.right == NULL ) return g2;
- if ( g2.left == NULL && g2.right == NULL ) return g1;
- ((Junction *)g1.right)->p1 = g2.left;
- g.left = g1.left;
- g.right = g2.right;
- return g;
-}
-
-/*
- * Make a subgraph an optional block
- *
- * makeOpt(G) ::= --o-->o-G-o-->o--
- * | ^
- * v |
- * o-------o
- *
- * Note that this constructs {A|B|...|Z} as if (A|B|...|Z|) was found.
- *
- * The node on the far right is added so that every block owns its own
- * EndBlk node.
- */
-Graph
-#ifdef __USE_PROTOS
-makeOpt( Graph g1, int approx, char * pFirstSetSymbol )
-#else
-makeOpt( g1, approx, pFirstSetSymbol )
-Graph g1;
-int approx;
-char * pFirstSetSymbol;
-#endif
-{
- Junction *j1,*j2,*p;
- Graph g;
- require(g1.left != NULL && g1.right != NULL, "makeOpt: invalid graph");
-
- j1 = newJunction();
- j2 = newJunction();
- ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */
-
- /* MR21
- *
- * There is code in genBlk which recognizes the node created
- * by emptyAlt() as a special case and bypasses it. We don't
- * want this to happen for the optBlk.
- */
-
- g = emptyAlt3(); /* MR21 */
- if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1;
- ((Junction *)g.left)->altnum = ((Junction *)g1.left)->altnum + 1;
- for(p=(Junction *)g1.left; p->p2!=NULL; p=(Junction *)p->p2)
- {;} /* find last alt */
- p->p2 = g.left; /* add optional alternative */
- ((Junction *)g.right)->p1 = (Node *)j2; /* opt alt points to EndBlk */
- g1.right = (Node *)j2;
- SetBlk(g1, aOptBlk, approx, pFirstSetSymbol);
- j1->p1 = g1.left; /* add generic node in front */
- g.left = (Node *) j1;
- g.right = g1.right;
- return g;
-}
-
-/*
- * Make a graph into subblock
- *
- * makeBlk(G) ::= --o-->o-G-o-->o--
- *
- * The node on the far right is added so that every block owns its own
- * EndBlk node.
- */
-Graph
-#ifdef __USE_PROTOS
-makeBlk( Graph g1, int approx, char * pFirstSetSymbol )
-#else
-makeBlk( g1, approx, pFirstSetSymbol )
-Graph g1;
-int approx;
-char * pFirstSetSymbol;
-#endif
-{
- Junction *j,*j2;
- Graph g;
- require(g1.left != NULL && g1.right != NULL, "makeBlk: invalid graph");
-
- j = newJunction();
- j2 = newJunction();
- ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */
- g1.right = (Node *)j2;
- SetBlk(g1, aSubBlk, approx, pFirstSetSymbol);
- j->p1 = g1.left; /* add node in front */
- g.left = (Node *) j;
- g.right = g1.right;
-
- return g;
-}
-
-/*
- * Make a subgraph into a loop (closure) block -- (...)*
- *
- * makeLoop(G) ::= |---|
- * v |
- * --o-->o-->o-G-o-->o--
- * | ^
- * v |
- * o-----------o
- *
- * After making loop, always place generic node out front. It becomes
- * the start of enclosing block. The aLoopBlk is the target of the loop.
- *
- * Loop blks have TWO EndBlk nodes--the far right and the node that loops back
- * to the aLoopBlk node. Node with which we can branch past loop == aLoopBegin and
- * one which is loop target == aLoopBlk.
- * The branch-past (initial) aLoopBegin node has end
- * pointing to the last EndBlk node. The loop-target node has end==NULL.
- *
- * Loop blocks have a set of locks (from 1..CLL_k) on the aLoopBlk node.
- */
-Graph
-#ifdef __USE_PROTOS
-makeLoop( Graph g1, int approx, char * pFirstSetSymbol )
-#else
-makeLoop( g1, approx, pFirstSetSymbol)
-Graph g1;
-int approx;
-char * pFirstSetSymbol;
-#endif
-{
- Junction *back, *front, *begin;
- Graph g;
- require(g1.left != NULL && g1.right != NULL, "makeLoop: invalid graph");
-
- back = newJunction();
- front = newJunction();
- begin = newJunction();
- g = emptyAlt3();
- ((Junction *)g1.right)->p2 = g1.left; /* add loop branch to G */
- ((Junction *)g1.right)->p1 = (Node *) back; /* add node to G at end */
- ((Junction *)g1.right)->jtype = EndBlk; /* mark 1st EndBlk node */
- ((Junction *)g1.left)->jtype = aLoopBlk; /* mark 2nd aLoopBlk node */
- ((Junction *)g1.left)->end = (Junction *) g1.right;
- ((Junction *)g1.left)->lock = makelocks();
- ((Junction *)g1.left)->pred_lock = makelocks();
- g1.right = (Node *) back;
- begin->p1 = (Node *) g1.left;
- g1.left = (Node *) begin;
- begin->p2 = (Node *) g.left; /* make bypass arc */
- ((Junction *)g.right)->p1 = (Node *) back;
- SetBlk(g1, aLoopBegin, approx, pFirstSetSymbol);
- front->p1 = g1.left; /* add node to front */
- g1.left = (Node *) front;
-
- return g1;
-}
-
-/*
- * Make a subgraph into a plus block -- (...)+ -- 1 or more times
- *
- * makePlus(G) ::= |---|
- * v |
- * --o-->o-G-o-->o--
- *
- * After making loop, always place generic node out front. It becomes
- * the start of enclosing block. The aPlusBlk is the target of the loop.
- *
- * Plus blks have TWO EndBlk nodes--the far right and the node that loops back
- * to the aPlusBlk node.
- *
- * Plus blocks have a set of locks (from 1..CLL_k) on the aPlusBlk node.
- */
-Graph
-#ifdef __USE_PROTOS
-makePlus( Graph g1, int approx, char * pFirstSetSymbol)
-#else
-makePlus( g1, approx, pFirstSetSymbol)
-Graph g1;
-int approx;
-char * pFirstSetSymbol;
-#endif
-{
- int has_empty_alt_already = 0;
- Graph g;
- Junction *j2, *j3, *first_alt;
- Junction *last_alt=NULL, *p;
- require(g1.left != NULL && g1.right != NULL, "makePlus: invalid graph");
-
- first_alt = (Junction *)g1.left;
- j2 = newJunction();
- j3 = newJunction();
- if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1;
- ((Junction *)g1.right)->p2 = g1.left; /* add loop branch to G */
- ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */
- ((Junction *)g1.right)->jtype = EndBlk; /* mark 1st EndBlk node */
- g1.right = (Node *) j2;
- SetBlk(g1, aPlusBlk, approx, pFirstSetSymbol);
- ((Junction *)g1.left)->lock = makelocks();
- ((Junction *)g1.left)->pred_lock = makelocks();
- j3->p1 = g1.left; /* add node to front */
- g1.left = (Node *) j3;
-
- /* add an optional branch which is the "exit" branch of loop */
- /* FIRST, check to ensure that there does not already exist
- * an optional path.
- */
- /* find last alt */
- for(p=first_alt; p!=NULL; p=(Junction *)p->p2)
- {
- if ( p->p1->ntype == nJunction &&
- p->p1!=NULL &&
- ((Junction *)p->p1)->jtype==Generic &&
- ((Junction *)p->p1)->p1!=NULL &&
- ((Junction *)((Junction *)p->p1)->p1)->jtype==EndBlk )
- {
- has_empty_alt_already = 1;
- }
- last_alt = p;
- }
- if ( !has_empty_alt_already )
- {
- require(last_alt!=NULL, "last_alt==NULL; bad (..)+");
- g = emptyAlt();
- last_alt->p2 = g.left;
- ((Junction *)g.right)->p1 = (Node *) j2;
-
- /* make sure lookahead computation ignores this alt for
- * FIRST("(..)+"); but it's still used for computing the FIRST
- * of each alternative.
- */
- ((Junction *)g.left)->ignore = 1;
- }
-
- return g1;
-}
-
-/*
- * Return an optional path: --o-->o--
- */
-
-Graph
-#ifdef __USE_PROTOS
-emptyAlt( void )
-#else
-emptyAlt( )
-#endif
-{
- Junction *j1, *j2;
- Graph g;
-
- j1 = newJunction();
- j2 = newJunction();
- j1->p1 = (Node *) j2;
- g.left = (Node *) j1;
- g.right = (Node *) j2;
-
- return g;
-}
-
-/* MR21
- *
- * There is code in genBlk which recognizes the node created
- * by emptyAlt() as a special case and bypasses it. We don't
- * want this to happen for the optBlk.
- */
-
-Graph
-#ifdef __USE_PROTOS
-emptyAlt3( void )
-#else
-emptyAlt3( )
-#endif
-{
- Junction *j1, *j2, *j3;
- Graph g;
-
- j1 = newJunction();
- j2 = newJunction();
- j3 = newJunction();
- j1->p1 = (Node *) j2;
- j2->p1 = (Node *) j3;
- g.left = (Node *) j1;
- g.right = (Node *) j3;
-
- return g;
-}
-
-/* N o d e A l l o c a t i o n */
-
-TokNode *
-#ifdef __USE_PROTOS
-newTokNode( void )
-#else
-newTokNode( )
-#endif
-{
- static TokNode *FreeList = NULL;
- TokNode *p, *newblk;
-
- if ( FreeList == NULL )
- {
- newblk = (TokNode *)calloc(TokenBlockAllocSize, sizeof(TokNode));
- if ( newblk == NULL )
- fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
- for (p=newblk; p<&(newblk[TokenBlockAllocSize]); p++)
- {
- p->next = (Node *)FreeList; /* add all new token nodes to FreeList */
- FreeList = p;
- }
- }
- p = FreeList;
- FreeList = (TokNode *)FreeList->next;/* remove a TokNode node */
- p->next = NULL; /* NULL the ptr we used */
- memset( (char *) p, 0, sizeof(TokNode)); /* MR10 */
- p->ntype = nToken;
- p->rname = CurRule;
- p->file = CurFile;
- p->line = zzline;
- p->altstart = NULL;
-
- return p;
-}
-
-RuleRefNode *
-#ifdef __USE_PROTOS
-newRNode( void )
-#else
-newRNode( )
-#endif
-{
- static RuleRefNode *FreeList = NULL;
- RuleRefNode *p, *newblk;
-
- if ( FreeList == NULL )
- {
- newblk = (RuleRefNode *)calloc(RRefBlockAllocSize, sizeof(RuleRefNode));
- if ( newblk == NULL )
- fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
- for (p=newblk; p<&(newblk[RRefBlockAllocSize]); p++)
- {
- p->next = (Node *)FreeList; /* add all new rref nodes to FreeList */
- FreeList = p;
- }
- }
- p = FreeList;
- FreeList = (RuleRefNode *)FreeList->next;/* remove a Junction node */
- p->next = NULL; /* NULL the ptr we used */
- memset( (char *) p, 0, sizeof(RuleRefNode)); /* MR10 */
- p->ntype = nRuleRef;
- p->rname = CurRule;
- p->file = CurFile;
- p->line = zzline;
- p->astnode = ASTinclude;
- p->altstart = NULL;
-
- return p;
-}
-
-static int junctionSeqNumber=0; /* MR10 */
-
-Junction *
-#ifdef __USE_PROTOS
-newJunction( void )
-#else
-newJunction( )
-#endif
-{
- static Junction *FreeList = NULL;
- Junction *p, *newblk;
-
- if ( FreeList == NULL )
- {
- newblk = (Junction *)calloc(JunctionBlockAllocSize, sizeof(Junction));
- if ( newblk == NULL )
- fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
- for (p=newblk; p<&(newblk[JunctionBlockAllocSize]); p++)
- {
- p->p1 = (Node *)FreeList; /* add all new Junction nodes to FreeList */
- FreeList = p;
- }
- }
- p = FreeList;
- FreeList = (Junction *)FreeList->p1;/* remove a Junction node */
- p->p1 = NULL; /* NULL the ptr we used */
- memset( (char *) p, 0, sizeof(Junction)); /* MR10 */
- p->ntype = nJunction;
- p->visited = 0;
- p->jtype = Generic;
- p->rname = CurRule;
- p->file = CurFile;
- p->line = zzline;
- p->exception_label = NULL;
- p->fset = (set *) calloc(CLL_k+1, sizeof(set));
- require(p->fset!=NULL, "cannot allocate fset in newJunction");
- p->seq=++junctionSeqNumber; /* MR10 */
-
- return p;
-}
-
-ActionNode *
-#ifdef __USE_PROTOS
-newActionNode( void )
-#else
-newActionNode( )
-#endif
-{
- static ActionNode *FreeList = NULL;
- ActionNode *p, *newblk;
-
- if ( FreeList == NULL )
- {
- newblk = (ActionNode *)calloc(ActionBlockAllocSize, sizeof(ActionNode));
- if ( newblk == NULL )
- fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule));
- for (p=newblk; p<&(newblk[ActionBlockAllocSize]); p++)
- {
- p->next = (Node *)FreeList; /* add all new Action nodes to FreeList */
- FreeList = p;
- }
- }
- p = FreeList;
- FreeList = (ActionNode *)FreeList->next;/* remove an Action node */
- memset( (char *) p, 0, sizeof(ActionNode)); /* MR10 */
- p->ntype = nAction;
- p->next = NULL; /* NULL the ptr we used */
- p->done = 0;
- p->pred_fail = NULL;
- p->guardpred = NULL;
- p->ampersandPred = NULL;
- return p;
-}
-
-/*
- * allocate the array of locks (1..CLL_k) used to inhibit infinite recursion.
- * Infinite recursion can occur in (..)* blocks, FIRST calcs and FOLLOW calcs.
- * Therefore, we need locks on aLoopBlk, RuleBlk, EndRule nodes.
- *
- * if ( lock[k]==TRUE ) then we have been here before looking for k tokens
- * of lookahead.
- */
-char *
-#ifdef __USE_PROTOS
-makelocks( void )
-#else
-makelocks( )
-#endif
-{
- char *p = (char *) calloc(CLL_k+1, sizeof(char));
- require(p!=NULL, "cannot allocate lock array");
-
- return p;
-}
-
-#if 0
-** #ifdef __USE_PROTOS
-** void my_memset(char *p,char value,int count)
-** #else
-** void my_memset(p,value,count)
-** char *p;
-** char value;
-** int count;
-** #endif
-** {
-** int i;
-**
-** for (i=0; i<count; i++) {
-** p[i]=value;
-** };
-** }
-#endif
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c
deleted file mode 100644
index 8156159f71..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpcycles.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <stdio.h>
-#include <ctype.h>
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-
-void
-#ifdef __USE_PROTOS
-dumpcycles(void)
-#else
-dumpcycles()
-#endif
-{
- Cycle *c;
- CacheEntry *f;
- ListNode *p;
- int i=0;
- int k;
- int degree;
-
- for (k=1; k <= CLL_k; k++) {
- if (Cycles[k] == NULL) continue;
-
- for (p = Cycles[k]->next; p!=NULL; p=p->next) {
- c = (Cycle *) p->elem;
- degree=set_deg(c->cyclicDep);
- fprintf(stderr,"Cycle %d: (degree %d) %s -->\n", i++, degree, RulePtr[c->croot]->rname);
- fprintf(stderr," *self*\n");
- MR_dumpRuleSet(c->cyclicDep);
- fprintf(stderr,"\n");
- f = (CacheEntry *)
- hash_get(Fcache,Fkey(RulePtr[c->croot]->rname,'o',k));
- if (f == NULL) {
- fprintf(stderr," *** FOLLOW(%s) must be in cache but isn't ***\n",
- RulePtr[c->croot]->rname);
- };
- };
- };
-}
-
-void
-#ifdef __USE_PROTOS
-dumpfostack(int k)
-#else
-dumpfostack(k)
-int k;
-#endif
-{
- int i=0;
- int *pi;
-
- fprintf(stderr,"\n");
- if (FoStack[k] == NULL) {
- fprintf(stderr,"FoStack[%d] is null\n",k);
- };
- if (FoTOS[k] == NULL) {
- fprintf(stderr,"FoTOS[%d] is null\n",k);
- }
- if (FoTOS[k] != NULL && FoStack[k] != NULL) {
- for (pi=FoStack[k]; pi <= FoTOS[k]; pi++) {
- i++;
- fprintf(stderr,"#%d rule %d %s\n",i,*pi,RulePtr[*pi]->rname);
- }
- }
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c
deleted file mode 100644
index 2a34c6fcd5..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/dumpnode.c
+++ /dev/null
@@ -1,423 +0,0 @@
-#include <stdio.h>
-#include <ctype.h>
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-
-#ifdef __USE_PROTOS
-void dumpset1(set s)
-#else
-void dumpset1(s)
- set s;
-#endif
-{
- if (set_nil(s)) {
- fprintf(stderr,"{}");
- } else {
- s_fprT(stderr,s);
- };
-}
-
-#ifdef __USE_PROTOS
-void dumpset(set s)
-#else
-void dumpset(s)
- set s;
-#endif
-{
- dumpset1(s);
- fprintf(stderr,"\n");
-}
-
-#ifdef __USE_PROTOS
-int isEndRule(Node * p)
-#else
-int isEndRule(p)
- Node * p;
-#endif
-{
- int result=0;
- if ( p->ntype == nJunction &&
- ( (Junction *) p)->jtype == EndRule) {
- result=1;
- };
- return result;
-}
-
-#ifdef __USE_PROTOS
-void dumppred1(int depth,Predicate *p)
-#else
-void dumppred1(depth,p)
- int depth;
- Predicate *p;
-#endif
-{
- int i;
- int k;
-
- for (i=0; i<depth ; i++) {
- fprintf(stderr," ");
- };
- if (p->expr == PRED_AND_LIST ||
- p->expr == PRED_OR_LIST) {
- fprintf(stderr," %s", (p->expr == NULL ? "null expr" : p->expr));
- if (p->inverted) fprintf(stderr," predicate inverted !");
- if (p->redundant) {
- fprintf(stderr," Redundant!");
- };
- if (p->isConst) fprintf(stderr," const %d !",p->constValue);
- fprintf(stderr,"\n");
- } else {
- fprintf(stderr,"predicate k=%d",p->k);
- k=set_int(p->completionSet);
- if (k >= 0) {
- fprintf(stderr," Incomplete Set=%d !",k);
- };
- k=set_int(p->completionTree);
- if (k >= 0) {
- fprintf(stderr," Incomplete Tree=%d !",k);
- };
- if (p->redundant) {
- fprintf(stderr," Redundant!");
- };
- fprintf(stderr," \"%s\" (%x)", (p->expr == NULL ? "null expr" : p->expr) ,p);
- if (p->source != NULL) {
- fprintf(stderr,"line %d",p->source->line);
- };
- if (p->inverted) fprintf(stderr," predicate inverted !");
- fprintf(stderr,"\n");
- for (i=0; i<depth ; i++) {
- fprintf(stderr," ");
- };
- fprintf(stderr,"scontext: ");
- dumpset(p->scontext[1]);
- for (i=0; i<depth ; i++) {
- fprintf(stderr," ");
- };
- fprintf(stderr,"tcontext: ");
- preorder(p->tcontext);
- fprintf(stderr,"\n");
- };
- fprintf(stderr,"\n");
- if (p->down != NULL) {
- dumppred1(depth+1,p->down);
- };
- if (p->right != NULL) {
- dumppred1(depth,p->right);
- };
-}
-
-#ifdef __USE_PROTOS
-void dumppred(Predicate *p)
-#else
-void dumppred(p)
- Predicate *p;
-#endif
-{
- fprintf(stderr,"---------------------------------\n");
- dumppred1(0,p);
- fprintf(stderr,"\n");
-}
-
-#ifdef __USE_PROTOS
-void dumppredtree(Predicate *p)
-#else
-void dumppredtree(p)
- Predicate *p;
-#endif
-{
- fprintf(stderr,"predicate k=%d \"%s\" line %d\n",p->k,p->expr,p->source->line);
- dumpset(p->scontext[1]);
-}
-
-#ifdef __USE_PROTOS
-void dumppredexpr(Predicate *p)
-#else
-void dumppredexpr(p)
- Predicate *p;
-#endif
-{
- fprintf(stderr," pred expr \"%s\"\n",p->expr);
-}
-
-#ifdef __USE_PROTOS
-void dt(Tree *t)
-#else
-void dt(t)
- Tree *t;
-#endif
-{
- MR_dumpTreeF(stderr,0,t,5);
-}
-
-#ifdef __USE_PROTOS
-void d(Node * p)
-#else
-void d(p)
- Node * p;
-#endif
-{
-
- Junction *j;
- RuleRefNode *r;
- TokNode *t;
- ActionNode *a;
-
- if (p==NULL) {
- fprintf(stderr,"dumpNode: Node is NULL");
- return;
- };
-
- switch (p->ntype) {
- case nJunction :
- j = (Junction *) p;
- fprintf(stderr, "Junction (#%d in rule %s line %d) ",j->seq,j->rname,j->line);
- if (j->guess) fprintf(stderr,"guess block ");
- switch (j->jtype ) {
- case aSubBlk :
- fprintf(stderr,"aSubBlk");
- break;
- case aOptBlk :
- fprintf(stderr,"aOptBlk");
- break;
- case aLoopBegin :
- fprintf(stderr,"aLoopBeginBlk");
- break;
- case aLoopBlk :
- fprintf(stderr,"aLoopBlk");
- break;
- case aPlusBlk :
- fprintf(stderr,"aPlusBlk");
- break;
- case EndBlk :
- fprintf(stderr,"EndBlk");
- break;
- case RuleBlk :
- fprintf(stderr,"RuleBlk");
- break;
- case Generic :
- fprintf(stderr,"Generic");
- break;
- case EndRule :
- fprintf(stderr,"EndRule");
- break;
- };
- if (j->halt) fprintf(stderr," halt!");
- if (j->p1) fprintf(stderr," p1 valid");
- if (j->p2) {
- if (j->p2->ntype == nJunction) {
- fprintf(stderr," (p2=#%d)",( (Junction *) j->p2)->seq);
- } else {
- fprintf(stderr," (p2 valid)");
- };
- };
- if (j->ignore) fprintf(stderr, " ignore/plus-block-bypass");
- if (j->fset != NULL && set_deg(*j->fset) != 0) {
- fprintf(stderr,"\nfset:\n");
- dumpset(*j->fset);
- };
- if (j->ftree != NULL) {
- fprintf(stderr,"\nftree:\n");
- preorder(j->ftree);
- };
- fprintf(stderr,"\n");
- break;
- case nRuleRef :
- r = (RuleRefNode *) p;
- fprintf(stderr, "RuleRefNode (in rule %s line %d) to rule %s\n", r->rname,r->line,r->text);
- break;
- case nToken :
- t = (TokNode *) p;
- fprintf(stderr, "TokNode (in rule %s line %d) token %s\n",t->rname,t->line,TerminalString(t->token));
- break;
- case nAction :
- a =(ActionNode *) p;
- if (a->is_predicate) {
- fprintf(stderr, "Predicate (in rule %s line %d) %s",a->rname,a->line,a->action);
- if (a->inverted) fprintf(stderr," action inverted !");
- if (a->guardpred != NULL) {
- fprintf(stderr," guarded");
- dumppredexpr(a->guardpred);
- if (a->ampersandPred) {
- fprintf(stderr," \"&&\" style");
- } else {
- fprintf(stderr," \"=>\" style");
- };
- };
- if (a->predEntry != NULL) fprintf(stderr," predEntry \"%s\" ",a->predEntry->str);
- fprintf(stderr,"\n");
- } else if (a->init_action) {
- fprintf(stderr, "Init-Action (in rule %s line %d) %s\n",a->rname,a->line,a->action);
- } else {
- fprintf(stderr, "Action (in rule %s line %d) %s\n",a->rname,a->line,a->action);
- };
- break;
- };
-}
-
-#ifdef __USE_PROTOS
-Node * dp1(Node * p)
-#else
-Node * dp1(p)
- Node * p;
-#endif
-{
- Node *result=NULL;
-
- if (p->ntype == nJunction) {
- result=( (Junction *) p )->p1;
- d(result);
- } else {
- fprintf(stderr,"dp1: Not a Junction node");
- };
- return result;
-}
-
-#ifdef __USE_PROTOS
-Node * dp2(Node * p)
-#else
-Node * dp2(p)
- Node * p;
-#endif
-{
- Node *result=NULL;
-
- if (p->ntype == nJunction) {
- result=( (Junction *) p )->p2;
- d(result);
- } else {
- fprintf(stderr,"dp2: Not a Junction node");
- };
- return result;
-}
-
-#ifdef __USE_PROTOS
-Node * dn(Node * p)
-#else
-Node * dn(p)
- Node * p;
-#endif
-
-{
- Node *result=NULL;
-
- if (p->ntype == nRuleRef) {
- result=( (RuleRefNode *)p )->next;
- } else if (p->ntype == nAction) {
- result=( (ActionNode *)p )->next;
- } else if (p->ntype == nToken) {
- result=( (TokNode *)p )->next;
- } else {
- fprintf(stderr,"No next field: Neither a RuleRefNode, ActionNode, nor TokNode");
- };
- if (result != NULL) d(result);
- return result;
-}
-
-#ifdef __USE_PROTOS
-void df(Node * p)
-#else
-void df(p)
- Node * p;
-#endif
-{
- int count=0;
- Node *next;
-
- fprintf(stderr,"\n#%d ",++count);
- d(p);
-
- for (next=p; next != NULL && !isEndRule(next) ; ) {
- fprintf(stderr,"#%d ",++count);
- if (next->ntype == nJunction) {
- next=dp1(next);
- } else {
- next=dn(next);
- };
- };
-}
-
-#ifdef __USE_PROTOS
-Node * dfn(Node * p,int target)
-#else
-Node * dfn(p,target)
- Node * p;
- int target;
-#endif
-{
- Node *result=NULL;
- int count=0;
- Node *next;
-
- fprintf(stderr,"#%d ",++count);
- d(p);
-
- for (next=p; next != NULL && !isEndRule(next) ; ) {
- fprintf(stderr,"#%d ",++count);
- if (next->ntype == nJunction) {
- next=dp1(next);
- } else {
- next=dn(next);
- };
- if (count == target) {
- result=next;
- break;
- };
- };
- return result;
-}
-
-
-static int findnodeMatch;
-
-#ifdef __USE_PROTOS
-Junction *findnode1(Node *n)
-#else
-Junction *findnode1(n)
- Node *n;
-#endif
-{
- Node *next;
- Junction *j;
- Junction *match;
-
- if (n == NULL) return NULL;
- if (n->ntype == nJunction) {
- j=(Junction *) n;
- if (j->seq == findnodeMatch) return j;
- if (j->jtype == EndRule) return NULL;
- if (j->jtype != RuleBlk && j->jtype != EndBlk) {
- if (j->p2 != NULL && !j->ignore) {
- match=findnode1(j->p2);
- if (match != NULL) return match;
- };
- };
- };
- next=MR_advance(n);
- return findnode1(next);
-}
-
-#ifdef __USE_PROTOS
-Junction *findnode(int match)
-#else
-Junction *findnode(match)
- int match;
-#endif
-{
- Junction *j;
- Junction *result=NULL;
-
- findnodeMatch=match;
-
- for (j=SynDiag; j != NULL; j=(Junction *)j->p2) {
- require (j->ntype == nJunction && j->jtype == RuleBlk,"Not a rule block");
- result=findnode1( (Node *) j);
- if (result != NULL) break;
- };
- if (result != NULL) {
- d( (Node *) result);
- };
- return result;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c
deleted file mode 100644
index c8a633fc06..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/egman.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * egman.c
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33MR10
- * 2001
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "proto.h"
-
-static ExceptionGroup **egArray=NULL; /* ExceptionGroup by BlkLevel */
-static LabelEntry **leArray=NULL; /* LabelEntry by BlkLevel */
-static Junction **altArray=NULL; /* start of alternates */
-static int arraySize=0;
-static int highWater=0;
-static ExceptionGroup *lastEG=NULL; /* used in altFixup() */
-static int lastBlkLevel=0; /* used in altFixup() */
-
-#ifdef __USE_PROTOS
-static void arrayCheck(void);
-#else
-static void arrayCheck();
-#endif
-
-/* Called to add an exception group for an alternative EG */
-
-#ifdef __USE_PROTOS
-void egAdd(ExceptionGroup * eg)
-#else
-void egAdd(eg)
-ExceptionGroup *eg;
-#endif
-{
- int i;
-
- ExceptionGroup *nextEG;
- ExceptionGroup *innerEG;
-
- LabelEntry *nextLE;
- LabelEntry *innerLE;
-
- Junction *nextAlt;
- Junction *innerAlt;
-
- lastEG=eg;
- lastBlkLevel=BlkLevel;
-
- arrayCheck();
- eg->pendingLink=egArray[BlkLevel];
- egArray[BlkLevel]=eg;
-
- /* EG for alternates already have their altID filled in */
-
- for (i=BlkLevel+1; i<=highWater ; i++) {
- for (innerEG=egArray[i]; innerEG != NULL ; innerEG=nextEG) {
- nextEG=innerEG->pendingLink;
- innerEG->pendingLink=NULL;
- innerEG->outerEG=eg;
- };
- egArray[i]=NULL;
- };
-
- /*
- * for patching up the LabelEntry you might use an EG for the
- * current alternative - unlike patching up an alternative EG
- * i.e. start the loop at BlkLevel rather than (BlkLevel+1)
- * fill it in only if the EG and the LE are for the very
- * same alternative if they're at the same BlkLevel
- * it's easier to leave the LE on this list (filled in) rather than
- * trying to selectively remove it. It will eventually be
- * removed anyway when the BlkLevel gets small enough.
- */
-
- for (i=BlkLevel; i<=highWater ; i++) {
- for (innerLE=leArray[i]; innerLE != NULL ; innerLE=nextLE) {
- nextLE=innerLE->pendingLink;
- if (BlkLevel != i ||
- innerLE->curAltNum == CurAltNum_array[BlkLevel]) {
- if (innerLE->outerEG == NULL) {
- innerLE->outerEG=eg;
- };
- };
- };
- if (BlkLevel != i) leArray[i]=NULL;
- };
-
-/*
- * For the start of alternatives it is necessary to make a
- * distinction between the exception group for the current
- * alternative and the "fallback" EG for the block which
- * contains the alternative
- *
- * The fallback outerEG is used to handle the case where
- * no alternative of a block matches. In that case the
- * signal is "NoViableAlt" (or "NoSemViableAlt" and the
- * generator needs the EG of the block CONTAINING the
- * current one.
- *
- * rule: ( ( ( a
- * | b
- * )
- * | c
- * )
- * | d
- * );
- */
-
- for (i=BlkLevel; i <= highWater ; i++) {
- for (innerAlt=altArray[i]; innerAlt != NULL ; innerAlt=nextAlt) {
- nextAlt=innerAlt->pendingLink;
-
- /* first fill in the EG for the current alternative */
- /* but leave it on the list in order to get the fallback EG */
- /* if the EG is at the same LEVEL as the alternative then */
- /* fill it in only if in the very same alternative */
- /* */
- /* rule: ( a */
- /* | b */
- /* | c exception ... */
- /* ) */
- /* */
- /* if the EG is outside the alternative (e.g. BlkLevel < i) */
- /* then it doesn't matter about the alternative */
- /* */
- /* rule: ( a */
- /* | b */
- /* | c */
- /* ) exception ... */
- /* */
-
-#if 0
- printf("BlkLevel=%d i=%d altnum=%d CurAltNum=%d altID=%s\n",
- BlkLevel,i,innerAlt->curAltNum,CurAltNum_array[BlkLevel],eg->altID);
-#endif
- if (BlkLevel != i ||
- innerAlt->curAltNum == CurAltNum_array[BlkLevel]) {
- if (innerAlt->exception_label == NULL) {
- innerAlt->exception_label=eg->altID;
- };
- };
-
- /* ocurs at a later pass then for the exception_label */
- /* if an outerEG has been found then fill in the outer EG */
- /* remove if from the list when the BlkLevel gets smaller */
-
- if (BlkLevel != i) {
- if (innerAlt->outerEG == NULL) {
- innerAlt->outerEG=eg;
- };
- };
- };
- if (BlkLevel != i) altArray[i]=NULL;
- };
-}
-
-#ifdef __USE_PROTOS
-void leAdd(LabelEntry * le)
-#else
-void leAdd(le)
-LabelEntry *le;
-#endif
-
-{
- arrayCheck();
- le->pendingLink=leArray[BlkLevel];
- le->curAltNum=CurAltNum_array[BlkLevel];
- leArray[BlkLevel]=le;
-}
-
-#ifdef __USE_PROTOS
-void altAdd(Junction *alt)
-#else
-void altAdd(alt)
-Junction *alt;
-#endif
-
-{
- arrayCheck();
-#if 0
- printf("BlkLevel=%d CurAltNum=%d\n",
- BlkLevel,CurAltNum_array[BlkLevel]);
-#endif
- alt->curAltNum=CurAltNum_array[BlkLevel];
- alt->pendingLink=altArray[BlkLevel];
- altArray[BlkLevel]=alt;
-}
-
-static void
-#ifdef __USE_PROTOS
-arrayCheck(void)
-#else
-arrayCheck()
-#endif
-{
- ExceptionGroup **egArrayNew;
- LabelEntry **leArrayNew;
- Junction **altArrayNew;
- int arraySizeNew;
- int i;
-
- if (BlkLevel > highWater) highWater=BlkLevel;
-
- if (BlkLevel >= arraySize) {
- arraySizeNew=BlkLevel+5; /* MR20 */
- egArrayNew=(ExceptionGroup **)
- calloc(arraySizeNew,sizeof(ExceptionGroup *));
- leArrayNew=(LabelEntry **)
- calloc(arraySizeNew,sizeof(LabelEntry *));
- altArrayNew=(Junction **)
- calloc(arraySizeNew,sizeof(Junction *));
- for (i=0; i<arraySize ; i++) {
- egArrayNew[i]=egArray[i];
- leArrayNew[i]=leArray[i];
- altArrayNew[i]=altArray[i];
- };
- arraySize=arraySizeNew;
- if (egArray != NULL) free( (char *) egArray);
- if (leArray != NULL) free( (char *) leArray);
- if (altArray != NULL) free( (char *) altArray);
- egArray=egArrayNew;
- leArray=leArrayNew;
- altArray=altArrayNew;
- };
-}
-
-/* always call leFixup() BEFORE egFixup() */
-
-void
-#ifdef __USE_PROTOS
-egFixup(void)
-#else
-egFixup()
-#endif
-{
- int i;
- ExceptionGroup *nextEG;
- ExceptionGroup *innerEG;
-
- for (i=1; i<=highWater ; i++) {
- for (innerEG=egArray[i]; innerEG != NULL ; innerEG=nextEG) {
- nextEG=innerEG->pendingLink;
- innerEG->pendingLink=NULL;
- };
- egArray[i]=NULL;
- };
- lastEG=NULL;
- lastBlkLevel=0;
-}
-
-/* always call leFixup() BEFORE egFixup() */
-
-#ifdef __USE_PROTOS
-void leFixup(void)
-#else
-void leFixup()
-#endif
-{
-
- int i;
- LabelEntry *nextLE;
- LabelEntry *innerLE;
-
- for (i=BlkLevel; i<=highWater ; i++) {
- for (innerLE=leArray[i]; innerLE != NULL ; innerLE=nextLE) {
- nextLE=innerLE->pendingLink;
- innerLE->pendingLink=NULL;
- };
- leArray[i]=NULL;
- };
-}
-
-/* always call altFixup() BEFORE egFixup() */
-
-#ifdef __USE_PROTOS
-void altFixup(void)
-#else
-void altFixup()
-#endif
-{
-
- int i;
- Junction *nextAlt;
- Junction *innerAlt;
-
- for (i=BlkLevel; i<=highWater ; i++) {
- for (innerAlt=altArray[i]; innerAlt != NULL ; innerAlt=nextAlt) {
-
- /* if an outerEG has been found then fill in the outer EG */
-
- if (lastBlkLevel <= i) {
- if (innerAlt->outerEG == NULL) {
- innerAlt->outerEG=lastEG;
- };
- };
- nextAlt=innerAlt->pendingLink;
- innerAlt->pendingLink=NULL;
- };
- altArray[i]=NULL;
- };
-}
-
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c
deleted file mode 100644
index ca239398cf..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/err.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * A n t l r S e t s / E r r o r F i l e H e a d e r
- *
- * Generated from: antlr.g
- *
- * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001
- * Parr Research Corporation
- * with Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include "pcctscfg.h"
-#include "set.h"
-#include <ctype.h>
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#define zzcr_attr(attr,tok,t)
-#define zzSET_SIZE 20
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-#include "err.h"
-
-ANTLRChar *zztokens[157]={
- /* 00 */ "Invalid",
- /* 01 */ "Eof",
- /* 02 */ "QuotedTerm",
- /* 03 */ "\\n|\\r|\\r\\n",
- /* 04 */ "\\(\\n|\\r|\\r\\n)",
- /* 05 */ "\\~[]",
- /* 06 */ "~[\\n\\r\"\\]+",
- /* 07 */ "\"",
- /* 08 */ "\\n|\\r|\\r\\n",
- /* 09 */ "\\(\\n|\\r|\\r\\n)",
- /* 10 */ "\\~[]",
- /* 11 */ "~[\\n\\r\"\\]+",
- /* 12 */ "'",
- /* 13 */ "\\n|\\r|\\r\\n",
- /* 14 */ "\\~[]",
- /* 15 */ "~[\\n\\r'\\]+",
- /* 16 */ "\\*/",
- /* 17 */ "\\*",
- /* 18 */ "\\n|\\r|\\r\\n",
- /* 19 */ "~[\\n\\r\\*]+",
- /* 20 */ "\\*/",
- /* 21 */ "\\*",
- /* 22 */ "\\n|\\r|\\r\\n",
- /* 23 */ "~[\\n\\r\\*]+",
- /* 24 */ "\\n|\\r|\\r\\n",
- /* 25 */ "~[\\n\\r]+",
- /* 26 */ "\\n|\\r|\\r\\n",
- /* 27 */ "~[\\n\\r]+",
- /* 28 */ "\\n|\\r|\\r\\n",
- /* 29 */ "~[\\n\\r]+",
- /* 30 */ "\\*/",
- /* 31 */ "\\*",
- /* 32 */ "\\n|\\r|\\r\\n",
- /* 33 */ "~[\\n\\r\\*]+",
- /* 34 */ "Action",
- /* 35 */ "Pred",
- /* 36 */ "PassAction",
- /* 37 */ "consumeUntil\\( [\\ \\t]* \\{~[\\}]+\\} [\\ \\t]* \\)",
- /* 38 */ "consumeUntil\\( ~[\\)]+ \\)",
- /* 39 */ "\\n|\\r|\\r\\n",
- /* 40 */ "\\>",
- /* 41 */ "$",
- /* 42 */ "$$",
- /* 43 */ "$\\[\\]",
- /* 44 */ "$\\[",
- /* 45 */ "$[0-9]+",
- /* 46 */ "$[0-9]+.",
- /* 47 */ "$[0-9]+.[0-9]+",
- /* 48 */ "$[_a-zA-Z][_a-zA-Z0-9]*",
- /* 49 */ "#0",
- /* 50 */ "#\\[\\]",
- /* 51 */ "#\\(\\)",
- /* 52 */ "#[0-9]+",
- /* 53 */ "#line[\\ \\t]* [0-9]+ {[\\ \\t]* \"~[\"]+\" ([\\ \\t]* [0-9]*)* } (\\n|\\r|\\r\\n)",
- /* 54 */ "#line ~[\\n\\r]* (\\n|\\r|\\r\\n)",
- /* 55 */ "#[_a-zA-Z][_a-zA-Z0-9]*",
- /* 56 */ "#\\[",
- /* 57 */ "#\\(",
- /* 58 */ "#",
- /* 59 */ "\\)",
- /* 60 */ "\\[",
- /* 61 */ "\\(",
- /* 62 */ "\\\\]",
- /* 63 */ "\\\\)",
- /* 64 */ "\\>",
- /* 65 */ "'",
- /* 66 */ "\"",
- /* 67 */ "\\$",
- /* 68 */ "\\#",
- /* 69 */ "\\(\\n|\\r|\\r\\n)",
- /* 70 */ "\\~[\\]\\)>$#]",
- /* 71 */ "/",
- /* 72 */ "/\\*",
- /* 73 */ "\\*/",
- /* 74 */ "//",
- /* 75 */ "~[\\n\\r\\)\\(\\$#\\>\\]\\[\"'/]+",
- /* 76 */ "[\\t\\ ]+",
- /* 77 */ "\\n|\\r|\\r\\n",
- /* 78 */ "\\[",
- /* 79 */ "\\<\\<",
- /* 80 */ "\"",
- /* 81 */ "/\\*",
- /* 82 */ "\\*/",
- /* 83 */ "//",
- /* 84 */ "#line[\\ \\t]* [0-9]+ {[\\ \\t]* \"~[\"]+\" ([\\ \\t]* [0-9]*)* } (\\n|\\r|\\r\\n)",
- /* 85 */ "#line ~[\\n\\r]* (\\n|\\r|\\r\\n)",
- /* 86 */ "\\>\\>",
- /* 87 */ "WildCard",
- /* 88 */ "\\@",
- /* 89 */ "LABEL",
- /* 90 */ "grammar-element",
- /* 91 */ "meta-symbol",
- /* 92 */ "Pragma",
- /* 93 */ "FirstSetSymbol",
- /* 94 */ "{\\}#header",
- /* 95 */ "{\\}#first",
- /* 96 */ "{\\}#parser",
- /* 97 */ "{\\}#tokdefs",
- /* 98 */ "\\}",
- /* 99 */ "class",
- /* 100 */ "NonTerminal",
- /* 101 */ "TokenTerm",
- /* 102 */ "\\{",
- /* 103 */ "!",
- /* 104 */ "\\<",
- /* 105 */ "\\>",
- /* 106 */ ":",
- /* 107 */ ";",
- /* 108 */ "{\\}#lexaction",
- /* 109 */ "{\\}#lexmember",
- /* 110 */ "{\\}#lexprefix",
- /* 111 */ "{\\}#pred",
- /* 112 */ "\\|\\|",
- /* 113 */ "&&",
- /* 114 */ "\\(",
- /* 115 */ "\\)",
- /* 116 */ "{\\}#lexclass",
- /* 117 */ "{\\}#errclass",
- /* 118 */ "{\\}#tokclass",
- /* 119 */ "..",
- /* 120 */ "{\\}#token",
- /* 121 */ "=",
- /* 122 */ "[0-9]+",
- /* 123 */ "\\|",
- /* 124 */ "\\~",
- /* 125 */ "^",
- /* 126 */ "approx",
- /* 127 */ "LL\\(1\\)",
- /* 128 */ "LL\\(2\\)",
- /* 129 */ "\\*",
- /* 130 */ "\\+",
- /* 131 */ "?",
- /* 132 */ "=>",
- /* 133 */ "exception",
- /* 134 */ "default",
- /* 135 */ "catch",
- /* 136 */ "{\\}#[A-Za-z0-9_]*",
- /* 137 */ "[\\t\\ ]+",
- /* 138 */ "\\n|\\r|\\r\\n",
- /* 139 */ "//",
- /* 140 */ "/\\*",
- /* 141 */ "#ifdef",
- /* 142 */ "#if",
- /* 143 */ "#ifndef",
- /* 144 */ "#else",
- /* 145 */ "#endif",
- /* 146 */ "#undef",
- /* 147 */ "#import",
- /* 148 */ "ID",
- /* 149 */ "#define",
- /* 150 */ "INT",
- /* 151 */ "enum",
- /* 152 */ "\\{",
- /* 153 */ "=",
- /* 154 */ ",",
- /* 155 */ "\\}",
- /* 156 */ ";"
-};
-SetWordType zzerr1[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr2[20] = {0xfc,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xf3,
- 0xbf,0xff,0xff,0xff, 0xff,0xff,0xff,0x1f};
-SetWordType zzerr3[20] = {0xfc,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xfb,
- 0x3b,0xf7,0xf7,0xc7, 0xff,0xff,0xff,0x1f};
-SetWordType zzerr4[20] = {0x4,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x80,0x7,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType setwd1[157] = {0x0,0x50,0xa0,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x6a,0x20,0xa0,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x0,0x0,0x20,0x20,0x21,
- 0x21,0x21,0x21,0x6e,0x6e,0x64,0x20,0x0,
- 0x20,0xa0,0xa0,0xa0,0x20,0x6a,0x6a,0x6a,
- 0x6e,0x20,0x20,0x20,0x20,0x66,0x6e,0x6e,
- 0x20,0x66,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
- 0x20,0x20,0x20,0x20,0x20,0x20};
-SetWordType zzerr5[20] = {0x0,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x1,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr6[20] = {0x4,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x7,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr7[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x6,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr8[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x4,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr9[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf0,0x70,0x1, 0x20,0x0,0x0,0x0};
-SetWordType setwd2[157] = {0x0,0xf8,0x6,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xf8,0x0,0x1,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xf8,0xf8,0xf8,0x0,0x0,
- 0x0,0x1,0x2,0x6,0x0,0xf8,0xf8,0xf8,
- 0xf8,0x0,0x0,0x0,0x0,0xf8,0xf8,0xf8,
- 0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0xe8,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr10[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0xbc,0xf8,0x74,0x1, 0x20,0x0,0x0,0x0};
-SetWordType zzerr11[20] = {0x0,0x0,0x0,0x0, 0x8,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0xa0,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr12[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
-SetWordType zzerr13[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0xa0,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
-SetWordType setwd3[157] = {0x0,0xfa,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xfa,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xfa,0xfa,0xfa,0x5,0x0,
- 0x5,0x0,0x0,0x0,0xe2,0xfa,0xfa,0xfa,
- 0xfa,0xc0,0x80,0x5,0xe0,0xfa,0xfa,0xfa,
- 0x0,0xfa,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0xfa,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr14[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr15[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr16[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr17[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr18[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x24,0x0,0x80,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr19[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr20[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x74,0x3, 0x20,0x0,0x0,0x0};
-SetWordType zzerr21[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x70,0x3, 0x20,0x0,0x0,0x0};
-SetWordType setwd4[157] = {0x0,0xe5,0xda,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xe5,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xed,0xe5,0xe7,0x1a,0x0,
- 0x0,0x0,0x0,0x0,0xc0,0xe5,0xe5,0xe5,
- 0xe5,0x0,0x0,0x0,0x0,0xe5,0xe5,0xe5,
- 0x0,0xe5,0x40,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0xe5,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr22[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x3c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
-SetWordType zzerr23[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
-SetWordType zzerr24[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
-SetWordType zzerr25[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0};
-SetWordType zzerr26[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5,
- 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType setwd5[157] = {0x0,0x1f,0xc1,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xdf,0xc0,0xc0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0xc0,0x0,0xc0,0x0,0x0,0xc0,0xc0,0x0,
- 0x0,0x0,0x0,0x7f,0x1f,0xdf,0xc0,0xc0,
- 0x0,0x0,0xc0,0x0,0x67,0x1f,0x1f,0x1f,
- 0x1f,0x0,0x0,0xc0,0x60,0x1f,0x1f,0x1f,
- 0x0,0x1f,0x0,0x0,0x40,0xc0,0x0,0x0,
- 0x0,0x0,0xc0,0xc0,0x0,0x0,0x5f,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr27[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x0,0x0,0x0,0x10, 0x0,0x0,0x0,0x0};
-SetWordType zzerr28[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x80,0x2,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr29[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr30[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
- 0x0,0x0,0x80,0x0, 0x20,0x0,0x0,0x0};
-SetWordType zzerr31[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
- 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0};
-SetWordType zzerr32[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5,
- 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr33[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType setwd6[157] = {0x0,0x0,0xfd,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xe1,0xe1,0xe1,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0xfd,0x60,0xe9,0x0,0x0,0xe1,0xe1,0x0,
- 0x0,0x0,0x0,0xe2,0x0,0xfd,0xfd,0xe1,
- 0x20,0x0,0xe1,0x0,0xe2,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xe1,0xe2,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0xe2,0xe0,0x20,0x0,
- 0x0,0x0,0xe1,0xe1,0x0,0x0,0xe2,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr34[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
- 0x0,0x0,0x80,0x0, 0x20,0x0,0x0,0x0};
-SetWordType zzerr35[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd,
- 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0};
-SetWordType zzerr36[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5,
- 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr37[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xc,
- 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0};
-SetWordType zzerr38[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x84,0x9,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr39[20] = {0x0,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x1,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr40[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x4,0x9,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr41[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr42[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x80,0x0,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType setwd7[157] = {0x0,0x0,0xdf,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xdf,0xdf,0xff,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0xdf,0x3,0xdf,0x0,0x0,0xdf,0xdf,0x0,
- 0x0,0x0,0x0,0xdf,0x0,0xdf,0xdf,0xdf,
- 0x1,0x30,0xdf,0x0,0xdf,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xdf,0xdf,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0xdf,0xdf,0x1,0x0,
- 0x0,0x0,0xdf,0xdf,0x0,0x0,0xdf,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr43[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr44[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xc0, 0x1,0x0,0x0,0x0};
-SetWordType zzerr45[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x30,
- 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr46[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr47[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x20,
- 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr48[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x2,0x0, 0x10,0x0,0x0,0x0};
-SetWordType zzerr49[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0};
-SetWordType zzerr50[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x4,0x8,0xa,0x18, 0x30,0x0,0x0,0x0};
-SetWordType zzerr51[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x4,0x8,0x8,0x18, 0x28,0x0,0x0,0x0};
-SetWordType zzerr52[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr53[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType setwd8[157] = {0x0,0x0,0xe1,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0xe1,0xe1,0xe1,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0xe1,0x0,0xe1,0x0,0x0,0xe3,0xe7,0x0,
- 0x0,0x0,0x0,0xe1,0x0,0xe1,0xe1,0xef,
- 0x0,0x0,0xe1,0x0,0xe1,0x0,0x0,0x0,
- 0x0,0x0,0x10,0xef,0xe1,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0xe1,0xe1,0x0,0x0,
- 0x0,0x0,0xe1,0xe1,0x0,0x10,0xe1,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr54[20] = {0x2,0x0,0x0,0x0, 0x14,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x78,0x9, 0xe0,0x0,0x0,0x0};
-SetWordType zzerr55[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x78,0x9, 0x60,0x0,0x0,0x0};
-SetWordType zzerr56[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0};
-SetWordType zzerr57[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x1c,0xf8,0x78,0x9, 0xe0,0x0,0x0,0x0};
-SetWordType setwd9[157] = {0x0,0x7c,0x1,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x7f,0x1,0x1,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x1,0x0,0x1,0x0,0x0,0x1,0x1,0x0,
- 0x0,0x0,0x0,0x7f,0x7e,0x7f,0x1,0x1,
- 0x0,0x0,0x1,0x0,0x7d,0x7e,0x7e,0x7e,
- 0x7e,0x0,0x0,0x1,0x7d,0x7e,0x7e,0x7e,
- 0x0,0x7e,0x0,0x0,0x7d,0x1,0x0,0x0,
- 0x0,0x0,0x1,0x1,0x0,0x0,0x7f,0x64,
- 0x64,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x80,0x0,0x0,0x0,0x0,0x0,0x80,0x0,
- 0x80,0x0,0x0,0x0,0x0,0x0};
-SetWordType zzerr58[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0xa0,0x0};
-SetWordType zzerr59[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x80,0xa0,0x0};
-SetWordType zzerr60[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0xa0,0x0};
-SetWordType zzerr61[20] = {0x2,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x80,0xa0,0x0};
-SetWordType zzerr62[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe};
-SetWordType zzerr63[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe};
-SetWordType zzerr64[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe};
-SetWordType zzerr65[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0, 0x0,0x0,0x10,0xc};
-SetWordType setwd10[157] = {0x0,0xc,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,
- 0x3,0x0,0x0,0xf0,0xf0,0x0};
-SetWordType setwd11[157] = {0x0,0x1,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
- 0x1,0x0,0x0,0x0,0x0,0x0};
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c
deleted file mode 100644
index ff7dcdfdd5..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fcache.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * fcache.c
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33MR10
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-
-#include "pcctscfg.h"
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-
-#ifdef __USE_PROTOS
-CacheEntry *dumpFcache1(char *prev)
-#else
-CacheEntry *dumpFcache1(prev)
- char *prev;
-#endif
-{
- Entry **table=Fcache;
-
- int low=0;
- int hi=0;
-
- CacheEntry *least=NULL;
-
- Entry **p;
-
- for (p=table; p<&(table[HashTableSize]); p++) {
-
- CacheEntry *q =(CacheEntry *) *p;
-
- if ( q != NULL && low==0 ) low = p-table;
- while ( q != NULL ) {
- if (strcmp(q->str,prev) > 0) {
- if (least == NULL) {
- least=q;
- } else {
- if (strcmp(q->str,least->str) < 0) {
- least=q;
- };
- };
- };
- q = q->next;
- };
-
- if ( *p != NULL ) hi = p-table;
- }
- return least;
-}
-
-#ifdef __USE_PROTOS
-void reportFcache(CacheEntry *q)
-#else
-void reportFcache(q)
- CacheEntry *q;
-#endif
-{
- char *qstr;
-
- fprintf(stdout,"\nrule ");
- for (qstr=q->str; *qstr != '*' ; qstr++) {
- fprintf(stdout,"%c",*qstr);
- };
-
- qstr++;
- if (*qstr == 'i') fprintf(stdout," First[");
- if (*qstr == 'o') fprintf(stdout," Follow[");
- qstr++;
- fprintf(stdout,"%s]",qstr);
- if (q->incomplete) fprintf(stdout," *** incomplete ***");
- fprintf(stdout,"\n");
- MR_dumpTokenSet(stdout,1,q->fset);
-}
-
-void
-#ifdef __USE_PROTOS
-DumpFcache(void)
-#else
-DumpFcache()
-#endif
-{
-
- char *prev="";
- int n=0;
- CacheEntry *next;
-
- fprintf(stdout,"\n\nDump of First/Follow Cache\n");
-
- for(;;) {
- next=dumpFcache1(prev);
- if (next == NULL) break;
- reportFcache(next);
- ++n;
- prev=next->str;
- };
- fprintf(stdout,"\nEnd dump of First/Follow Cache\n");
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c
deleted file mode 100644
index e1a76ec620..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset.c
+++ /dev/null
@@ -1,1555 +0,0 @@
-/*
- * fset.c
- *
- * Compute FIRST and FOLLOW sets.
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pcctscfg.h"
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-#include "limits.h"
-
-#ifdef __USE_PROTOS
-static void ensure_predicates_cover_ambiguous_lookahead_sequences
- (Junction *, Junction *, char *, Tree *);
-#else
-static void ensure_predicates_cover_ambiguous_lookahead_sequences();
-#endif
-
-/*
- * What tokens are k tokens away from junction q?
- *
- * Follow both p1 and p2 paths (unless RuleBlk) to collect the tokens k away from this
- * node.
- * We lock the junction according to k--the lookahead. If we have been at this
- * junction before looking for the same, k, number of lookahead tokens, we will
- * do it again and again...until we blow up the stack. Locks are only used on aLoopBlk,
- * RuleBlk, aPlusBlk and EndRule junctions to remove/detect infinite recursion from
- * FIRST and FOLLOW calcs.
- *
- * If p->jtype == EndRule we are going to attempt a FOLLOW. (FOLLOWs are really defined
- * in terms of FIRST's, however). To proceed with the FOLLOW, p->halt cannot be
- * set. p->halt is set to indicate that a reference to the current rule is in progress
- * and the FOLLOW is not desirable.
- *
- * If we attempt a FOLLOW and find that there is no FOLLOW or REACHing beyond the EndRule
- * junction yields an empty set, replace the empty set with EOF. No FOLLOW means that
- * only EOF can follow the current rule. This normally occurs only on the start symbol
- * since all other rules are referenced by another rule somewhere.
- *
- * Normally, both p1 and p2 are followed. However, checking p2 on a RuleBlk node is
- * the same as checking the next rule which is clearly incorrect.
- *
- * Cycles in the FOLLOW sense are possible. e.g. Fo(c) requires Fo(b) which requires
- * Fo(c). Both Fo(b) and Fo(c) are defined to be Fo(b) union Fo(c). Let's say
- * Fo(c) is attempted first. It finds all of the FOLLOW symbols and then attempts
- * to do Fo(b) which finds of its FOLLOW symbols. So, we have:
- *
- * Fo(c)
- * / \
- * a set Fo(b)
- * / \
- * a set Fo(c) .....Hmmmm..... Infinite recursion!
- *
- * The 2nd Fo(c) is not attempted and Fo(b) is left deficient, but Fo(c) is now
- * correctly Fo(c) union Fo(b). We wish to pick up where we left off, so the fact
- * that Fo(b) terminated early means that we lack Fo(c) in the Fo(b) set already
- * laying around. SOOOOoooo, we track FOLLOW cycles. All FOLLOW computations are
- * cached in a hash table. After the sequence of FOLLOWs finish, we reconcile all
- * cycles --> correct all Fo(rule) sets in the cache.
- *
- * Confused? Good! Read my MS thesis [Purdue Technical Report TR90-30].
- * TJP 8/93 -- can now read PhD thesis from Purdue.
- *
- * Also, FIRST sets are cached in the hash table. Keys are (rulename,Fi/Fo,k).
- * Only FIRST sets, for which the FOLLOW is not included, are stored.
- *
- * SPECIAL CASE of (...)+ blocks:
- * I added an optional alt so that the alts could see what
- * was behind the (...)+ block--thus using enough lookahead
- * to branch out rather than just enough to distinguish
- * between alts in the (...)+. However, when the FIRST("(...)+") is
- * is needed, must not use this last "optional" alt. This routine
- * turns off this path by setting a new 'ignore' flag for
- * the alt and then resetting it afterwards.
- */
-
-set
-#ifdef __USE_PROTOS
-rJunc( Junction *p, int k, set *rk )
-#else
-rJunc( p, k, rk )
-Junction *p;
-int k;
-set *rk;
-#endif
-{
- set a, b;
-
- require(p!=NULL, "rJunc: NULL node");
- require(p->ntype==nJunction, "rJunc: not junction");
-
-#ifdef DBG_LL1
- if ( p->jtype == RuleBlk ) fprintf(stderr, "FIRST(%s,%d) \n",((Junction *)p)->rname,k);
- else fprintf(stderr, "rJunc: %s in rule %s\n",
- decodeJType[p->jtype], ((Junction *)p)->rname);
-#endif
- /* if this is one of the added optional alts for (...)+ then return */
-
- /* no need to pop backtrace - hasn't been pushed */
-
- if ( p->ignore ) return empty;
-
- if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
-
-/* MR14 */ if (AlphaBetaTrace && p->alpha_beta_guess_end) {
-/* MR14 */ warnFL(
-/* MR14 */ "not possible to compute follow set for alpha in an \"(alpha)? beta\" block. ",
-/* MR14 */ FileStr[p->file],p->line);
-/* MR14 */ MR_alphaBetaTraceReport();
-/* MR14 */ };
-
-/* MR14 */ if (p->alpha_beta_guess_end) {
-/* MR14 */ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
-/* MR14 */ return empty;
-/* MR14 */ }
-
- /* locks are valid for aLoopBlk,aPlusBlk,RuleBlk,EndRule junctions only */
- if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
- p->jtype==aPlusBlk || p->jtype==EndRule )
- {
- require(p->lock!=NULL, "rJunc: lock array is NULL");
- if ( p->lock[k] )
- {
- if ( p->jtype == EndRule ) /* FOLLOW cycle? */
- {
-#ifdef DBG_LL1
- fprintf(stderr, "FOLLOW cycle to %s: panic!\n", p->rname);
-#endif
- if (! MR_AmbSourceSearch) RegisterCycle(p->rname, k);
- }
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return empty;
- }
- if ( p->jtype == RuleBlk &&
- p->end->halt &&
- ! MR_AmbSourceSearch) /* check for FIRST cache */
- {
- CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'i',k));
- if ( q != NULL )
- {
- set_orin(rk, q->rk);
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return set_dup( q->fset );
- }
- }
- if ( p->jtype == EndRule &&
- !p->halt && /* MR11 was using cache even when halt set */
- ! MR_AmbSourceSearch) /* FOLLOW set cached already? */
- {
- CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'o',k));
- if ( q != NULL )
- {
-#ifdef DBG_LL1
- fprintf(stderr, "cache for FOLLOW(%s,%d):", p->rname,k);
- s_fprT(stderr, q->fset);
- if ( q->incomplete ) fprintf(stderr, " (incomplete)");
- fprintf(stderr, "\n");
-#endif
- if ( !q->incomplete )
- {
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return set_dup( q->fset );
- }
- }
- }
- p->lock[k] = TRUE; /* This rule is busy */
- }
-
- a = b = empty;
-
- if ( p->jtype == EndRule )
- {
- if (p->halt ) /* don't want FOLLOW here? */ /* unless MR10 hoisting */
- {
- p->lock[k] = FALSE;
- set_orel(k, rk); /* indicate this k value needed */
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return empty;
- }
- if (! MR_AmbSourceSearch) FoPush(p->rname, k); /* Attempting FOLLOW */
- if ( p->p1 == NULL ) set_orel((TokenInd!=NULL?TokenInd[EofToken]:EofToken), &a);/* if no FOLLOW assume EOF */
-#ifdef DBG_LL1
- fprintf(stderr, "-->FOLLOW(%s,%d)\n", p->rname,k);
-#endif
- }
-
- if ( p->p1 != NULL ) {
-/* MR14 */ if (p->guess) {
-/* MR14 */ if (p->guess_analysis_point == NULL) {
-/* MR14 */ Node * guess_point;
-/* MR14 */ guess_point=(Node *)analysis_point(p);
-/* MR14 */ if (guess_point == (Node *)p) {
-/* MR14 */ guess_point=p->p1;
-/* MR14 */ }
-/* MR14 */ p->guess_analysis_point=guess_point;
-/* MR14 */ }
-/* MR14 */ REACH(p->guess_analysis_point, k, rk, a);
- } else {
- REACH(p->p1, k, rk, a);
- }
- }
-
- /* C a c h e R e s u l t s */
-
- if ( p->jtype == RuleBlk && p->end->halt && ! MR_AmbSourceSearch) /* can save FIRST set? */
- {
- CacheEntry *q = newCacheEntry( Fkey(p->rname,'i',k) );
- /*fprintf(stderr, "Caching %s FIRST %d\n", p->rname, k);*/
- hash_add(Fcache, Fkey(p->rname,'i',k), (Entry *)q);
- q->fset = set_dup( a );
- q->rk = set_dup( *rk );
- }
-
- if ( p->jtype == EndRule &&
- !p->halt && /* MR11 was using cache even with halt set */
- ! MR_AmbSourceSearch) /* just completed FOLLOW? */
- {
- /* Cache Follow set */
- CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'o',k));
- if ( q==NULL )
- {
- q = newCacheEntry( Fkey(p->rname,'o',k) );
- hash_add(Fcache, Fkey(p->rname,'o',k), (Entry *)q);
- }
- /*fprintf(stderr, "Caching %s FOLLOW %d\n", p->rname, k);*/
- if ( set_nil(a) && !q->incomplete )
- {
- /* Don't ever save a nil set as complete.
- * Turn it into an eof set.
- */
- set_orel(EofToken, &a);
- }
- set_orin(&(q->fset), a);
- FoPop( k );
- if ( FoTOS[k] == NULL && Cycles[k] != NULL ) ResolveFoCycles(k);
-#ifdef DBG_LL1
- fprintf(stderr, "saving FOLLOW(%s,%d):", p->rname, k);
- s_fprT(stderr, q->fset);
- if ( q->incomplete ) fprintf(stderr, " (incomplete)");
- fprintf(stderr, "\n");
-#endif
- }
-
- if (p->jtype != RuleBlk && p->p2 != NULL && /* MR14 */ ! p->guess) {
- REACH(p->p2, k, rk, b);
- }
-
- if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
- p->jtype==aPlusBlk || p->jtype==EndRule )
- p->lock[k] = FALSE; /* unlock node */
-
- set_orin(&a, b);
- set_free(b);
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return a;
-}
-
-set
-#ifdef __USE_PROTOS
-rRuleRef( RuleRefNode *p, int k, set *rk_out )
-#else
-rRuleRef( p, k, rk_out )
-RuleRefNode *p;
-int k;
-set *rk_out;
-#endif
-{
- set rk;
- Junction *r;
- int k2;
- set a, rk2, b;
- int save_halt;
- RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
- require(p!=NULL, "rRuleRef: NULL node");
- require(p->ntype==nRuleRef, "rRuleRef: not rule ref");
-
-#ifdef DBG_LL1
- fprintf(stderr, "rRuleRef: %s\n", p->text);
-#endif
-
- if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
-
- if ( q == NULL )
- {
- warnFL( eMsg1("rule %s not defined",p->text), FileStr[p->file], p->line );
- REACH(p->next, k, rk_out, a);
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return a;
- }
- rk2 = empty;
-
-/* MR9 Problems with rule references in guarded predicates */
-/* MR9 Perhaps can use hash table to find rule ? */
-
-/* MR9 */ if (RulePtr == NULL) {
-/* MR9 */ fatalFL(eMsg2("Rule %s uses rule %s via RulePtr before it has been initialized",
-/* MR9 */ p->rname,q->str),FileStr[p->file],p->line);
-/* MR9 */ };
-
- r = RulePtr[q->rulenum];
- if ( r->lock[k] )
- {
- errNoFL( eMsg2("infinite left-recursion to rule %s from rule %s",
- r->rname, p->rname) );
-
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
-
- return empty;
- }
-
- save_halt = r->end->halt;
- r->end->halt = TRUE; /* don't let reach fall off end of rule here */
- rk = empty;
- REACH(r, k, &rk, a);
- r->end->halt = save_halt;
- while ( !set_nil(rk) ) {
- k2 = set_int(rk); /* MR11 this messes up the ambiguity search routine */
- set_rm(k2, rk);
- REACH(p->next, k2, &rk2, b); /* MR11 by changing the value of k */
- set_orin(&a, b);
- set_free(b);
- }
- set_free(rk); /* this has no members, but free it's memory */
- set_orin(rk_out, rk2); /* remember what we couldn't do */
- set_free(rk2);
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return a;
-}
-
-/*
- * Return FIRST sub k ( token_node )
- *
- * TJP 10/11/93 modified this so that token nodes that are actually
- * ranges (T1..T2) work.
- */
-set
-#ifdef __USE_PROTOS
-rToken( TokNode *p, int k, set *rk )
-#else
-rToken( p, k, rk )
-TokNode *p;
-int k;
-set *rk;
-#endif
-{
- set a;
-
- require(p!=NULL, "rToken: NULL node");
- require(p->ntype==nToken, "rToken: not token node");
-
-#ifdef DBG_LL1
- fprintf(stderr, "rToken: %s\n", (TokenString(p->token)!=NULL)?TokenString(p->token):
- ExprString(p->token));
-#endif
-
-
- if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
-
- if (MR_AmbSourceSearch && (k-1) == 0) {
-
- set localConstrain;
- set intersection;
-
- localConstrain=fset[maxk-k+1];
-
- if (! set_nil(p->tset)) {
- intersection=set_and(localConstrain,p->tset);
- if (! set_nil(intersection)) {
- MR_backTraceReport();
- };
- set_free(intersection);
- } else {
- if (set_el( (unsigned) p->token,localConstrain)) {
- MR_backTraceReport();
- }
- };
- };
-
- if ( k-1 == 0 ) {
-
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
-
- if ( !set_nil(p->tset) ) {
- return set_dup(p->tset);
- } else {
- return set_of(p->token);
- };
- }
-
- REACH(p->next, k-1, rk, a);
-
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
-
- return a;
-}
-
-set
-#ifdef __USE_PROTOS
-rAction( ActionNode *p, int k, set *rk )
-#else
-rAction( p, k, rk )
-ActionNode *p;
-int k;
-set *rk;
-#endif
-{
- set a;
-
- require(p!=NULL, "rJunc: NULL node");
- require(p->ntype==nAction, "rJunc: not action");
-
-/* MR11 */ if (p->is_predicate && p->ampersandPred != NULL) {
-/* MR11 */ Predicate *pred=p->ampersandPred;
-/* MR11 */ if (k <= pred->k) {
-/* MR11 */ REACH(p->guardNodes,k,rk,a);
-/* MR11 */ return a;
-/* MR11 */ };
-/* MR11 */ };
-
- /* it might be a good idea when doing an MR_AmbSourceSearch
- to *not* look behind predicates under some circumstances
- we'll look into that later
- */
-
- REACH(p->next, k, rk, a); /* ignore actions */
- return a;
-}
-
- /* A m b i g u i t y R e s o l u t i o n */
-
-
-void
-#ifdef __USE_PROTOS
-dumpAmbigMsg( set *fset, FILE *f, int want_nls )
-#else
-dumpAmbigMsg( fset, f, want_nls )
-set *fset;
-FILE *f;
-int want_nls;
-#endif
-{
- int i;
-
- set copy; /* MR11 */
-
- if ( want_nls ) fprintf(f, "\n\t");
- else fprintf(f, " ");
-
- for (i=1; i<=CLL_k; i++)
- {
- copy=set_dup(fset[i]); /* MR11 */
-
- if ( i>1 )
- {
- if ( !want_nls ) fprintf(f, ", ");
- }
- if ( set_deg(copy) > 3 && elevel == 1 )
- {
- int e,m;
- fprintf(f, "{");
- for (m=1; m<=3; m++)
- {
- e=set_int(copy);
- fprintf(f, " %s", TerminalString(e));
- set_rm(e, copy);
- }
- fprintf(f, " ... }");
- }
- else s_fprT(f, copy);
- if ( want_nls ) fprintf(f, "\n\t");
- set_free(copy);
- }
- fprintf(f, "\n");
-
-}
-
-static void
-#ifdef __USE_PROTOS
-verify_context(Predicate *predicate)
-#else
-verify_context(predicate)
-Predicate *predicate;
-#endif
-{
- if ( predicate == NULL ) return;
-
- if ( predicate->expr == PRED_OR_LIST ||
- predicate->expr == PRED_AND_LIST )
- {
- verify_context(predicate->down);
- verify_context(predicate->right); /* MR10 */
- return;
- }
-
- if ( !predicate->source->ctxwarned && predicate->source->guardpred==NULL &&
- ((predicate->k > 1 &&
- !is_single_tuple(predicate->tcontext)) ||
- ( predicate->k == 1 &&
- set_deg(predicate->scontext[1])>1 )) )
- {
-
-/* MR9 Suppress annoying messages caused by our own clever(?) fix */
-
- fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
- predicate->source->line);
- fprintf(stderr, " warning: predicate applied for >1 lookahead %d-sequences\n", predicate->k);
- fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
- predicate->source->line);
- fprintf(stderr, " predicate text: \"%s\"\n",
- (predicate->expr == NULL ? "(null)" : predicate->expr) );
- fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
- predicate->source->line);
- fprintf(stderr, " You may only want one lookahead %d-sequence to apply\n", predicate->k);
- fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
- predicate->source->line);
- fprintf(stderr, " Try using a context guard '(...)? =>'\n");
- predicate->source->ctxwarned = 1;
- }
- verify_context(predicate->right); /* MR10 */
-}
-
-/*
- * If delta is the set of ambiguous lookahead sequences, then make sure that
- * the predicate(s) for productions alt1,alt2 cover the sequences in delta.
- *
- * For example,
- * a : <<PRED1>>? (A B|A C)
- * | b
- * ;
- * b : <<PRED2>>? A B
- * | A C
- * ;
- *
- * This should give a warning that (A C) predicts both productions and alt2
- * does not have a predicate in the production that generates (A C).
- *
- * The warning detection is simple. Let delta = LOOK(alt1) intersection LOOK(alt2).
- * Now, if ( delta set-difference context(predicates-for-alt1) != empty then
- * alt1 does not "cover" all ambiguous sequences.
- *
- * If ambig is nonempty, then ambig in LL(k) sense -> use tree info; else use fset
- * info. Actually, sets are used only if k=1 for this grammar.
- */
-static void
-#ifdef __USE_PROTOS
-ensure_predicates_cover_ambiguous_lookahead_sequences
- ( Junction *alt1, Junction *alt2, char *sub, Tree *ambig )
-#else
-ensure_predicates_cover_ambiguous_lookahead_sequences( alt1, alt2, sub, ambig )
-Junction *alt1;
-Junction *alt2;
-char *sub;
-Tree *ambig;
-#endif
-{
- if ( !ParseWithPredicates ) return;
-
- if ( ambig!=NULL )
- {
- Tree *non_covered = NULL;
- if ( alt1->predicate!=NULL )
- non_covered = tdif(ambig, alt1->predicate, alt1->fset, alt2->fset);
- if ( (non_covered!=NULL || alt1->predicate==NULL) && WarningLevel>1 )
- {
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
- alt1->altnum, sub);
- if ( alt1->predicate!=NULL && non_covered!=NULL )
- {
- fprintf(stderr, " upon");
- preorder(non_covered);
- }
- else if ( alt1->predicate==NULL )
- {
- fprintf(stderr, " upon");
- preorder(ambig->down);
- }
- fprintf(stderr, "\n");
- }
- Tfree(non_covered);
- non_covered = NULL;
- if ( alt2->predicate!=NULL )
- non_covered = tdif(ambig, alt2->predicate, alt1->fset, alt2->fset);
- if ( (non_covered!=NULL || alt2->predicate==NULL) && WarningLevel>1 )
- {
- fprintf(stderr, ErrHdr, FileStr[alt2->file], alt2->line);
- fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
- alt2->altnum, sub);
- if ( alt2->predicate!=NULL && non_covered!=NULL )
- {
- fprintf(stderr, " upon");
- preorder(non_covered);
- }
- else if ( alt2->predicate==NULL )
- {
- fprintf(stderr, " upon");
- preorder(ambig->down);
- }
- fprintf(stderr, "\n");
- }
- Tfree(non_covered);
- }
- else if ( !set_nil(alt1->fset[1]) )
- {
- set delta, non_covered;
- delta = set_and(alt1->fset[1], alt2->fset[1]);
- non_covered = set_dif(delta, covered_set(alt1->predicate));
- if ( set_deg(non_covered)>0 && WarningLevel>1 )
- {
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
- alt1->altnum, sub);
- if ( alt1->predicate!=NULL )
- {
- fprintf(stderr, " upon ");
- s_fprT(stderr, non_covered);
- }
- fprintf(stderr, "\n");
- }
- set_free( non_covered );
- non_covered = set_dif(delta, covered_set(alt2->predicate));
- if ( set_deg(non_covered)>0 && WarningLevel>1 )
- {
- fprintf(stderr, ErrHdr, FileStr[alt2->file], alt2->line);
- fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
- alt2->altnum, sub);
- if ( alt2->predicate!=NULL )
- {
- fprintf(stderr, " upon ");
- s_fprT(stderr, non_covered);
- }
- fprintf(stderr, "\n");
- }
- set_free( non_covered );
- set_free( delta );
- }
- else fatal_internal("productions have no lookahead in predicate checking routine");
-}
-
-#ifdef __USE_PROTOS
-void MR_doPredicatesHelp(int inGuessBlock,Junction *alt1,Junction *alt2,int jtype,char *sub)
-#else
-void MR_doPredicatesHelp(inGuessBlock,alt1,alt2,jtype,sub)
- int inGuessBlock;
- Junction *alt1;
- Junction *alt2;
- int jtype;
- char *sub;
-#endif
-{
- Predicate *p1;
- Predicate *p2;
-
- Junction *parentRule=MR_nameToRuleBlk(alt1->rname);
-
- if (inGuessBlock && WarningLevel <= 1) return;
-
- /* let antlr give the usual error message */
-
- if (alt1->predicate == NULL && alt2->predicate == NULL) return;
-
- if ( (jtype == RuleBlk || jtype == aSubBlk)
- && (alt1->predicate == NULL && alt2->predicate != NULL)) {
- fprintf(stderr, ErrHdr, FileStr[parentRule->file],parentRule->line);
- fprintf(stderr," warning: alt %d line %d and alt %d line %d of %s\n%s%s%s",
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- sub,
- " These alts have ambig lookahead sequences resolved by a predicate for\n",
- " the second choice. The second choice may not be reachable.\n",
- " You may want to use a complementary predicate or rearrange the alts\n"
- );
- return;
- };
-
- /* first do the easy comparison. then do the hard one */
-
- if (MR_comparePredicates(alt1->predicate,alt2->predicate)) {
-
- if (jtype == aLoopBegin || jtype == aPlusBlk ) {
-
- /* I'm not sure this code is reachable.
- Predicates following a (...)+ or (...)* block are probably
- considered validation predicates and therefore not
- participate in the predication expression
- */
-
- fprintf(stderr, ErrHdr,FileStr[parentRule->file],parentRule->line);
- fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s",
- "the predicates used to disambiguate optional/exit paths of ",
- sub,
- CurRule,
- FileStr[alt1->file],
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- " are identical and have no resolving power\n");
- } else {
- fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
- fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s",
- "the predicates used to disambiguate",
- CurRule,
- FileStr[alt1->file],
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- " are identical and have no resolving power\n");
- };
- } else {
- p1=predicate_dup_without_context(alt1->predicate);
- p1=MR_unfold(p1);
- MR_clearPredEntry(p1);
- MR_simplifyInverted(p1,0);
- p1=MR_predSimplifyALL(p1);
- p2=predicate_dup_without_context(alt2->predicate);
- p2=MR_unfold(p2);
- MR_clearPredEntry(p2);
- MR_simplifyInverted(p2,0);
- p2=MR_predSimplifyALL(p2);
- if (MR_comparePredicates(p1,p2)) {
- if (jtype == aLoopBegin || jtype == aPlusBlk ) {
- fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
- fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
- "the predicates used to disambiguate optional/exit paths of ",
- sub,
- CurRule,
- FileStr[alt1->file],
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- " are identical when compared without context and may have no\n",
- " resolving power for some lookahead sequences.\n");
- } else {
- fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
- fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
- "the predicates used to disambiguate",
- CurRule,
- FileStr[alt1->file],
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- " are identical when compared without context and may have no\n",
- " resolving power for some lookahead sequences.\n");
- };
- if (InfoP) {
- fprintf(output,"\n#if 0\n\n");
- fprintf(output,"The following predicates are identical when compared without\n");
- fprintf(output," lookahead context information. For some ambiguous lookahead\n");
- fprintf(output," sequences they may not have any power to resolve the ambiguity.\n");
- fprintf(output,"\n");
-
- fprintf(output,"Choice 1: %s alt %d line %d file %s\n\n",
- MR_ruleNamePlusOffset( (Node *) alt1),
- alt1->altnum,
- alt1->line,
- FileStr[alt1->file]);
- fprintf(output," The original predicate for choice 1 with available context information:\n\n");
- MR_dumpPred1(2,alt1->predicate,1);
- fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n");
- MR_dumpPred1(2,p1,0);
- if (p1 == NULL) {
- Predicate *phelp;
- fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n");
- phelp=predicate_dup_without_context(alt1->predicate);
- phelp=MR_unfold(phelp);
- MR_clearPredEntry(phelp);
- MR_simplifyInverted(phelp,0);
- phelp=MR_predSimplifyALLX(phelp,1);
- MR_dumpPred1(2,phelp,0);
- predicate_free(phelp);
- };
- fprintf(output,"\n");
-
- fprintf(output,"Choice 2: %s alt %d line %d file %s\n\n",
- MR_ruleNamePlusOffset( (Node *) alt2),
- alt2->altnum,
- alt2->line,
- FileStr[alt2->file]);
- fprintf(output," The original predicate for choice 2 with available context information:\n\n");
- MR_dumpPred1(1,alt2->predicate,1);
- fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n");
- MR_dumpPred1(1,p2,0);
- if (p2 == NULL) {
- Predicate *phelp;
- fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n");
- phelp=predicate_dup_without_context(alt2->predicate);
- phelp=MR_unfold(phelp);
- MR_clearPredEntry(phelp);
- MR_simplifyInverted(phelp,0);
- phelp=MR_predSimplifyALLX(phelp,1);
- MR_dumpPred1(2,phelp,0);
- predicate_free(phelp);
- };
- fprintf(output,"\n#endif\n");
- };
- } else if (MR_secondPredicateUnreachable(p1,p2)) {
- if (jtype == aLoopBegin || jtype == aPlusBlk ) {
- fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
- fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
- "the predicate used to disambiguate the first choice of the optional/exit paths of ",
- sub,
- CurRule,
- FileStr[alt1->file],
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- " appears to \"cover\" the second predicate when compared without context.\n",
- " The second predicate may have no resolving power for some lookahead sequences.\n");
- } else {
- fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line);
- fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s",
- "the predicate used to disambiguate the first choice of",
- CurRule,
- FileStr[alt1->file],
- alt1->altnum,
- alt1->line,
- alt2->altnum,
- alt2->line,
- " appears to \"cover\" the second predicate when compared without context.\n",
- " The second predicate may have no resolving power for some lookahead sequences.\n");
- };
- if (InfoP) {
- fprintf(output,"\n#if 0\n\n");
- fprintf(output,"The first predicate appears to \"cover\" the second predicate when they\n");
- fprintf(output," are compared without lookahead context information. For some ambiguous\n");
- fprintf(output," lookahead sequences the second predicate may not have any power to\n");
- fprintf(output," resolve the ambiguity.\n");
- fprintf(output,"\n");
- fprintf(output,"Choice 1: %s alt %d line %d file %s\n\n",
- MR_ruleNamePlusOffset( (Node *) alt1),
- alt1->altnum,
- alt1->line,
- FileStr[alt1->file]);
- fprintf(output," The original predicate for choice 1 with available context information:\n\n");
- MR_dumpPred1(2,alt1->predicate,1);
- fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n");
- MR_dumpPred1(2,p1,0);
- if (p1 == NULL) {
- Predicate *phelp;
- fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n");
- phelp=predicate_dup_without_context(alt1->predicate);
- phelp=MR_unfold(phelp);
- MR_clearPredEntry(phelp);
- MR_simplifyInverted(phelp,0);
- phelp=MR_predSimplifyALLX(phelp,1);
- MR_dumpPred1(2,phelp,0);
- predicate_free(phelp);
- };
- fprintf(output,"\n");
-
- fprintf(output,"Choice 2: %s alt %d line %d file %s\n\n",
- MR_ruleNamePlusOffset( (Node *) alt2),
- alt2->altnum,
- alt2->line,
- FileStr[alt2->file]);
- fprintf(output," The original predicate for choice 2 with available context information:\n\n");
- MR_dumpPred1(1,alt2->predicate,1);
- fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n");
- MR_dumpPred1(1,p2,0);
- if (p2 == NULL) {
- Predicate *phelp;
- fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n");
- phelp=predicate_dup_without_context(alt2->predicate);
- phelp=MR_unfold(phelp);
- MR_clearPredEntry(phelp);
- MR_simplifyInverted(phelp,0);
- phelp=MR_predSimplifyALLX(phelp,1);
- MR_dumpPred1(2,phelp,0);
- predicate_free(phelp);
- };
- fprintf(output,"\n#endif\n");
- };
- };
- predicate_free(p1);
- predicate_free(p2);
- };
-}
-
-static int totalOverflow=0; /* MR9 */
-
-void
-#ifdef __USE_PROTOS
-HandleAmbiguity( Junction *block, Junction *alt1, Junction *alt2, int jtype )
-#else
-HandleAmbiguity( block, alt1, alt2, jtype )
-Junction *block;
-Junction *alt1;
-Junction *alt2;
-int jtype;
-#endif
-{
- unsigned **ftbl;
- set *fset, b;
- int i, numAmbig,n2;
- Tree *ambig=NULL, *t, *u;
- char *sub = "";
- long n;
- int thisOverflow=0; /* MR9 */
- long set_deg_value; /* MR10 */
- long threshhold; /* MR10 */
-
- require(block!=NULL, "NULL block");
- require(block->ntype==nJunction, "invalid block");
-
- /* These sets are used to constrain LL_k set, but are made CLL_k long anyway */
- fset = (set *) calloc(CLL_k+1, sizeof(set));
- require(fset!=NULL, "cannot allocate fset");
- ftbl = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *));
- require(ftbl!=NULL, "cannot allocate ftbl");
-
- /* create constraint table and count number of possible ambiguities (use<=LL_k) */
- for (n=1,i=1; i<=CLL_k; i++)
- {
- b = set_and(alt1->fset[i], alt2->fset[i]);
-/* MR9 */ set_deg_value = set_deg(b);
-/* MR10 */ if (n > 0) {
-/* MR10 */ threshhold = LONG_MAX / n;
-/* MR10 */ if (set_deg_value <= threshhold) {
-/* MR10 */ n *= set_deg_value;
-/* MR10 */ } else {
-/* MR10 */ n=LONG_MAX;
-/* MR9 */ if (totalOverflow == 0) {
-#if 0
- /* MR10 comment this out because it just makes users worry */
-
-/* MR9 */ warnNoFL("Overflow in computing number of possible ambiguities in HandleAmbiguity\n");
-#endif
-/* MR9 */ };
-/* MR9 */ thisOverflow++;
-/* MR9 */ totalOverflow++;
-/* MR9 */ };
-/* MR10 */ } else {
-/* MR10 */ n *= set_deg_value;
-/* MR9 */ };
- fset[i] = set_dup(b);
- ftbl[i] = set_pdq(b);
- set_free(b);
- }
-
- switch ( jtype )
- {
- case aSubBlk: sub = "of (..) "; break;
- case aOptBlk: sub = "of {..} "; break;
- case aLoopBegin: sub = "of (..)* "; break;
- case aLoopBlk: sub = "of (..)* "; break;
- case aPlusBlk: sub = "of (..)+ "; break;
- case RuleBlk: sub = "of the rule itself "; break;
- default : sub = ""; break;
- }
-
- /* If the block is marked as a compressed lookahead only block, then
- * simply return; ambiguity warning is given only at warning level 2.
- */
- if ( block->approx>0 )
- {
- if ( ParseWithPredicates )
- {
- if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
- if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
-
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
- alt1->predicate=MR_predSimplifyALL(alt1->predicate);
-
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
- alt2->predicate=MR_predSimplifyALL(alt2->predicate);
-
- MR_doPredicatesHelp(0,alt1,alt2,jtype,sub);
-
- if ( HoistPredicateContext
- && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
- {
- verify_context(alt1->predicate);
- verify_context(alt2->predicate);
- }
-
- if ( HoistPredicateContext
- && (alt1->predicate!=NULL||alt2->predicate!=NULL)
- && WarningLevel>1 )
- ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
- }
-
- if ( WarningLevel>1 )
- {
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- if ( jtype == aLoopBegin || jtype == aPlusBlk )
- fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
- else
- fprintf(stderr, " warning(approx): alts %d and %d %sambiguous upon",
- alt1->altnum, alt2->altnum, sub);
- dumpAmbigMsg(fset, stderr, 0);
- MR_traceAmbSource(fset,alt1,alt2);
- }
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
-
- /* if all sets have degree 1 for k<LL_k, then must be ambig upon >=1 permutation;
- * don't bother doing full LL(k) analysis.
- * (This "if" block handles the LL(1) case)
- */
-
- n2 = 0;
- for (i=1; i<LL_k; i++) n2 += set_deg(alt1->fset[i])+set_deg(alt2->fset[i]);
-
- /* here STARTS the special case in which the lookahead sets for alt1 and alt2
- all have degree 1 for k<LL_k (including LL_k=1)
- */
-
- if ( n2==2*(LL_k-1) )
- {
-
- /* TJP: added to fix the case where LL(1) and syntactic predicates didn't
- * work. It now recognizes syntactic predicates, but does not like combo:
- * LL(1)/syn/sem predicates. (10/24/93)
- */
-
- if ( first_item_is_guess_block_extra((Junction *)alt1->p1)!=NULL )
- {
- if ( WarningLevel==1 )
- {
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
-
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- if ( jtype == aLoopBegin || jtype == aPlusBlk )
- fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
- else
- fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
- alt1->altnum, alt2->altnum, sub);
- dumpAmbigMsg(fset, stderr, 0);
- MR_traceAmbSource(fset,alt1,alt2);
- }
-
- ambig = NULL;
- if ( LL_k>1 ) ambig = make_tree_from_sets(alt1->fset, alt2->fset);
- if ( ParseWithPredicates )
- {
- if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
- if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
-
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
- alt1->predicate=MR_predSimplifyALL(alt1->predicate);
-
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
- alt2->predicate=MR_predSimplifyALL(alt2->predicate);
-
- MR_doPredicatesHelp(0,alt1,alt2,jtype,sub);
-
- if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
- {
- verify_context(alt1->predicate);
- verify_context(alt2->predicate);
- }
- if (HoistPredicateContext&&(alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1)
- ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
- if ( WarningLevel == 1 &&
- (alt1->predicate!=NULL||alt2->predicate!=NULL))
- {
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- Tfree(ambig);
- return;
- }
- }
-/* end TJP (10/24/93) */
-
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- if ( jtype == aLoopBegin || jtype == aPlusBlk )
- fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
- else
- fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
- alt1->altnum, alt2->altnum, sub);
- if ( elevel == 3 && LL_k>1 )
- {
- preorder(ambig);
- fprintf(stderr, "\n");
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- Tfree(ambig);
- return;
- };
-
- Tfree(ambig);
- dumpAmbigMsg(fset, stderr, 0);
-
- /* because this is a special case in which both alt1 and alt2 have
- lookahead sets of degree 1 for k<LL_k (including k=1) the linear
- lookahead style search is adequate
- */
-
- MR_traceAmbSource(fset,alt1,alt2);
-
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
-
- /* here ENDS the special case in which the lookahead sets for alt1 and alt2
- all have degree 1 for k<LL_k (including LL_k=1)
- */
-
- /* in case tree construction runs out of memory, set info to make good err msg */
-
- CurAmbigAlt1 = alt1->altnum;
- CurAmbigAlt2 = alt2->altnum;
- CurAmbigbtype = sub;
- CurAmbigfile = alt1->file;
- CurAmbigline = alt1->line;
-
- /* Don't do full LL(n) analysis if (...)? block because the block,
- by definition, defies LL(n) analysis.
- If guess (...)? block and ambiguous then don't remove anything from
- 2nd alt to resolve ambig.
- Want to predict with LL sup 1 ( n ) decision not LL(n) if guess block
- since it is much cheaper than LL(n). LL sup 1 ( n ) "covers" the LL(n)
- lookahead information.
-
- Note: LL(n) context cannot be computed for semantic predicates when
- followed by (..)?.
-
- If (..)? then we scream "AAAHHHH! No LL(n) analysis will help"
-
- Is 'ambig' always defined if we enter this if? I hope so
- because the 'ensure...()' func references it. TJP Nov 1993.
- */
-
- /* THM MR30: Instead of using first_item_is_guss_block we use
- first_item_is_guess_block_extra which will look inside a
- loop block for a guess block. In other words ( (...)? )*.
- It there is an ambiguity in this circumstance then we suppress
- the normal methods of resolving ambiguities.
- */
-
- if ( first_item_is_guess_block_extra((Junction *)alt1->p1)!=NULL )
- {
- if ( ParseWithPredicates )
- {
- if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
- if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
- alt1->predicate=MR_predSimplifyALL(alt1->predicate);
-
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
- alt2->predicate=MR_predSimplifyALL(alt2->predicate);
-
- MR_doPredicatesHelp(1,alt1,alt2,jtype,sub);
-
- if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
- {
- verify_context(alt1->predicate);
- verify_context(alt2->predicate);
- }
- if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 )
- ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
- if ( WarningLevel==1 &&
- (alt1->predicate!=NULL||alt2->predicate!=NULL))
- {
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
- }
-
- if ( WarningLevel>1 )
- {
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- if ( jtype == aLoopBegin || jtype == aPlusBlk )
- fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
- else
- fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
- alt1->altnum, alt2->altnum, sub);
- dumpAmbigMsg(fset, stderr, 0);
- MR_traceAmbSource(fset,alt1,alt2);
- }
-
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
-
- /* Not resolved with (..)? block. Do full LL(n) analysis */
-
- /* ambig is the set of k-tuples truly in common between alt 1 and alt 2 */
- /* MR11 VerifyAmbig once used fset destructively */
-
- ambig = VerifyAmbig(alt1, alt2, ftbl, fset, &t, &u, &numAmbig);
-
- /* are all things in intersection really ambigs? */
-
- if (thisOverflow || numAmbig < n ) /* MR9 */
- {
- Tree *v;
-
- /* remove ambig permutation from 2nd alternative to resolve ambig;
- * We want to compute the set of artificial tuples, arising from
- * LL sup 1 (n) compression, that collide with real tuples from the
- * 2nd alternative. This is the set of "special case" tuples that
- * the LL sup 1 (n) decision template maps incorrectly.
- */
-
- /* when generating code in genExpr() it does
- *
- * if ( genExprSets(j->fset) && !genExprTree(j->ftree)) {...
- *
- * Sooooo the j->ftree is the tree of alt2
- * after removal of conflicts, not alt1 !
- */
-
- if ( ambig!=NULL )
- {
- /* at the top of ambig is an ALT node */
-
- for (v=ambig->down; v!=NULL; v=v->right)
- {
- u = trm_perm(u, v); /* remove v FROM u */
- }
-/* fprintf(stderr, "after rm alt2:"); preorder(u); fprintf(stderr, "\n");*/
- }
- Tfree( t );
- alt1->ftree = tappend(alt1->ftree, u);
- alt1->ftree = tleft_factor(alt1->ftree);
- }
-
- if ( ambig==NULL )
- {
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
-
- ambig = tleft_factor(ambig);
-
-/* TJP:
- * At this point, we surely have an LL(k) ambiguity. Check for predicates
- */
- if ( ParseWithPredicates )
- {
- if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
- if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
- alt1->predicate=MR_predSimplifyALL(alt1->predicate);
-
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
- alt2->predicate=MR_predSimplifyALL(alt2->predicate);
-
- MR_doPredicatesHelp(0,alt1,alt2,jtype,sub);
-
- if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
- {
- verify_context(alt1->predicate);
- verify_context(alt2->predicate);
- }
- if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 )
- ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig);
- if ( WarningLevel==1 &&
- (alt1->predicate!=NULL||alt2->predicate!=NULL))
- {
-
- /* We found at least one pred for at least one of the alts;
- * If warnings are low, just return.
- */
-
- Tfree(ambig);
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
- return;
- }
- /* else we're gonna give a warning */
- }
-/* end TJP addition */
-
- fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line);
- if ( jtype == aLoopBegin || jtype == aPlusBlk )
- fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub);
- else
- fprintf(stderr, " warning: alts %d and %d %sambiguous upon",
- alt1->altnum, alt2->altnum, sub);
- if ( elevel == 3 )
- {
- preorder(ambig->down); /* <===== k>1 ambiguity message data */
- fprintf(stderr, "\n");
- } else {
- MR_skipped_e3_report=1;
- dumpAmbigMsg(fset, stderr, 0);
- };
-
- MR_traceAmbSourceK(ambig,alt1,alt2); /* <====== k>1 ambiguity aid */
-
- Tfree(ambig);
-
- for (i=1; i<=CLL_k; i++) set_free( fset[i] );
- free((char *)fset);
- for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] );
- free((char *)ftbl);
-}
-
-/* Don't analyze alpha block of (alpha)?beta; if (alpha)? then analyze
- * Return the 1st node of the beta block if present else return j.
- */
-Junction *
-#ifdef __USE_PROTOS
-analysis_point( Junction *j )
-#else
-analysis_point( j )
-Junction *j;
-#endif
-{
- Junction *gblock;
-
- /* MR13b When there was an action/predicate preceding a guess block
- the guess block became invisible at the analysis_point.
-
- first_item_is_guess_block accepts any kind of node,
- despite the fact that the formal is a junction. But
- I don't want to have to change it all over the place
- until I know it works.
- */
-
- if ( j->ntype != nJunction && j->ntype != nAction) return j;
-
- gblock = first_item_is_guess_block((Junction *)j);
-
- if ( gblock!=NULL )
- {
- Junction *past = gblock->end;
- Junction *p;
- require(past!=NULL, "analysis_point: no end block on (...)? block");
-
- for (p=(Junction *)past->p1; p!=NULL; )
- {
- if ( p->ntype==nAction )
- {
- p=(Junction *)((ActionNode *)p)->next;
- continue;
- }
- if ( p->ntype!=nJunction )
- {
- past->alpha_beta_guess_end=1; /* MR14 */
- return (Junction *)past->p1;
- }
- if ( p->jtype==EndBlk || p->jtype==EndRule )
- {
- return j;
- }
-/* MR6 */
-/* MR6 A guess block is of the form "(alpha)? beta" or "(alpha)?". */
-/* MR6 When beta is omitted (second form) this means "(alpha)? alpha". */
-/* MR6 The program does not store another copy of alpha in this case. */
-/* MR6 During analysis when the program needs to know what follows the */
-/* MR6 guess clause. It calls this routine. */
-/* MR6 */
-/* MR6 If it is of the form "(alpha)? beta" it returns a pointer to beta.*/
-/* MR6 */
-/* MR6 If it is of the form "(alpha)?" it returns a pointer to the guess */
-/* MR6 block itself thereby reusing the junction tree. */
-/* MR6 */
-/* MR6 It works by searching the "next in sequence" chain (skipping actions) */
-/* MR6 searching for a RuleRef or Token node. (Those are the only 4 kinds */
-/* MR6 of nodes: Junctions, RuleRef, Token, and Action.) */
-/* MR6 */
-/* MR6 This won't work for the special case "(alpha)? ()" because it has no */
-/* MR6 rule references or token nodes. It eventually encounters a */
-/* MR6 junction of type EndBlk or EndRule and says to its caller: nothing */
-/* MR6 more here to analyze - must be of the form "(alpha)?". */
-/* MR6 */
-/* MR6 In the case of "(alpha)? ()" it should return a pointer to "()" */
-/* MR6 */
-/* MR6 I think. */
-/* MR6 */
- if ( p->jtype!=Generic) { /* MR6 */
- past->alpha_beta_guess_end=1; /* MR14 */
- return (Junction *)past->p1; /* MR6 */
- }; /* MR6 */
- p=(Junction *)p->p1;
- }
- }
- return j;
-}
-
-set
-#ifdef __USE_PROTOS
-First( Junction *j, int k, int jtype, int *max_k )
-#else
-First( j, k, jtype, max_k )
-Junction *j;
-int k;
-int jtype;
-int *max_k;
-#endif
-{
- Junction *alt1, *alt2;
- set a, rk, fCurBlk;
- int savek;
- int p1, p2;
-
- int save_maintainBackTrace;
-
- require(j->ntype==nJunction, "First: non junction passed");
-
- /* C o m p u t e F I R S T s e t w i t h k l o o k a h e a d */
- fCurBlk = rk = empty;
- for (alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2 )
- {
- Junction * p = NULL;
- Junction * p1junction = NULL;
- p = analysis_point((Junction *)alt1->p1);
- p1junction = (Junction *) (alt1->p1);
-#if 0
- if (p != p1junction) {
- fprintf(stdout,"Analysis point for #%d is #%d", p1junction->seq, p->seq); /* debug */
- }
-#endif
- REACH(p, k, &rk, alt1->fset[k]);
- require(set_nil(rk), "rk != nil");
- set_free(rk);
- set_orin(&fCurBlk, alt1->fset[k]);
- }
-
- /* D e t e c t A m b i g u i t i e s */
- *max_k = 1;
- for (p1=1,alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2, p1++)
- {
- for (p2=1,alt2=(Junction *)alt1->p2; alt2!=NULL; alt2 = (Junction *)alt2->p2, p2++)
- {
- savek = k;
- a = set_and(alt1->fset[k], alt2->fset[k]);
- while ( !set_nil(a) )
- {
- /* if we have hit the max k requested, just give warning */
- if ( j->approx==k ) {
- }
-
- if ( k==CLL_k )
- {
-#ifdef NOT_USED
-*** int save_LL_k = LL_k;
-*** int save_CLL_k = CLL_k;
-*** /* Get new LL_k from interactive feature if enabled */
-*** if ( AImode )
-*** AmbiguityDialog(j, jtype, alt1, alt2, &CLL_k, &LL_k);
-#endif
- *max_k = CLL_k;
- save_maintainBackTrace=MR_MaintainBackTrace;
- if (AlphaBetaTrace) MR_MaintainBackTrace=0;
- HandleAmbiguity(j, alt1, alt2, jtype);
- MR_MaintainBackTrace=save_maintainBackTrace;
- break;
- }
- else
- {
- Junction *p = analysis_point((Junction *)alt1->p1);
- Junction *q = analysis_point((Junction *)alt2->p1);
- k++; /* attempt ambig alts again with more lookahead */
-
- REACH(p, k, &rk, alt1->fset[k]);
- require(set_nil(rk), "rk != nil");
- REACH(q, k, &rk, alt2->fset[k]);
- require(set_nil(rk), "rk != nil");
- set_free(a);
- a = set_and(alt1->fset[k], alt2->fset[k]);
- if ( k > *max_k ) *max_k = k;
- }
- }
- set_free(a);
- k = savek;
- }
- }
-
- return fCurBlk;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
deleted file mode 100644
index fe1b4d6242..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
+++ /dev/null
@@ -1,2250 +0,0 @@
-/*
- * fset2.c
- *
- * Compute FIRST sets for full LL(k)
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "pcctscfg.h"
-#include <stdlib.h>
-
-#ifdef PCCTS_USE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-
-/* ick! globals. Used by permute() to track which elements of a set have been used */
-
-static int *findex;
-set *fset; /* MR11 make global */
-static unsigned **ftbl;
-static set *constrain; /* pts into fset. constrains tToken() to 'constrain' */
-int ConstrainSearch;
-int maxk; /* set to initial k upon tree construction request */
- /* MR11 make global */
-static Tree *FreeList = NULL;
-
-#ifdef __USE_PROTOS
-static int tmember_of_context(Tree *, Predicate *);
-#else
-static int tmember_of_context();
-#endif
-
-#if TREE_DEBUG
-set set_of_tnodes_in_use;
-int stop_on_tnode_seq_number=(-1); /* (-1) to disable */
-#endif
-
-/* Do root
- * Then each sibling
- */
-
-void
-#ifdef __USE_PROTOS
-preorder( Tree *tree )
-#else
-preorder( tree )
-Tree *tree;
-#endif
-{
- if ( tree == NULL ) return;
- if ( tree->down != NULL ) fprintf(stderr, " (");
- if ( tree->token == ALT ) fprintf(stderr, " ALT");
- else fprintf(stderr, " %s", TerminalString(tree->token));
- if ( tree->token==EpToken ) fprintf(stderr, "(%d)", tree->v.rk);
- preorder(tree->down);
- if ( tree->down != NULL ) fprintf(stderr, " )");
- preorder(tree->right);
-}
-
-#ifdef __USE_PROTOS
-int MR_tree_matches_constraints(int k,set * constrain,Tree *t)
-#else
-int MR_tree_matches_constraints(k,constrain,t)
- int k;
- set * constrain;
- Tree * t;
-#endif
-{
- int i;
- Tree *u;
-
- if (k == 0) return 1;
-
- /* for testing guard predicates: if the guard tree is shorter
- than the constraint then it is a match. The reason is that
- a guard of (A B) should be equivalent to a guard of (A B . . .)
- where "." matches every token. Thus a match which runs out
- of tree before constraint is a match.
- */
-
- if (t == NULL) return 1;
- require (set_deg(constrain[0]) == 1,
- "MR_tree_matches_constraints: set_deg != 1");
- i=set_int(constrain[0]);
- if (t->token != i) return 0;
- if (k-1 == 0) return 1;
- for (u=t->down; u != NULL; u=u->right) {
- if (MR_tree_matches_constraints(k-1,&constrain[1],u)) {
- return 1;
- };
- };
- return 0;
-}
-
-/* check the depth of each primary sibling to see that it is exactly
- * k deep. e.g.;
- *
- * ALT
- * |
- * A ------- B
- * | |
- * C -- D E
- *
- * Remove all branches <= k deep.
- *
- * Added by TJP 9-23-92 to make the LL(k) constraint mechanism to work.
- */
-
-static int pruneCount=0;
-static int prunePeak=200;
-
-Tree *
-#ifdef __USE_PROTOS
-prune( Tree *t, int k )
-#else
-prune( t, k )
-Tree *t;
-int k;
-#endif
-{
- pruneCount++;
- if (pruneCount > prunePeak+100) {
- prunePeak=pruneCount;
-#if 0
-*** fprintf(stderr,"pruneCount=%d\n",pruneCount);
-/*** preorder(t); ***/
-*** fprintf(stderr,"\n",pruneCount);
-#endif
- };
- if ( t == NULL ) {
- pruneCount--;
- return NULL;
- };
- if ( t->token == ALT ) fatal_internal("prune: ALT node in FIRST tree");
- if ( t->right!=NULL ) t->right = prune(t->right, k);
- if ( k>1 )
- {
- if ( t->down!=NULL ) t->down = prune(t->down, k-1);
- if ( t->down == NULL )
- {
- Tree *r = t->right;
- t->right = NULL;
- Tfree(t);
- pruneCount--;
- return r;
- }
- }
- pruneCount--;
- return t;
-}
-
-/* build a tree (root child1 child2 ... NULL) */
-#ifdef PCCTS_USE_STDARG
-Tree *tmake(Tree *root, ...)
-#else
-Tree *tmake(va_alist)
-va_dcl
-#endif
-{
- Tree *w;
- va_list ap;
- Tree *child, *sibling=NULL, *tail=NULL;
-#ifndef PCCTS_USE_STDARG
- Tree *root;
-#endif
-
-#ifdef PCCTS_USE_STDARG
- va_start(ap, root);
-#else
- va_start(ap);
- root = va_arg(ap, Tree *);
-#endif
- child = va_arg(ap, Tree *);
- while ( child != NULL )
- {
-#ifdef DUM
- /* added "find end of child" thing TJP March 1994 */
- for (w=child; w->right!=NULL; w=w->right) {;} /* find end of child */
-#else
- w = child;
-#endif
-
- if ( sibling == NULL ) {sibling = child; tail = w;}
- else {tail->right = child; tail = w;}
- child = va_arg(ap, Tree *);
- }
-
- /* was "root->down = sibling;" */
- if ( root==NULL ) root = sibling;
- else root->down = sibling;
-
- va_end(ap);
- return root;
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tnode( int tok )
-#else
-tnode( tok )
-int tok;
-#endif
-{
- Tree *p, *newblk;
- static int n=0;
-
- if ( FreeList == NULL )
- {
- /*fprintf(stderr, "tnode: %d more nodes\n", TreeBlockAllocSize);*/
- if ( TreeResourceLimit > 0 )
- {
- if ( (n+TreeBlockAllocSize) >= TreeResourceLimit )
- {
- fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
- fprintf(stderr, " hit analysis resource limit while analyzing alts %d and %d %s\n",
- CurAmbigAlt1,
- CurAmbigAlt2,
- CurAmbigbtype);
- exit(PCCTS_EXIT_FAILURE);
- }
- }
- newblk = (Tree *)calloc(TreeBlockAllocSize, sizeof(Tree));
- if ( newblk == NULL )
- {
- fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
- fprintf(stderr, " out of memory while analyzing alts %d and %d %s\n",
- CurAmbigAlt1,
- CurAmbigAlt2,
- CurAmbigbtype);
- exit(PCCTS_EXIT_FAILURE);
- }
- n += TreeBlockAllocSize;
- for (p=newblk; p<&(newblk[TreeBlockAllocSize]); p++)
- {
- p->right = FreeList; /* add all new Tree nodes to Free List */
- FreeList = p;
- }
- }
- p = FreeList;
- FreeList = FreeList->right; /* remove a tree node */
- p->right = NULL; /* zero out ptrs */
- p->down = NULL;
- p->token = tok;
-
- TnodesAllocated++; /* MR10 */
- TnodesInUse++; /* MR10 */
- if (TnodesInUse > TnodesPeak) TnodesPeak=TnodesInUse; /* MR10 */
-
-#ifdef TREE_DEBUG
- require(!p->in_use, "tnode: node in use!");
- p->in_use = 1;
- p->seq=TnodesAllocated;
- set_orel( (unsigned) TnodesAllocated,&set_of_tnodes_in_use);
- if (stop_on_tnode_seq_number == p->seq) {
- fprintf(stderr,"\n*** just allocated tnode #%d ***\n",
- stop_on_tnode_seq_number);
- };
-#endif
- return p;
-}
-
-static Tree *
-#ifdef __USE_PROTOS
-eofnode( int k )
-#else
-eofnode( k )
-int k;
-#endif
-{
- Tree *t=NULL;
- int i;
-
- for (i=1; i<=k; i++)
- {
- t = tmake(tnode((TokenInd!=NULL?TokenInd[EofToken]:EofToken)), t, NULL);
- }
- return t;
-}
-
-
-
-void
-#ifdef __USE_PROTOS
-_Tfree( Tree *t )
-#else
-_Tfree( t )
-Tree *t;
-#endif
-{
- if ( t!=NULL )
- {
-#ifdef TREE_DEBUG
- if (t->seq == stop_on_tnode_seq_number) {
- fprintf(stderr,"\n*** just freed tnode #%d ***\n",t->seq);
- };
- require(t->in_use, "_Tfree: node not in use!");
- t->in_use = 0;
- set_rm( (unsigned) t->seq,set_of_tnodes_in_use);
-#endif
- t->right = FreeList;
- FreeList = t;
- TnodesInUse--; /* MR10 */
- }
-}
-
-/* tree duplicate */
-Tree *
-#ifdef __USE_PROTOS
-tdup( Tree *t )
-#else
-tdup( t )
-Tree *t;
-#endif
-{
- Tree *u;
-
- if ( t == NULL ) return NULL;
- u = tnode(t->token);
- u->v.rk = t->v.rk;
- u->right = tdup(t->right);
- u->down = tdup(t->down);
- return u;
-}
-
-/* tree duplicate (assume tree is a chain downwards) */
-Tree *
-#ifdef __USE_PROTOS
-tdup_chain( Tree *t )
-#else
-tdup_chain( t )
-Tree *t;
-#endif
-{
- Tree *u;
-
- if ( t == NULL ) return NULL;
- u = tnode(t->token);
- u->v.rk = t->v.rk;
- u->down = tdup(t->down);
- return u;
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tappend( Tree *t, Tree *u )
-#else
-tappend( t, u )
-Tree *t;
-Tree *u;
-#endif
-{
- Tree *w;
-
-/*** fprintf(stderr, "tappend(");
- *** preorder(t); fprintf(stderr, ",");
- *** preorder(u); fprintf(stderr, " )\n");
-*/
- if ( t == NULL ) return u;
- if ( t->token == ALT && t->right == NULL ) return tappend(t->down, u);
- for (w=t; w->right!=NULL; w=w->right) {;}
- w->right = u;
- return t;
-}
-
-/* dealloc all nodes in a tree */
-void
-#ifdef __USE_PROTOS
-Tfree( Tree *t )
-#else
-Tfree( t )
-Tree *t;
-#endif
-{
- if ( t == NULL ) return;
- Tfree( t->down );
- Tfree( t->right );
- _Tfree( t );
-}
-
-/* find all children (alts) of t that require remaining_k nodes to be LL_k
- * tokens long.
- *
- * t-->o
- * |
- * a1--a2--...--an <-- LL(1) tokens
- * | | |
- * b1 b2 ... bn <-- LL(2) tokens
- * | | |
- * . . .
- * . . .
- * z1 z2 ... zn <-- LL(LL_k) tokens
- *
- * We look for all [Ep] needing remaining_k nodes and replace with u.
- * u is not destroyed or actually used by the tree (a copy is made).
- */
-Tree *
-#ifdef __USE_PROTOS
-tlink( Tree *t, Tree *u, int remaining_k )
-#else
-tlink( t, u, remaining_k )
-Tree *t;
-Tree *u;
-int remaining_k;
-#endif
-{
- Tree *p;
- require(remaining_k!=0, "tlink: bad tree");
-
- if ( t==NULL ) return NULL;
- /*fprintf(stderr, "tlink: u is:"); preorder(u); fprintf(stderr, "\n");*/
- if ( t->token == EpToken && t->v.rk == remaining_k )
- {
- require(t->down==NULL, "tlink: invalid tree");
- if ( u == NULL ) {
-/* MR10 */ Tree *tt=t->right;
-/* MR10 */ _Tfree(t);
-/* MR10 */ return tt;
- };
- p = tdup( u );
- p->right = t->right;
- _Tfree( t );
- return p;
- }
- t->down = tlink(t->down, u, remaining_k);
- t->right = tlink(t->right, u, remaining_k);
- return t;
-}
-
-/* remove as many ALT nodes as possible while still maintaining semantics */
-Tree *
-#ifdef __USE_PROTOS
-tshrink( Tree *t )
-#else
-tshrink( t )
-Tree *t;
-#endif
-{
- if ( t == NULL ) return NULL;
- t->down = tshrink( t->down );
- t->right = tshrink( t->right );
- if ( t->down == NULL )
- {
- if ( t->token == ALT )
- {
- Tree *u = t->right;
- _Tfree(t);
- return u; /* remove useless alts */
- }
- return t;
- }
-
- /* (? (ALT (? ...)) s) ==> (? (? ...) s) where s = sibling, ? = match any */
- if ( t->token == ALT && t->down->right == NULL)
- {
- Tree *u = t->down;
- u->right = t->right;
- _Tfree( t );
- return u;
- }
- /* (? (A (ALT t)) s) ==> (? (A t) s) where A is a token; s,t siblings */
- if ( t->token != ALT && t->down->token == ALT && t->down->right == NULL )
- {
- Tree *u = t->down->down;
- _Tfree( t->down );
- t->down = u;
- return t;
- }
- return t;
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tflatten( Tree *t )
-#else
-tflatten( t )
-Tree *t;
-#endif
-{
- if ( t == NULL ) return NULL;
- t->down = tflatten( t->down );
- t->right = tflatten( t->right );
- if ( t->down == NULL ) return t;
-
- if ( t->token == ALT )
- {
- Tree *u;
- /* find tail of children */
- for (u=t->down; u->right!=NULL; u=u->right) {;}
- u->right = t->right;
- u = t->down;
- _Tfree( t );
- return u;
- }
- return t;
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tJunc( Junction *p, int k, set *rk )
-#else
-tJunc( p, k, rk )
-Junction *p;
-int k;
-set *rk;
-#endif
-{
- Tree *t=NULL, *u=NULL;
- Junction *alt;
- Tree *tail=NULL, *r;
-
-#ifdef DBG_TRAV
- fprintf(stderr, "tJunc(%d): %s in rule %s\n", k,
- decodeJType[p->jtype], ((Junction *)p)->rname);
-#endif
-
-/* MR14 */ if (AlphaBetaTrace && p->alpha_beta_guess_end) {
-/* MR14 */ warnFL(
-/* MR14 */ "not possible to compute follow set for alpha in an \"(alpha)? beta\" block. ",
-/* MR14 */ FileStr[p->file],p->line);
-/* MR14 */ MR_alphaBetaTraceReport();
-/* MR14 */ };
-
-/* MR14 */ if (p->alpha_beta_guess_end) {
-/* MR14 */ return NULL;
-/* MR14 */ }
-
- if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
- p->jtype==aPlusBlk || p->jtype==aSubBlk || p->jtype==aOptBlk )
- {
- if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) {
- require(p->lock!=NULL, "rJunc: lock array is NULL");
- if ( p->lock[k] ) return NULL;
- p->lock[k] = TRUE;
- }
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR10 */ };
-
- TRAV(p->p1, k, rk, tail);
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
-/* MR10 */ };
-
- if ( p->jtype==RuleBlk ) {p->lock[k] = FALSE; return tail;}
- r = tmake(tnode(ALT), tail, NULL);
- for (alt=(Junction *)p->p2; alt!=NULL; alt = (Junction *)alt->p2)
- {
- /* if this is one of the added optional alts for (...)+ then break */
- if ( alt->ignore ) break;
-
- if ( tail==NULL ) {TRAV(alt->p1, k, rk, tail); r->down = tail;}
- else
- {
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR10 */ };
-
- TRAV(alt->p1, k, rk, tail->right);
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
-/* MR10 */ };
- if ( tail->right != NULL ) tail = tail->right;
- }
- }
- if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) p->lock[k] = FALSE;
-#ifdef DBG_TREES
- fprintf(stderr, "blk(%s) returns:",((Junction *)p)->rname); preorder(r); fprintf(stderr, "\n");
-#endif
- if ( r->down == NULL ) {_Tfree(r); return NULL;}
- return r;
- }
-
- if ( p->jtype==EndRule )
- {
- if ( p->halt ) /* don't want FOLLOW here? */
- {
-/**** if ( ContextGuardTRAV ) return NULL; ****/
- set_orel( (unsigned) k, rk); /* indicate this k value needed */ /* MR10 cast */
- t = tnode(EpToken);
- t->v.rk = k;
- return t;
- }
- require(p->lock!=NULL, "rJunc: lock array is NULL");
- if ( p->lock[k] ) return NULL;
- /* if no FOLLOW assume k EOF's */
- if ( p->p1 == NULL ) return eofnode(k);
- p->lock[k] = TRUE;
- }
-
-/* MR14 */ if (p->p1 != NULL && p->guess && p->guess_analysis_point == NULL) {
-/* MR14 */ Node * guess_point;
-/* MR14 */ guess_point=(Node *)analysis_point(p);
-/* MR14 */ if (guess_point == (Node *)p) {
-/* MR14 */ guess_point=p->p1;
-/* MR14 */ }
-/* MR14 */ p->guess_analysis_point=guess_point;
-/* MR14 */ }
-
- if ( p->p2 == NULL )
- {
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR10 */ };
-
-/* M14 */ if (p->guess_analysis_point != NULL) {
-/* M14 */ TRAV(p->guess_analysis_point, k, rk,t);
-/* M14 */ } else {
- TRAV(p->p1, k, rk,t);
-/* M14 */ }
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
-/* MR10 */ };
-
- if ( p->jtype==EndRule ) p->lock[k]=FALSE;
- return t;
- }
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR10 */ };
-
-/* M14 */ if (p->guess_analysis_point != NULL) {
-/* M14 */ TRAV(p->guess_analysis_point, k, rk,t);
-/* M14 */ } else {
- TRAV(p->p1, k, rk,t);
-/* M14 */ }
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack);
-/* MR10 */ };
-
- if ( p->jtype!=RuleBlk && /* MR14 */ !p->guess) TRAV(p->p2, k, rk, u);
-
- if ( p->jtype==EndRule ) p->lock[k] = FALSE;/* unlock node */
-
- if ( t==NULL ) return tmake(tnode(ALT), u, NULL);
- return tmake(tnode(ALT), t, u, NULL);
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tRuleRef( RuleRefNode *p, int k, set *rk_out )
-#else
-tRuleRef( p, k, rk_out )
-RuleRefNode *p;
-int k;
-set *rk_out;
-#endif
-{
- int k2;
- Tree *t=NULL, *u=NULL;
- Junction *r;
- set rk, rk2;
- int save_halt;
- RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
-
-#ifdef DBG_TRAV
- fprintf(stderr, "tRuleRef: %s\n", p->text);
-#endif
- if ( q == NULL )
- {
- TRAV(p->next, k, rk_out, t);/* ignore undefined rules */
- return t;
- }
- rk = rk2 = empty;
- if (RulePtr == NULL) fatal("RulePtr==NULL");
- r = RulePtr[q->rulenum];
- if ( r->lock[k] ) return NULL;
- save_halt = r->end->halt;
- r->end->halt = TRUE; /* don't let reach fall off end of rule here */
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR10 */ };
-
- TRAV(r, k, &rk, t);
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack);
-/* MR10 */ };
-
- r->end->halt = save_halt;
-#ifdef DBG_TREES
- fprintf(stderr, "after ruleref, t is:"); preorder(t); fprintf(stderr, "\n");
-#endif
- t = tshrink( t );
- while ( !set_nil(rk) ) { /* any k left to do? if so, link onto tree */
- k2 = set_int(rk);
- set_rm(k2, rk);
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR10 */ };
-
- TRAV(p->next, k2, &rk2, u);
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack);
-/* MR10 */ };
-
- t = tlink(t, u, k2); /* any alts missing k2 toks, add u onto end */
- Tfree(u); /* MR10 */
- }
- set_free(rk); /* rk is empty, but free it's memory */
- set_orin(rk_out, rk2); /* remember what we couldn't do */
- set_free(rk2);
- return t;
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tToken( TokNode *p, int k, set *rk )
-#else
-tToken( p, k, rk )
-TokNode *p;
-int k;
-set *rk;
-#endif
-{
- Tree *t=NULL, *tset=NULL, *u;
-
- if (ConstrainSearch) {
- if (MR_AmbSourceSearch) {
- require(constrain>=fset&&constrain<=&(fset[CLL_k]),"tToken: constrain is not a valid set");
- } else {
- require(constrain>=fset&&constrain<=&(fset[LL_k]),"tToken: constrain is not a valid set");
- };
- constrain = &fset[maxk-k+1];
- }
-
-#ifdef DBG_TRAV
- fprintf(stderr, "tToken(%d): %s\n", k, TerminalString(p->token));
- if ( ConstrainSearch ) {
- fprintf(stderr, "constrain is:"); s_fprT(stderr, *constrain); fprintf(stderr, "\n");
- }
-#endif
-
- /* is it a meta token (set of tokens)? */
-
- if ( !set_nil(p->tset) )
- {
- unsigned e=0;
- set a;
- Tree *n, *tail = NULL;
-
- if ( ConstrainSearch ) {
- a = set_and(p->tset, *constrain);
- if (set_nil(a)) { /* MR10 */
- set_free(a); /* MR11 */
- return NULL; /* MR10 */
- }; /* MR10 */
- } else {
- a = set_dup(p->tset);
- };
-
- for (; !set_nil(a); set_rm(e, a))
- {
- e = set_int(a);
- n = tnode(e);
- if ( tset==NULL ) { tset = n; tail = n; }
- else { tail->right = n; tail = n; }
- }
- set_free( a );
- }
- else if ( ConstrainSearch && !set_el(p->token, *constrain) )
- {
-/* fprintf(stderr, "ignoring token %s(%d)\n", TerminalString(p->token),
- k);*/
- return NULL;
- }
- else {
- tset = tnode( p->token );
- };
-
-/* MR10 */ if (MR_MaintainBackTrace) {
-/* MR10 */ if (k == 1) {
-/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p);
-/* MR13 */ if (MR_SuppressSearch) {
-/* MR13 */ MR_suppressSearchReport();
-/* MR13 */ } else {
-/* MR10 */ MR_backTraceReport();
-/* MR13 */ };
-/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack);
-/* MR11 */ Tfree(tset);
-/* MR11 */ return NULL;
-/* MR10 */ };
-/* MR10 */ };
-
- if ( k == 1 ) return tset;
-
- if (MR_MaintainBackTrace) {
- MR_pointerStackPush(&MR_BackTraceStack,p);
- };
-
- TRAV(p->next, k-1, rk, t);
-
- if (MR_MaintainBackTrace) {
- Tfree(t);
- Tfree(tset);
- MR_pointerStackPop(&MR_BackTraceStack);
- return NULL;
- };
-
- /* here, we are positive that, at least, this tree will not contribute
- * to the LL(2) tree since it will be too shallow, IF t==NULL.
- * If doing a context guard walk, then don't prune.
- */
- if ( t == NULL && !ContextGuardTRAV ) /* tree will be too shallow */
- {
- if ( tset!=NULL ) Tfree( tset );
- return NULL;
- }
-#ifdef DBG_TREES
- fprintf(stderr, "tToken(%d)->next:",k); preorder(t); fprintf(stderr, "\n");
-#endif
-
- /* if single token root, then just make new tree and return */
- /* MR10 - set_nil(p->tset) isn't a good test because of ConstraintSearch */
-
- if (tset->right == NULL) return tmake(tset, t, NULL); /* MR10 */
-
- /* here we must make a copy of t as a child of each element of the tset;
- * e.g., "T1..T3 A" would yield ( nil ( T1 A ) ( T2 A ) ( T3 A ) )
- */
- for (u=tset; u!=NULL; u=u->right)
- {
- /* make a copy of t and hook it onto bottom of u */
- u->down = tdup(t);
- }
- Tfree( t );
-#ifdef DBG_TREES
- fprintf(stderr, "range is:"); preorder(tset); fprintf(stderr, "\n");
-#endif
- return tset;
-}
-
-Tree *
-#ifdef __USE_PROTOS
-tAction( ActionNode *p, int k, set *rk )
-#else
-tAction( p, k, rk )
-ActionNode *p;
-int k;
-set *rk;
-#endif
-{
- Tree *t=NULL;
- set *save_fset=NULL;
- int i;
-
- /* fprintf(stderr, "tAction\n"); */
-
-/* An MR_SuppressSearch is looking for things that can be
- reached even when the predicate is false.
-
- There are three kinds of predicates:
- plain: r1: <<p>>? r2
- guarded: r1: (A)? => <<p>>? r2
- ampersand style: r1: (A)? && <<p>>? r2
-
- Of the three kinds of predicates, only a guard predicate
- has things which are reachable even when the predicate
- is false. To be reachable the constraint must *not*
- match the guard.
-
-*/
-
- if (p->is_predicate && MR_SuppressSearch) {
-
- Predicate *pred=p->guardpred;
-
- if (pred == NULL) {
- t=NULL;
- goto EXIT;
- };
- constrain = &fset[maxk-k+1];
- if (pred->k == 1) {
- set dif;
- dif=set_dif(*constrain,pred->scontext[1]);
- if (set_nil(dif)) {
- set_free(dif);
- t=NULL;
- goto EXIT;
- };
- set_free(dif);
- } else {
- if (MR_tree_matches_constraints(k,constrain,pred->tcontext)) {
- t=NULL;
- goto EXIT;
- };
- }
- };
-
- /* The ampersand predicate differs from the
- other predicates because its first set
- is a subset of the first set behind the predicate
-
- r1: (A)? && <<p>>? r2 ;
- r2: A | B;
-
- In this case first[1] of r1 is A, even
- though first[1] of r2 is {A B}.
- */
-
- if (p->is_predicate && p->ampersandPred != NULL) {
-
- Predicate *pred=p->ampersandPred;
- Tree *tAND;
- Tree *tset;
-
- if (k <= pred->k) {
- if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p);
- TRAV(p->guardNodes,k,rk,t);
- if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack);
- return t;
- } else {
- require (k>1,"tAction for ampersandpred: k <= 1");
- if (ConstrainSearch) {
- if (MR_AmbSourceSearch) {
- require(constrain>=fset&&constrain<=&(fset[CLL_k]),
- "tToken: constrain is not a valid set");
- } else {
- require(constrain>=fset&&constrain<=&(fset[LL_k]),
- "tToken: constrain is not a valid set");
- };
- save_fset=(set *) calloc (CLL_k+1,sizeof(set));
- require (save_fset != NULL,"tAction save_fset alloc");
- for (i=1; i <= CLL_k ; i++) {
- save_fset[i]=set_dup(fset[i]);
- };
- if (pred->k == 1) {
- constrain = &fset[maxk-k+1];
- set_andin(constrain,pred->scontext[1]);
- if (set_nil(*constrain)) {
- t=NULL;
- goto EXIT;
- };
- } else {
- constrain = &fset[maxk-k+1];
- if (! MR_tree_matches_constraints(pred->k,constrain,pred->tcontext)) {
- t=NULL;
- goto EXIT;
- }; /* end loop on i */
- }; /* end loop on pred scontext/tcontext */
- }; /* end if on k > pred->k */
- }; /* end if on constrain search */
-
- TRAV(p->next,k,rk,t);
-
- if (t != NULL) {
- t=tshrink(t);
- t=tflatten(t);
- t=tleft_factor(t);
- if (pred->tcontext != NULL) {
- tAND=MR_computeTreeAND(t,pred->tcontext);
- } else {
- tset=MR_make_tree_from_set(pred->scontext[1]);
- tAND=MR_computeTreeAND(t,tset);
- Tfree(tset);
- };
- Tfree(t);
- t=tAND;
- };
- goto EXIT;
-
- }; /* end if on ampersand predicate */
-
- TRAV(p->next,k,rk,t);
-
-EXIT:
- if (save_fset != NULL) {
- for (i=1 ; i <= CLL_k ; i++) {
- set_free(fset[i]);
- fset[i]=save_fset[i];
- };
- free ( (char *) save_fset);
- };
- return t;
-}
-
-/* see if e exists in s as a possible input permutation (e is always a chain) */
-
-int
-#ifdef __USE_PROTOS
-tmember( Tree *e, Tree *s )
-#else
-tmember( e, s )
-Tree *e;
-Tree *s;
-#endif
-{
- if ( e==NULL||s==NULL ) return 0;
-/** fprintf(stderr, "tmember(");
-*** preorder(e); fprintf(stderr, ",");
-*** preorder(s); fprintf(stderr, " )\n");
-*/
- if ( s->token == ALT && s->right == NULL ) return tmember(e, s->down);
- if ( e->token!=s->token )
- {
- if ( s->right==NULL ) return 0;
- return tmember(e, s->right);
- }
- if ( e->down==NULL && s->down == NULL ) return 1;
- if ( tmember(e->down, s->down) ) return 1;
- if ( s->right==NULL ) return 0;
- return tmember(e, s->right);
-}
-
-/* see if e exists in s as a possible input permutation (e is always a chain);
- * Only check s to the depth of e. In other words, 'e' can be a shorter
- * sequence than s.
- */
-int
-#ifdef __USE_PROTOS
-tmember_constrained( Tree *e, Tree *s)
-#else
-tmember_constrained( e, s )
-Tree *e;
-Tree *s;
-#endif
-{
- if ( e==NULL||s==NULL ) return 0;
-/** fprintf(stderr, "tmember_constrained(");
-*** preorder(e); fprintf(stderr, ",");
-*** preorder(s); fprintf(stderr, " )\n");
-**/
- if ( s->token == ALT && s->right == NULL )
- return tmember_constrained(e, s->down);
- if ( e->token!=s->token )
- {
- if ( s->right==NULL ) return 0;
- return tmember_constrained(e, s->right);
- }
- if ( e->down == NULL ) return 1; /* if s is matched to depth of e return */
- if ( tmember_constrained(e->down, s->down) ) return 1;
- if ( s->right==NULL ) return 0;
- return tmember_constrained(e, s->right);
-}
-
-/* combine (? (A t) ... (A u) ...) into (? (A t u)) */
-Tree *
-#ifdef __USE_PROTOS
-tleft_factor( Tree *t )
-#else
-tleft_factor( t )
-Tree *t;
-#endif
-{
- Tree *u, *v, *trail, *w;
-
- /* left-factor what is at this level */
- if ( t == NULL ) return NULL;
- for (u=t; u!=NULL; u=u->right)
- {
- trail = u;
- v=u->right;
- while ( v!=NULL )
- {
- if ( u->token == v->token )
- {
- if ( u->down!=NULL )
- {
- for (w=u->down; w->right!=NULL; w=w->right) {;}
- w->right = v->down; /* link children together */
- }
- else u->down = v->down;
- trail->right = v->right; /* unlink factored node */
- _Tfree( v );
- v = trail->right;
- }
- else {trail = v; v=v->right;}
- }
- }
- /* left-factor what is below */
- for (u=t; u!=NULL; u=u->right) u->down = tleft_factor( u->down );
- return t;
-}
-
-/* remove the permutation p from t if present */
-Tree *
-#ifdef __USE_PROTOS
-trm_perm( Tree *t, Tree *p )
-#else
-trm_perm( t, p )
-Tree *t;
-Tree *p;
-#endif
-{
- /*
- fprintf(stderr, "trm_perm(");
- preorder(t); fprintf(stderr, ",");
- preorder(p); fprintf(stderr, " )\n");
- */
- if ( t == NULL || p == NULL ) return NULL;
- if ( t->token == ALT )
- {
- t->down = trm_perm(t->down, p);
- if ( t->down == NULL ) /* nothing left below, rm cur node */
- {
- Tree *u = t->right;
- _Tfree( t );
- return trm_perm(u, p);
- }
- t->right = trm_perm(t->right, p); /* look for more instances of p */
- return t;
- }
- if ( p->token != t->token ) /* not found, try a sibling */
- {
- t->right = trm_perm(t->right, p);
- return t;
- }
- t->down = trm_perm(t->down, p->down);
- if ( t->down == NULL ) /* nothing left below, rm cur node */
- {
- Tree *u = t->right;
- _Tfree( t );
- return trm_perm(u, p);
- }
- t->right = trm_perm(t->right, p); /* look for more instances of p */
- return t;
-}
-
-/* add the permutation 'perm' to the LL_k sets in 'fset' */
-void
-#ifdef __USE_PROTOS
-tcvt( set *fset, Tree *perm )
-#else
-tcvt( fset, perm )
-set *fset;
-Tree *perm;
-#endif
-{
- if ( perm==NULL ) return;
- set_orel(perm->token, fset);
- tcvt(fset+1, perm->down);
-}
-
-/* for each element of ftbl[k], make it the root of a tree with permute(ftbl[k+1])
- * as a child.
- */
-Tree *
-#ifdef __USE_PROTOS
-permute( int k, int max_k )
-#else
-permute( k, max_k )
-int k, max_k;
-#endif
-{
- Tree *t, *u;
-
- if ( k>max_k ) return NULL;
- if ( ftbl[k][findex[k]] == nil ) return NULL;
- t = permute(k+1, max_k);
- if ( t==NULL&&k<max_k ) /* no permutation left below for k+1 tokens? */
- {
- findex[k+1] = 0;
- (findex[k])++; /* try next token at this k */
- return permute(k, max_k);
- }
-
- u = tmake(tnode(ftbl[k][findex[k]]), t, NULL);
- if ( k == max_k ) (findex[k])++;
- return u;
-}
-
-/* Compute LL(k) trees for alts alt1 and alt2 of p.
- * function result is tree of ambiguous input permutations
- *
- * ALGORITHM may change to look for something other than LL_k size
- * trees ==> maxk will have to change.
- */
-Tree *
-#ifdef __USE_PROTOS
-VerifyAmbig( Junction *alt1, Junction *alt2, unsigned **ft, set *fs, Tree **t, Tree **u, int *numAmbig )
-#else
-VerifyAmbig( alt1, alt2, ft, fs, t, u, numAmbig )
-Junction *alt1;
-Junction *alt2;
-unsigned **ft;
-set *fs;
-Tree **t;
-Tree **u;
-int *numAmbig;
-#endif
-{
- set rk;
- Tree *perm, *ambig=NULL;
- Junction *p;
- int k;
- int tnodes_at_start=TnodesAllocated;
- int tnodes_at_end;
- int tnodes_used;
- set *save_fs;
- int j;
-
- save_fs=(set *) calloc(CLL_k+1,sizeof(set));
- require(save_fs != NULL,"save_fs calloc");
-
- for (j=0; j <= CLL_k ; j++) save_fs[j]=set_dup(fs[j]);
-
- maxk = LL_k; /* NOTE: for now, we look for LL_k */
- ftbl = ft;
- fset = fs;
- constrain = &(fset[1]);
- findex = (int *) calloc(LL_k+1, sizeof(int));
- if ( findex == NULL )
- {
- fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
- fprintf(stderr, " out of memory while analyzing alts %d and %d of %s\n",
- CurAmbigAlt1,
- CurAmbigAlt2,
- CurAmbigbtype);
- exit(PCCTS_EXIT_FAILURE);
- }
- for (k=1; k<=LL_k; k++) findex[k] = 0;
-
- rk = empty;
- ConstrainSearch = 1; /* consider only tokens in ambig sets */
-
- p = analysis_point((Junction *)alt1->p1);
- TRAV(p, LL_k, &rk, *t);
- *t = tshrink( *t );
- *t = tflatten( *t );
- *t = tleft_factor( *t ); /* MR10 */
- *t = prune(*t, LL_k);
- *t = tleft_factor( *t );
-
-/*** fprintf(stderr, "after shrink&flatten&prune&left_factor:"); preorder(*t); fprintf(stderr, "\n");*/
- if ( *t == NULL )
- {
-/*** fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/
- Tfree( *t ); /* kill if impossible to have ambig */
- *t = NULL;
- }
-
- p = analysis_point((Junction *)alt2->p1);
-
- TRAV(p, LL_k, &rk, *u);
- *u = tshrink( *u );
- *u = tflatten( *u );
- *t = tleft_factor( *t ); /* MR10 */
- *u = prune(*u, LL_k);
- *u = tleft_factor( *u );
-/* fprintf(stderr, "after shrink&flatten&prune&lfactor:"); preorder(*u); fprintf(stderr, "\n");*/
- if ( *u == NULL )
- {
-/* fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/
- Tfree( *u );
- *u = NULL;
- }
-
- for (k=1; k<=LL_k; k++) set_clr( fs[k] );
-
- ambig = tnode(ALT);
- k = 0;
- if ( *t!=NULL && *u!=NULL )
- {
- while ( (perm=permute(1,LL_k))!=NULL )
- {
-/* fprintf(stderr, "chk perm:"); preorder(perm); fprintf(stderr, "\n");*/
- if ( tmember(perm, *t) && tmember(perm, *u) )
- {
-/* fprintf(stderr, "ambig upon"); preorder(perm); fprintf(stderr, "\n");*/
-
- k++;
- perm->right = ambig->down;
- ambig->down = perm;
- tcvt(&(fs[1]), perm);
- }
- else Tfree( perm );
- }
- }
-
- for (j=0; j <= CLL_k ; j++) fs[j]=save_fs[j];
- free( (char *) save_fs);
-
- tnodes_at_end=TnodesAllocated;
- tnodes_used=tnodes_at_end - tnodes_at_start;
-
- if (TnodesReportThreshold > 0 && tnodes_used > TnodesReportThreshold) {
- fprintf(stdout,"There were %d tuples whose ambiguity could not be resolved by full lookahead\n",k);
- fprintf(stdout,"There were %d tnodes created to resolve ambiguity between:\n\n",tnodes_used);
- fprintf(stdout," Choice 1: %s line %d file %s\n",
- MR_ruleNamePlusOffset( (Node *) alt1),alt1->line,FileStr[alt1->file]);
- fprintf(stdout," Choice 2: %s line %d file %s\n",
- MR_ruleNamePlusOffset( (Node *) alt2),alt2->line,FileStr[alt2->file]);
- for (j=1; j <= CLL_k ; j++) {
- fprintf(stdout,"\n Intersection of lookahead[%d] sets:\n",j);
- MR_dumpTokenSet(stdout,2,fs[j]);
- };
- fprintf(stdout,"\n");
- };
-
- *numAmbig = k;
- if ( ambig->down == NULL ) {_Tfree(ambig); ambig = NULL;}
- free( (char *)findex );
-/* fprintf(stderr, "final ambig:"); preorder(ambig); fprintf(stderr, "\n");*/
- return ambig;
-}
-
-static Tree *
-#ifdef __USE_PROTOS
-bottom_of_chain( Tree *t )
-#else
-bottom_of_chain( t )
-Tree *t;
-#endif
-{
- if ( t==NULL ) return NULL;
- for (; t->down != NULL; t=t->down) {;}
- return t;
-}
-
-/*
- * Make a tree from k sets where the degree of the first k-1 sets is 1.
- */
-Tree *
-#ifdef __USE_PROTOS
-make_tree_from_sets( set *fset1, set *fset2 )
-#else
-make_tree_from_sets( fset1, fset2 )
-set *fset1;
-set *fset2;
-#endif
-{
- set inter;
- int i;
- Tree *t=NULL, *n, *u;
- unsigned *p,*q;
- require(LL_k>1, "make_tree_from_sets: LL_k must be > 1");
-
- /* do the degree 1 sets first */
- for (i=1; i<=LL_k-1; i++)
- {
- inter = set_and(fset1[i], fset2[i]);
- require(set_deg(inter)==1, "invalid set to tree conversion");
- n = tnode(set_int(inter));
- if (t==NULL) t=n; else tmake(t, n, NULL);
- set_free(inter);
- }
-
- /* now add the chain of tokens at depth k */
- u = bottom_of_chain(t);
- inter = set_and(fset1[LL_k], fset2[LL_k]);
- if ( (q=p=set_pdq(inter)) == NULL ) fatal_internal("Can't alloc space for set_pdq");
- /* first one is linked to bottom, then others are sibling linked */
- n = tnode(*p++);
- u->down = n;
- u = u->down;
- while ( *p != nil )
- {
- n = tnode(*p);
- u->right = n;
- u = u->right;
- p++;
- }
- free((char *)q);
-
- return t;
-}
-
-/* create and return the tree of lookahead k-sequences that are in t, but not
- * in the context of predicates in predicate list p.
- */
-Tree *
-#ifdef __USE_PROTOS
-tdif( Tree *ambig_tuples, Predicate *p, set *fset1, set *fset2 )
-#else
-tdif( ambig_tuples, p, fset1, fset2 )
-Tree *ambig_tuples;
-Predicate *p;
-set *fset1;
-set *fset2;
-#endif
-{
- unsigned **ft;
- Tree *dif=NULL;
- Tree *perm;
- set b;
- int i,k;
-
- if ( p == NULL ) return tdup(ambig_tuples);
-
- ft = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *));
- require(ft!=NULL, "cannot allocate ft");
- for (i=1; i<=CLL_k; i++)
- {
- b = set_and(fset1[i], fset2[i]);
- ft[i] = set_pdq(b);
- set_free(b);
- }
- findex = (int *) calloc(LL_k+1, sizeof(int));
- if ( findex == NULL )
- {
- fatal_internal("out of memory in tdif while checking predicates");
- }
- for (k=1; k<=LL_k; k++) findex[k] = 0;
-
-#ifdef DBG_TRAV
- fprintf(stderr, "tdif_%d[", p->k);
- preorder(ambig_tuples);
- fprintf(stderr, ",");
- preorder(p->tcontext);
- fprintf(stderr, "] =");
-#endif
-
- ftbl = ft;
- while ( (perm=permute(1,p->k))!=NULL )
- {
-#ifdef DBG_TRAV
- fprintf(stderr, "test perm:"); preorder(perm); fprintf(stderr, "\n");
-#endif
- if ( tmember_constrained(perm, ambig_tuples) &&
- !tmember_of_context(perm, p) )
- {
-#ifdef DBG_TRAV
- fprintf(stderr, "satisfied upon"); preorder(perm); fprintf(stderr, "\n");
-#endif
- k++;
- if ( dif==NULL ) dif = perm;
- else
- {
- perm->right = dif;
- dif = perm;
- }
- }
- else Tfree( perm );
- }
-
-#ifdef DBG_TRAV
- preorder(dif);
- fprintf(stderr, "\n");
-#endif
-
- for (i=1; i<=CLL_k; i++) free( (char *)ft[i] );
- free((char *)ft);
- free((char *)findex);
-
- return dif;
-}
-
-/* is lookahead sequence t a member of any context tree for any
- * predicate in p?
- */
-static int
-#ifdef __USE_PROTOS
-tmember_of_context( Tree *t, Predicate *p )
-#else
-tmember_of_context( t, p )
-Tree *t;
-Predicate *p;
-#endif
-{
- for (; p!=NULL; p=p->right)
- {
- if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST )
- return tmember_of_context(t, p->down);
- if ( tmember_constrained(t, p->tcontext) ) return 1;
- if ( tmember_of_context(t, p->down) ) return 1;
- }
- return 0;
-}
-
-int
-#ifdef __USE_PROTOS
-is_single_tuple( Tree *t )
-#else
-is_single_tuple( t )
-Tree *t;
-#endif
-{
- if ( t == NULL ) return 0;
- if ( t->right != NULL ) return 0;
- if ( t->down == NULL ) return 1;
- return is_single_tuple(t->down);
-}
-
-
-/* MR10 Check that a context guard contains only allowed things */
-/* MR10 (mainly token references). */
-
-#ifdef __USE_PROTOS
-int contextGuardOK(Node *p,int h,int *hmax)
-#else
-int contextGuardOK(p,h,hmax)
- Node *p;
- int h;
- int *hmax;
-#endif
-{
- Junction *j;
- TokNode *tn;
-
- if (p == NULL) return 1;
- if (p->ntype == nToken) {
- h++;
- if (h > *hmax) *hmax=h;
- tn=(TokNode *)p;
- if (tn->el_label != NULL) {
- warnFL(eMsg1("a label (\"%s\") for a context guard element is meaningless",tn->el_label),
- FileStr[p->file],p->line);
- };
- return contextGuardOK( ( (TokNode *) p)->next,h,hmax);
- } else if (p->ntype == nAction) {
- goto Fail;
- } else if (p->ntype == nRuleRef) {
- goto Fail;
- } else {
- require (p->ntype == nJunction,"Unexpected ntype");
- j=(Junction *) p;
- if (j->jtype != Generic &&
- j->jtype != aSubBlk && /* pretty sure this one is allowed */
-/**** j->jtype != aOptBlk && ****/ /* pretty sure this one is allowed */ /* MR11 not any more ! */
- j->jtype != EndBlk) {
- errFL("A context guard may not contain an option block: {...} or looping block: (...)* or (...)+",
- FileStr[p->file],p->line);
- contextGuardOK(j->p1,h,hmax);
- return 0;
- };
- /* do both p1 and p2 so use | rather than || */
- return contextGuardOK(j->p2,h,hmax) | contextGuardOK(j->p1,h,hmax);
- };
-Fail:
- errFL("A context guard may contain only Token references - guard will be ignored",
- FileStr[p->file],p->line);
- contextGuardOK( ( (ActionNode *) p)->next,h,hmax);
- return 0;
-}
-
-/*
- * Look at a (...)? generalized-predicate context-guard and compute
- * either a lookahead set (k==1) or a lookahead tree for k>1. The
- * k level is determined by the guard itself rather than the LL_k
- * variable. For example, ( A B )? is an LL(2) guard and ( ID )?
- * is an LL(1) guard. For the moment, you can only have a single
- * tuple in the guard. Physically, the block must look like this
- * --o-->TOKEN-->o-->o-->TOKEN-->o-- ... -->o-->TOKEN-->o--
- * An error is printed for any other type.
- */
-Predicate *
-#ifdef __USE_PROTOS
-computePredFromContextGuard(Graph blk,int *msgDone) /* MR10 */
-#else
-computePredFromContextGuard(blk,msgDone) /* MR10 */
- Graph blk;
- int *msgDone; /* MR10 */
-#endif
-{
- Junction *junc = (Junction *)blk.left, *p;
- Tree *t=NULL;
- Predicate *pred = NULL;
- set scontext, rk;
- int ok;
- int hmax=0;
-
- require(junc!=NULL && junc->ntype == nJunction, "bad context guard");
-
-/* MR10 Check for anything other than Tokens and generic junctions */
-
- *msgDone=0; /* MR10 */
- ok=contextGuardOK( (Node *)junc,0,&hmax); /* MR10 */
- if (! ok) { /* MR10 */
- *msgDone=1; /* MR10 */
- return NULL; /* MR10 */
- }; /* MR10 */
- if (hmax == 0) {
-errFL("guard is 0 tokens long",FileStr[junc->file],junc->line); /* MR11 */
- *msgDone=1;
- return NULL;
- };
- if (hmax > CLL_k) { /* MR10 */
-errFL(eMsgd2("guard is %d tokens long - lookahead is limited to max(k,ck)==%d", /* MR10 */
- hmax,CLL_k), /* MR10 */
- FileStr[junc->file],junc->line); /* MR10 */
- *msgDone=1; /* MR10 */
- return NULL; /* MR10 */
- }; /* MR10 */
-
- rk = empty;
- p = junc;
- pred = new_pred();
- pred->k = hmax; /* MR10 should be CLL_k, not LLK ? */
- if (hmax > 1 ) /* MR10 was LL_k */
- {
- ConstrainSearch = 0;
- ContextGuardTRAV = 1;
- TRAV(p, hmax, &rk, t); /* MR10 was LL_k */
- ContextGuardTRAV = 0;
- set_free(rk);
- t = tshrink( t );
- t = tflatten( t );
- t = tleft_factor( t );
-/*
- fprintf(stderr, "ctx guard:");
- preorder(t);
- fprintf(stderr, "\n");
-*/
- pred->tcontext = t;
- }
- else
- {
- REACH(p, 1, &rk, scontext);
- require(set_nil(rk), "rk != nil");
- set_free(rk);
-/*
- fprintf(stderr, "LL(1) ctx guard is:");
- s_fprT(stderr, scontext);
- fprintf(stderr, "\n");
-*/
- pred->scontext[1] = scontext;
- }
-
- list_add(&ContextGuardPredicateList,pred); /* MR13 */
-
- return pred;
-}
-
-/* MR13
- When the context guard is originally computed the
- meta-tokens are not known.
-*/
-
-#ifdef __USE_PROTOS
-void recomputeContextGuard(Predicate *pred)
-#else
-void recomputeContextGuard(pred)
- Predicate *pred;
-#endif
-{
- Tree * t=NULL;
- set scontext;
- set rk;
- ActionNode * actionNode;
- Junction * p;
-
- actionNode=pred->source;
- require (actionNode != NULL,"context predicate's source == NULL");
-
- p=actionNode->guardNodes;
- require (p != NULL,"context predicate's guardNodes == NULL");
-
- rk = empty;
- if (pred->k > 1 )
- {
- ConstrainSearch = 0;
- ContextGuardTRAV = 1;
- TRAV(p, pred->k, &rk, t);
- ContextGuardTRAV = 0;
- set_free(rk);
- t = tshrink( t );
- t = tflatten( t );
- t = tleft_factor( t );
- Tfree(pred->tcontext);
- pred->tcontext = t;
- }
- else
- {
- REACH(p, 1, &rk, scontext);
- require(set_nil(rk), "rk != nil");
- set_free(rk);
- set_free(pred->scontext[1]);
- pred->scontext[1] = scontext;
- }
-}
-
-/* MR11 - had enough of flags yet ? */
-
-int MR_AmbSourceSearch=0;
-int MR_AmbSourceSearchGroup=0;
-int MR_AmbSourceSearchChoice=0;
-int MR_AmbSourceSearchLimit=0;
-int MR_matched_AmbAidRule=0;
-
-static set *matchSets[2]={NULL,NULL};
-static int *tokensInChain=NULL;
-static Junction *MR_AmbSourceSearchJ[2];
-
-void MR_traceAmbSourceKclient()
-{
- int i;
- set *save_fset;
- int save_ConstrainSearch;
- set incomplete;
- Tree *t;
-
- if (matchSets[0] == NULL) {
- matchSets[0]=(set *) calloc (CLL_k+1,sizeof(set));
- require (matchSets[0] != NULL,"matchSets[0] alloc");
- matchSets[1]=(set *) calloc (CLL_k+1,sizeof(set));
- require (matchSets[1] != NULL,"matchSets[1] alloc");
- };
-
- for (i=1 ; i <= MR_AmbSourceSearchLimit ; i++) {
- set_clr(matchSets[0][i]);
- set_orel( (unsigned) tokensInChain[i],
- &matchSets[0][i]);
- set_clr(matchSets[1][i]);
- set_orel( (unsigned) tokensInChain[i],
- &matchSets[1][i]);
- };
-
- save_fset=fset;
- save_ConstrainSearch=ConstrainSearch;
-
-
-
- for (i=0 ; i < 2 ; i++) {
-
-#if 0
-** fprintf(stdout," Choice:%d Depth:%d ",i+1,MR_AmbSourceSearchLimit);
-** fprintf(stdout,"(");
-** for (j=1 ; j <= MR_AmbSourceSearchLimit ; j++) {
-** if (j != 1) fprintf(stdout," ");
-** fprintf(stdout,"%s",TerminalString(tokensInChain[j]));
-** };
-** fprintf(stdout,")\n\n");
-#endif
-
- fset=matchSets[i];
-
- MR_AmbSourceSearch=1;
- MR_MaintainBackTrace=1;
- MR_AmbSourceSearchChoice=i;
- ConstrainSearch=1;
-
- maxk = MR_AmbSourceSearchLimit;
-
- incomplete=empty;
- t=NULL;
-
- constrain = &(fset[1]);
- MR_pointerStackReset(&MR_BackTraceStack);
-
- TRAV(MR_AmbSourceSearchJ[i],maxk,&incomplete,t);
-
- Tfree(t);
-
- require (set_nil(incomplete),"MR_traceAmbSourceK TRAV incomplete");
- require (MR_BackTraceStack.count == 0,"K: MR_BackTraceStack.count != 0");
-
- set_free(incomplete);
- };
-
- ConstrainSearch=save_ConstrainSearch;
- fset=save_fset;
- MR_AmbSourceSearch=0;
- MR_MaintainBackTrace=0;
- MR_AmbSourceSearchChoice=0;
-}
-
-#ifdef __USE_PROTOS
-Tree *tTrunc(Tree *t,int depth)
-#else
-Tree *tTrunc(t,depth)
- Tree *t;
-#endif
-{
- Tree *u;
-
- require ( ! (t == NULL && depth > 0),"tree too short");
-
- if (depth == 0) return NULL;
-
- if (t->token == ALT) {
- u=tTrunc(t->down,depth);
- } else {
- u=tnode(t->token);
- u->down=tTrunc(t->down,depth-1);
- };
- if (t->right != NULL) u->right=tTrunc(t->right,depth);
- return u;
-}
-
-#ifdef __USE_PROTOS
-void MR_iterateOverTree(Tree *t,int chain[])
-#else
-void MR_iterateOverTree(t,chain)
- Tree *t;
- int chain[];
-#endif
-{
- if (t == NULL) return;
- chain[0]=t->token;
- if (t->down != NULL) {
- MR_iterateOverTree(t->down,&chain[1]);
- } else {
- MR_traceAmbSourceKclient();
- };
- MR_iterateOverTree(t->right,&chain[0]);
- chain[0]=0;
-}
-
-#ifdef __USE_PROTOS
-void MR_traceAmbSourceK(Tree *t,Junction *alt1,Junction *alt2)
-#else
-void MR_traceAmbSourceK(t,alt1,alt2)
- Tree *t;
- Junction *alt1;
- Junction *alt2;
-#endif
-{
- int i;
- int depth;
- int maxDepth;
- Tree *truncatedTree;
-
- if (MR_AmbAidRule == NULL) return;
-
- if ( ! (
- strcmp(MR_AmbAidRule,alt1->rname) == 0 ||
- strcmp(MR_AmbAidRule,alt2->rname) == 0 ||
- MR_AmbAidLine==alt1->line ||
- MR_AmbAidLine==alt2->line
- )
- ) return;
-
- MR_matched_AmbAidRule++;
-
- /* there are no token sets in trees, only in TokNodes */
-
- MR_AmbSourceSearchJ[0]=analysis_point( (Junction *) alt1->p1);
- MR_AmbSourceSearchJ[1]=analysis_point( (Junction *) alt2->p1);
-
- if (tokensInChain == NULL) {
- tokensInChain=(int *) calloc (CLL_k+1,sizeof(int));
- require (tokensInChain != NULL,"tokensInChain alloc");
- };
-
- MR_AmbSourceSearchGroup=0;
-
- fprintf(stdout,"\n");
- fprintf(stdout," Ambiguity Aid ");
- fprintf(stdout,
- (MR_AmbAidDepth <= LL_k ?
- "(-k %d -aa %s %s -aad %d)\n\n" :
- "(-k %d -aa %s %s [-k value limits -aad %d])\n\n"),
- LL_k,
- MR_AmbAidRule,
- (MR_AmbAidMultiple ? "-aam" : ""),
- MR_AmbAidDepth);
-
- for (i=0 ; i < 2 ; i++) {
- fprintf(stdout," Choice %d: %-25s line %d file %s\n",
- (i+1),
- MR_ruleNamePlusOffset( (Node *) MR_AmbSourceSearchJ[i]),
- MR_AmbSourceSearchJ[i]->line,
- FileStr[MR_AmbSourceSearchJ[i]->file]);
- };
-
- fprintf(stdout,"\n");
-
- if (MR_AmbAidDepth < LL_k) {
- maxDepth=MR_AmbAidDepth;
- } else {
- maxDepth=LL_k;
- };
-
- for (depth=1 ; depth <= maxDepth; depth++) {
- MR_AmbSourceSearchLimit=depth;
- if (depth < LL_k) {
- truncatedTree=tTrunc(t,depth);
- truncatedTree=tleft_factor(truncatedTree);
- MR_iterateOverTree(truncatedTree,&tokensInChain[1]); /* <===== */
- Tfree(truncatedTree);
- } else {
- MR_iterateOverTree(t,tokensInChain); /* <===== */
- };
- fflush(stdout);
- fflush(stderr);
- };
-
- fprintf(stdout,"\n");
- MR_AmbSourceSearch=0;
- MR_MaintainBackTrace=0;
- MR_AmbSourceSearchGroup=0;
- MR_AmbSourceSearchChoice=0;
- MR_AmbSourceSearchLimit=0;
-
-}
-
-
-/* this if for k=1 grammars only
-
- this is approximate only because of the limitations of linear
- approximation lookahead. Don't want to do a k=3 search when
- the user only specified a ck=3 grammar
-*/
-
-#ifdef __USE_PROTOS
-void MR_traceAmbSource(set *matchSets,Junction *alt1, Junction *alt2)
-#else
-void MR_traceAmbSource(matchSets,alt1,alt2)
- set *matchSets;
- Junction *alt1;
- Junction *alt2;
-#endif
-{
- set *save_fset;
- Junction *p[2];
- int i;
- int j;
- set *dup_matchSets;
- set intersection;
- set incomplete;
- set tokensUsed;
- int depth;
-
- if (MR_AmbAidRule == NULL) return;
- if ( ! (
- strcmp(MR_AmbAidRule,alt1->rname) == 0 ||
- strcmp(MR_AmbAidRule,alt2->rname) == 0 ||
- MR_AmbAidLine==alt1->line ||
- MR_AmbAidLine==alt2->line
- )
- ) return;
-
- MR_matched_AmbAidRule++;
-
- save_fset=fset;
-
- dup_matchSets=(set *) calloc(CLL_k+1,sizeof(set));
- require (dup_matchSets != NULL,"Can't allocate dup_matchSets");
-
- p[0]=analysis_point( (Junction *) alt1->p1);
- p[1]=analysis_point( (Junction *) alt2->p1);
-
- fprintf(stdout,"\n");
-
- fprintf(stdout," Ambiguity Aid ");
- fprintf(stdout,
- (MR_AmbAidDepth <= CLL_k ?
- "(-ck %d -aa %s %s -aad %d)\n\n" :
- "(-ck %d -aa %s %s [-ck value limits -aad %d])\n\n"),
- CLL_k,
- MR_AmbAidRule,
- (MR_AmbAidMultiple ? "-aam" : ""),
- MR_AmbAidDepth);
-
- for (i=0 ; i < 2 ; i++) {
- fprintf(stdout," Choice %d: %-25s line %d file %s\n",
- (i+1),
- MR_ruleNamePlusOffset( (Node *) p[i]),
- p[i]->line,FileStr[p[i]->file]);
- };
-
- for (j=1; j <= CLL_k ; j++) {
- fprintf(stdout,"\n Intersection of lookahead[%d] sets:\n",j);
- intersection=set_and(alt1->fset[j],alt2->fset[j]);
- MR_dumpTokenSet(stdout,2,intersection);
- set_free(intersection);
- };
-
- fprintf(stdout,"\n");
-
- require (1 <= MR_AmbAidDepth && MR_AmbAidDepth <= CLL_k,
- "illegal MR_AmbAidDepth");
-
- MR_AmbSourceSearchGroup=0;
- for (depth=1; depth <= MR_AmbAidDepth; depth++) {
- MR_AmbSourceSearchLimit=depth;
- for (i=0 ; i < 2 ; i++) {
-
-/*** fprintf(stdout," Choice:%d Depth:%d\n\n",i+1,depth); ***/
-
- for (j=0 ; j <= CLL_k ; j++) { dup_matchSets[j]=set_dup(matchSets[j]); };
- fset=dup_matchSets;
-
- fflush(output);
- fflush(stdout);
-
- MR_AmbSourceSearch=1;
- MR_MaintainBackTrace=1;
- MR_AmbSourceSearchChoice=i;
-
- maxk = depth;
- tokensUsed=empty;
- incomplete=empty;
-
- constrain = &(fset[1]);
- MR_pointerStackReset(&MR_BackTraceStack);
-
- REACH(p[i],depth,&incomplete,tokensUsed);
-
- fflush(output);
- fflush(stdout);
-
- require (set_nil(incomplete),"MR_traceAmbSource REACH incomplete");
- require (MR_BackTraceStack.count == 0,"1: MR_BackTraceStack.count != 0");
-
- set_free(incomplete);
- set_free(tokensUsed);
-
- for (j=0 ; j <= CLL_k ; j++) { set_free(dup_matchSets[j]); };
- };
- };
-
- fprintf(stdout,"\n");
-
- MR_AmbSourceSearch=0;
- MR_MaintainBackTrace=0;
- MR_AmbSourceSearchGroup=0;
- MR_AmbSourceSearchChoice=0;
- MR_AmbSourceSearchLimit=0;
-
- fset=save_fset;
- free ( (char *) dup_matchSets);
-}
-
-static int itemCount;
-
-void MR_backTraceDumpItemReset() {
- itemCount=0;
-}
-
-#ifdef __USE_PROTOS
-void MR_backTraceDumpItem(FILE *f,int skip,Node *n)
-#else
-void MR_backTraceDumpItem(f,skip,n)
- FILE *f;
- int skip;
- Node *n;
-#endif
-{
- TokNode *tn;
- RuleRefNode *rrn;
- Junction *j;
- ActionNode *a;
-
- switch (n->ntype) {
- case nToken:
- itemCount++; if (skip) goto EXIT;
- tn=(TokNode *)n;
- if (set_nil(tn->tset)) {
- fprintf(f," %2d #token %-23s",itemCount,TerminalString(tn->token));
- } else {
- fprintf(f," %2d #tokclass %-20s",itemCount,TerminalString(tn->token));
- };
- break;
- case nRuleRef:
- itemCount++; if (skip) goto EXIT;
- rrn=(RuleRefNode *)n;
- fprintf(f," %2d to %-27s",itemCount,rrn->text);
- break;
- case nAction:
- a=(ActionNode *)n;
- goto EXIT;
- case nJunction:
-
- j=(Junction *)n;
-
- switch (j->jtype) {
- case aSubBlk:
- if (j->guess) {
- itemCount++; if (skip) goto EXIT;
- fprintf(f," %2d %-30s",itemCount,"in (...)? block at");
- break;
- };
-/****** fprintf(f," %2d %-32s",itemCount,"in (...) block at"); *******/
-/****** break; *******/
- goto EXIT;
- case aOptBlk:
- itemCount++; if (skip) goto EXIT;
- fprintf(f," %2d %-30s",itemCount,"in {...} block");
- break;
- case aLoopBlk:
- itemCount++; if (skip) goto EXIT;
- fprintf(f," %2d %-30s",itemCount,"in (...)* block");
- break;
- case EndBlk:
- if (j->alpha_beta_guess_end) {
- itemCount++; if (skip) goto EXIT;
- fprintf(f," %2d %-30s",itemCount,"end (...)? block at");
- break;
- };
- goto EXIT;
-/****** fprintf(f," %2d %-32s",itemCount,"end of a block at"); *****/
-/****** break; *****/
- case RuleBlk:
- itemCount++; if (skip) goto EXIT;
- fprintf(f," %2d %-30s",itemCount,j->rname);
- break;
- case Generic:
- goto EXIT;
- case EndRule:
- itemCount++; if (skip) goto EXIT;
- fprintf (f," %2d end %-26s",itemCount,j->rname);
- break;
- case aPlusBlk:
- itemCount++; if (skip) goto EXIT;
- fprintf(f," %2d %-30s",itemCount,"in (...)+ block");
- break;
- case aLoopBegin:
- goto EXIT;
- };
- break;
- };
- fprintf(f," %-23s line %-4d %s\n",MR_ruleNamePlusOffset(n),n->line,FileStr[n->file]);
-EXIT:
- return;
-}
-
-
-static PointerStack previousBackTrace={0,0,NULL};
-
-#ifdef __USE_PROTOS
-void MR_backTraceReport(void)
-#else
-void MR_backTraceReport()
-#endif
-{
- int i;
- int match = 0;
- int limitMatch;
-
- Node *p;
- TokNode *tn;
- set remainder;
- int depth;
-
- /* Even when doing a k=2 search this routine can get
- called when there is only 1 token on the stack.
- This is because something like rRuleRef can change
- the search value of k from 2 to 1 temporarily.
- It does this because the it wants to know the k=1
- first set before it does a k=2 search
- */
-
- depth=0;
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- p=(Node *) MR_BackTraceStack.data[i];
- if (p->ntype == nToken) depth++;
- };
-
-/* MR14 */ if (MR_AmbSourceSearch) {
-/* MR14 */ require (depth <= MR_AmbSourceSearchLimit,"depth > MR_AmbSourceSearchLimit");
-/* MR14 */ }
-
- /* MR23 THM - Traceback report was being called at the wrong time for -alpha reports */
- /* Reported by Arpad Beszedes (beszedes@inf.u-szeged.hu) */
-
- if (MR_AmbSourceSearchLimit == 0 || depth < MR_AmbSourceSearchLimit) {
- return;
- };
-
- MR_backTraceDumpItemReset();
-
- limitMatch=MR_BackTraceStack.count;
- if (limitMatch > previousBackTrace.count) {
- limitMatch=previousBackTrace.count;
- };
-
- for (match=0; match < limitMatch; match++) {
- if (MR_BackTraceStack.data[match] !=
- previousBackTrace.data[match]) {
- break;
- };
- };
-
- /* not sure at the moment why there would be duplicates */
-
- if (match != MR_BackTraceStack.count) {
-
- fprintf(stdout," Choice:%d Depth:%d Group:%d",
- (MR_AmbSourceSearchChoice+1),
- MR_AmbSourceSearchLimit,
- ++MR_AmbSourceSearchGroup);
-
- depth=0;
- fprintf(stdout," (");
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- p=(Node *) MR_BackTraceStack.data[i];
- if (p->ntype != nToken) continue;
- tn=(TokNode *)p;
- if (depth != 0) fprintf(stdout," ");
- fprintf(stdout, "%s", TerminalString(tn->token));
- depth++;
- if (! MR_AmbAidMultiple) {
- if (set_nil(tn->tset)) {
- set_rm( (unsigned) tn->token,fset[depth]);
- } else {
- remainder=set_dif(fset[depth],tn->tset);
- set_free(fset[depth]);
- fset[depth]=remainder;
- };
- };
- };
- fprintf(stdout,")\n");
-
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- MR_backTraceDumpItem(stdout, (i<match) ,(Node *) MR_BackTraceStack.data[i]);
- };
- fprintf(stdout,"\n");
- fflush(stdout);
-
- MR_pointerStackReset(&previousBackTrace);
-
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- MR_pointerStackPush(&previousBackTrace,MR_BackTraceStack.data[i]);
- };
-
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_setConstrainPointer(set * newConstrainValue)
-#else
-void MR_setConstrainPointer(newConstrainValue)
- set * newConstrainValue;
-#endif
-{
- constrain=newConstrainValue;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
deleted file mode 100644
index d0a448d31d..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
+++ /dev/null
@@ -1,4797 +0,0 @@
-/*
- * gen.c
- *
- * Generate C code (ANSI, K&R, C++)
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "pcctscfg.h"
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-
-#define NumExprPerLine 4
-static int on1line=0;
-static set tokensRefdInBlock;
-
- /* T r a n s l a t i o n T a b l e s */
-
-/* C_Trans[node type] == pointer to function that knows how to translate that node. */
-#ifdef __cplusplus
-void (*C_Trans[NumNodeTypes+1])(...) = {
- NULL,
- NULL, /* See next table.
-Junctions have many types */
- (void (*)(...)) genRuleRef,
- (void (*)(...)) genToken,
- (void (*)(...)) genAction
- };
-#else
-void (*C_Trans[NumNodeTypes+1])() = {
- NULL,
- NULL, /* See next table.
-Junctions have many types */
- genRuleRef,
- genToken,
- genAction
- };
-#endif
-
-/* C_JTrans[Junction type] == pointer to function that knows how to translate that
- * kind of junction node.
- */
-#ifdef __cplusplus
-void (*C_JTrans[NumJuncTypes+1])(...) = {
- NULL,
- (void (*)(...)) genSubBlk,
- (void (*)(...)) genOptBlk,
- (void (*)(...)) genLoopBlk,
- (void (*)(...)) genEndBlk,
- (void (*)(...)) genRule,
- (void (*)(...)) genJunction,
- (void (*)(...)) genEndRule,
- (void (*)(...)) genPlusBlk,
- (void (*)(...)) genLoopBegin
- };
-#else
-void (*C_JTrans[NumJuncTypes+1])() = {
- NULL,
- genSubBlk,
- genOptBlk,
- genLoopBlk,
- genEndBlk,
- genRule,
- genJunction,
- genEndRule,
- genPlusBlk,
- genLoopBegin
- };
-#endif
-
-#define PastWhiteSpace(s) while (*(s) == ' ' || *(s) == '\t') {s++;}
-
-static int tabs = 0;
-
-/* MR6 Got tired of text running off page when using standard tab stops */
-
-#define TAB { int i; \
- if (TabWidth==0) { \
- for (i=0; i<tabs; i++) fputc('\t', output); \
- } else { \
- for (i=0; i<tabs*TabWidth; i++) fputc(' ',output); \
- }; \
- }
-
-static void
-#ifdef __USE_PROTOS
-tab( void )
-#else
-tab( )
-#endif
-TAB
-
-#ifdef __USE_PROTOS
-static char *tokenFollowSet(TokNode *);
-static ActionNode *findImmedAction( Node * );
-static void dumpRetValAssign(char *, char *, RuleRefNode *); /* MR30 */
-static void dumpAfterActions(FILE *output);
-static set ComputeErrorSet(Junction *, int, int);
-static void makeErrorClause(Junction *, set, int, int);
-static void DumpFuncHeader( Junction *, RuleEntry * );
-static int has_guess_block_as_first_item(Junction *);
-static int genExprSets(set *, int);
-static void genExprTree( Tree *t, int k );
-static void genExprTreeOriginal( Tree *t, int k ); /* MR10 */
-static char * findOuterHandlerLabel(ExceptionGroup *eg); /* MR7 */
-static void OutLineInfo(FILE *file,int line,char *fileName); /* MR14 */
-#else
-static char *tokenFollowSet();
-static ActionNode *findImmedAction();
-static void dumpRetValAssign();
-static void dumpAfterActions();
-static set ComputeErrorSet();
-static void makeErrorClause();
-static void DumpFuncHeader();
-static int has_guess_block_as_first_item();
-static int genExprSets();
-static void genExprTree();
-static void genExprTreeOriginal(); /* MR10 */
-static char * findOuterHandlerLabel(); /* MR7 */
-static void OutLineInfo(); /* MR14 */
-#endif
-
-#define gen(s) {tab(); fprintf(output, s);}
-#define gen1(s,a) {tab(); fprintf(output, s,a);}
-#define gen2(s,a,b) {tab(); fprintf(output, s,a,b);}
-#define gen3(s,a,b,c) {tab(); fprintf(output, s,a,b,c);}
-#define gen4(s,a,b,c,d) {tab(); fprintf(output, s,a,b,c,d);}
-#define gen5(s,a,b,c,d,e) {tab(); fprintf(output, s,a,b,c,d,e);}
-#define gen6(s,a,b,c,d,e,f) {tab(); fprintf(output, s,a,b,c,d,e,f);}
-#define gen7(s,a,b,c,d,e,f,g) {tab(); fprintf(output, s,a,b,c,d,e,f,g);}
-
-#define _gen(s) {fprintf(output, s);}
-#define _gen1(s,a) {fprintf(output, s,a);}
-#define _gen2(s,a,b) {fprintf(output, s,a,b);}
-#define _gen3(s,a,b,c) {fprintf(output, s,a,b,c);}
-#define _gen4(s,a,b,c,d){fprintf(output, s,a,b,c,d);}
-#define _gen5(s,a,b,c,d,e){fprintf(output, s,a,b,c,d,e);}
-#define _gen6(s,a,b,c,d,e,f){fprintf(output, s,a,b,c,d,e,f);}
-#define _gen7(s,a,b,c,d,e,f,g){fprintf(output, s,a,b,c,d,e,f,g);}
-
-
-/* MR11 a convenient place to set a break point */
-
-#ifdef __USE_PROTOS
-void MR_break(void)
-#else
-void MR_break()
-#endif
-{
- return;
-}
-
-/* MR10 genTraceOut(Junction *) */
-
-#ifdef __USE_PROTOS
-static void genTraceOut(Junction *q)
-#else
-static void genTraceOut(q)
- Junction *q;
-#endif
-{
- if ( TraceGen ) {
- if ( GenCC ) {gen1("zzTRACEOUT(\"%s\");\n", q->rname);}
- else gen1("zzTRACEOUT((ANTLRChar *)\"%s\");\n", q->rname);
- }
-}
-
-static void
-#ifdef __USE_PROTOS
-warn_about_using_gk_option(void)
-#else
-warn_about_using_gk_option()
-#endif
-{
- static int warned_already=0;
-
- if ( !DemandLookahead || warned_already ) return;
- warned_already = 1;
- warnNoFL("-gk option could cause trouble for <<...>>? predicates");
-}
-
-void
-#ifdef __USE_PROTOS
-freeBlkFsets( Junction *q )
-#else
-freeBlkFsets( q )
-Junction *q;
-#endif
-{
- int i;
- Junction *alt;
- require(q!=NULL, "freeBlkFsets: invalid node");
-
- for (alt=q; alt != NULL; alt= (Junction *) alt->p2 )
- {
- for (i=1; i<=CLL_k; i++) set_free(alt->fset[i]);
- }
-}
-
-/*
- * Generate a local variable allocation for each token references
- * in this block.
- */
-static void
-#ifdef __USE_PROTOS
-genTokenPointers( Junction *q )
-#else
-genTokenPointers( q )
-Junction *q;
-#endif
-{
- /* Rule refs are counted and can be referenced, but their
- * value is not set to anything useful ever.
- *
- * The ptrs are to be named _tij where i is the current level
- * and j is the element number within an alternative.
- */
- int first=1, t=0;
- set a;
- tokensRefdInBlock = q->tokrefs;
-
- if ( set_deg(q->tokrefs) == 0 ) return;
- a = set_dup(q->tokrefs);
- gen("ANTLRTokenPtr ");
- for (; !set_nil(a); set_rm(t, a))
- {
- t = set_int(a);
- if ( first ) first = 0;
- else _gen(",");
- if ( !DontCopyTokens ) _gen2("_tv%d%d,", BlkLevel, t);
- _gen2("_t%d%d", BlkLevel, t);
- if ( !DontCopyTokens ) {_gen2("= &_tv%d%d", BlkLevel, t);}
- else _gen("=NULL");
- }
- _gen(";\n");
- set_free(a);
-}
-
-static int
-#ifdef __USE_PROTOS
-hasDefaultException(ExceptionGroup *eg)
-#else
-hasDefaultException(eg)
-ExceptionGroup *eg;
-#endif
-{
- ListNode *q;
-
- for (q = eg->handlers->next; q!=NULL; q=q->next)
- {
- ExceptionHandler *eh = (ExceptionHandler *)q->elem;
- if ( strcmp("default", eh->signalname)==0 ) {
- return 1;
- }
- }
- return 0;
-}
-static void
-#ifdef __USE_PROTOS
-dumpException(ExceptionGroup *eg, int no_default_case)
-#else
-dumpException(eg, no_default_case)
-ExceptionGroup *eg;
-int no_default_case;
-#endif
-{
- char *outerLabel; /* MR7 */
- int altHandler=0; /* MR7 */
- int namedHandler=0; /* MR7 */
-
- outerLabel=findOuterHandlerLabel(eg); /* MR7 */
-
- if (eg->label != NULL) { /* MR7 */
- namedHandler=1; /* MR7 */
- } else if (eg->forRule) { /* MR7 */
- /* nothing */ /* MR20 */
- } else { /* MR7 */
- altHandler=1; /* MR7 */
- }; /* MR7 */
-
-#if 0
-** if (! eg->used) { /* MR7 */
-** warnFL("exception group never used", /* MR7 */
-** FileStr[eg->altstart->file],eg->altstart->line); /* MR7 */
-** }; /* MR7 */
-#endif
-
- if (namedHandler) { /* MR7 */
- gen1("switch ( _signal ) { /* [%s] */\n",eg->label); /* MR7 */
- } else { /* MR7 */
- gen("switch ( _signal ) {\n"); /* MR7 */
- gen("case NoSignal: break; /* MR7 */\n"); /* MR7 */
- }; /* MR7 */
- {
- ListNode *q;
- for (q = eg->handlers->next; q!=NULL; q=q->next)
- {
- ExceptionHandler *eh = (ExceptionHandler *)q->elem;
- if ( strcmp("default", eh->signalname)==0 ) {
- gen("default :\n");
- tabs++;
- dumpAction(eh->action, output, tabs, -1, 1, 1);
- gen("_signal=NoSignal; /* MR7 */\n"); /* MR7 */
- gen("break; /* MR7 */\n"); /* MR7 */
- tabs--;
- gen("}\n");
-
- /* copied from later code in dumpException */ /* MR7 */
-
- if (namedHandler) { /* MR7 */
- gen("if (_signal != NoSignal)"); /* MR7 */
- _gen1(" goto %s_handler; /* MR7 */\n",outerLabel);/* MR7 */
- } else if (altHandler) { /* MR7 */
- gen1("goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */
- };
- return;
- }
- gen1("case %s :\n", eh->signalname);
- tabs++;
- if ( eh->action != NULL )
- {
- dumpAction(eh->action, output, tabs, -1, 1, 1);
- gen("break; /* MR7 */\n"); /* MR7 */
- }
- tabs--;
- }
- }
- if ( no_default_case ) return;
-
- gen("default :\n");
- tabs++; /* MR7 */
- gen("break; /* MR7 */\n"); /* MR7 */
- tabs--; /* MR7 */
-
- tabs++;
-/***** gen("*_retsignal = _signal;\n"); *****/
-
- tabs--;
- gen("}\n");
-
- if (namedHandler) { /* MR7 */
- gen("if (_signal != NoSignal)"); /* MR7 */
- _gen1(" goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */
- } else if (altHandler) { /* MR7 */
- gen1("goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */
- };
-
-}
-
-static void
-#ifdef __USE_PROTOS
-dumpExceptions(ListNode *list)
-#else
-dumpExceptions(list)
-ListNode *list;
-#endif
-{
- ListNode *p;
-
- for (p = list->next; p!=NULL; p=p->next)
- {
- ExceptionGroup *eg = (ExceptionGroup *) p->elem;
- _gen2("%s%s_handler:\n",
- eg->label==NULL?"":eg->label,
- eg->altID==NULL?"":eg->altID);
- if ( eg->altID!=NULL ) dumpException(eg, 0);
- else {
- /* This must be the rule exception handler */
- dumpException(eg, 1);
- if ( !hasDefaultException(eg) )
- {
- gen("default :\n");
- tabs++;
- gen("zzdflthandlers(_signal,_retsignal);\n");
- tabs--;
- gen("}\n");
- }
- }
- }
-}
-
-/* For each element label that is found in a rule, generate a unique
- * Attribute (and AST pointer if GenAST) variable.
- */
-void
-#ifdef __USE_PROTOS
-genElementLabels(ListNode *list)
-#else
-genElementLabels(list)
-ListNode *list;
-#endif
-{
- int first=1;
- ListNode *p;
-
- if ( GenCC ) {gen("ANTLRTokenPtr");}
- else {gen("Attrib");}
- for (p = list->next; p!=NULL; p=p->next)
- {
- char *ep = (char *)p->elem;
- if ( first ) first = 0;
- else _gen(",");
- if ( GenCC ) {_gen1(" %s=NULL",ep);}
- else {_gen1(" %s",ep);}
- }
- _gen(";\n");
-
- if ( !GenAST ) return;
-
- first = 1;
- gen("AST");
- for (p = list->next; p!=NULL; p=p->next)
- {
- char *ep = (char *)p->elem;
- if ( first ) first = 0;
- else _gen(",");
- _gen1(" *%s_ast=NULL",ep);
- }
- _gen(";\n");
-}
-
-/*
- * Generate a local variable allocation for each token or rule reference
- * in this block.
- */
-static void
-#ifdef __USE_PROTOS
-genASTPointers( Junction *q )
-#else
-genASTPointers( q )
-Junction *q;
-#endif
-{
- int first=1, t;
- set a;
-
- a = set_or(q->tokrefs, q->rulerefs);
- if ( set_deg(a) > 0 )
- {
- gen("AST ");
- for (; !set_nil(a); set_rm(t, a))
- {
- t = set_int(a);
- if ( first ) first = 0;
- else _gen(",");
- _gen2("*_ast%d%d=NULL", BlkLevel, t);
- }
- set_free(a);
- }
- _gen(";\n");
-}
-
-static void
-#ifdef __USE_PROTOS
-BLOCK_Head( void )
-#else
-BLOCK_Head( )
-#endif
-{
- gen("{\n");
- tabs++;
- if ( !GenCC ) gen1("zzBLOCK(zztasp%d);\n", BlkLevel);
-}
-
-static void
-#ifdef __USE_PROTOS
-BLOCK_Tail( void )
-#else
-BLOCK_Tail( )
-#endif
-{
- if ( !GenCC ) gen1("zzEXIT(zztasp%d);\n", BlkLevel);
- if ( !GenCC ) gen("}\n");
- tabs--;
- gen("}\n");
-}
-
-static void
-#ifdef __USE_PROTOS
-BLOCK_Preamble( Junction *q )
-#else
-BLOCK_Preamble( q )
-Junction *q;
-#endif
-{
- ActionNode *a;
- Junction *begin;
-
- BLOCK_Head();
- if ( GenCC ) genTokenPointers(q);
- if ( GenCC&&GenAST ) genASTPointers(q);
- if ( q->jtype == aPlusBlk ) gen("int zzcnt=1;\n");
- if ( q->parm != NULL && !q->predparm ) gen1("zzaPush(%s);\n", q->parm)
- else if ( !GenCC ) gen("zzMake0;\n");
- if ( !GenCC ) gen("{\n");
- if ( q->jtype == aLoopBegin ) begin = (Junction *) ((Junction *)q->p1);
- else begin = q;
- if ( has_guess_block_as_first_item(begin) )
- {
- gen("zzGUESS_BLOCK\n");
- }
- if ( q->jtype == aLoopBegin )
- a = findImmedAction( ((Junction *)q->p1)->p1 ); /* look at aLoopBlk */
- else
- a = findImmedAction( q->p1 );
- if ( a!=NULL && !a->is_predicate) {
-/* MR21 */ if (!a->noHoist) dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1);
- a->done = 1; /* remove action. We have already handled it */
- }
-}
-
-void
-#ifdef __USE_PROTOS
-genCombinedPredTreeContextOrig( Predicate *p )
-#else
-genCombinedPredTreeContextOrig( p )
-Predicate *p;
-#endif
-{
- static set *ctx=NULL; /* genExprSets() is destructive, make copy*/
- require(p!=NULL, "can't make context tree for NULL pred tree");
-
-#ifdef DBG_PRED
- fprintf(stderr, "enter genCombinedPredTreeContextOrig(%s,0x%x) with sets:\n", p->expr, p);
- s_fprT(stderr, p->scontext[1]);
- fprintf(stderr, "\n");
-#endif
- if ( p->down == NULL )
- {
-/*** if ( p->k>1 && p->tcontext!=NULL ) ***/
- if ( p->tcontext!=NULL )
- {
- _gen("(");
- genExprTree(p->tcontext, 1);
- _gen(")");
- }
-/*** else if ( p->k==1 && set_deg(p->scontext[1])>0 ) ***/
- else if ( set_deg(p->scontext[1])>0 )
- {
- if ( ctx==NULL ) ctx = (set *)calloc(CLL_k+1, sizeof(set));
- require(ctx!=NULL, "ctx cannot allocate");
- ctx[0]=empty;
- ctx[1]=set_dup(p->scontext[1]);
- _gen("(");
- genExprSets(&(ctx[0]), p->k);
- _gen(")");
- set_free(ctx[1]);
- }
- else if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST ) {
- fatal_internal("pred tree is orphan OR or AND list");
- }
- else {
- if (! HoistPredicateContext) {
- _gen(" 1 /* no context: prc is off */ ");
- } else {
- fatal_internal("pred tree context is empty");
- };
- }
- return;
- }
-
-/* MR10 - make AND just like OR */
-
- if ( p->expr == PRED_AND_LIST )
- {
- Predicate *list = p->down;
- for (; list!=NULL; list=list->right)
- {
- genCombinedPredTreeContextOrig(list);
- if ( list->right!=NULL ) _gen("|| /* MR10 was wrong */ ");
- };
- return;
- }
-
- if ( p->expr == PRED_OR_LIST )
- {
- Predicate *list = p->down;
- for (; list!=NULL; list=list->right)
- {
- genCombinedPredTreeContextOrig(list);
- if ( list->right!=NULL ) _gen("||");
- };
- return;
- };
-
- fatal("pred tree is really wacked");
-}
-
-/* [genCombinedPredTreeContext] */
-
-void
-#ifdef __USE_PROTOS
-genCombinedPredTreeContext( Predicate *p )
-#else
-genCombinedPredTreeContext( p )
-Predicate *p;
-#endif
-{
- Tree *t;
- int predDepth=0;
-
- if (0 && ! MR_usingPredNames && ! MRhoisting) {
- genCombinedPredTreeContextOrig(p);
- } else {
-/* MR13 */ MR_pred_depth(p,&predDepth);
-/* MR13 */ if (predDepth == 1) {
-/* MR13 */
-/* MR13 */ set scontext[2];
-/* MR13 */ scontext[0]=empty;
-/* MR13 */ scontext[1]=MR_compute_pred_set(p);
-/* MR13 */ if (set_nil(scontext[1])) {
-/* MR13 */ _gen(" 1 /* MR12 no context (-prc off) */ ");
-/* MR13 */ } else {
-/* MR13 */ _gen("(");
-/* MR13 */ genExprSets(&scontext[0], 1);
-/* MR13 */ set_free(scontext[1]);
-/* MR13 */ _gen(")");
-/* MR13 */ };
-
- } else {
- t=MR_compute_pred_tree_context(p);
- if (t == NULL) {
- _gen(" 1 /* MR12 no context (-prc off) */ ");
- } else {
- _gen("(");
- genExprTree(t, 1);
- Tfree(t); /* MR10 */
- _gen(")");
- };
- };
- };
-}
-
-/* [genPredTreeGate] */
-
-void
-#ifdef __USE_PROTOS
-genPredTreeGate( Predicate *p, int in_and_expr )
-#else
-genPredTreeGate( p, in_and_expr )
-Predicate *p;
-int in_and_expr;
-#endif
-{
- if ( in_and_expr )
- {
- _gen("!(");
- genCombinedPredTreeContext(p);
- _gen(")||");
- if ( p->down!=NULL ) _gen("\n");
- }
- else
- {
- _gen("(");
- genCombinedPredTreeContext(p);
- _gen(")&&");
- if ( p->down!=NULL ) _gen("\n");
- }
-}
-
-#ifdef __USE_PROTOS
-void genPredEntry(Predicate *p,int outer)
-#else
-void genPredEntry(p,outer)
- Predicate *p;
- int outer;
-#endif
-{
- int inverted=0;
- Predicate *q;
- int localOuter=outer;
- int needRP=0;
-
- if (p == NULL) return;
-
- if (p->predEntry != NULL && p->predEntry->predLiteral != NULL) {
- if (p->inverted != p->predEntry->pred->inverted) {
- _gen("! /* inverted pred */ (");
- needRP=1;
- } else {
- if (!localOuter) _gen("(");
- needRP=1;
- };
- dumpAction(p->predEntry->predLiteral,output,0,p->source->file,p->source->line,0);
- if (needRP) _gen(")");
- return;
- };
-
- inverted=p->inverted;
-
- if (inverted) {
- _gen(" ! /* inverted pred */ (");
- localOuter=1;
- };
-
- if (p->expr == PRED_OR_LIST) {
- if (!localOuter) _gen("(");
- for (q=p->down; q != NULL ; q=q->right) {
- genPredEntry(q,0);
- if (q->right != NULL) _gen(" || ");
- };
- if (!localOuter) _gen(")");
- } else if (p->expr == PRED_AND_LIST) {
- if (!localOuter) _gen("(");
- for (q=p->down; q != NULL ; q=q->right) {
- genPredEntry(q,0);
- if (q->right != NULL) _gen(" && ");
- };
- if (!localOuter) _gen(")");
- } else {
- if (!localOuter) _gen("(");
- require (p->source != NULL,"predEntry->source == NULL");
- require (p->source->inverted == 0,"dumpPredEntry p->source->inverted != 0");
- dumpAction(p->source->action,output,0,p->source->file,p->source->line,0);
- if (!localOuter) _gen(")");
- };
-
- if (inverted) {
- _gen(")");
- }
-}
-
-void
-#ifdef __USE_PROTOS
-dumpPredAction(ActionNode *anode,
- char *s,FILE *output,int tabs,int file,int line,int final_newline)
-#else
-dumpPredAction(anode,
- s,output,tabs,file,line,final_newline)
-
- ActionNode *anode;
- char *s;
- FILE *output;
- int tabs;
- int file;
- int line;
- int final_newline;
-#endif
-{
- PredEntry *predEntry=anode->predEntry;
- int inverted=anode->inverted;
- Predicate *workPred;
-
- if (predEntry == NULL) {
-
- /* inline predicate literal */
-
- require(inverted == 0,"dumpPredAction action->inverted");
- dumpAction(s,output,tabs,file,line,final_newline);
-
- } else {
-
- /* a reference to a predicate - possibly with an inverted source */
-
- if (predEntry->predLiteral != NULL) {
- if (inverted) _gen("! /* inverted pred */ (");
- dumpAction(predEntry->predLiteral,output,0,anode->file,anode->line,0);
- if (inverted) _gen(")");
- } else {
- workPred=predicate_dup(predEntry->pred);
- if (inverted) workPred->inverted=!workPred->inverted;
- genPredEntry(workPred,1);
- predicate_free(workPred);
- };
- };
-}
-
-/* [genPred] */
-
-void
-#ifdef __USE_PROTOS
-genPred(Predicate *p, Node *j,int suppress_sva)
-#else
-genPred(p,j,suppress_sva)
- Predicate *p;
- Node *j;
- int suppress_sva;
-#endif
-{
- if ( FoundException && !suppress_sva) {_gen("(_sva=(");} /* MR11 suppress_sva */
- else {_gen("(");}
- if ( GenLineInfo && j->file != -1 ) _gen("\n");
- if (p->source != NULL && p->source->ampersandPred != NULL) {
- if (p->source->ampersandPred->k == 1) {
-
- set ctx[2];
-
- ctx[0]=empty;
- ctx[1]=set_dup(p->source->ampersandPred->scontext[1]);
-
- _gen("(");
- genExprSets(&(ctx[0]), p->k);
- _gen(") && ");
- set_free(ctx[1]);
- } else {
- _gen("( ");
- genExprTree(p->source->ampersandPred->tcontext,1);
- _gen(" ) && ");
- };
- };
-
- dumpPredAction((ActionNode *)p->source,
- p->expr, output, 0, -1 /*indicates no line info*/, j->line, 0);
-
- if ( FoundException && !suppress_sva) /* MR11 suppress_sva */
- {_gen("),_sva)");} /* MR10 - get red of "meant ==" messages */
- else {_gen(")");}
-}
-
-void
-#ifdef __USE_PROTOS
-MR_distinctORcontextOpt(Predicate *p,Node *j,int in_and_expr)
-#else
-MR_distinctORcontextOpt(p,j,in_and_expr)
- Predicate *p;
- Node *j;
- int in_and_expr;
-#endif
-{
- Predicate *q;
-
- _gen(" /* MR10 Distinct OR context optimization */ \n");
-
- if (in_and_expr) {
- gen("zzpf=0,\n");
- for (q=p->down; q != NULL; q=q->right) {
- gen("( ");
- genCombinedPredTreeContext(q);
- _gen(" && (zzpf=1, ");
- genPred(q,j,0);
- _gen(" )) ||\n");
- };
- gen("!zzpf)");
- } else {
- require (0,
- "MR_distinctORcontextOpt: can't get here when using MR_predSimplify");
-#if 0
-** for (q=p->down; q != NULL; q=q->right) {
-** gen("( ");
-** genCombinedPredTreeContext(q);
-** _gen(" && ");
-** genPred(q,j);
-** if (q->right != NULL) {
-** _gen(" ) ||\n");
-** };
-** };
-** gen(")");
-#endif
- };
-}
-
-void
-#ifdef __USE_PROTOS
-genPredTreeOrig( Predicate *p, Node *j, int in_and_expr )
-#else
-genPredTreeOrig( p, j, in_and_expr )
-Predicate *p;
-Node *j;
-int in_and_expr;
-#endif
-{
-
-/* MR10 */ int allHaveContext=1;
-/* MR10 */ int noneHaveContext=1;
-
-/* MR10 */ MR_predContextPresent(p,&allHaveContext,&noneHaveContext);
-
- if ( ! noneHaveContext ) /* MR10 context guards ignored when -prc off */
- {
- _gen("(");
- genPredTreeGate(p, in_and_expr);
- }
-
- /* if leaf node, just gen predicate */
-
- if ( p->down==NULL )
- {
- genPred(p,j,0);
- if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
- return;
- }
-
- /* if AND list, do both preds (only two possible) */
- if ( p->expr == PRED_AND_LIST )
- {
-#if 0
-** _gen("(");
-** genPredTreeOrig(p->down, j, 1);
-** _gen("&&");
-** genPredTreeOrig(p->down->right, j, 1);
-** _gen(")");
-** if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
-** return;
-#endif
- /* MR11 - make it work with AND with more than two children - like OR */
-
- Predicate *list;
- _gen("(");
- list = p->down;
- for (; list!=NULL; list=list->right)
- {
- genPredTreeOrig(list, j, 1);
- if ( list->right!=NULL ) _gen("&&");
- }
- _gen(")");
- if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
- return;
- };
-
- if ( p->expr == PRED_OR_LIST )
- {
- Predicate *list;
- _gen("(");
- list = p->down;
- for (; list!=NULL; list=list->right)
- {
- genPredTreeOrig(list, j, 0);
- if ( list->right!=NULL ) _gen("||");
- }
- _gen(")");
- if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
- return;
- }
-
- fatal_internal("genPredTreeOrig: predicate tree is wacked");
-}
-
-#if 0
-** Predicate member dummyPredDepth is no longer used in MR10
-** but we might need it again in the future
-**
-** if (MRhoisting) {
-** if ( !noneHaveContext &&
-** ! in_and_expr &&
-** p->source != NULL &&
-** p->source->dummyPredicateDepth > 0 &&
-** p->down == NULL) {
-** _gen("(");
-** genCombinedPredTreeContext(p);
-** _gen(" )\n");
-** return;
-** };
-** };
-#endif
-
-/* [genPredTree] */
-
-/* in_and_expr
-
- what to do if the context is wrong
- what to do if the context is correct but the predicate is false
-
- remember: if the context is wrong it's the same as if the
- predicate is true as far as enabling an alternative
-
- Consider (AND p q r)
-
- if in an ... && ... expression then you don't want
- the entire predicate chain to fail just because the
- context for one component is wrong: so return true
-
- Consider (OR p q r)
-
- if in an ... || ... expression then you don't want
- the entire predicate chain to succeed just because
- the context for one component is correct when the
- corresponding test is false: so return false when
- the context is correct but the test is false.
-*/
-
-void
-#ifdef __USE_PROTOS
-genPredTree( Predicate *p, Node *j, int in_and_expr, int suppress_sva )
-#else
-genPredTree( p, j, in_and_expr, suppress_sva)
- Predicate *p;
- Node *j;
- int in_and_expr;
- int suppress_sva;
-#endif
-{
-
- int allHaveContext=1;
- int noneHaveContext=1;
- Tree *groupTree;
- Tree *oneTree;
- Predicate *q;
- int identicalORcontextOptimization=0;
- int identicalANDcontextOptimization=0;
-
- if (0 && !MR_usingPredNames && !MRhoisting) {
- genPredTreeOrig(p,j,in_and_expr);
- return;
- };
-
- MR_predContextPresent(p,&allHaveContext,&noneHaveContext);
-
- if ( ! noneHaveContext ) { /* MR10 context guards ignored when -prc off */
-
- _gen("(");
-
- /* MR10 optimize OR predicates which are all leaves */
-
- if (p->expr == PRED_OR_LIST && MR_allPredLeaves(p->down)) {
- groupTree=MR_compute_pred_tree_context(p);
- for (q=p->down ; q != NULL ; q=q->right) {
- oneTree=MR_compute_pred_tree_context(q);
- if (! MR_tree_equ(groupTree,oneTree)) {
- Tfree(oneTree);
- break;
- };
- Tfree(oneTree);
- };
- Tfree(groupTree);
- if (q == NULL) {
- _gen("/* MR10 individual OR gates suppressed when all predicates are leaves");
- _gen(" with identical context */\n");
- genPredTreeGate(p,in_and_expr); /* use the parent's in_and_expr for this gate */
- identicalORcontextOptimization=1;
- } else {
- MR_distinctORcontextOpt(p,j,in_and_expr);
- return;
- };
- } else if (p->expr == PRED_AND_LIST && MR_allPredLeaves(p->down)) {
-
- /* MR12 optimize AND predicates which are all leaves */
-
- groupTree=MR_compute_pred_tree_context(p);
- for (q=p->down ; q != NULL ; q=q->right) {
- oneTree=MR_compute_pred_tree_context(q);
- if (! MR_tree_equ(groupTree,oneTree)) {
- Tfree(oneTree);
- break;
- };
- Tfree(oneTree);
- };
- Tfree(groupTree);
- if (q == NULL) {
- _gen("/* MR12 individual AND gates suppressed when all predicates are leaves");
- _gen(" with identical context */\n");
- genPredTreeGate(p,in_and_expr); /* use the parent's in_and_expr for this gate */
- identicalANDcontextOptimization=1;
- } else {
- genPredTreeGate(p, in_and_expr);
- };
- } else {
- genPredTreeGate(p, in_and_expr);
- };
- }
-
- /* if leaf node, just gen predicate */
-
- if ( p->down==NULL )
- {
- genPred(p,j,suppress_sva);
- if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
- return;
- }
-
- /* if AND list, do both preds (only two possible) */
- /* MR10 not any more ! */
-
- if ( p->expr == PRED_AND_LIST )
- {
- Predicate *list;
- _gen("(");
- list = p->down;
- for (; list != NULL; list=list->right) {
- if (identicalANDcontextOptimization) {
- genPred(list, j,suppress_sva);
- } else {
- genPredTree(list, j, 1, suppress_sva); /* in and context */
- };
- if ( list->right!=NULL ) _gen("&&");
- };
- _gen(")");
- if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
- return;
- }
-
- if ( p->expr == PRED_OR_LIST )
- {
- Predicate *list;
- _gen("(");
- list = p->down;
- for (; list!=NULL; list=list->right)
- {
- if (identicalORcontextOptimization) {
- genPred(list, j,suppress_sva);
- } else {
- genPredTree(list, j, 0, suppress_sva);
- };
- if ( list->right!=NULL ) _gen("||");
- }
- _gen(")");
- if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */
- return;
- }
-
- fatal_internal("predicate tree is wacked");
-}
-
-/* [genPredTreeMainXX] */
-
-Predicate * /* MR10 */
-#ifdef __USE_PROTOS
-genPredTreeMainXX( Predicate *p, Node *j ,int in_and_expr)
-#else
-genPredTreeMainXX( p, j ,in_and_expr)
- Predicate *p;
- Node *j;
- int in_and_expr;
-#endif
-{
-
- int allHaveContext=1;
- int noneHaveContext=1;
-
-#if 0
- fprintf(stderr,"Pred before\n");
- dumppred(p);
- fprintf(stderr,"\n");
- fprintf(stderr,"Pred after\n");
- dumppred(p);
- fprintf(stderr,"\n");
-#endif
-
- p=MR_predSimplifyALL(p); /* MR10 */
-
- require (MR_predicate_context_completed(p),"predicate context is not complete");
-
- MR_cleanup_pred_trees(p); /* MR10 */
-
- MR_predContextPresent(p,&allHaveContext,&noneHaveContext);
- if (!noneHaveContext & !allHaveContext) {
- warnFL("predicate contains elements both with and without context",
- FileStr[j->file],j->line);
- };
-
- if (InfoP) {
- _gen("\n#if 0\n\n");
- MR_dumpPred(p,1);
- _gen("#endif\n");
- };
- genPredTree(p,j,in_and_expr,0);
- return p;
-}
-
-Predicate * /* MR10 */
-#ifdef __USE_PROTOS
-genPredTreeMain( Predicate *p, Node *j)
-#else
-genPredTreeMain( p, j)
- Predicate *p;
- Node *j;
-#endif
-{
- return genPredTreeMainXX(p,j,1);
-}
-
-static void
-#ifdef __USE_PROTOS
-genExprTreeOriginal( Tree *t, int k )
-#else
-genExprTreeOriginal( t, k )
-Tree *t;
-int k;
-#endif
-{
- require(t!=NULL, "genExprTreeOriginal: NULL tree");
-
- if ( t->token == ALT )
- {
- _gen("("); genExprTreeOriginal(t->down, k); _gen(")");
- if ( t->right!=NULL )
- {
- _gen("||");
- on1line++;
- if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
- _gen("("); genExprTreeOriginal(t->right, k); _gen(")");
- }
- return;
- }
- if ( t->down!=NULL ) _gen("(");
- _gen1("LA(%d)==",k);
- if ( TokenString(t->token) == NULL ) _gen1("%d", t->token)
- else _gen1("%s", TokenString(t->token));
- if ( t->down!=NULL )
- {
- _gen("&&");
- on1line++;
- if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
- _gen("("); genExprTreeOriginal(t->down, k+1); _gen(")");
- }
- if ( t->down!=NULL ) _gen(")");
- if ( t->right!=NULL )
- {
- _gen("||");
- on1line++;
- if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
- _gen("("); genExprTreeOriginal(t->right, k); _gen(")");
- }
-}
-
-#ifdef __USE_PROTOS
-static void MR_LAtokenString(int k,int token)
-#else
-static void MR_LAtokenString(k,token)
- int k;
- int token;
-#endif
-{
- char *ts;
-
- ts=TokenString(token);
- if (ts == NULL) {
- _gen2(" LA(%d)==%d",k,token);
- } else {
- _gen2(" LA(%d)==%s",k,ts);
- };
-}
-
-
-#ifdef __USE_PROTOS
-static int MR_countLeaves(Tree *t)
-#else
-static int MR_countLeaves(t)
- Tree *t;
-#endif
-{
- if (t == NULL) return 0;
- if (t->token == ALT) {
- return MR_countLeaves(t->down)+MR_countLeaves(t->right);
- } else {
- return 1+MR_countLeaves(t->down)+MR_countLeaves(t->right);
- };
-}
-
-#ifdef __USE_PROTOS
-static void MR_genOneLine(Tree *tree,int k)
-#else
-static void MR_genOneLine(tree,k)
- Tree *tree;
- int k;
-#endif
-{
- if (tree == NULL) return;
- if (tree->token == ALT) {
- MR_genOneLine(tree->down,k);
- } else {
- MR_LAtokenString(k,tree->token);
- if (tree->down != NULL &&
- tree->down->right == NULL) {
- _gen(" &&");
- MR_genOneLine(tree->down,k+1);
- } else if (tree->down != NULL) {
- _gen(" && (");
- MR_genOneLine(tree->down,k+1);
- _gen(")");
- };
- };
- if (tree->right != NULL) {
- _gen(" ||");
- MR_genOneLine(tree->right,k);
- };
-}
-
-static int across;
-static int depth;
-static int lastkonline;
-
-#ifdef __USE_PROTOS
-static void MR_genMultiLine(Tree *tree,int k)
-#else
-static void MR_genMultiLine(tree,k)
- Tree *tree;
- int k;
-#endif
-{
- int i;
-
- if (tree == NULL) return;
- if (tree->token == ALT) {
- MR_genMultiLine(tree,k);
- } else {
- MR_LAtokenString(k,tree->token);
- lastkonline=k;
- across++;
- if (tree->down != NULL && tree->down->right == NULL) {
- if (across > 3) {
- _gen("\n");
- across=0;
- lastkonline=0;
- for (i=0 ; i < depth+k ; i++) _gen(" ");
- _gen("&&");
- } else {
- _gen(" &&");
- };
- MR_genMultiLine(tree->down,k+1);
- } else if (tree->down != NULL) {
- _gen("\n");
- lastkonline=0;
- across=0;
- for (i=0 ; i < depth+k ; i++) _gen(" ");
- _gen("&& (");
- MR_genMultiLine(tree->down,k+1);
- _gen(")");
- };
- };
- if (tree->right != NULL) {
- if (k < lastkonline) {
- _gen("\n");
- across=0;
- lastkonline=0;
- for (i=0; i < depth+k-1 ; i++) _gen(" ");
- _gen("||");
- } else if (across > 3 ) {
- _gen("\n");
- across=0;
- lastkonline=0;
- for (i=0; i < depth+k ; i++) _gen(" ");
- _gen("||");
- } else {
- _gen(" ||");
- };
- MR_genMultiLine(tree->right,k);
- };
-}
-
-#ifdef __USE_PROTOS
-static void genExprTree(Tree *tree,int k)
-#else
-static void genExprTree(tree,k)
- Tree *tree;
- int k;
-#endif
-{
- int count;
-
-#if 0
- /* MR20 THM This was probably an error.
- The routine should probably reference that static
- "across" and this declaration hides it.
- */
-
- int across;
-#endif
-
- require (tree != NULL,"genExprTree: tree is NULL");
- require (k > 0,"genExprTree: k <= 0");
-
- if (0 && !MRhoisting) { /* MR11 make new version standard */
- genExprTreeOriginal(tree,k);
- } else {
- count=MR_countLeaves(tree);
- if (count < 5) {
- MR_genOneLine(tree,k);
- } else {
- _gen("\n");
- across=0;
- depth=0;
- lastkonline=0;
- MR_genMultiLine(tree,k);
- _gen("\n");
- };
- };
-}
-
-
-/*
- * Generate LL(k) type expressions of the form:
- *
- * (LA(1) == T1 || LA(1) == T2 || ... || LA(1) == Tn) &&
- * (LA(2) == T1 || LA(2) == T2 || ... || LA(2) == Tn) &&
- * .....
- * (LA(k) == T1 || LA(k) == T2 || ... || LA(k) == Tn)
- *
- * If GenExprSetsOpt generate:
- *
- * (setwdi[LA(1)]&(1<<j)) && (setwdi[LA(2)]&(1<<j)) ...
- *
- * where n is set_deg(expr) and Ti is some random token and k is the last nonempty
- * set in fset <=CLL_k.
- * k=1..CLL_k where CLL_k >= 1.
- *
- * This routine is visible only to this file and cannot answer a TRANS message.
- *
- */
-
-/* [genExpr] */
-
-static int
-#ifdef __USE_PROTOS
-genExpr( Junction *j )
-#else
-genExpr( j )
-Junction *j;
-#endif
-{
- int max_k;
-
- /* if full LL(k) is sufficient, then don't use approximate (-ck) lookahead
- * from CLL_k..LL_k
- */
- {
- int limit;
- if ( j->ftree!=NULL ) limit = LL_k;
- else limit = CLL_k;
- max_k = genExprSets(j->fset, limit);
- }
-
- /* Do tests for real tuples from other productions that conflict with
- * artificial tuples generated by compression (using sets of tokens
- * rather than k-trees).
- */
- if ( j->ftree != NULL )
- {
- _gen(" && !("); genExprTree(j->ftree, 1); _gen(")");
- }
-
- if ( ParseWithPredicates && j->predicate!=NULL )
- {
- Predicate *p = j->predicate;
- warn_about_using_gk_option();
- _gen("&&");
- j->predicate=genPredTreeMain(p, (Node *)j); /* MR10 */
- }
-
- return max_k;
-}
-
-static int
-#ifdef __USE_PROTOS
-genExprSets( set *fset, int limit )
-#else
-genExprSets( fset, limit )
-set *fset;
-int limit;
-#endif
-{
- int k = 1;
- int max_k = 0;
- unsigned *e, *g, firstTime=1;
-
- if (set_nil(fset[1])) {
- _gen(" 0 /* MR13 empty set expression - undefined rule ? infinite left recursion ? */ ");
- MR_BadExprSets++;
- };
-
- if ( GenExprSetsOpt )
- {
- while ( k <= limit && !set_nil(fset[k]) ) /* MR11 */
- {
- if ( set_deg(fset[k])==1 ) /* too simple for a set? */
- {
- int e;
- _gen1("(LA(%d)==",k);
- e = set_int(fset[k]);
- if ( TokenString(e) == NULL ) _gen1("%d)", e)
- else _gen1("%s)", TokenString(e));
- }
- else
- {
- NewSet();
- FillSet( fset[k] );
- _gen3("(setwd%d[LA(%d)]&0x%x)", wordnum, k, 1<<setnum);
- }
- if ( k>max_k ) max_k = k;
- if ( k == CLL_k ) break;
- k++;
- if ( k<=limit && !set_nil(fset[k]) ) _gen(" && "); /* MR11 */
- on1line++;
- if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
- }
- return max_k;
- }
-
- while ( k<= limit && !set_nil(fset[k]) ) /* MR11 */
- {
- if ( (e=g=set_pdq(fset[k])) == NULL ) fatal_internal("genExpr: cannot allocate IF expr pdq set");
- for (; *e!=nil; e++)
- {
- if ( !firstTime ) _gen(" || ") else { _gen("("); firstTime = 0; }
- on1line++;
- if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
- _gen1("LA(%d)==",k);
- if ( TokenString(*e) == NULL ) _gen1("%d", *e)
- else _gen1("%s", TokenString(*e));
- }
- free( (char *)g );
- _gen(")");
- if ( k>max_k ) max_k = k;
- if ( k == CLL_k ) break;
- k++;
- if ( k <= limit && !set_nil(fset[k]) ) { firstTime=1; _gen(" && "); } /* MR11 */
- on1line++;
- if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); }
- }
- return max_k;
-}
-
-/*
- * Generate code for any type of block. If the last alternative in the block is
- * empty (not even an action) don't bother doing it. This permits us to handle
- * optional and loop blocks as well.
- *
- * Only do this block, return after completing the block.
- * This routine is visible only to this file and cannot answer a TRANS message.
- */
-static set
-#ifdef __USE_PROTOS
-genBlk( Junction *q, int jtype, int *max_k, int *need_right_curly, int * lastAltEmpty /* MR23 */)
-#else
-genBlk( q, jtype, max_k, need_right_curly, lastAltEmpty /* MR23 */)
-Junction *q;
-int jtype;
-int *max_k;
-int *need_right_curly;
-int *lastAltEmpty; /* MR23 */
-#endif
-{
- set f;
- Junction *alt;
- int a_guess_in_block = 0;
- require(q!=NULL, "genBlk: invalid node");
- require(q->ntype == nJunction, "genBlk: not junction");
- *need_right_curly=0;
- *lastAltEmpty = 0; /* MR23 */
- if ( q->p2 == NULL ) /* only one alternative? Then don't need if */
- {
- if (first_item_is_guess_block((Junction *)q->p1)!=NULL )
- {
- if (jtype != aLoopBlk && jtype != aOptBlk && jtype != aPlusBlk) {
- warnFL("(...)? as only alternative of block is unnecessary", FileStr[q->file], q->line);
- };
- gen("zzGUESS\n"); /* guess anyway to make output code consistent */
-/* MR10 disable */ /**** gen("if ( !zzrv )\n"); ****/
-/* MR10 */ gen("if ( !zzrv ) {\n"); tabs++; (*need_right_curly)++;
- };
- TRANS(q->p1);
- return empty; /* no decision to be made-->no error set */
- }
-
- f = First(q, 1, jtype, max_k);
- for (alt=q; alt != NULL; alt= (Junction *) alt->p2 )
- {
- if ( alt->p2 == NULL ) /* chk for empty alt */
- {
- Node *p = alt->p1;
- if ( p->ntype == nJunction )
- {
- /* we have empty alt */
-/* MR23
- There is a conflict between giving good error information for non-exceptions
- and making life easy for those using parser exception handling. Consider:
-
- r: { A } b;
- b: B;
-
- with input "C"
-
- Before MR21 the error message would be "expecting B - found C". After MR21
- the error message would be "expcect A, B - found C". This was good, but it
- caused problems for those using parser exceptions because the reference to
- B was generated inside the {...} where B really wasn't part of the block.
-
- In MR23 this has been changed for the case where exceptions are in use to
- not generate the extra check in the tail of the {A} block.
-*/
-
-
-/* MR23 */ if (isEmptyAlt( ((Junction *)p)->p1, (Node *)q->end)) {
-/* MR23 */ *lastAltEmpty = 1;
-/* MR23 */ if (FoundException) {
-/* MR23 */ /* code to restore state if a prev alt didn't follow guess */
-/* MR23 */ if ( a_guess_in_block && jtype != aPlusBlk) {
-/* MR23 */ gen("if ( !zzrv ) zzGUESS_DONE; /* MR28 */\n");
-/* MR23 */ }
-/* MR23 */ break;
-/* MR23 */ };
-/* MR28 */ if (jtype == aPlusBlk) {
-/* MR28 */ break;
-/* MR28 */ }
-/* MR23 */ }
- }
- } /* end of for loop on alt */
-
-/* MR10 */ if (alt->p2 == NULL &&
-/* MR10 */ ( q->jtype == aSubBlk || q->jtype == RuleBlk) ) {
-/* MR10 */ if (first_item_is_guess_block(alt)) {
-/* MR10 */ warnFL("(...)? as last alternative of block is unnecessary",
-/* MR10 */ FileStr[alt->file],alt->line);
-/* MR10 */ };
-/* MR10 */ };
-
- if ( alt != q ) gen("else ")
- else
- {
- if ( DemandLookahead ) {
- if ( !GenCC ) {gen1("LOOK(%d);\n", *max_k);}
- else gen1("look(%d);\n", *max_k);
- }
- }
-
- if ( alt!=q )
- {
- _gen("{\n");
- tabs++;
- (*need_right_curly)++;
- /* code to restore state if a prev alt didn't follow guess */
- if ( a_guess_in_block )
- gen("if ( !zzrv ) zzGUESS_DONE;\n");
- }
- if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL )
- {
- a_guess_in_block = 1;
- gen("zzGUESS\n");
- }
- gen("if ( ");
- if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) _gen("!zzrv && ");
- genExpr(alt);
- _gen(" ) ");
- _gen("{\n");
- tabs++;
- TRANS(alt->p1);
- --tabs;
- gen("}\n");
-/* MR10 */ if (alt->p2 == NULL) {
-/* MR10 */ if (first_item_is_guess_block(alt)) {
-/* MR10 */ gen("/* MR10 */ else {\n");
-/* MR10 */ tabs++;
-/* MR10 */ (*need_right_curly)++;
-/* MR10 */ /* code to restore state if a prev alt didn't follow guess */
-/* MR10 */ gen("/* MR10 */ if ( !zzrv ) zzGUESS_DONE;\n");
-/* MR10 */ gen("/* MR10 */ if (0) {} /* last alternative of block is guess block */\n");
-/* MR10 */ };
-/* MR10 */ };
- }
- return f;
-}
-
-static int
-#ifdef __USE_PROTOS
-has_guess_block_as_first_item( Junction *q )
-#else
-has_guess_block_as_first_item( q )
-Junction *q;
-#endif
-{
- Junction *alt;
-
- for (alt=q; alt != NULL; alt= (Junction *) alt->p2 )
- {
- if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) return 1;
- }
- return 0;
-}
-
-static int
-#ifdef __USE_PROTOS
-has_guess_block_as_last_item( Junction *q )
-#else
-has_guess_block_as_last_item( q )
-Junction *q;
-#endif
-{
- Junction *alt;
-
- if (q == NULL) return 0;
- for (alt=q; alt->p2 != NULL && !( (Junction *) alt->p2)->ignore; alt= (Junction *) alt->p2 ) {};
- return first_item_is_guess_block( (Junction *) alt->p1) != NULL;
-}
-
-/* MR30 See description of first_item_is_guess_block for background */
-
-Junction *
-#ifdef __USE_PROTOS
-first_item_is_guess_block_extra(Junction *q )
-#else
-first_item_is_guess_block_extra(q)
-Junction *q;
-#endif
-{
- while ( q!=NULL &&
- ( ( q->ntype==nAction ) ||
- ( q->ntype==nJunction &&
- (q->jtype==Generic || q->jtype == aLoopBlk)
- )
- )
- )
- {
- if ( q->ntype==nJunction ) q = (Junction *)q->p1;
- else q = (Junction *) ((ActionNode *)q)->next;
- }
-
- if ( q==NULL ) return NULL;
- if ( q->ntype!=nJunction ) return NULL;
- if ( q->jtype!=aSubBlk ) return NULL;
- if ( !q->guess ) return NULL;
-
- return q;
-}
-
-/* return NULL if 1st item of alt is NOT (...)? block; else return ptr to aSubBlk node
- * of (...)?; This function ignores actions and predicates.
- */
-
-Junction *
-#ifdef __USE_PROTOS
-first_item_is_guess_block( Junction *q )
-#else
-first_item_is_guess_block( q )
-Junction *q;
-#endif
-{
- Junction * qOriginal = q; /* DEBUG */
-
- /* MR14 Couldn't find aSubBlock which was a guess block when it lay
- behind aLoopBlk. The aLoopBlk only appear in conjunction with
- aLoopBegin, but the routine didn't know that. I think.
-
- MR14a Added extra parentheses to clarify precedence
-
- MR30 This appears to have been a mistake. The First set was then
- computed incorrectly for:
-
- r : ( (A)? B
- | C
- )*
-
- The routine analysis_point was seeing the guess block when
- it was still analyzing the loopBegin block. As a consequence,
- when it looked for the analysis_point it was processing the B, but
- skipping over the C alternative altogether because it thought
- it was looking at a guess block, not realizing there was a loop
- block in front of the loopBegin.
-
- loopBegin loopBlk subBlk/guess A G EB G B EB EB EB ER
- | | | ^ ^
- | | | |
- | +-> G C G ----------------------+ |
- | |
- +--- G G G -------------------------------------+
-
- Reported by Arpad Beszedes (beszedes@inf.u-szeged.hu).
-
- MR30 This is still more complicated. This fix caused ambiguity messages
- to be reported for "( (A B)? )* A B" but not for "( (A B)? )+". Why is
- there a difference when these are outwardly identical ? It is because the
- start of a (...)* block is represented by two nodes: a loopBegin block
- followed by a loopBlock whereas the start of a (...)+ block is
- represented as a single node: a plusBlock. So if first_item_is_guess_block
- is called when the current node is a loopBegin it starts with the
- loop block rather than the the sub block which follows the loop block.
- However, we can't just skip past the loop block because some routines
- depend on the old implementation. So, we provide a new implementation
- which does skip the loopBlock. However, which should be called when ?
- I'm not sure, but my guess is that first_item_is_guess_block_extra (the
- new one) should only be called for the ambiguity routines.
-
- */
-
- while ( q!=NULL &&
- ( ( q->ntype==nAction ) ||
- ( q->ntype==nJunction &&
- (q->jtype==Generic /*** || q->jtype == aLoopBlk ***/ ) /*** MR30 Undo MR14 change ***/
- )
- )
- )
- {
- if ( q->ntype==nJunction ) q = (Junction *)q->p1;
- else q = (Junction *) ((ActionNode *)q)->next;
- }
-
- if ( q==NULL ) return NULL;
- if ( q->ntype!=nJunction ) return NULL;
- if ( q->jtype!=aSubBlk ) return NULL;
- if ( !q->guess ) return NULL;
-
- return q;
-}
-
-/* MR1 */
-/* MR1 10-Apr-97 MR1 Routine to stringize failed semantic predicates msgs */
-/* MR1 */
-
-#define STRINGIZEBUFSIZE 1024
-
-static char stringizeBuf[STRINGIZEBUFSIZE];
-char *
-#ifdef __USE_PROTOS
-stringize(char * s)
-#else
-stringize(s)
-char *s;
-#endif
-
-{
- char *p;
- char *stop;
-
- p=stringizeBuf;
- stop=&stringizeBuf[1015];
-
- if (s != 0) {
- while (*s != 0) {
- if (p >= stop) {
- goto stringizeStop;
- } else if (*s == '\n') {
- *p++='\\';
- *p++='n';
- *p++='\\';
- *p++=*s++;
- } else if (*s == '\\') {
- *p++=*s;
- *p++=*s++;
- } else if (*s == '\"') {
- *p++='\\';
- *p++=*s++;
- while (*s != 0) {
- if (p >= stop) {
- goto stringizeStop;
- } else if (*s == '\n') {
- *p++='\\';
- *p++=*s++;
- } else if (*s == '\\') {
- *p++=*s++;
- *p++=*s++;
- } else if (*s == '\"') {
- *p++='\\';
- *p++=*s++;
- break;
- } else {
- *p++=*s++;
- };
- };
- } else if (*s == '\'') {
- *p++=*s++;
- while (*s != 0) {
- if (p >= stop) {
- goto stringizeStop;
- } else if (*s == '\'') {
- *p++=*s++;
- break;
- } else if (*s == '\\') {
- *p++=*s++;
- *p++=*s++;
- } else if (*s == '\"') {
- *p++='\\';
- *p++=*s++;
- break;
- } else {
- *p++=*s++;
- };
- };
- } else {
- *p++=*s++;
- };
- };
- };
- goto stringizeExit;
-stringizeStop:
- *p++='.';
- *p++='.';
- *p++='.';
-stringizeExit:
- *p=0;
- return stringizeBuf;
-}
-
-#ifdef __USE_PROTOS
-int isNullAction(char *s)
-#else
-int isNullAction(s)
- char *s;
-#endif
-{
- char *p;
- for (p=s; *p != '\0' ; p++) {
- if (*p != ';' && *p !=' ') return 0;
- };
- return 1;
-}
-/* MR1 */
-/* MR1 End of Routine to stringize code for failed predicates msgs */
-/* MR1 */
-
-/* Generate an action. Don't if action is NULL which means that it was already
- * handled as an init action.
- */
-void
-#ifdef __USE_PROTOS
-genAction( ActionNode *p )
-#else
-genAction( p )
-ActionNode *p;
-#endif
-{
- require(p!=NULL, "genAction: invalid node and/or rule");
- require(p->ntype==nAction, "genAction: not action");
-
- if ( !p->done ) /* MR10 */ /* MR11 */
- {
- if ( p->is_predicate)
- {
- if ( p->guardpred != NULL )
- {
- Predicate *guardDup=predicate_dup(p->guardpred); /* MR10 */
- gen("if (!");
- guardDup=genPredTreeMain(guardDup, (Node *)p);
- predicate_free(guardDup);
- }
-/* MR10 */ else if (p->ampersandPred != NULL) {
-/* MR10 */ gen("if (!");
-/* MR10 */ p->ampersandPred=genPredTreeMain(p->ampersandPred, (Node *)p);
-/* MR10 */ }
- else
- {
- gen("if (!(");
- /* make sure that '#line n' is on front of line */
- if ( GenLineInfo && p->file != -1 ) _gen("\n");
- dumpPredAction(p,p->action, output, 0, p->file, p->line, 0);
- _gen(")");
- }
-
-/* MR23 Change failed predicate macro to have three arguments:
-
- macro arg 1: The stringized predicate itself
- macro arg 2: 0 => no user-defined error action
- 1 => user-defined error action
- macro arg 3: The user-defined error action
-
- This gives the user more control of the error action.
-*/
- tabs++;
- gen3(") {zzfailed_pred(\"%s\",%s, { %s } );}\n", /* MR23 */
- stringize(p->action), /* MR23 */
- (p->pred_fail == NULL ? /* MR23/MR27 */
- "0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
- (p->pred_fail == NULL ? /* MR23 */
- "0; /* no user action */" : p->pred_fail)); /* MR23 */
- tabs--;
- }
- else /* not a predicate */
- {
- if (! isNullAction(p->action) && !p->noHoist) {
- if ( FoundGuessBlk ) {
- if ( GenCC ) {
- gen("if ( !guessing ) {\n");
- } else {
- gen("zzNON_GUESS_MODE {\n");
- };
- };
- dumpActionPlus(p, p->action, output, tabs, p->file, p->line, 1); /* MR21 */
- if ( FoundGuessBlk ) gen("}\n");
- };
- }
- }
- TRANS(p->next)
-}
-
-/*
- * if invoking rule has !noAST pass zzSTR to rule ref and zzlink it in
- * else pass addr of temp root ptr (&_ast) (don't zzlink it in).
- *
- * if ! modifies rule-ref, then never link it in and never pass zzSTR.
- * Always pass address of temp root ptr.
- */
-void
-#ifdef __USE_PROTOS
-genRuleRef( RuleRefNode *p )
-#else
-genRuleRef( p )
-RuleRefNode *p;
-#endif
-{
- Junction *q;
- char *handler_id = "";
- RuleEntry *r, *r2;
- char *parm = "", *exsig = "";
-
- int genRuleRef_emittedGuessGuard=0; /* MR10 */
-
- require(p!=NULL, "genRuleRef: invalid node and/or rule");
- require(p->ntype==nRuleRef, "genRuleRef: not rule reference");
-
- if ( p->altstart!=NULL && p->altstart->exception_label!=NULL )
- handler_id = p->altstart->exception_label;
-
- r = (RuleEntry *) hash_get(Rname, p->text);
- if ( r == NULL )
- {
- warnFL( eMsg1("rule %s not defined",
- p->text), FileStr[p->file], p->line );
- return;
- }
-
-/* MR8 5-Aug-97 Reported by S.Bochnak@microtool.com.pl */
-/* Don't do assign when no return values declared */
-/* Move definition of q up and use it to guard p->assign */
-
- q = RulePtr[r->rulenum]; /* find definition of ref'd rule */ /* MR8 */
-
- r2 = (RuleEntry *) hash_get(Rname, p->rname);
- if ( r2 == NULL ) {warnNoFL("Rule hash table is screwed up beyond belief"); return;}
-
- OutLineInfo(output,p->line,FileStr[p->file]);
-
- if ( GenCC && GenAST ) {
- gen("_ast = NULL;\n");
- }
-
- if ( FoundGuessBlk && p->assign!=NULL && q->ret != NULL ) { /* MR8 */
- if ( GenCC ) {
- gen("if ( !guessing ) {\n");
- } else {
- gen("zzNON_GUESS_MODE {\n");
- };
- tabs++; /* MR11 */
- genRuleRef_emittedGuessGuard=1; /* MR11 */
- };
-
- if ( FoundException ) exsig = "&_signal";
-
- tab();
- if ( GenAST )
- {
- if ( GenCC ) {
-/**** if ( r2->noAST || p->astnode==ASTexclude )
-****/
- {
-/**** _gen("_ast = NULL;\n");
-****/
- parm = "&_ast";
- }
-/*** we always want to set just a pointer now, then set correct
-pointer after
-
- else {
- _gen("_astp =
-(_tail==NULL)?(&_sibling):(&(_tail->_right));\n");
- parm = "_astp";
- }
-****/
- }
- else {
- if ( r2->noAST || p->astnode==ASTexclude )
- {
- _gen("_ast = NULL; ");
- parm = "&_ast";
- }
- else parm = "zzSTR";
- }
- if ( p->assign!=NULL && q->ret!=NULL ) /* MR8 */
- {
- if ( !hasMultipleOperands(p->assign) ) {_gen1("%s = ",p->assign);} /* MR23 */
- else _gen1("{ struct _rv%d _trv; _trv = ", r->rulenum);
- }
- if ( FoundException ) {
- _gen5("%s%s(%s,&_signal%s%s); ",
- RulePrefix,
- p->text,
- parm,
- (p->parms!=NULL)?",":"",
- (p->parms!=NULL)?p->parms:"");
- if ( p->ex_group!=NULL ) {
- _gen("\n");
- gen("if (_signal) {\n");
- tabs++;
- dumpException(p->ex_group, 0);
- tabs--;
- gen("}");
- }
- else {
- _gen1("if (_signal) goto %s_handler;", handler_id);
- }
- }
- else {
- _gen5("%s%s(%s%s%s);",
- RulePrefix,
- p->text,
- parm,
- (p->parms!=NULL)?",":"",
- (p->parms!=NULL)?p->parms:"");
- }
- if ( GenCC && (r2->noAST || p->astnode==ASTexclude) )
- {
- /* rule has a ! or element does */
- /* still need to assign to #i so we can play with it */
- _gen("\n");
- gen2("_ast%d%d = (AST *)_ast;", BlkLevel-1, p->elnum);
- }
- else if ( !r2->noAST && p->astnode == ASTinclude )
- {
- /* rule doesn't have a ! and neither does element */
-/* MR10 */ if (FoundGuessBlk && !genRuleRef_emittedGuessGuard) {
-/* MR10 */ _gen("\n");
-/* MR10 */ if (GenCC) gen ("if (!guessing) { /* MR10 */")
-/* MR10 */ else gen ("if (!zzguessing) { /* MR10 */\n");
-/* MR10 */ tabs++;
-/* MR10 */ };
- if ( GenCC ) {
- _gen("\n");
- gen("if ( _tail==NULL ) _sibling = _ast; else _tail->setRight(_ast);\n");
- gen2("_ast%d%d = (AST *)_ast;\n", BlkLevel-1, p->elnum);
- tab();
- }
- else _gen(" ");
- if ( GenCC ) {
- _gen("ASTBase::"); }
- else _gen("zz");
- _gen("link(_root, &_sibling, &_tail);");
-
-/* MR10 */ if (FoundGuessBlk && !genRuleRef_emittedGuessGuard) { /* MR10 */
-/* MR10 */ _gen("\n");
-/* MR10 */ tabs--;
-/* MR10 */ if (GenCC) gen ("}; /* MR10 */")
-/* MR10 */ else gen ("}; /* MR10 */");
-/* MR10 */ };
- }
- }
- else
- {
- if ( p->assign!=NULL && q->ret!=NULL ) /* MR8 */
- {
- if ( !hasMultipleOperands(p->assign) ) {_gen1("%s = ",p->assign);} /* MR23 */
- else _gen1("{ struct _rv%d _trv; _trv = ", r->rulenum);
- }
- if ( FoundException ) {
- _gen4("%s%s(&_signal%s%s); ",
- RulePrefix,
- p->text,
- (p->parms!=NULL)?",":"",
- (p->parms!=NULL)?p->parms:"");
- if ( p->ex_group!=NULL ) {
- _gen("\n");
- gen("if (_signal) {\n");
- tabs++;
- dumpException(p->ex_group, 0);
- tabs--;
- gen("}");
- }
- else {
- _gen1("if (_signal) goto %s_handler;", handler_id);
- }
- }
- else {
- _gen3("%s%s(%s);",
- RulePrefix,
- p->text,
- (p->parms!=NULL)?p->parms:"");
- }
- if ( p->assign!=NULL && q->ret!=NULL ) _gen("\n"); /* MR8 */
- }
-
- if ( p->assign!=NULL && q->ret!=NULL) { /* MR8 */
- if ( hasMultipleOperands(p->assign) ) /* MR23 */
- {
- _gen("\n");
- dumpRetValAssign(p->assign, q->ret, p); /* MR30 */
- _gen("}");
- }
- }
- _gen("\n");
-
- /* Handle element labels now */
- if ( p->el_label!=NULL )
- {
- if ( GenAST )
- {
- if ( GenCC ) {
- gen3("%s_ast = _ast%d%d;\n", p->el_label, BlkLevel-1, p->elnum);
- }
- else {gen1("%s_ast = zzastCur;\n", p->el_label);}
- }
- else if (!GenCC ) {
- gen1("%s = zzaCur;\n", p->el_label);
- }
- }
-
- if ( FoundGuessBlk && p->assign!=NULL && q->ret!=NULL ) { /* MR8 */
- /* in guessing mode, don't branch to handler upon error */
- tabs--; /* MR11 */
- gen("} else {\n");
- tabs++; /* MR11 */
- if ( FoundException ) {
- gen6("%s%s(%s%s&_signal%s%s);\n",
- RulePrefix,
- p->text,
- parm,
- (*parm!='\0')?",":"",
- (p->parms!=NULL)?",":"",
- (p->parms!=NULL)?p->parms:"");
- }
- else {
- gen5("%s%s(%s%s%s);\n",
- RulePrefix,
- p->text,
- parm,
- (p->parms!=NULL && *parm!='\0')?",":"",
- (p->parms!=NULL)?p->parms:"");
- }
- tabs--; /* MR11 */
- gen("}\n");
- }
- TRANS(p->next)
-}
-
-/*
- * Generate code to match a token.
- *
- * Getting the next token is tricky. We want to ensure that any action
- * following a token is executed before the next GetToken();
- */
-void
-#ifdef __USE_PROTOS
-genToken( TokNode *p )
-#else
-genToken( p )
-TokNode *p;
-#endif
-{
- RuleEntry *r;
- char *handler_id = "";
- ActionNode *a;
- char *set_name;
- char *set_nameErrSet;
- int complement;
- int ast_label_in_action = 0; /* MR27 */
- int pushedCmodeAST = 0; /* MR27 */
-
- require(p!=NULL, "genToken: invalid node and/or rule");
- require(p->ntype==nToken, "genToken: not token");
- if ( p->altstart!=NULL && p->altstart->exception_label!=NULL )
- handler_id = p->altstart->exception_label;
-
- r = (RuleEntry *) hash_get(Rname, p->rname);
- if ( r == NULL ) {warnNoFL("Rule hash table is screwed up beyond belief"); return;}
-
-/*
- * MR27 Has the element label been referenced as an AST (with the # operator) ?
- * If so, then we'll want to build the AST even though the user has used
- * the ! operator.
- */
-/* MR27 */ if (GenAST && p->el_label != NULL) {
-/* MR27 */ ast_label_in_action = list_search_cstring(r->ast_labels_in_actions,
-/* MR27 */ p->el_label);
-/* MR27 */ }
-
- OutLineInfo(output,p->line,FileStr[p->file]);
-
- if ( !set_nil(p->tset) ) /* implies '.', ~Tok, or tokenclass */
- {
- unsigned e;
- unsigned eErrSet = 0;
- set b;
- set bErrSet; /* MR23 */
- b = set_dup(p->tset);
- bErrSet = set_dup(p->tset); /* MR23 */
- complement = p->complement; /* MR23 */
- if ( p->tclass!=NULL && complement == 0 /* MR23 */) { /* token class not complemented*/
- static char buf[MaxRuleName+20]; /* MR23 */
- static char bufErrSet[MaxRuleName+20]; /* MR23 */
- if ( p->tclass->dumped ) {
- e = p->tclass->setnum;
- eErrSet = p->tclass->setnumErrSet;
- }
- else {
- e = DefErrSet(&b, 0, TokenString(p->token));
- eErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, TokenString(p->token), "_errset");
- p->tclass->dumped = 1; /* indicate set has been created */
- p->tclass->setnum = e;
- p->tclass->setnumErrSet = eErrSet; /* MR23 */
- }
- sprintf(buf, "%s_set", TokenString(p->token));
- sprintf(bufErrSet, "%s_errset", TokenString(p->token)); /* MR23 */
- set_name = buf;
- set_nameErrSet = bufErrSet; /* MR23 */
- }
-
- /* MR23 - Forgot about the case of ~TOKCLASS. */
-
- else if ( p->tclass!=NULL && complement != 0 /* MR23 */)
- {
- static char buf[MaxRuleName+20]; /* MR23 */
- static char bufErrSet[MaxRuleName+20]; /* MR23 */
- if ( p->tclass->dumpedComplement ) {
- e = p->tclass->setnumComplement;
- eErrSet = p->tclass->setnumErrSetComplement;
- }
- else {
- e = DefErrSetWithSuffix(0, &b, 0, TokenString(p->token), "_setbar");
- eErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, TokenString(p->token), "_errsetbar");
- p->tclass->dumpedComplement = 1; /* indicate set has been created */
- p->tclass->setnumComplement = e;
- p->tclass->setnumErrSetComplement = eErrSet; /* MR23 */
- }
- sprintf(buf, "%s_setbar", TokenString(p->token));
- sprintf(bufErrSet, "%s_errsetbar", TokenString(p->token)); /* MR23 */
- set_name = buf;
- set_nameErrSet = bufErrSet; /* MR23 */
- }
- else { /* wild card */
- static char buf[sizeof("zzerr")+10];
- static char bufErrSet[sizeof("zzerr")+10];
- int n = DefErrSet( &b, 0, NULL );
- int nErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, NULL, "_set");
- if ( GenCC ) sprintf(buf, "err%d", n);
- else sprintf(buf, "zzerr%d", n);
- if ( GenCC ) sprintf(bufErrSet, "err%d", nErrSet);
- else sprintf(bufErrSet, "zzerr%d", nErrSet);
- set_name = buf;
- set_nameErrSet = bufErrSet;
- }
-
- if ( !FoundException ) {
-/* MR23 */ gen2("zzsetmatch(%s, %s);", set_name, set_nameErrSet);
- }
- else if ( p->ex_group==NULL ) {
- if ( p->use_def_MT_handler )
- gen3("zzsetmatch_wdfltsig(%s,(ANTLRTokenType)%d,%s);",
- set_name,
- p->token,
- tokenFollowSet(p))
- else
- gen2("zzsetmatch_wsig(%s, %s_handler);",
- set_name,
- handler_id);
- }
- else
- {
- gen1("if ( !_setmatch_wsig(%s) ) {\n", set_name);
- tabs++;
-/* MR6 */ if (FoundGuessBlk) {
-/* MR6 */ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");}
-/* MR6 */ else gen("if ( zzguessing ) goto fail;\n");
-/* MR6 */ };
- gen("_signal=MismatchedToken;\n");
- dumpException(p->ex_group, 0);
- tabs--;
- gen("}\n");
- }
- set_free(b);
- set_free(bErrSet);
- }
- else if ( TokenString(p->token)!=NULL )
- {
- if ( FoundException ) {
- if ( p->use_def_MT_handler )
- gen2("zzmatch_wdfltsig(%s,%s);",TokenString(p->token),tokenFollowSet(p))
- else if ( p->ex_group==NULL )
- {
- gen2("zzmatch_wsig(%s, %s_handler);",
- TokenString(p->token),
- handler_id);
- }
- else
- {
-/* MR6 */ if (GenCC) {
-/* MR6 */ gen1("if ( !_match_wsig(%s) ) {\n", TokenString(p->token));
-/* MR6 */ } else {
-/* MR6 */ gen1("if ( !_zzmatch_wsig(%s) ) {\n", TokenString(p->token));
-/* MR6 */ };
- tabs++;
-/* MR6 */ if (FoundGuessBlk) {
-/* MR6 */ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");}
-/* MR6 */ else gen("if ( zzguessing ) goto fail;\n");
-/* MR6 */ };
- gen("_signal=MismatchedToken;\n");
- dumpException(p->ex_group, 0);
- tabs--;
- gen("}\n");
- }
- }
- else gen1("zzmatch(%s);", TokenString(p->token));
- }
- else {
- if ( FoundException ) {
- if ( p->use_def_MT_handler )
- gen2("zzmatch_wdfltsig((ANTLRTokenType)%d,%s);",
- p->token,tokenFollowSet(p))
- else
- gen2("zzmatch_wsig(%d,%s_handler);",p->token,handler_id);
- }
- else {gen1("zzmatch(%d);", p->token);}
- }
-
- a = findImmedAction( p->next );
- /* generate the token labels */
- if ( GenCC && p->elnum>0 )
- {
- /* If building trees in C++, always gen the LT() assigns */
- if ( set_el(p->elnum, tokensRefdInBlock) || GenAST )
- {
-/* MR10 */ if ( FoundGuessBlk ) {
-/* MR10 */ gen("\n");
-/* MR10 */ if (p->label_used_in_semantic_pred) {
-/* MR10 */ gen2(" _t%d%d = (ANTLRTokenPtr)LT(1); /* MR10 */\n", BlkLevel-1, p->elnum);
-/* MR10 */ } else {
-/* MR10 */ gen("if ( !guessing ) {\n"); tab();
-/* MR10 */ _gen2(" _t%d%d = (ANTLRTokenPtr)LT(1);\n", BlkLevel-1, p->elnum);
-/* MR10 */ gen("}\n");
-/* MR10 */ };
-/* MR10 */ } else {
-/* MR10 */ _gen2(" _t%d%d = (ANTLRTokenPtr)LT(1);", BlkLevel-1, p->elnum);
-/* MR10 */ };
-/* MR10 */
- }
-
-/*
- * MR23 labase is never used in the C++ runtime library.
- * and this code is generated only in C++ mode
- */
-
-/*** if ( LL_k>1 ) / * MR23 disabled */
-/*** if ( !DemandLookahead ) _gen(" labase++;"); / * MR23 disabled */
-/*** _gen("\n"); / * MR23 disabled */
-/*** tab(); / * MR23 disabled */
- }
- if ( GenAST )
- {
- if ( FoundGuessBlk &&
- (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST)) )
- {
- if ( GenCC ) {_gen("if ( !guessing ) {\n"); tab();}
- else {_gen("zzNON_GUESS_MODE {\n"); tab();}
- }
-
-/* MR27 addition when labels referenced when operator ! used */
-
- pushedCmodeAST = 0; /* MR27 */
- if (ast_label_in_action && (p->astnode == ASTexclude || r->noAST)) {
- _gen("\n");
- if (GenCC) {
-/* MR13 */ if (NewAST) {
-/* MR13 */ gen4("_ast%d%d = newAST(_t%d%d); /* MR27 */\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
-/* MR13 */ } else {
-/* MR13 */ gen4("_ast%d%d = new AST(_t%d%d); /* MR27 */\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
-/* MR13 */ }
- }
- else {
- pushedCmodeAST = 1;
- gen("zzastPush(zzmk_ast(zzastnew(),zzaCur)); /* MR27 */");
- }
- }
-
-/* end MR27 addition for labels referenced when operator ! used */
-
- if (!r->noAST )
- {
- if (GenCC && !(p->astnode == ASTexclude) ) {
- _gen("\n");
-/* MR13 */ if (NewAST) {
-/* MR13 */ gen4("_ast%d%d = newAST(_t%d%d);\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
-/* MR13 */ } else {
-/* MR13 */ gen4("_ast%d%d = new AST(_t%d%d);\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum);
-/* MR13 */ }
- tab();
- }
- if ( GenCC && !(p->astnode == ASTexclude) )
- {_gen2("_ast%d%d->", BlkLevel-1, p->elnum);}
- else _gen(" ");
- if ( p->astnode==ASTchild ) {
- if ( !GenCC ) _gen("zz");
- _gen("subchild(_root, &_sibling, &_tail);");
- }
- else if ( p->astnode==ASTroot ) {
- if ( !GenCC ) _gen("zz");
- _gen("subroot(_root, &_sibling, &_tail);");
- }
- if ( GenCC && !(p->astnode == ASTexclude) ) {
- _gen("\n");
- tab();
- }
- }
- else if ( !GenCC ) {
- if (! pushedCmodeAST) _gen(" zzastDPush;");
- }
- if ( FoundGuessBlk &&
- (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST)) )
- {gen("}\n"); tab();}
- }
-
- /* Handle element labels now */
- if ( p->el_label!=NULL )
- {
- int done_NON_GUESSMODE=0;
-
- _gen("\n");
-
-/* MR10 */ /* do Attrib / Token ptr for token label used in semantic pred */
-/* MR10 */ /* for these cases do assign even in guess mode */
-/* MR10 */
-/* MR10 */ if (p->label_used_in_semantic_pred) {
-/* MR10 */ if ( GenCC ) {
-/* MR10 */ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) {
-/* MR10 */ gen3("%s = _t%d%d;", p->el_label, BlkLevel-1, p->elnum);
-/* MR10 */ } else {
-/* MR10 */ gen1("%s = (ANTLRTokenPtr)LT(1);\n", p->el_label);
-/* MR10 */ };
-/* MR10 */ } else {
-/* MR10 */ gen1("%s = zzaCur;", p->el_label);
-/* MR10 */ };
-/* MR10 */ if (FoundGuessBlk) _gen(" /* MR10 */");
-/* MR10 */ _gen("\n");
-/* MR10 */ };
-
- /* Do Attrib / Token ptr */
-
-/* MR10 */ if (! p->label_used_in_semantic_pred) {
-/* MR10 */
-/* MR10 */ if ( FoundGuessBlk ) {
-/* MR10 */ if (! done_NON_GUESSMODE) {
-/* MR10 */ done_NON_GUESSMODE=1;
-/* MR10 */ if ( GenCC ) {gen("if ( !guessing ) {\n"); tab();}
-/* MR10 */ else {gen("zzNON_GUESS_MODE {\n"); tab();}
-/* MR10 */ };
-/* MR10 */ };
-/* MR10 */
-/* MR10 */ if ( GenCC ) {
-/* MR10 */ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) {
-/* MR10 */ gen3("%s = _t%d%d;\n", p->el_label, BlkLevel-1, p->elnum);
-/* MR10 */ } else {
-/* MR10 */ gen1("%s = (ANTLRTokenPtr)LT(1);\n", p->el_label);
-/* MR10 */ };
-/* MR10 */ } else {
-/* MR10 */ gen1("%s = zzaCur;\n", p->el_label);
-/* MR10 */ };
-/* MR10 */ };
-
- /* Do AST ptr */
-
- if (GenAST && (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST) )) /* MR27 */
- {
-
-/* MR10 */ if ( FoundGuessBlk ) {
-/* MR10 */ if (! done_NON_GUESSMODE) {
-/* MR10 */ done_NON_GUESSMODE=1;
-/* MR10 */ if ( GenCC ) {gen("if ( !guessing ) {\n"); tab();}
-/* MR10 */ else {gen("zzNON_GUESS_MODE {\n"); tab();}
-/* MR10 */ };
-/* MR10 */ };
-
- if ( GenCC ) {
- gen3("%s_ast = _ast%d%d;\n", p->el_label, BlkLevel-1, p->elnum);
- }
- else {gen1("%s_ast = zzastCur;\n", p->el_label);}
- }
-
-/* MR10 */ if (done_NON_GUESSMODE) {
-/* MR10 */ gen("}\n"); tab();
-/* MR10 */ };
-
- }
-
- /* Handle any actions immediately following action */
- if ( a != NULL ) /* MR10 */ /* MR11 */
- {
- /* delay next token fetch until after action */
- _gen("\n");
- if ( a->is_predicate)
- {
-#if 0
-/* Disabled in MR30 ************************************************************
- And moved into genAction
- *****************************************************************************
-*/
-
- gen("if (!(");
-
- /* make sure that '#line n' is on front of line */ /* MR14 */
- if ( GenLineInfo && p->file != -1 ) _gen("\n"); /* MR14 */
- dumpPredAction(a,a->action, output, 0, a->file, a->line, 0);
-
-/* MR23 Change failed predicate macro to have three arguments:
-
- macro arg 1: The stringized predicate itself
- macro arg 2: 0 => no user-defined error action
- 1 => user-defined error action
- macro arg 3: The user-defined error action
-
- This gives the user more control of the error action.
-*/
- _gen(")) \n");
- tabs++;
- gen3(" {zzfailed_pred(\"%s\",%s,{ %s } );}\n", /* MR23 */
- stringize(a->action), /* MR23 */
- (a->pred_fail == NULL ? /* MR23/MR27 */
- "0 /* report */" : "1 /* user action */"), /* MR23/MR27 */
- (a->pred_fail == NULL ? /* MR23 */
- "0; /* no user action */" : a->pred_fail)); /* MR23 */
- tabs--;
-/* Disabled in MR30 ************************************************************
- And moved into genAction
- *****************************************************************************
-*/
-#endif
- }
- else /* MR9 a regular action - not a predicate action */
- {
-
-/* MR23: Search an action which is not a predicate for LT(i),
- LA(i), or LATEXT(i) in order to warn novice users that
- it refers to the previous matched token, not the next
- one. This is different than the case for semantic
- predicates.
-*/
-
-/* MR23 */ if (GenCC) {
-/* MR23 */ if (strstr(a->action, "LT(") != NULL) LTinTokenAction = 1;
-/* MR23 */ }
-/* MR23 */ else {
-/* MR23 */ if (strstr(a->action, "LA(") != NULL) LTinTokenAction = 1;
-/* MR23 */ if (strstr(a->action, "LATEXT(") != NULL) LTinTokenAction = 1;
-/* MR23 */ }
-
- if ( FoundGuessBlk ) {
- if ( GenCC ) {gen("if ( !guessing ) {\n");}
- else gen("zzNON_GUESS_MODE {\n");
- }
- dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1); /* MR21 */
- if ( FoundGuessBlk ) gen("}\n");
- a->done = 1; /* MR30 */
- }
-/*** a->done = 1; MR30 Moved up into then branch for true actions, but not predicates ***/
- if ( !DemandLookahead ) {
- if ( GenCC ) {
- if ( FoundException && p->use_def_MT_handler ) gen("if (!_signal)");
- _gen(" consume();")
- if ( FoundException && p->use_def_MT_handler )
- _gen(" _signal=NoSignal;");
- _gen("\n");
- }
- else
- {
- if ( FoundException && p->use_def_MT_handler ) _gen("if (!_signal)");
- _gen(" zzCONSUME;\n");
- if ( FoundException && p->use_def_MT_handler ) _gen(" _signal=NoSignal;");
- _gen("\n");
- }
- }
- else gen("\n");
- if (a->done) { /* MR30 */
- TRANS( a->next ); /* MR30 */
- } /* MR30 */
- else { /* MR30 */
- TRANS( p->next ); /* MR30 */
- } /* MR30 */
- }
- else
- {
- if ( !DemandLookahead ) {
- if ( GenCC ) {
- if (FoundException && p->use_def_MT_handler) _gen("if (!_signal)");
- _gen(" consume();")
- if (FoundException&&p->use_def_MT_handler) _gen(" _signal=NoSignal;");
- _gen("\n");
- }
- else {
- if (FoundException && p->use_def_MT_handler) _gen("if (!_signal)");
- _gen(" zzCONSUME;");
- if ( FoundException && p->use_def_MT_handler ) _gen(" _signal=NoSignal;");
- _gen("\n");
- }
- }
- else _gen("\n");
- TRANS(p->next);
- }
-}
-
-/* MR21
- *
- * There was a bug in the code generation for {...} which causes it
- * to omit the optional tokens from the error messages. The easiest
- * way to fix this was to make the opt block look like a sub block:
- *
- * { a | b | c }
- *
- * becomes (internally):
- *
- * ( a | b | c | )
- *
- * The code for genOptBlk is now identical to genSubBlk except for
- * cosmetic changes.
- */
-
-void
-#ifdef __USE_PROTOS
-genOptBlk( Junction *q )
-#else
-genOptBlk( q )
-Junction *q;
-#endif
-{
- int max_k;
- set f;
- int need_right_curly;
- set savetkref;
- int lastAltEmpty; /* MR23 */
- savetkref = tokensRefdInBlock;
- require(q->ntype == nJunction, "genOptBlk: not junction");
- require(q->jtype == aOptBlk, "genOptBlk: not opt block");
-
- OutLineInfo(output,q->line,FileStr[q->file]);
- BLOCK_Preamble(q);
- BlkLevel++;
- BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */
- f = genBlk(q, aOptBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
-/* MR23
- Bypass error clause generation when exceptions are used in {...} block
- See multi-line note in genBlk near call to isEmptyAlt.
-*/
- if (! FoundException) {
- if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );}
- }
- else {
- gen("/* MR23 skip error clause for {...} when exceptions in use */\n");
- }
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- freeBlkFsets(q);
- --BlkLevel;
- BLOCK_Tail();
-
- if ( q->guess )
- {
- gen("zzGUESS_DONE\n");
- }
-
- /* must duplicate if (alpha)?; one guesses (validates), the
- * second pass matches */
- if ( q->guess && analysis_point(q)==q )
- {
- OutLineInfo(output,q->line,FileStr[q->file]);
- BLOCK_Preamble(q);
- BlkLevel++;
- f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
- if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );}
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- freeBlkFsets(q);
- --BlkLevel;
- BLOCK_Tail();
- }
-
- tokensRefdInBlock = savetkref;
- if (q->end->p1 != NULL) TRANS(q->end->p1);
-}
-
-/*
- * Generate code for a loop blk of form:
- *
- * |---|
- * v |
- * --o-G-o-->o--
- */
-void
-#ifdef __USE_PROTOS
-genLoopBlk( Junction *begin, Junction *q, Junction *start, int max_k )
-#else
-genLoopBlk( begin, q, start, max_k )
-Junction *begin;
-Junction *q;
-Junction *start; /* where to start generating code from */
-int max_k;
-#endif
-{
- set f;
- int need_right_curly;
- set savetkref;
- Junction *guessBlock; /* MR10 */
- int singleAlt; /* MR10 */
- int lastAltEmpty; /* MR23 */
-
- savetkref = tokensRefdInBlock;
- require(q->ntype == nJunction, "genLoopBlk: not junction");
- require(q->jtype == aLoopBlk, "genLoopBlk: not loop block");
-
- if ( q->visited ) return;
- q->visited = TRUE;
-
- /* first_item_is_guess_block doesn't care what kind of node it is */
-
- guessBlock=first_item_is_guess_block( (Junction *) q->p1); /* MR10 */
- singleAlt=q->p2==NULL; /* MR10 */
-
- if (singleAlt && !guessBlock) /* MR10 */ /* only one alternative? */
- {
- if ( DemandLookahead ) {
- if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
- else gen1("look(%d);\n", max_k);
- }
- gen("while ( ");
- if ( begin!=NULL ) genExpr(begin);
- else genExpr(q);
- /* if no predicates have been hoisted for this single alt (..)*
- * do so now
- */
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- if ( ParseWithPredicates && begin->predicate==NULL )
- {
- Predicate *a = MR_find_predicates_and_supp((Node *)q->p1);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
-
- if ( a!=NULL )
- {
- _gen("&&");
- a=genPredTreeMain(a, (Node *)q); /* MR10 */
- }
-/* MR10 */ if (MRhoisting) {
-/* MR10 */ predicate_free(a);
-/* MR10 */ };
- }
- _gen(" ) {\n");
- tabs++;
- TRANS(q->p1);
- if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1);
- if ( DemandLookahead ) {
- if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
- else gen1("look(%d);\n", max_k);
- }
- --tabs;
- gen("}\n");
- freeBlkFsets(q);
- q->visited = FALSE;
- tokensRefdInBlock = savetkref;
- return;
- }
- gen("for (;;) {\n"); /* MR20 G. Hobbelt */
- tabs++;
-/* MR6 */
-/* MR6 "begin" can never be null when called from genLoopBegin */
-/* MR6 because q==(Junction *)begin->p1 and we know q is valid */
-/* MR6 */
-/* MR6 from genLoopBegin: */
-/* MR6 */
-/* MR6 if ( LL_k>1 && !set_nil(q->fset[2]) ) */
-/* MR6 genLoopBlk( q, (Junction *)q->p1, q, max_k ); */
-/* MR6 else genLoopBlk( q, (Junction *)q->p1, NULL, max_k ); */
-/* MR6 */
- if ( begin!=NULL )
- {
- if ( DemandLookahead )
- {
- if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
- else gen1("look(%d);\n", max_k);
- }
- /* The bypass arc of the (...)* predicts what to do when you fail, but
- * ONLY after having tested the loop start expression. To avoid this,
- * we simply break out of the (...)* loop when we find something that
- * is not in the prediction of the loop (all alts thereof).
- */
- gen("if ( !(");
-
-/*** TJP says: It used to use the prediction expression for the bypass arc
- of the (...)*. HOWEVER, if a non LL^1(k) decision was found, this
- thing would miss the ftree stored in the aLoopBegin node and generate
- an LL^1(k) decision anyway.
-
- *** genExpr((Junction *)begin->p2);
- ***/
-
- genExpr((Junction *)begin);
- _gen(")) break;\n");
-
- }
-
- /* generate code for terminating loop (this is optional branch) */
-
- f = genBlk(q, aLoopBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
- set_free(f);
- freeBlkFsets(q);
-
- /* generate code for terminating loop (this is optional branch) */
-
-/* MR6 */
-/* MR6 30-May-97 Bug reported by Manuel Ornato */
-/* MR6 A definite bug involving the exit from a loop block */
-/* MR6 In 1.23 and later versions (including 1.33) Instead */
-/* MR6 exiting the block and reporting a syntax error the */
-/* MR6 code loops forever. */
-/* MR6 Looking at 1.20 which generates proper code it is not */
-/* MR6 clear which of two changes should be undone. */
-/* MR6 This is my best guess. */
-/* MR6 From earlier MR6 note we know that begin can never be */
-/* MR6 null when genLoopBlk called from genLoopBegin */
-/* MR6 */
-/* MR6 */ if ( begin==NULL) {
-/* MR6 */ /* code for exiting loop "for sure" */
-/* MR6 */ gen("/* Suppressed by MR6 */ /*** else break; ***/\n");
-/* MR6 */ };
-
-/* MR10 */if (singleAlt && guessBlock) {
-/* MR10 */ tabs--;
-/* MR6 */ gen("} else break; /* MR6 code for exiting loop \"for sure\" */\n");
-/* MR10 */ need_right_curly--;
-/* MR10 */ } else {
-/* MR6 */ gen("else break; /* MR6 code for exiting loop \"for sure\" */\n");
-/* MR10 */ };
-
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1);
- --tabs;
- gen("}\n");
- q->visited = FALSE;
- tokensRefdInBlock = savetkref;
-}
-
-/*
- * Generate code for a loop blk of form:
- *
- * |---|
- * v |
- * --o-->o-->o-G-o-->o--
- * | ^
- * v |
- * o-----------o
- *
- * q->end points to the last node (far right) in the blk.
- *
- * Note that q->end->jtype must be 'EndBlk'.
- *
- * Generate code roughly of the following form:
- *
- * do {
- * ... code for alternatives ...
- * } while ( First Set of aLoopBlk );
- *
- * OR if > 1 alternative
- *
- * do {
- * ... code for alternatives ...
- * else break;
- * } while ( 1 );
- */
-void
-#ifdef __USE_PROTOS
-genLoopBegin( Junction *q )
-#else
-genLoopBegin( q )
-Junction *q;
-#endif
-{
- set f;
- int i;
- int max_k;
- set savetkref;
- savetkref = tokensRefdInBlock;
- require(q!=NULL, "genLoopBegin: invalid node and/or rule");
- require(q->ntype == nJunction, "genLoopBegin: not junction");
- require(q->jtype == aLoopBegin, "genLoopBegin: not loop block");
- require(q->p2!=NULL, "genLoopBegin: invalid Loop Graph");
-
- OutLineInfo(output,q->line,FileStr[q->file]);
-
- BLOCK_Preamble(q);
- BlkLevel++;
- BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */
- f = First(q, 1, aLoopBegin, &max_k);
- /* If not simple LL(1), must specify to start at LoopBegin, not LoopBlk */
- if ( LL_k>1 && !set_nil(q->fset[2]) )
- genLoopBlk( q, (Junction *)q->p1, q, max_k );
- else genLoopBlk( q, (Junction *)q->p1, NULL, max_k );
-
- for (i=1; i<=CLL_k; i++) set_free(q->fset[i]);
- for (i=1; i<=CLL_k; i++) set_free(((Junction *)q->p2)->fset[i]);
- --BlkLevel;
- BLOCK_Tail();
- set_free(f);
- tokensRefdInBlock = savetkref;
-/* MR21 */ if (MR_BlkErr) {
-/* MR21 */ set f, fArray[2];
-/* MR21 */ f = ComputeErrorSet(q,1,0 /* use plus block bypass ? */ );
-/* MR21 */ fArray[0]= empty;
-/* MR21 */ fArray[1]= set_dup(f);
-/* MR21 */ gen("if (");
-/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */
-/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n");
-/* MR21 */ tabs++;
-/* MR21 */ tab();
-/* MR21 */ _gen("/* nothing */ }\n");
-/* MR21 */ tab();
-/* MR21 */ makeErrorClause(q,f,1,0 /* use plus block bypass ? */ ); /* frees set */
-/* MR21 */ tabs--;
-/* MR21 */ };
- if (q->end->p1 != NULL) TRANS(q->end->p1);
-}
-
-/*
- * Generate code for a loop blk of form:
- *
- * |---|
- * v |
- * --o-G-o-->o--
- *
- * q->end points to the last node (far right) in the blk.
- * Note that q->end->jtype must be 'EndBlk'.
- *
- * Generate code roughly of the following form:
- *
- * do {
- * ... code for alternatives ...
- * } while ( First Set of aPlusBlk );
- *
- * OR if > 1 alternative
- *
- * do {
- * ... code for alternatives ...
- * else if not 1st time through, break;
- * } while ( 1 );
- */
-void
-#ifdef __USE_PROTOS
-genPlusBlk( Junction *q )
-#else
-genPlusBlk( q )
-Junction *q;
-#endif
-{
- int max_k;
- set f;
- int need_right_curly;
- int lastAltEmpty; /* MR23 */
- set savetkref;
- Junction *guessBlock; /* MR10 */
- int singleAlt; /* MR10 */
-
- savetkref = tokensRefdInBlock;
- require(q!=NULL, "genPlusBlk: invalid node and/or rule");
- require(q->ntype == nJunction, "genPlusBlk: not junction");
- require(q->jtype == aPlusBlk, "genPlusBlk: not Plus block");
- require(q->p2 != NULL, "genPlusBlk: not a valid Plus block");
-
- if ( q->visited ) return;
- q->visited = TRUE;
- OutLineInfo(output,q->line,FileStr[q->file]);
- BLOCK_Preamble(q);
- BlkLevel++;
-
- BlockPreambleOption((Junction *)q, q->pFirstSetSymbol); /* MR21 */
-
- /* first_item_is_guess_block doesn't care what kind of node it is */
-
- guessBlock=first_item_is_guess_block( (Junction *)q->p1); /* MR10 */
-
- /* if the ignore flag is set on the 2nd alt and that alt is empty,
- * then it is the implied optional alternative that we added for (...)+
- * and, hence, only 1 alt.
- */
-
-/* MR10 Reported by Pulkkinen Esa (esap@cs.tut.fi)
- * Outer code for guess blocks ignored when there is only one alt
- * for a (...)+ block.
- * Force use of regular code rather than "optimized" code for that case
- */
-
- singleAlt=( ( (Junction *) q->p2)->p2 == NULL) &&
- ( ( (Junction *) q->p2)->ignore ); /* only one alternative? */
-
- if (singleAlt && !guessBlock) /* MR10 */
- {
-
- Predicate *a=NULL;
- /* if the only alt has a semantic predicate, hoist it; must test before
- * entering loop.
- */
- if ( ParseWithPredicates )
- {
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
- a = MR_find_predicates_and_supp((Node *)q);
- require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty");
-
- if ( a!=NULL ) {
- gen("if (");
- a=genPredTreeMain(a, (Node *)q); /* MR10 */
- _gen(") {\n");
- }
- }
- gen("do {\n");
- tabs++;
- TRANS(q->p1);
- if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1);
- f = First(q, 1, aPlusBlk, &max_k);
- if ( DemandLookahead ) {
- if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
- else gen1("look(%d);\n", max_k);
- }
- --tabs;
- gen("} while ( ");
- if ( q->parm!=NULL && q->predparm ) _gen1("(%s) && ", q->parm);
- genExpr(q);
- if ( ParseWithPredicates && a!=NULL )
- {
- if (! MR_comparePredicates(q->predicate,a)) {
- _gen("&&");
- a=genPredTreeMain(a, (Node *)q); /* MR10 */
- };
- }
- _gen(" );\n");
- if ( ParseWithPredicates && a!=NULL ) gen("}\n");
- --BlkLevel;
- BLOCK_Tail();
- q->visited = FALSE;
- freeBlkFsets(q);
- set_free(f);
- tokensRefdInBlock = savetkref;
-/* MR21 */ if (MR_BlkErr) {
-/* MR21 */ set f, fArray[2];
-/* MR21 */ f = ComputeErrorSet(q,1,1 /* use plus block bypass ? */ );
-/* MR21 */ fArray[0]= empty;
-/* MR21 */ fArray[1]= set_dup(f);
-/* MR21 */ gen("if (");
-/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */
-/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n");
-/* MR21 */ tabs++;
-/* MR21 */ tab();
-/* MR21 */ _gen("/* nothing */ }\n");
-/* MR21 */ tab();
-/* MR21 */ makeErrorClause(q,f,1,1 /* use plus block bypass ? */ ); /* frees set */
-/* MR21 */ tabs--;
-/* MR21 */ };
- if (q->end->p1 != NULL) TRANS(q->end->p1);
-/* MR10 */ if (MRhoisting) {
-/* MR10 */ predicate_free(a);
-/* MR10 */ };
- return;
- }
- gen("do {\n");
- tabs++;
- f = genBlk(q, aPlusBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
-/* MR6 */
-/* MR6 Sinan Karasu (sinan@tardis.ds.boeing.com) */
-/* MR6 Failed to turn off guess mode when leaving block */
-/* MR6 */
-/* MR6 */ if ( has_guess_block_as_last_item(q) ) {
-/* MR10 */ gen("/* MR10 ()+ */ else {\n");
-/* MR10 */ tabs++;
-/* MR10 */ need_right_curly++;
-/* MR10 */ gen("/* MR10 ()+ */ if ( !zzrv ) zzGUESS_DONE;\n");
-/* MR6 */ gen("/* MR10 ()+ */ if ( zzcnt > 1 ) break;\n");
-/* MR10 */ } else {
-/* MR10 */ gen("/* MR10 ()+ */ else {\n");
-/* MR10 */ tabs++;
-/* MR10 */ need_right_curly++;
-/* MR10 */ gen("if ( zzcnt > 1 ) break;\n");
-/* MR10 */ };
-
-/* MR21 */ if (MR_BlkErr && 1 >= max_k) {
-/* MR21 */ set f;
-/* MR21 */ f = ComputeErrorSet(q,1,0 /* use plus block bypass ? */ );
-/* MR21 */ tabs++;
-/* MR21 */ tab();
-/* MR21 */ makeErrorClause(q,f,1,0 /* use plus block bypass ? */ ); /* frees set */
-/* MR21 */ tabs--;
-/* MR21 */ }
-/* MR21 */ else {
- tab();
- makeErrorClause(q,f,max_k,1 /* use plus block bypass ? */);
- /* MR21 I think this generates the wrong set ? */
- /* MR21 because it includes the plus block bypass ? */
- /* MR21 but I'm afraid to change it without additional checking */
- }
-
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- freeBlkFsets(q);
- gen("zzcnt++;");
- if ( !GenCC ) _gen1(" zzLOOP(zztasp%d);", BlkLevel-1);
- _gen("\n");
- if ( DemandLookahead ) {
- if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);}
- else gen1("look(%d);\n", max_k);
- }
- --tabs;
- if ( q->parm!=NULL && q->predparm ) {gen1("} while (%s);\n", q->parm);}
- else gen("} while ( 1 );\n");
- --BlkLevel;
- BLOCK_Tail();
- q->visited = FALSE;
- tokensRefdInBlock = savetkref;
-/* MR21 */ if (MR_BlkErr) {
-/* MR21 */ set f, fArray[2];
-/* MR21 */ f = ComputeErrorSet(q,1,1 /* use plus block bypass ? */ );
-/* MR21 */ fArray[0]= empty;
-/* MR21 */ fArray[1]= set_dup(f);
-/* MR21 */ gen("if (");
-/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */
-/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n");
-/* MR21 */ tabs++;
-/* MR21 */ tab();
-/* MR21 */ _gen("/* nothing */ }\n");
-/* MR21 */ tab();
-/* MR21 */ makeErrorClause(q,f,1,1 /* use plus block bypass ? */ ); /* frees set */
-/* MR21 */ tabs--;
-/* MR21 */ };
- if (q->end->p1 != NULL) TRANS(q->end->p1);
-}
-
-/*
- * Generate code for a sub blk of alternatives of form:
- *
- * --o-G1--o--
- * | ^
- * v /|
- * o-G2-o|
- * | ^
- * v |
- * ..........
- * | ^
- * v /
- * o-Gn-o
- *
- * q points to the 1st junction of blk (upper-left).
- * q->end points to the last node (far right) in the blk.
- * Note that q->end->jtype must be 'EndBlk'.
- * The last node in every alt points to q->end.
- *
- * Generate code of the following form:
- * if ( First(G1) ) {
- * ...code for G1...
- * }
- * else if ( First(G2) ) {
- * ...code for G2...
- * }
- * ...
- * else {
- * ...code for Gn...
- * }
- */
-
-void
-#ifdef __USE_PROTOS
-genSubBlk( Junction *q )
-#else
-genSubBlk( q )
-Junction *q;
-#endif
-{
- int max_k;
- set f;
- int need_right_curly;
- int lastAltEmpty; /* MR23 */
- set savetkref;
- savetkref = tokensRefdInBlock;
- require(q->ntype == nJunction, "genSubBlk: not junction");
- require(q->jtype == aSubBlk, "genSubBlk: not subblock");
-
- OutLineInfo(output,q->line,FileStr[q->file]);
- BLOCK_Preamble(q);
- BlkLevel++;
- BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */
- f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
-
-/* MR23
- Bypass error clause generation when exceptions are used in a sub block
- in which the last alternative is epsilon. Example: "(A | B | )".
- See multi-line note in genBlk near call to isEmptyAlt.
-*/
- if (FoundException && lastAltEmpty) {
- gen("/* MR23 skip error clause for (...| epsilon) when exceptions in use */\n");
- }
- else {
- if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );}
- }
-
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- freeBlkFsets(q);
- --BlkLevel;
- BLOCK_Tail();
-
- if ( q->guess )
- {
- gen("zzGUESS_DONE\n");
- }
-
- /* must duplicate if (alpha)?; one guesses (validates), the
- * second pass matches */
- if ( q->guess && analysis_point(q)==q )
- {
- OutLineInfo(output,q->line,FileStr[q->file]);
- BLOCK_Preamble(q);
- BlkLevel++;
- f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
- if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */);}
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- freeBlkFsets(q);
- --BlkLevel;
- BLOCK_Tail();
- }
-
- tokensRefdInBlock = savetkref;
- if (q->end->p1 != NULL) TRANS(q->end->p1);
-}
-
-static int TnodesAllocatedPrevRule=0;
-
-/*
- * Generate code for a rule.
- *
- * rule--> o-->o-Alternatives-o-->o
- * Or,
- * rule--> o-->o-Alternative-o-->o
- *
- * The 1st junction is a RuleBlk. The second can be a SubBlk or just a junction
- * (one alternative--no block), the last is EndRule.
- * The second to last is EndBlk if more than one alternative exists in the rule.
- *
- * To get to the init-action for a rule, we must bypass the RuleBlk,
- * and possible SubBlk.
- * Mark any init-action as generated so genBlk() does not regenerate it.
- */
-void
-#ifdef __USE_PROTOS
-genRule( Junction *q )
-#else
-genRule( q )
-Junction *q;
-#endif
-{
-
- const char * returnValueInitializer;
-
-do { /* MR10 Change recursion into iteration */
-
- int max_k;
- set follow, rk, f;
- ActionNode *a;
- RuleEntry *r;
- int lastAltEmpty; /* MR23 */
- static int file = -1;
- int need_right_curly;
- require(q->ntype == nJunction, "genRule: not junction");
- require(q->jtype == RuleBlk, "genRule: not rule");
-
-/* MR14 */ require (MR_BackTraceStack.count == 0,"-alpha MR_BackTraceStack.count != 0");
-/* MR14 */ MR_pointerStackReset(&MR_BackTraceStack);
-/* MR14 */ if (AlphaBetaTrace) MR_MaintainBackTrace=1;
-
- CurRule=q->rname; /* MR11 */
-
- r = (RuleEntry *) hash_get(Rname, q->rname);
- if ( r == NULL ) warnNoFL("Rule hash table is screwed up beyond belief");
- if ( q->file != file ) /* open new output file if need to */
- {
-/* MR6 */
-/* MR6 Simpler to debug when output goes to stdout rather than a file */
-/* MR6 */
-/* MR6 */ if (UseStdout) {
-/* MR6 */ output = stdout;
-/* MR6 */ } else {
-/* MR6 */ if ( output != NULL) fclose( output );
-/* MR6 */ output = fopen(OutMetaName(outname(FileStr[q->file])), "w");
-/* MR6 */ };
- require(output != NULL, "genRule: can't open output file");
-
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(outname(FileStr[q->file]))); /* MR1 */
-#endif
- if ( file == -1 ) genHdr1(q->file);
- else genHdr(q->file);
- file = q->file;
- }
-
- if (InfoM) {
- fprintf(stderr," rule %s\n",q->rname);
- fflush(output);
- };
-
-#if 0
- if (strcmp(q->rname,"***debug***") == 0) {
- fprintf(stderr,"***debug*** %s reached\n",q->rname);
- MR_break();
- };
-#endif
-
- DumpFuncHeader(q,r);
- tabs++;
-
- /* MR23
-
- If there is a single return value then it can be initialized in
- the declaration using assignment syntax. If there are multiple
- return values then antlr creates a struct and initialization takes
- place element by element for each element of the struct. For
- multiple elements the initialization is by assignment so we have
- to wait until all declarations are done before emitting that code -
- because of restrictions in C which don't exist in C++.
-
- In the past (before MR23) the only kind of initialization was
- the PURIFY macro which was just a memset() of 0. Now we allow
- the user to specify an initial value. PURIFY is still used in C
- mode because C does not have constructors. However, PURIFY is
- not used in C++ mode because it might overwrite information created
- by elements which have their own ctor.
-
- */
-
- if ( q->ret!=NULL )
- {
- if ( hasMultipleOperands(q->ret) ) /* MR23 */
- {
-
- /* Emit initialization code later. */
-
- gen1("struct _rv%d _retv;\n",r->rulenum);
- }
- else
- {
- /* Emit initialization code now. */
-
- tab();
- DumpType(q->ret, output);
- returnValueInitializer = getInitializer(q->ret);
- if (returnValueInitializer == NULL) { /* MR23 */
- gen(" _retv;\n"); /* MR1 MR3 */
- } /* MR23 */
- else { /* MR23 */
- gen1(" _retv = %s;\n", returnValueInitializer); /* MR23 */
- } /* MR23 */
- }
- }
-
- OutLineInfo(output,q->line,FileStr[q->file]);
-
- if (InfoM) {
- fflush(output);
- };
-
- gen("zzRULE;\n");
- if ( FoundException )
- {
- gen("int _sva=1;\n");
- }
- if ( GenCC && GenAST )
- gen("ASTBase *_ast = NULL, *_sibling = NULL, *_tail = NULL;\n");
- if ( GenCC ) genTokenPointers(q);
- if ( GenCC&&GenAST ) genASTPointers(q);
- if ( q->el_labels!=NULL ) genElementLabels(q->el_labels);
- if ( FoundException ) gen("int _signal=NoSignal;\n");
-
- if ( !GenCC ) gen1("zzBLOCK(zztasp%d);\n", BlkLevel);
-
-/* MR10 */ /* move zzTRACEIN to before init action */
-
-/* MR10 */ if ( TraceGen ) {
-/* MR10 */ if ( GenCC ) {gen1("zzTRACEIN(\"%s\");\n", q->rname);}
-/* MR10 */ else gen1("zzTRACEIN((ANTLRChar *)\"%s\");\n", q->rname);
-/* MR10 */ }
-
-/* MR7 Moved PURIFY() to after all local variables have been declared */
-/* MR7 so that the generated code is valid C as well as C++ */
-/* MR7 Jan Mikkelsen 10-June-1997 */
-
-
- /*
- MR23 Do the PURIFY macro only for C mode.
- C++ users should use constructors or initialization expressions.
- */
-
- if ( q->ret != NULL ) /* MR7 */
- { /* MR7 */
- if (hasMultipleOperands(q->ret)) { /* MR23 */
- if (PURIFY == TRUE) {
- gen1("PCCTS_PURIFY(_retv,sizeof(struct _rv%d))\n",r->rulenum); /* MR23 */
- }
- } /* MR7 */
- else { /* MR7 */
-
- /* MR23
- If there were only one return value operand and
- it had an initializer then it would have been
- initiailized in the declaration.
- */
-
- returnValueInitializer = getInitializer(q->ret); /* MR23 */
- if (returnValueInitializer == NULL) { /* MR23 */
- if (PURIFY == TRUE) {
- gen("PCCTS_PURIFY(_retv,sizeof("); /* MR23 */
- DumpType(q->ret, output); /* MR7 */
- gen("))\n"); /* MR7 */
- }
- } /* MR23 */
- } /* MR7 */
-
- if (hasMultipleOperands(q->ret)) { /* MR23 */
- DumpInitializers(output, r, q->ret); /* MR23 */
- }
-
- }
- if ( !GenCC ) gen("zzMake0;\n");
- if ( FoundException ) gen("*_retsignal = NoSignal;\n");
-
- if ( !GenCC ) gen("{\n");
-
- if ( has_guess_block_as_first_item((Junction *)q->p1) )
- {
- gen("zzGUESS_BLOCK\n");
- }
-
- /* L o o k F o r I n i t A c t i o n */
- if ( ((Junction *)q->p1)->jtype == aSubBlk )
- a = findImmedAction( ((Junction *)q->p1)->p1 );
- else
- a = findImmedAction( q->p1 ); /* only one alternative in rule */
- if ( a!=NULL && !a->is_predicate)
- {
- /* MR21 */ if (!a->noHoist) dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1);
- a->done = 1; /* ignore action. We have already handled it */
- }
-
- BlkLevel++;
- q->visited = TRUE; /* mark RULE as visited for FIRST/FOLLOW */
- BlockPreambleOption((Junction *)q->p1, NULL); /* MR21 */
- f = genBlk((Junction *)q->p1, RuleBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */);
- if ( q->p1 != NULL )
- if ( ((Junction *)q->p1)->p2 != NULL )
- {tab(); makeErrorClause((Junction *)q->p1,f,max_k,0 /* use plus block bypass ? */);}
- { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} }
- freeBlkFsets((Junction *)q->p1);
- q->visited = FALSE;
- --BlkLevel;
- if ( !GenCC ) gen1("zzEXIT(zztasp%d);\n", BlkLevel);
-
- genTraceOut(q);
-
- if ( q->ret!=NULL ) gen("return _retv;\n") else gen("return;\n");
- /* E r r o r R e c o v e r y */
- NewSet();
- rk = empty;
-
-/* MR14 */ if (r->dontComputeErrorSet) {
-/* MR14 */ follow=empty;
- } else {
- MR_pointerStackReset(&MR_BackTraceStack); /* MR14 */
- MR_ErrorSetComputationActive=1;
- REACH(q->end, 1, &rk, follow);
- MR_ErrorSetComputationActive=0;
- require (MR_BackTraceStack.count == 0,"K: MR_BackTraceStack.count != 0");
- }
-
- FillSet( follow );
- set_free( follow );
-
- /* MR20 G. Hobbelt
- Isn't it so that "fail:" is ONLY referenced when:
-
- !FoundException || FoundGuessBlk ?
-
- Therefore add the "if" around this piece of code generation...
-
- Should guessing mode also use _handler label instead of "fail"
- when exception handling is active? gen can automatically put
- "if (guessing)" there so as to skip all kinds of user code.
-
- */
-
- if ( !FoundException || FoundGuessBlk ) /* MR20 G. Hobbelt */
- { /* MR20 G. Hobbelt */
- _gen("fail:\n");
- if ( !GenCC ) gen("zzEXIT(zztasp1);\n");
- if ( FoundGuessBlk ) {
- if ( !GenCC ) {gen("if ( zzguessing ) zzGUESS_FAIL;\n");}
- else gen("if ( guessing ) zzGUESS_FAIL;\n");
- }
- if ( q->erraction!=NULL )
- dumpAction(q->erraction, output, tabs, q->file, q->line, 1);
- if ( GenCC )
- {
- gen1("syn(zzBadTok, %s, zzMissSet, zzMissTok, zzErrk);\n",
- r->egroup==NULL?"(ANTLRChar *)\"\"":r->egroup);
- }
- else
- {
- gen1("zzsyn(zzMissText, zzBadTok, %s, zzMissSet, zzMissTok, zzErrk, zzBadText);\n",
- r->egroup==NULL?"(ANTLRChar *)\"\"":r->egroup);
- }
- gen3("%sresynch(setwd%d, 0x%x);\n", GenCC?"":"zz", wordnum, 1<<setnum);
-
- if ( q->ret!=NULL ) {
- genTraceOut(q);
- gen("return _retv;\n");
- } else if ( q->exceptions!=NULL ) {
- genTraceOut(q);
- gen("return;\n");
- } else if (!FoundException) { /* MR10 */
- genTraceOut(q); /* MR10 */
- };
-
- } /* MR20 G. Hobbelt */
-
- if ( !GenCC ) gen("}\n");
-
- /* Gen code for exception handlers */
- /* make sure each path out contains genTraceOut() */
-
- if ( q->exceptions!=NULL )
- {
-
- gen("/* exception handlers */\n");
-
- dumpExceptions(q->exceptions);
-
- if ( !r->has_rule_exception )
- {
- _gen("_handler:\n");
- gen("zzdflthandlers(_signal,_retsignal);\n");
- }
-/* MR20 G. Gobbelt The label "adios" is never referenced */
-
-#if 0
- _gen("_adios:\n");
-#endif
- if ( q->ret!=NULL ) {
- genTraceOut(q);
- gen("return _retv;\n");
- }
- else {
- genTraceOut(q);
- gen("return;\n");
- }
- }
- else if ( FoundException )
- {
- _gen("_handler:\n");
- gen("zzdflthandlers(_signal,_retsignal);\n");
-
-/* MR1 */
-/* MR1 7-Apr-97 Fix suggested by: John Bair (jbair@iftime.com) */
-/* MR1 */
-
- if ( q->ret != NULL) { /* MR1 */
- genTraceOut(q); /* MR10 */
- gen("return _retv;\n"); /* MR1 */
- } else { /* MR1 */
- genTraceOut(q); /* MR10 */
- gen("return;\n") ; /* MR1 */
- }; /* MR1 */
- }
-
- tabs--;
- gen("}\n");
-
-/* MR10 Tired of looking at stacks that are as deep as the number of */
-/* MR10 rules. Changes recursion to iteration. */
-
- MR_releaseResourcesUsedInRule( (Node *) q ); /* MR10 */
-
- if (InfoT) {
- fprintf(output,"\n/* tnodes created for rule %s: %d */\n",
- q->rname, (TnodesAllocated-TnodesAllocatedPrevRule) );
- };
-
- TnodesAllocatedPrevRule=TnodesAllocated;
-
- if (q->p2 == NULL) dumpAfterActions( output );
- q=(Junction *)q->p2;
- require(q==NULL || q->jtype==RuleBlk,"RuleBlk p2 does not point to another RuleBlk");
-
-} while (q != NULL);
-
-/**** The old code ****/
-/**** if ( q->p2 != NULL ) {TRANS(q->p2);} ****/ /* generate code for next rule too */
-/**** else dumpAfterActions( output ); ****/
-
-}
-
-
-/* This is for the function definition, not the declaration. */
-
-static void
-#ifdef __USE_PROTOS
-DumpFuncHeader( Junction *q, RuleEntry *r )
-#else
-DumpFuncHeader( q, r )
-Junction *q;
-RuleEntry *r;
-#endif
-{
-/* */
-/* MR1 10-Apr-97 MR1 Simplify insertion of commas in function header */
-/* */
- int needComma; /* MR1 */
-
-
- /* A N S I */
- _gen("\n");
- if ( q->ret!=NULL )
- {
- if ( hasMultipleOperands(q->ret) ) /* MR23 */
- {
- if (GenCC) gen2("%s::_rv%d\n", CurrentClassName, r->rulenum)
- else gen1("struct _rv%d\n",r->rulenum);
- }
- else
- {
- DumpType(q->ret, output);
- gen("\n");
- }
- }
- else
- {
- _gen("void\n");
- }
-/* MR1 */
-/* MR1 10-Apr-97 133MR1 Replace __STDC__ with __USE_PROTOS */
-/* MR1 */
- if ( !GenCC ) _gen("#ifdef __USE_PROTOS\n"); /* MR1 */
- if ( !GenCC ) gen2("%s%s(", RulePrefix, q->rname)
- else gen3("%s::%s%s(", CurrentClassName, RulePrefix,q->rname);
-
- /* If we generate C++ method names, we must hide default arguments */
- /* which can appear in the parameter declaration list. */
- /* NOTICE: this is done only here, for the method definition, but */
- /* not for the method declaration inside the class */
- /* definition. This is exactly the behaviour defined in */
- /* C++ standard for default paramters. */
-
- DumpANSIFunctionArgDef(output,q, 0 /* emit initializers ? */);
- _gen("\n");
-
- if ( GenCC ) {
- gen("{\n");
- return;
- }
-
- /* K & R */
- gen("#else\n");
- gen2("%s%s(", RulePrefix, q->rname);
- needComma=0; /* MR1 */
- if ( GenAST ) /* MR1 */
- { /* MR1 */
- _gen("_root"); /* MR1 */
- needComma=1; /* MR1 */
- } /* MR1 */
- if ( FoundException ) /* MR1 */
- { /* MR1 */
- if (needComma) {_gen(",");needComma=0;}; /* MR1 */
- _gen("_retsignal"); /* MR1 */
- needComma=1; /* MR1 */
- } /* MR1 */
-/* MR5 Change below by Jan Mikkelsen (janm@zeta.org.au) 26-May-97 MR5 */
- DumpListOfParmNames( q->pdecl, output, needComma ); /* MR5 */
- gen(")\n");
- if ( GenAST ) gen("AST **_root;\n");
- if ( FoundException ) gen("int *_retsignal;\n");
- DumpOldStyleParms( q->pdecl, output );
- gen("#endif\n");
- gen("{\n");
-}
-
-void
-#ifdef __USE_PROTOS
-DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInitializer)
-#else
-DumpANSIFunctionArgDef(f,q,bInitializer)
-FILE *f;
-Junction *q;
-int bInitializer;
-#endif
-{
- if ( GenAST )
- {
- if ( GenCC ) {fprintf(f,"ASTBase **_root");}
- else fprintf(f,"AST**_root");
- if ( !FoundException && q->pdecl!=NULL ) fprintf(f,",");
- }
- if ( FoundException )
- {
- if ( GenAST ) fprintf(f,",");
- fprintf(f,"int *_retsignal");
- if ( q->pdecl!=NULL ) {
- fprintf(f,",");
- }
- }
- if ( q->pdecl!=NULL ) {
- DumpFormals(f, q->pdecl, bInitializer); /* MR23 */
- }
- else {
- if ( !GenAST && !FoundException ) {
- fprintf(f,"void");
- }
- }
- fprintf(f,")");
-}
-
-void
-#ifdef __USE_PROTOS
-genJunction( Junction *q )
-#else
-genJunction( q )
-Junction *q;
-#endif
-{
- require(q->ntype == nJunction, "genJunction: not junction");
- require(q->jtype == Generic, "genJunction: not generic junction");
-
- if ( q->p1 != NULL ) TRANS(q->p1);
- if ( q->p2 != NULL ) TRANS(q->p2);
-}
-
-void
-#ifdef __USE_PROTOS
-genEndBlk( Junction *q )
-#else
-genEndBlk( q )
-Junction *q;
-#endif
-{
-}
-
-void
-#ifdef __USE_PROTOS
-genEndRule( Junction *q )
-#else
-genEndRule( q )
-Junction *q;
-#endif
-{
-}
-
-void
-#ifdef __USE_PROTOS
-genHdr( int file )
-#else
-genHdr( file )
-int file;
-#endif
-{
- int i;
-
- _gen("/*\n");
- _gen(" * A n t l r T r a n s l a t i o n H e a d e r\n");
- _gen(" *\n");
- _gen(" * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
- _gen(" * Purdue University Electrical Engineering\n");
- _gen(" * With AHPCRC, University of Minnesota\n");
- _gen1(" * ANTLR Version %s\n", Version);
- _gen(" *\n");
-/* MR10 */ _gen(" * ");
-/* MR10 */ for (i=0 ; i < Save_argc ; i++) {
-/* MR10 */ _gen(" ");
-/* MR10 */ _gen1("%s", Save_argv[i]);
-/* MR10 */ };
- _gen("\n");
- _gen(" *\n");
- _gen(" */\n\n");
- if (FirstAction != NULL ) dumpAction( FirstAction, output, 0, -1, 0, 1); /* MR11 MR15b */
- _gen1("#define ANTLR_VERSION %s\n", VersionDef);
- _gen("#include \"pcctscfg.h\"\n");
- _gen("#include \"pccts_stdio.h\"\n");
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- _gen2("#define %s %s\n", DefaultParserName, ParserName);
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- {_gen1("#include \"%s\"\n", RemapFileName);}
- OutLineInfo(output,1,FileStr[file]);
- if ( GenCC ) {
- if ( UserTokenDefsFile != NULL )
- fprintf(output, "#include %s\n", UserTokenDefsFile);
- else
- fprintf(output, "#include \"%s\"\n", DefFileName);
- }
-
- if ( HdrAction != NULL ) dumpAction( HdrAction, output, 0, -1, 0, 1);
- if ( !GenCC && FoundGuessBlk )
- {
- _gen("#define ZZCAN_GUESS\n");
- _gen("#include \"pccts_setjmp.h\"\n"); /* MR15 K.J. Cummings (cummings@peritus.com) */
- }
- if ( FoundException )
- {
- _gen("#define EXCEPTION_HANDLING\n");
- _gen1("#define NUM_SIGNALS %d\n", NumSignals);
- }
- if ( !GenCC && OutputLL_k > 1 ) _gen1("#define LL_K %d\n", OutputLL_k);
- if ( GenAST&&!GenCC ) _gen("#define GENAST\n\n");
- if ( GenAST ) {
- if ( GenCC ) {_gen1("#include \"%s\"\n\n", ASTBASE_H);}
- else _gen("#include \"ast.h\"\n\n");
- }
- if ( !GenCC && DemandLookahead ) _gen("#define DEMAND_LOOK\n\n");
-#ifdef DUM
- if ( !GenCC && LexGen ) {
- _gen1("#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
- }
-#endif
- /* ###WARNING: This will have to change when SetWordSize changes */
- if ( !GenCC ) _gen1("#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
- if (TraceGen) {
- _gen("#ifndef zzTRACE_RULES\n"); /* MR20 */
- _gen("#define zzTRACE_RULES\n"); /* MR20 */
- _gen("#endif\n"); /* MR22 */
- };
- if ( !GenCC ) {_gen("#include \"antlr.h\"\n");}
- else {
- _gen1("#include \"%s\"\n", APARSER_H);
- _gen1("#include \"%s.h\"\n", CurrentClassName);
- }
- if ( !GenCC ) {
- if ( UserDefdTokens )
- {_gen1("#include %s\n", UserTokenDefsFile);}
- /* still need this one as it has the func prototypes */
- _gen1("#include \"%s\"\n", DefFileName);
- }
- /* still need this one as it defines the DLG interface */
- if ( !GenCC ) _gen("#include \"dlgdef.h\"\n");
- if ( LexGen && GenCC ) _gen1("#include \"%s\"\n", DLEXERBASE_H);
- if ( GenCC ) _gen1("#include \"%s\"\n", ATOKPTR_H);
- if ( !GenCC && LexGen ) _gen1("#include \"%s\"\n", ModeFileName);
-
-/* MR10 Ofer Ben-Ami (gremlin@cs.huji.ac.il) */
-/* MR10 Finally, a definition of the Purify macro */
-
- if (PURIFY == TRUE) { /* MR23 */
- _gen("\n/* MR23 In order to remove calls to PURIFY use the antlr"); /* MR23 */
- _gen(" -nopurify option */\n\n"); /* MR23 */
- _gen("#ifndef PCCTS_PURIFY\n");
- _gen("#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\\0',(s));\n");
- _gen("#endif\n\n");
- } /* MR23 */
-}
-
-void
-#ifdef __USE_PROTOS
-genHdr1( int file )
-#else
-genHdr1( file )
-int file;
-#endif
-{
- ListNode *p;
-
- genHdr(file);
- if ( GenAST )
- {
- if ( !GenCC ) {
- _gen("#include \"ast.c\"\n");
- _gen("zzASTgvars\n\n");
- }
- }
- if ( !GenCC ) _gen("ANTLR_INFO\n");
- if ( BeforeActions != NULL )
- {
- for (p = BeforeActions->next; p!=NULL; p=p->next)
- {
- UserAction *ua = (UserAction *)p->elem;
- dumpAction( ua->action, output, 0, ua->file, ua->line, 1);
- }
- }
-
- if ( !FoundException ) return;
-
- if ( GenCC )
- {
- _gen1("\nvoid %s::\n", CurrentClassName);
- _gen("zzdflthandlers( int _signal, int *_retsignal )\n");
- _gen("{\n");
- }
- else
- {
- _gen("\nvoid\n");
-/* MR1 */
-/* MR1 10-Apr-97 133MR1 Replace __STDC__ with __USE_PROTOS */
-/* MR1 */
- _gen("#ifdef __USE_PROTOS\n"); /* MR1 */
- _gen("zzdflthandlers( int _signal, int *_retsignal )\n");
- _gen("#else\n");
- _gen("zzdflthandlers( _signal, _retsignal )\n");
- _gen("int _signal;\n");
- _gen("int *_retsignal;\n");
- _gen("#endif\n");
- _gen("{\n");
- }
- tabs++;
- if ( DefaultExGroup!=NULL )
- {
- dumpException(DefaultExGroup, 1);
- if ( !hasDefaultException(DefaultExGroup) )
- {
- gen("default :\n");
- tabs++;
- gen("*_retsignal = _signal;\n");
- tabs--;
- gen("}\n");
- }
- }
- else {
- gen("*_retsignal = _signal;\n");
- }
-
- tabs--;
- _gen("}\n\n");
-}
-
-void
-#ifdef __USE_PROTOS
-genStdPCCTSIncludeFile( FILE *f,char *gate ) /* MR10 */
-#else
-genStdPCCTSIncludeFile( f , gate) /* MR10 */
-FILE *f;
-char * gate; /* MR10 */
-#endif
-{
-/* MR10 Ramanathan Santhanam (ps@kumaran.com) */
-/* MR10 Same preprocessor symbol use to gate stdpccts.h */
-/* MR10 even when two grammars are in use. */
-/* MR10 Derive gate symbol from -fh filename */
-
- if (gate == NULL) {
- fprintf(f,"#ifndef STDPCCTS_H\n"); /* MR10 */
- fprintf(f,"#define STDPCCTS_H\n"); /* MR10 */
- } else {
- fprintf(f,"#ifndef STDPCCTS_%s_H\n",gate); /* MR10 */
- fprintf(f,"#define STDPCCTS_%s_H\n",gate); /* MR10 */
- };
- fprintf(f,"/*\n");
- if (gate == NULL) {
- fprintf(f," * %s -- P C C T S I n c l u d e\n", stdpccts);
- } else {
- fprintf(f," * Standard PCCTS include file with -fh %s -- P C C T S I n c l u d e\n", stdpccts);
- }
- fprintf(f," *\n");
- fprintf(f," * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(f," * Purdue University Electrical Engineering\n");
- fprintf(f," * With AHPCRC, University of Minnesota\n");
- fprintf(f," * ANTLR Version %s\n", Version);
- fprintf(f," */\n\n");
-
- fprintf(f,"#ifndef ANTLR_VERSION\n");
- fprintf(f,"#define ANTLR_VERSION %s\n", VersionDef);
- fprintf(f,"#endif\n\n");
-
- if (FirstAction != NULL ) dumpAction(FirstAction, f, 0, -1, 0, 1); /* MR11 */
-
- fprintf(f,"#include \"pcctscfg.h\"\n");
- fprintf(f,"#include \"pccts_stdio.h\"\n");
- if ( GenCC )
- {
- if ( UserDefdTokens )
- fprintf(f, "#include %s\n", UserTokenDefsFile);
- else {
- fprintf(f, "#include \"%s\"\n", DefFileName);
- }
-
- fprintf(f, "#include \"%s\"\n", ATOKEN_H);
-
- if ( HdrAction != NULL ) dumpAction( HdrAction, f, 0, -1, 0, 1);
-
- fprintf(f, "#include \"%s\"\n", ATOKENBUFFER_H);
-
- if ( OutputLL_k > 1 ) fprintf(f,"static const unsigned LL_K=%d;\n", OutputLL_k);
- if ( GenAST ) {
- fprintf(f, "#include \"%s\"\n", ASTBASE_H);
- }
-
- if (TraceGen) {
- fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */
- fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */
- fprintf(f,"#endif\n"); /* MR22 */
- };
-
- fprintf(f,"#include \"%s\"\n", APARSER_H);
- fprintf(f,"#include \"%s.h\"\n", CurrentClassName);
- if ( LexGen ) fprintf(f,"#include \"%s\"\n", DLEXERBASE_H);
- fprintf(f, "#endif\n");
- return;
- }
-
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- fprintf(f, "#define %s %s\n", DefaultParserName, ParserName);
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- fprintf(f, "#include \"%s\"\n", RemapFileName);
- if ( UserTokenDefsFile != NULL )
- fprintf(f, "#include %s\n", UserTokenDefsFile);
- if ( HdrAction != NULL ) dumpAction( HdrAction, f, 0, -1, 0, 1);
- if ( FoundGuessBlk )
- {
- fprintf(f,"#define ZZCAN_GUESS\n");
- fprintf(f,"#include \"pccts_setjmp.h\"\n");
- }
- if (TraceGen) {
- fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */
- fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */
- fprintf(f,"#endif\n"); /* MR22 */
- };
- if ( OutputLL_k > 1 ) fprintf(f,"#define LL_K %d\n", OutputLL_k);
- if ( GenAST ) fprintf(f,"#define GENAST\n");
- if ( FoundException )
- {
-/* MR1 7-Apr-97 1.33MR1 */
-/* MR1 Fix suggested by: */
-/* MR1 Francois-Xavier Fontaine (fontaine_f@istvax.ist.lu) */
-
- fprintf(f,"#define EXCEPTION_HANDLING\n"); /* MR1 */
- fprintf(f,"#define NUM_SIGNALS %d\n", NumSignals); /* MR1 */
- }
- if ( DemandLookahead ) fprintf(f,"#define DEMAND_LOOK\n");
-#ifdef DUM
- if ( LexGen ) fprintf(f, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
-#endif
- /* ###WARNING: This will have to change when SetWordSize changes */
- fprintf(f, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
- if (TraceGen) {
- fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */
- fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */
- fprintf(f,"#endif\n"); /* MR22 */
- };
- fprintf(f,"#include \"antlr.h\"\n");
- if ( GenAST ) fprintf(f,"#include \"ast.h\"\n");
- if ( UserDefdTokens )
- fprintf(f, "#include %s\n", UserTokenDefsFile);
- /* still need this one as it has the func prototypes */
- fprintf(f, "#include \"%s\"\n", DefFileName);
- /* still need this one as it defines the DLG interface */
- fprintf(f,"#include \"dlgdef.h\"\n");
- /* don't need this one unless DLG is used */
- if ( LexGen ) fprintf(f,"#include \"%s\"\n", ModeFileName);
- fprintf(f,"#endif\n");
-}
-
-/* dump action 's' to file 'output' starting at "local" tab 'tabs'
- Dump line information in front of action if GenLineInfo is set
- If file == -1 then GenLineInfo is ignored.
- The user may redefine the LineInfoFormatStr to his/her liking
- most compilers will like the default, however.
-
- June '93; changed so that empty lines are left alone so that
- line information is correct for the compiler/debuggers.
-*/
-void
-#ifdef __USE_PROTOS
-dumpAction( char *s, FILE *output, int tabs, int file, int line,
-int final_newline )
-#else
-dumpAction( s, output, tabs, file, line, final_newline )
-char *s;
-FILE *output;
-int tabs;
-int file;
-int line;
-int final_newline;
-#endif
-{
- int inDQuote, inSQuote;
- require(s!=NULL, "dumpAction: NULL action");
- require(output!=NULL, eMsg1("dumpAction: output FILE is NULL for %s",s));
-
- if ( GenLineInfo && file != -1 )
- {
- OutLineInfo(output,line,FileStr[file]);
- }
- PastWhiteSpace( s );
- /* don't print a tab if first non-white char is a # (preprocessor command) */
- if ( *s!='#' ) {TAB;}
- inDQuote = inSQuote = FALSE;
- while ( *s != '\0' )
- {
- if ( *s == '\\' )
- {
- fputc( *s++, output ); /* Avoid '"' Case */
- if ( *s == '\0' ) return;
- if ( *s == '\'' ) fputc( *s++, output );
- if ( *s == '\"' ) fputc( *s++, output );
- }
- if ( *s == '\'' )
- {
- if ( !inDQuote ) inSQuote = !inSQuote;
- }
- if ( *s == '"' )
- {
- if ( !inSQuote ) inDQuote = !inDQuote;
- }
- if ( *s == '\n' )
- {
- fputc('\n', output);
- s++;
- PastWhiteSpace( s );
- if ( *s == '}' )
- {
- --tabs;
- TAB;
- fputc( *s++, output );
- continue;
- }
- if ( *s == '\0' ) return;
- if ( *s != '#' ) /* #define, #endif etc.. start at col 1 */
- {
- TAB;
- }
- }
- if ( *s == '}' && !(inSQuote || inDQuote) )
- {
- --tabs; /* Indent one fewer */
- }
- if ( *s == '{' && !(inSQuote || inDQuote) )
- {
- tabs++; /* Indent one more */
- }
- fputc( *s, output );
- s++;
- }
- if ( final_newline ) fputc('\n', output);
-}
-
-static void
-#ifdef __USE_PROTOS
-dumpAfterActions( FILE *output )
-#else
-dumpAfterActions( output )
-FILE *output;
-#endif
-{
- ListNode *p;
- require(output!=NULL, "dumpAfterActions: output file was NULL for some reason");
- if ( AfterActions != NULL )
- {
- for (p = AfterActions->next; p!=NULL; p=p->next)
- {
- UserAction *ua = (UserAction *)p->elem;
- dumpAction( ua->action, output, 0, ua->file, ua->line, 1);
- }
- }
- fclose( output );
-}
-
-/*
- * Find the next action in the stream of execution. Do not pass
- * junctions with more than one path leaving them.
- * Only pass generic junctions.
- *
- * Scan forward while (generic junction with p2==NULL)
- * If we stop on an action, return ptr to the action
- * else return NULL;
- */
-static ActionNode *
-#ifdef __USE_PROTOS
-findImmedAction( Node *q )
-#else
-findImmedAction( q )
-Node *q;
-#endif
-{
- Junction *j;
- require(q!=NULL, "findImmedAction: NULL node");
- require(q->ntype>=1 && q->ntype<=NumNodeTypes, "findImmedAction: invalid node");
-
- while ( q->ntype == nJunction )
- {
- j = (Junction *)q;
- if ( j->jtype != Generic || j->p2 != NULL ) return NULL;
- q = j->p1;
- if ( q == NULL ) return NULL;
- }
- if ( q->ntype == nAction ) return (ActionNode *)q;
- return NULL;
-}
-
-static void
-#ifdef __USE_PROTOS
-dumpRetValAssign( char *retval, char *ret_def, RuleRefNode * ruleRef /* MR30 */)
-#else
-dumpRetValAssign( retval, ret_def, ruleRef /* MR30 */)
-char *retval;
-char *ret_def;
-RuleRefNode *ruleRefNode;
-#endif
-{
- char *q = ret_def;
-
- tab();
- while ( *retval != '\0' && *q != '\0')
- {
- while ( isspace((*retval)) ) retval++;
- while ( *retval!=',' && *retval!='\0' ) fputc(*retval++, output);
- fprintf(output, " = _trv.");
-
- DumpNextNameInDef(&q, output);
- while ( isspace(*q) ) q++;
- fputc(';', output); fputc(' ', output);
- if ( *retval == ',' ) retval++;
- }
- if (*retval == '\0' && *q != '\0') {
-/* MR30 */ errFL("Fewer output values than output formals for rule reference",
-/* MR30 */ FileStr[ruleRef->file],ruleRef->line);
- }
- if (*retval != '\0' && *q == '\0') {
-/* MR30 */ errFL("More output actuals than output formals for rule reference",
-/* MR30 */ FileStr[ruleRef->file],ruleRef->line);
- }
-}
-
-/* This function computes the set of tokens that can possibly be seen k
- * tokens in the future from point j
- */
-
-static set
-#ifdef __USE_PROTOS
-ComputeErrorSet( Junction *j, int k, int usePlusBlockBypass)
-#else
-ComputeErrorSet( j, k, usePlusBlockBypass )
-Junction *j;
-int k;
-int usePlusBlockBypass;
-#endif
-{
- Junction *alt1;
- set a, rk, f;
- require(j->ntype==nJunction, "ComputeErrorSet: non junction passed");
-
- f = rk = empty;
- for (alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2)
- {
- if (alt1->ignore && ! usePlusBlockBypass) continue; /* MR21 - Ignore aPlusBlk forward p2 */
- REACH(alt1->p1, k, &rk, a);
- require(set_nil(rk), "ComputeErrorSet: rk != nil");
- set_free(rk);
- set_orin(&f, a);
- set_free(a);
- }
- return f;
-}
-
-static char *
-#ifdef __USE_PROTOS
-tokenFollowSet(TokNode *p)
-#else
-tokenFollowSet(p)
-TokNode *p;
-#endif
-{
- static char buf[100];
- set rk, a;
- int n;
- rk = empty;
-
- REACH(p->next, 1, &rk, a);
- require(set_nil(rk), "rk != nil");
- set_free(rk);
- n = DefErrSet( &a, 0, NULL );
- set_free(a);
- if ( GenCC )
- sprintf(buf, "err%d", n);
- else
- sprintf(buf, "zzerr%d", n);
- return buf;
-}
-
-static void
-#ifdef __USE_PROTOS
-makeErrorClause( Junction *q, set f, int max_k, int usePlusBlockBypass )
-#else
-makeErrorClause( q, f, max_k, usePlusBlockBypass )
-Junction *q;
-set f;
-int max_k;
-int usePlusBlockBypass;
-#endif
-{
- char * handler_id=""; /* MR7 */
- int nilf=0; /* MR13 */
- RuleEntry *ruleEntry; /* MR14 */
-
- if ( FoundException )
- {
- _gen("else {\n");
- tabs++;
- if ( FoundGuessBlk )
- {
- if ( GenCC ) {gen("if ( guessing ) goto fail;\n");}
- else gen("if ( zzguessing ) goto fail;\n");
- }
- gen("if (_sva) _signal=NoViableAlt;\n");
- gen("else _signal=NoSemViableAlt;\n");
- if (q->outerEG != NULL) {
- handler_id=q->outerEG->altID;
-#if 0
- } else {
- printf("q->curAltNum=%d q->exception_label=%s\n",q->curAltNum,q->exception_label);
- gen("*** DEBUG *** outerEG==NULL\n");
-#endif
- };
- gen1("goto %s_handler; /* MR7 */\n",handler_id); /* MR7 */
- tabs--;
- gen("}\n");
- return;
- }
-
- if ( max_k == 1 )
- {
-/* MR13 */ nilf=set_nil(f);
- if ( GenCC ) {
- _gen1("else {FAIL(1,err%d", DefErrSet1(1,&f,1,NULL));
- } else {
- _gen1("else {zzFAIL(1,zzerr%d", DefErrSet1(1,&f,1,NULL));
- };
- set_free(f);
- }
- else
- {
- int i;
- set_free(f);
- if ( GenCC ) {_gen1("else {FAIL(%d", max_k);}
- else _gen1("else {zzFAIL(%d", max_k);
-
- ruleEntry = (RuleEntry *) hash_get(Rname,q->rname);
-
- for (i=1; i<=max_k; i++)
- {
-/* MR14 */ if (ruleEntry->dontComputeErrorSet) {
-/* MR14 */ f=empty;
- } else {
- f = ComputeErrorSet(q, i, usePlusBlockBypass /* use plus block bypass ? */ );
- }
-
- if ( GenCC ) {_gen1(",err%d", DefErrSet( &f, 1, NULL ));}
- else _gen1(",zzerr%d", DefErrSet( &f, 1, NULL ));
-
- set_free(f);
- }
- }
- _gen(",&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}\n");
-/* MR13 */ if (nilf) {
-/* MR13 */ errFL("empty error set for alt - probably because of undefined rule or infinite left recursion",
-/* MR13 */ FileStr[q->file],q->line);
-/* MR13 */ gen(" /* MR13 empty error set for this alt - undef rule ? infinite left recursion ? */");
-/* MR13 */ };
-}
-
-static /* MR7 */
-#ifdef __USE_PROTOS
-char * findOuterHandlerLabel(ExceptionGroup *eg) /* MR7 */
-#else
-char * findOuterHandlerLabel(eg) /* MR7 */
-ExceptionGroup *eg; /* MR7 */
-#endif
-{
- char *label=NULL; /* MR7 */
- ExceptionGroup *outerEG; /* MR7 */
-
- if (eg->forRule == 0) { /* MR7 */
- if (eg->labelEntry != NULL) { /* MR7 */
- outerEG=eg->labelEntry->outerEG; /* MR7 */
- if (outerEG != NULL) { /* MR7 */
- label=outerEG->altID; /* MR7 */
- outerEG->used=1; /* MR7 */
- }; /* MR7 */
- } else if (eg->outerEG != NULL) { /* MR7 */
- outerEG=eg->outerEG; /* MR7 */
- label=outerEG->altID; /* MR7 */
- outerEG->used=1; /* MR7 */
- }; /* MR7 */
- }; /* MR7 */
- return (label==NULL ? "" : label); /* MR7 */
-} /* MR7 */
-
-/*** debug ***/
-#if 0
-** static /* MR7 */
-** #ifdef __USE_PROTOS
-** char * findOuterAltHandlerLabel(Junction *startJ) /* MR7 */
-** #else
-** char * findOuterAltHandlerLabel(startJ) /* MR7 */
-** Junction *startJ; /* MR7 */
-** #endif
-** { /* MR7 */
-** char *label=NULL; /* MR7 */
-** Junction *alt; /* MR7 */
-** /* MR7 */
-** for (alt=startJ; alt != NULL; alt=alt->outerAltstart) { /* MR7 */
-** label=alt->exception_label; /* MR7 */
-** if (label != NULL) break; /* MR7 */
-** }; /* MR7 */
-** return (label==NULL ? "" : label); /* MR7 */
-** } /* MR7 */
-#endif
-
-#ifdef __USE_PROTOS
-static void OutLineInfo(FILE *file,int line,char *fileName)
-#else
-static void OutLineInfo(file,line,fileName)
- FILE * file;
- int line;
- char * fileName;
-#endif
-{
- static char * prevFileName=NULL;
- static char * prevFileNameMS=NULL;
-
- char * p;
- char * q;
-
- if (! GenLineInfo) return;
-
- if (!GenLineInfoMS) {
- fprintf(file, LineInfoFormatStr,line,fileName);
- } else {
- if (fileName == prevFileName) {
- fprintf(file, LineInfoFormatStr,line,prevFileNameMS);
- } else {
- if (prevFileNameMS != NULL) free (prevFileNameMS);
- prevFileNameMS=(char *)calloc(1,strlen(fileName)+1);
- require(prevFileNameMS != NULL,"why not do this in calloc wrapper");
- q=prevFileNameMS;
- for (p=fileName; *p != 0; p++) {
- *q=*p;
- if (*q == '\\') *q='/';
- q++;
- }
- }
- prevFileName=fileName;
- };
-}
-
-#if 0
-
-/* MR21 */
-
-#ifdef __USE_PROTOS
-void OutFirstSetSymbol(Junction *q, char * pSymbol)
-#else
-void OutFirstSetSymbol(q, pSymbol)
- Junction* q;
- char * pSymbol
-#endif
-{
-
- set f;
- if (pSymbol == NULL) return;
- gen1("/** #FirstSetSymbol(%s) **/\n",pSymbol);
- f = ComputeErrorSet(q, 1, 0 /* use plus block bypass ? */);
- DefErrSetWithSuffix (0 /* nil ok */, &f,0 /* no substitute */, pSymbol, "");
- set_free(f);
-}
-#endif
-
-/* MR21 */
-
-#ifdef __USE_PROTOS
-void BlockPreambleOption(Junction *q, char * pSymbol)
-#else
-void BlockPreambleOption(q, pSymbol)
- Junction* q;
- char * pSymbol;
-#endif
-{
- set f = empty;
- if (pSymbol != NULL) {
- f = ComputeErrorSet(q, 1, 0 /* use plus block bypass ? */);
- gen1("/** #FirstSetSymbol(%s) **/\n",pSymbol);
- DefErrSetWithSuffix (0 /* nil ok */, &f,0 /* no substitute */, pSymbol, "");
- }
- set_free(f);
-}
-
-/* MR21 */
-
-void
-#ifdef __USE_PROTOS
-dumpActionPlus(ActionNode *a, char *s, FILE *output, int tabs, int file, int line,
-int final_newline )
-#else
-dumpActionPlus(a, s, output, tabs, file, line, final_newline )
-ActionNode *a;
-char *s;
-FILE *output;
-int tabs;
-int file;
-int line;
-int final_newline;
-#endif
-{
- dumpAction(s,output,tabs,file,line,final_newline);
-}
-
-
-#if 0
-** #ifdef __USE_PROTOS
-** void MR_ErrorSets(Junction *q, int max_k, int usePlusBlockBypass)
-** #else
-** void MR_ErrorSets(q, max_k, usePlusBlockBypass)
-** Junction *q;
-** int max_k;
-** int usePlusBlockBypass;
-** #endif
-** {
-** int k;
-** set setResult;
-** Junction* alt1;
-** Junction* p;
-** set rk;
-**
-** require (max_k <= CLL_k, "k > CLL_k");
-**
-**
-** for (k = 1; k <= CLL_k; k++) {set_clr(q->fset[k]); }
-**
-** for (k = 1; k <= max_k; k++) {
-** for (alt1=q; alt1 != NULL; alt1 = (Junction *)alt1->p2)
-** {
-** if (alt1->ignore && ! usePlusBlockBypass) continue;
-** p = analysis_point((Junction *)alt1->p1);
-** REACH(p, k, &rk, setResult);
-** require(set_nil(rk), "rk != nil");
-** set_orin(&q->fset[k], setResult);
-** }
-** }
-** }
-#endif
-
-
-#ifdef __USE_PROTOS
-void DumpInitializers(FILE* output, RuleEntry *r, char * pReturn)
-#else
-void DumpInitializers(output, r, pReturn)
-FILE* output;
-RuleEntry *r;
-char * pReturn;
-#endif
-{
- char *p = pReturn;
- char *pDataType;
- char *pSymbol;
- char *pEqualSign;
- char *pValue;
- char *pSeparator;
- int nest = 0;
- char *q;
-
- require(pReturn!=NULL, "DumpInitializer: invalid string");
-
- while (*p != 0) {
- p = endFormal(p,
- &pDataType,
- &pSymbol,
- &pEqualSign,
- &pValue,
- &pSeparator,
- &nest);
- if (nest != 0) return;
- if (pValue != NULL) {
- tab();
- q = strBetween(pSymbol, pEqualSign, pSeparator);
- fprintf(output, "_retv.%s", q);
- q = strBetween(pValue, NULL, pSeparator);
- fprintf(output, " = %s;\n", q);
- }
- }
-}
-
-#ifdef __USE_PROTOS
-void DumpFormals(FILE* output, char * pReturn, int bInitializer)
-#else
-void DumpFormals(output, pReturn, bInitializer)
-FILE* output;
-char * pReturn;
-int bInitializer;
-#endif
-{
- char *p = pReturn;
- char *pDataType;
- char *pSymbol;
- char *pEqualSign;
- char *pValue;
- char *pSeparator;
- int nest = 0;
- char *q;
- int count = 0;
-
- require(pReturn!=NULL, "DumpFormals: invalid string");
-
- while (*p != 0) {
- p = endFormal(p,
- &pDataType,
- &pSymbol,
- &pEqualSign,
- &pValue,
- &pSeparator,
- &nest);
- if (nest != 0) return;
- if (count > 0) fprintf(output,",");
- if (pDataType != NULL && pSymbol != NULL) {
- q = strBetween(pDataType, pSymbol, pSeparator);
- fprintf(output, "%s", q);
- q = strBetween(pSymbol, pEqualSign, pSeparator);
- fprintf(output," %s",q);
- if (pValue != NULL) {
- q = strBetween(pValue, NULL, pSeparator);
- if (bInitializer != 0) {
- fprintf(output, " = %s", q);
- }
- }
- }
- count++;
- }
-}
-
-/* MR23 Check for empty alt in a more intelligent way.
- Previously, an empty alt for genBlk had to point directly
- to the endBlock. This did not work once I changed {...}
- blocks to look like (...|...| epsilon) since there were
- intervening generics. This fixes the problem for this
- particular case. Things like actions or empty blocks of
- various kinds will still cause problems, but I wasnt't
- prepared to handle pathological cases like (A|()*). It
- does handle (A | ()), which is a recommended idiom for
- epsilon.
-
- Actually, this isn't quite correct since it doesn't handle
- the case of the ignore bit in the plus block bypass, but
- I'm too tired to figure out the correct fix, and will just
- work around it.
-*/
-
-#ifdef __USE_PROTOS
-int isEmptyAlt(Node * alt, Node * endBlock)
-#else
-int isEmptyAlt(alt, endBlock)
-Node * alt;
-Node * endBlock;
-#endif
-{
- Node * n = alt;
- Junction * j;
- while (n != endBlock) {
- switch (n->ntype) {
-
- case nRuleRef:
- return 0;
-
- case nToken:
- return 0;
-
- case nAction:
- return 0;
-
- case nJunction:
- goto JUNCTION;
-
- default:
- fatal_internal("Invalid node type");
- return 0;
- }
-JUNCTION:
- j = (Junction *) n;
-
- switch (j->jtype) {
- case Generic:
- {
- n = j->p1;
- goto NEXT;
- }
-
- case aSubBlk:
- {
- n = j->p1; /* MR26 */
- goto NEXT; /* MR26 */
- }
-
- case EndBlk:
- return 0;
-
- case EndRule:
- return 1;
-
- default:
- return 0;
- }
-NEXT: continue;
- }
- return 1;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h
deleted file mode 100644
index 8d736d5200..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/generic.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * generic.h -- generic include stuff for new PCCTS ANTLR.
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#define StrSame 0
-
-#define DefaultParserName "zzparser"
-
-/* MR9 JVincent@novell.com Allow user to override default ZZLEXBUFSIZE */
-/* MR11 thm Raise antlr's own default ZZLEXBUFSIZE to 8k */
-/* MR22 thm Raise antlr's own default ZZLEXBUFSIZE to 32k */
-
-#ifndef ZZLEXBUFSIZE
-#define ZZLEXBUFSIZE 32000
-#endif
-
-/* Tree/FIRST/FOLLOW defines -- valid only after all grammar has been read */
-#define ALT TokenNum+1
-#define SET TokenNum+2
-#define TREE_REF TokenNum+3
-
- /* E r r o r M a c r o s */
-
-#define fatal(err) fatalFL(err, __FILE__, __LINE__)
-#define fatal_internal(err) fatal_intern(err, __FILE__, __LINE__)
-
-
-#define eMsg1(s,a) eMsg3(s,a,NULL,NULL)
-#define eMsg2(s,a,b) eMsg3(s,a,b,NULL)
-
- /* S a n i t y C h e c k i n g */
-
-#ifndef require
-#define require(expr, err) {if ( !(expr) ) fatal_internal(err);}
-#endif
-
- /* L i s t N o d e s */
-
-typedef struct _ListNode {
- void *elem; /* pointer to any kind of element */
- struct _ListNode *next;
- } ListNode;
-
-/* Define a Cycle node which is used to track lists of cycles for later
- * reconciliation by ResolveFoCycles().
- */
-typedef struct _c {
- int croot; /* cycle root */
- set cyclicDep; /* cyclic dependents */
- unsigned deg; /* degree of FOLLOW set of croot */
- } Cycle;
-
-typedef struct _e {
- int tok; /* error class name == TokenStr[tok] */
- ListNode *elist; /* linked list of elements in error set */
- set eset;
- int setdeg; /* how big is the set */
- int lexclass; /* which lex class is it in? */
- } ECnode;
-
-typedef struct _TCnode {
- int tok; /* token class name */
- ListNode *tlist; /* linked list of elements in token set */
- set tset;
- int lexclass; /* which lex class is it in? */
- unsigned char dumped; /* this def has been been dumped */
- unsigned char dumpedComplement; /* this def has been been dumped */
- unsigned setnum; /* which set number is this guy? (if dumped) */
- unsigned setnumComplement; /* MR23 */
- unsigned setnumErrSet; /* MR23 which set is this #tokclass error set (if dumped) */
- unsigned setnumErrSetComplement; /* MR23 */
- } TCnode;
-
-typedef struct _ft {
- char *token; /* id of token type to remap */
- int tnum; /* move token type to which token position */
- } ForcedToken;
-
-typedef struct _ContextGuardPredicates { /* MR13 */
- Predicate *pred; /* MR13 */
- } ContextGuardPredicates; /* MR13 */
-
-#define newListNode (ListNode *) calloc(1, sizeof(ListNode));
-#define newCycle (Cycle *) calloc(1, sizeof(Cycle));
-#define newECnode (ECnode *) calloc(1, sizeof(ECnode));
-#define newTCnode (TCnode *) calloc(1, sizeof(TCnode));
-
-
- /* H a s h T a b l e E n t r i e s */
-
-typedef struct _t { /* Token name or expression */
- char *str;
- struct _t *next;
- int token; /* token number */
- unsigned char classname; /* is it a err/tok class name or token */
- TCnode *tclass; /* ptr to token class */
- char *action;
- char *akaString;
- } TermEntry;
-
-typedef struct _r { /* Rule name and ptr to start of rule */
- char *str;
- struct _t *next;
- int rulenum; /* RulePtr[rulenum]== ptr to RuleBlk junction */
- unsigned char noAST;/* gen AST construction code? (def==gen code) */
- char *egroup; /* which error group (err reporting stuff) */
-#if 0
- /* MR27 This appears to never be used. Delete this code later. */
-
- ListNode *el_labels;/* list of element labels ref in all of rule */
-#endif
- ListNode *ast_labels_in_actions; /* MR27 */
- unsigned char has_rule_exception;
- char dontComputeErrorSet; /* MR14 - don't compute error set
- special for rule in alpha part of
- (alpha)? beta block */
- } RuleEntry;
-
-typedef struct _f { /* cache Fi/Fo set */
- char *str; /* key == (rulename, computation, k) */
- struct _f *next;
- set fset; /* First/Follow of rule */
- set rk; /* set of k's remaining to be done after ruleref */
- int incomplete; /* only w/FOLLOW sets. Use only if complete */
- } CacheEntry;
-
-typedef struct _LabelEntry { /* element labels */
- char *str;
- struct _f *next;
- Node *elem; /* which element does it point to? */
- ExceptionGroup *ex_group;
- /* Is there an exception attached to label? */
- ExceptionGroup *outerEG; /* MR7 */
- /* next EG if ex_group doesn't catch it MR7 */
- struct _LabelEntry *pendingLink; /* MR7 */
- /* too lazy to use ListNode ? MR7 */
- int curAltNum; /* MR7 */
- } LabelEntry;
-
-typedef struct _SignalEntry {
- char *str;
- struct _f *next;
- int signum; /* unique signal number */
- } SignalEntry;
-
-typedef struct _PredEntry { /* MR11 predicate name and ptr to string */
- char *str;
- struct _PredEntry *next;
- int file;
- int line;
- Predicate *pred;
- char *predLiteral;
- } PredEntry;
-
-typedef struct _PointerStack { /* MR10 */
- int count;
- int size;
- void **data;
- } PointerStack;
-
-#define newTermEntry(s) (TermEntry *) newEntry(s, sizeof(TermEntry))
-#define newRuleEntry(s) (RuleEntry *) newEntry(s, sizeof(RuleEntry))
-#define newCacheEntry(s) (CacheEntry *) newEntry(s, sizeof(CacheEntry))
-#define newLabelEntry(s) (LabelEntry *) newEntry(s, sizeof(LabelEntry))
-#define newSignalEntry(s) (SignalEntry *) newEntry(s, sizeof(SignalEntry))
-#define newPredEntry(s) (PredEntry *) newEntry(s,sizeof(PredEntry))
-
-typedef struct _UserAction {
- char *action;
- int file, line;
- } UserAction;
-
-
- /* L e x i c a l C l a s s */
-
-/* to switch lex classes, switch ExprStr and Texpr (hash table) */
-typedef struct _lc {
- char *classnum, **exprs;
- Entry **htable;
- } LClass;
-
-typedef struct _exprOrder {
- char *expr;
- int lclass;
- } Expr;
-
-
-typedef Graph Attrib;
-
- /* M a x i m u m s */
-
-/* MR20 Note G. Hobbelt These values are superceded by values in hash.h */
-
-#ifndef HashTableSize
-#define HashTableSize 253
-#endif
-#ifndef StrTableSize
-#define StrTableSize 15000 /* all tokens, nonterminals, rexprs stored here */
-#endif
-#define MaxLexClasses 50 /* how many automatons */
-/* TokenStart and EofToken are ignored if #tokdefs meta-op is used */
-#define TokenStart 2 /* MUST be in 1 + EofToken */
-#define EofToken 1 /* Always predefined to be 1 */
-
-#ifndef MaxNumFiles
-#define MaxNumFiles 99
-#endif
-
-/**** MR9 JVincent@novell.com Move to pcctscfg.h */
-/**** #define MaxFileName 300 ****/ /* MR9 Move to pcctscfg.h */ /* largest file name size */
-
-#define MaxRuleName 100 /* largest rule name size */
-#define TSChunk 100 /* how much to expand TokenStr/ExprStr each time */
-#define TIChunk TSChunk /* expand TokenInd by same as TokenStr to mirror them */
-#define FoStackSize 100 /* deepest FOLLOW recursion possible */
-
-#define MaxClassDeclStuff 256 /* MR10 */
-
-#define NumPredefinedSignals 3
-
- /* S t a n d a r d S i g n a l s */
-
-#define sigNoSignal 0
-#define sigMismatchedToken 1
-#define sigNoViableAlt 2
-#define sigNoSemViableAlt 3
-
-
-
-/* AST token types */
-#define ASTexclude 0
-#define ASTchild 1
-#define ASTroot 2
-#define ASTinclude 3 /* include subtree made by rule ref */
-
-
-#define PredictionVariable "zzpr_expr"
-#define PredictionLexClassSuffix "_zzpred"
-
-#define WildCardString "WildCard"
-
-#if 0
- /* Removed in version 1.33MR19
- Don't understand why this never caused problems before
- */
-
- /*********************************************************
- #ifndef ANTLRm
- #define ANTLRm(st, f, _m) zzbufsize = ZZLEXBUFSIZE;\
- zzmode(_m); \
- zzenterANTLR(f); \
- st; ++zzasp; \
- zzleaveANTLR(f);
- #endif
- *********************************************************/
-#endif
-
-#include "proto.h"
-#include "pcctscfg.h" /* MR14 */
-#include <string.h>
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c
deleted file mode 100644
index 59d00320a0..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/globals.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * globals.c -- File containing all variables/tables visible to all files.
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-
-#include "pcctscfg.h"
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-
-char Version[] = "1.33MR33" ; /* PCCTS version number */ /* MRXXX */
-char VersionDef[] = "13333"; /* same (except int equiv for preproc symbol) */ /* MRXXX */
-
-char LexStartSymbol[] = "START";/* Name of starting lexical class/automaton */
-char *RemapFileName = "remap.h";
-char *DlgFileName = "parser.dlg";
-char *DefFileName = "tokens.h";
-char *ErrFileName = "err.c";
-char *ModeFileName = "mode.h";
-char *StdMsgName = NULL;
-
-char *ParserName = DefaultParserName;
-
-/* list of PCCTS supplied support symbols; these are renamed when more than
- * one ANTLR-generated parsers are linked together to avoid name conflicts.
- * Can't use '##' ANSIC preprocessor concat operator with K&R and:
- * #define zzskip zzparser ## skip
- * will not work for ANSI/C++ as 'zzparserskip' is created w/o zzparser
- * being substituted--ack!!!
- */
-char *StandardSymbols[] = {
-/* ANTLR stuff */
- "zzStackOvfMsg",
- "zzasp",
- "zzaStack",
- "inf_tokens",
- "inf_text",
- "inf_text_buffer",
- "inf_text_buffer_ptr",
- "inf_text_buffer_size",
- "inf_labase",
- "inf_last",
- "inf_lap",
- "zztokenLA",
- "zztextLA",
- "zzlap",
- "zzlabase",
- "zztoktext",
- "zztoken",
- "zzdirty",
- "zzguessing",
- "zzguess_start",
- "zzresynch",
- "zzinf_tokens",
- "zzinf_text",
- "zzinf_text_buffer",
- "zzinf_labase",
- "zzinf_last",
- "zzfill_inf_look",
- "zzFAIL",
- "zzsave_antlr_state",
- "zzrestore_antlr_state",
- "zzsyn",
- "zzset_el",
- "zzset_deg",
- "zzedecode",
- "_zzsetmatch",
- "_zzmatch",
- "_inf_zzgettok",
- "zzconsumeUntil",
- "zzconsumeUntilToken",
- "_zzmatch_wsig",
- "_zzsetmatch_wsig",
- "_zzmatch_wdfltsig",
- "_zzsetmatch_wdfltsig",
- "zzdflthandlers",
-/* DLG stuff */
- "zzreal_line",
- "zzcharfull",
- "zzerr",
- "zzlextext",
- "zzbegexpr",
- "zzendexpr",
- "zzbufsize",
- "zzbegcol",
- "zzendcol",
- "zzline",
- "zzchar",
- "zzbufovf",
- "zzrdstream",
- "zzrdfunc",
- "zzrdstr",
- "zzclose_stream",
- "zzsave_dlg_state",
- "zzrestore_dlg_state",
- "zzmode",
- "zzskip",
- "zzmore",
- "zzreplchar",
- "zzreplstr",
- "zzgettok",
- "zzadvance",
- "zzerrstd",
- "zzerr_in",
- "zzconstr_attr",
- "zzempty_attr",
- "zzerraction",
- "zztokens", /* list of token regular expressions */
- "dfa",
- "accepts",
- "actions",
- "zzTraceOptionValue", /* MR10 */
- "zzTraceGuessOptionValue", /* MR10 */
- "zzTraceCurrentRuleName", /* MR10 */
- "zzTraceDepth", /* MR10 */
- "zzGuessSeq", /* MR10 */
- "zzSyntaxErrCount", /* MR11 */
- "zzLexErrCount", /* MR11 */
- "zzTraceGuessDone", /* MR13 - BJS */
- "zzTraceGuessFail", /* MR13 - BJS */
- "zzTraceGuessOption", /* MR13 - BJS */
- "zzTraceIn", /* MR13 - BJS */
- "zzTraceOption", /* MR13 - BJS */
- "zzTraceOut", /* MR13 - BJS */
- "zzTraceReset", /* MR13 - BJS */
- NULL /* must be present */
-};
-
-/* list of PCCTS supplied support functions; these are renamed when more than
- * one ANTLR-generated parsers are linked together to avoid name conflicts.
- */
-char *ASTSymbols[] = {
- "AST",
- "zzast_sp",
- "zzastStack",
- "zzlink",
- "zzastnew",
- "zzsubchild",
- "zzsubroot",
- "zzpre_ast",
- "zzfree_ast",
- "zztmake",
- "zzdup_ast",
- "zztfree",
- "zzdouble_link",
- NULL /* must be present */
-};
-
-/* Current ambiguity examination information */
-int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile;
-char *CurAmbigbtype;
-
-
- /* M e t h o d T a b l e s */
-/*
- * The following tables are used to fill syntax diagram nodes with the correct
- * function pointers for computing FIRST sets and printing themselves.
- */
-
-/* fpTraverse[node type] == pointer to function that calculates trees
- * representing the FIRST sets for that node (maintains spatial info).
- * We use 'struct _tree' not 'tree' due to a g++ 2.4.3 bug.
- */
-#ifdef __cplusplus
-struct _tree *(*fpTraverse[NumNodeTypes+1])(... /* Node *, int, set * */) = {
- NULL,
- (struct _tree *(*)(...)) tJunc,
- (struct _tree *(*)(...)) tRuleRef,
- (struct _tree *(*)(...)) tToken,
- (struct _tree *(*)(...)) tAction
-};
-#else
-Tree *(*fpTraverse[NumNodeTypes+1])() = {
- NULL,
- tJunc,
- tRuleRef,
- tToken,
- tAction
-};
-#endif
-
-/* fpReach[node type] == pointer to function that calculates FIRST set for
- * that node. (r stands for reach). We use 'struct _set' not 'set'
- * due to a g++ 2.4.3 bug.
- */
-#ifdef __cplusplus
-struct _set (*fpReach[NumNodeTypes+1])(... /* Node *, int, set * */) = {
- NULL,
- (struct _set (*)(...)) rJunc,
- (struct _set (*)(...)) rRuleRef,
- (struct _set (*)(...)) rToken,
- (struct _set (*)(...)) rAction
-};
-#else
-set (*fpReach[NumNodeTypes+1])() = {
- NULL,
- rJunc,
- rRuleRef,
- rToken,
- rAction
-};
-#endif
-
-/* fpPrint[node type] == pointer to function that knows how to print that node. */
-#ifdef __cplusplus
-void (*fpPrint[NumNodeTypes+1])(... /* Node * */) = {
- NULL,
- (void (*)(...)) pJunc,
- (void (*)(...)) pRuleRef,
- (void (*)(...)) pToken,
- (void (*)(...)) pAction
-};
-#else
-void (*fpPrint[NumNodeTypes+1])() = {
- NULL,
- pJunc,
- pRuleRef,
- pToken,
- pAction
-};
-#endif
-
-char *decodeJType[] = {
- "invalid",
- "aSubBlk",
- "aOptBlk",
- "aLoopBlk",
- "EndBlk",
- "RuleBlk",
- "Generic",
- "EndRule",
- "aPlusBlk",
- "aLoopBegin"
-};
-
-
- /* H a s h T a b l e s */
-
-Entry **Tname, /* Table of all token names (maps name to tok num)*/
- **Texpr, /* Table of all token expressions
- (maps expr to tok num) */
- **Rname, /* Table of all Rules (has ptr to start of rule) */
- **Fcache, /* Cache of First/Follow Computations */
- **Tcache; /* Tree cache; First/Follow for permute trees */
-Entry **Elabel; /* Table of all element label names */
-Entry **Sname; /* Signal names */
-Entry **Pname; /* symbolic predicate names MR11 */
-
-
- /* V a r i a b l e s */
-
-int Save_argc; /* MR10 */
-char **Save_argv; /* MR10 */
-int EpToken=0; /* Imaginary Epsilon token number */
-int WildCardToken=0;
-int CurFile= -1; /* Index into FileStr table */
-char *CurPredName=NULL; /* MR11 */
-char *CurRule=NULL; /* Pointer to current rule name */
-int CurRuleDebug=0; /* MR13 debug flag */
-RuleEntry *CurRuleNode=NULL;/* Pointer to current rule node in syntax tree */
-char *CurRetDef=NULL; /* Pointer to current return type definition */
-char *CurParmDef=NULL; /* Pointer to current parameter definition */
-Junction *CurRuleBlk=NULL; /* Pointer to current block node for enclosing block */
-ListNode *CurExGroups=NULL; /* Current list of exception groups for rule/alts */
-ListNode *CurElementLabels=NULL;
-ListNode *CurAstLabelsInActions=NULL; /* MR27 */
-
-/* MR10 used by <<>>? to set "label_used_in_semantic_pred" */
-/* MR10 this will force LT(i) assignment even in guess mode */
-
-ListNode *CurActionLabels=NULL; /* MR10 Element Labels appearing in last action */
-int numericActionLabel=0 ; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */
-ListNode *NumericPredLabels=NULL; /* MR10 << ... $1 ... >>? ONLY */
-ListNode *ContextGuardPredicateList=NULL; /* MR13 for re-evaluating predicates
- after meta tokens are defined */
-
-int CurBlockID=0; /* Unique int for each block */
-int CurAltNum=0;
-Junction *CurAltStart = NULL; /* Junction node that starts the alt */
-Junction *OuterAltStart = NULL; /* For chaining exception groups MR7 */
-int NumRules=0; /* Rules are from 1 to n */
-FILE *output=NULL; /* current parser output file */
-FILE *input=NULL; /* current grammar input file */
-char *FileStr[MaxNumFiles];/* Ptr to array of file names on command-line */
-int NumFiles=0; /* current grammar file number */
-#ifdef __cplusplus
-void (**fpTrans)(...), /* array of ptrs to funcs that translate nodes */
- (**fpJTrans)(...); /* ... that translate junctions */
-#else
-void (**fpTrans)(), /* array of ptrs to funcs that translate nodes */
- (**fpJTrans)(); /* ... that translate junctions */
-#endif
-int **FoStack; /* Array of LL_k ptrs to stacks of rule numbers */
-int **FoTOS; /* FOLLOW stack top-of-stack pointers */
-Junction *SynDiag = NULL; /* Pointer to start of syntax diagram */
-int BlkLevel=1; /* Current block level. Set by antlr.g, used by
- * scanner to translate $i.j attributes */
-set reserved_positions; /* set of token positions reserved by '#token T=i' cmds */
-set all_tokens; /* set of all token types */
-set imag_tokens; /* set of all imaginary token types (EpToken, errclasses...) */
-set tokclasses; /* set of all token class token types */
-ListNode *ForcedTokens = 0; /* list of token_id/token_num pairs to remap */
-ListNode *MetaTokenNodes=NULL; /* list of meta token refs such as token classes etc... */
-int *TokenInd=NULL; /* an indirection level between token num and position
- * of that token def in TokenStr and ExprStr */
-int LastTokenCounted=0; /* ==TokenNum if no token renumbering (same as old TokenNum) */
-int TokenNum=TokenStart;
-char **TokenStr=NULL; /* map token # to token name */
-char **ExprStr=NULL; /* map token # to expr */
-Junction **RulePtr=NULL; /* map rule # to RuleBlk node of rule */
-ListNode *ExprOrder=NULL; /* list of exprs as they are found in grammar */
-ListNode *BeforeActions=NULL;/* list of grammar actions before rules */
-ListNode *AfterActions=NULL;/* list of grammar actions after rules */
-ListNode *LexActions=NULL; /* list of lexical actions */
-
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via #lexmember <<....>> */
-/* MR1 via #lexprefix <<....>> */
-/* MR1 */
-
-ListNode *LexMemberActions=NULL;/* list of lexical header member decl MR1 */
-ListNode *LexPrefixActions=NULL;/* list of lexical header #include decl MR1 */
-ListNode **Cycles=NULL; /* list of cycles (for each k) found when
- doing FOLLOWs */
-ListNode *eclasses=NULL; /* list of error classes */
-ListNode *tclasses=NULL; /* list of token classes */
-LClass lclass[MaxLexClasses]; /* array of lex class definitions */
-int CurrentLexClass; /* index into lclass */
-int NumLexClasses=0; /* in range 1..MaxLexClasses (init 0) */
-
-char *HdrAction=NULL; /* action defined with #header */
-char *FirstAction=NULL; /* action defined with #first MR11 */
-FILE *ErrFile; /* sets and error recovery stuff */
-FILE *DefFile=NULL; /* list of tokens, return value structs, setwd defs */
-FILE *MRinfoFile=NULL; /* MR10 information file */
-int MRinfo=0; /* MR10 */
-int MRinfoSeq=0; /* MR10 */
-int InfoP=0; /* MR10 predicates */
-int InfoT=0; /* MR10 tnodes */
-int InfoF=0; /* MR10 first/follow sets */
-int InfoM=0; /* MR10 monitor progress */
-int InfoO=0; /* MR12 orphan rules */
-int TnodesInUse=0; /* MR10 */
-int TnodesPeak=0; /* MR10 */
-int TnodesAllocated=0; /* MR10 */
-int TnodesReportThreshold=0; /* MR11 */
-int PotentialSuppression=0; /* MR10 */
-int PotentialDummy=0; /* MR10 */
-int CannotContinue=FALSE;
-int OutputLL_k = 1; /* LL_k for parsing must be power of 2 */
-int action_file; /* used to track start of action */
-int action_line;
-int FoundGuessBlk=0; /* there is a (...)? block somewhere in grammar */
-int FoundException=0; /* there is an exception somewhere in grammar */
-/* MR6 Distinguish between @ operator and real exception */
-/* MR6 by keeping separate flags for @ operator and real exceptions */
-int FoundAtOperator=0; /* MR6 */
-int FoundExceptionGroup=0; /* MR6 */
-int pLevel=0; /* print Level */
-int pAlt1,pAlt2; /* print "==>" in front of these alts */
-
-/* C++ output stuff */
-FILE *Parser_h, /* where subclass of ANTLRParser goes */
- *Parser_c; /* where code for subclass of ANTLRParser goes */
-char Parser_h_Name[MaxFileName+1] = "";
-char Parser_c_Name[MaxFileName+1] = "";
-char MRinfoFile_Name[MaxFileName+1] = ""; /* MR10 */
-char *ClassDeclStuff=NULL; /* MR10 */
-char *BaseClassName=NULL; /* MR22 */
-/* list of actions inside the #class {...} defs */
-ListNode *class_before_actions=NULL;
-ListNode *class_after_actions=NULL;
-
-char CurrentClassName[MaxRuleName]="";
-int no_classes_found=1;
-char *UserTokenDefsFile;
-int UserDefdTokens=0; /* found #tokdefs? */
-char *OutputDirectory=TopDirectory;
-ExceptionGroup *DefaultExGroup = NULL;
-int NumSignals = NumPredefinedSignals;
-int ContextGuardTRAV=0;
-
-char *MR_AmbAidRule=NULL; /* MR11 */
-int MR_AmbAidLine=0; /* MR11 */
-int MR_AmbAidDepth=0; /* MR11 */
-int MR_AmbAidMultiple=0; /* MR11 */
-int MR_skipped_e3_report=0; /* MR11 */
-int MR_usingPredNames=0; /* MR11 */
-int MR_BadExprSets=0; /* MR13 */
-int MR_Inhibit_Tokens_h_Gen=0; /* MR13 */
-int NewAST=0; /* MR13 */
-int tmakeInParser=0; /* MR23 */
-int AlphaBetaTrace=0; /* MR14 */
-int MR_BlkErr=0; /* MR21 */
-int MR_AlphaBetaMessageCount=0; /* MR14 */
-int MR_AlphaBetaWarning=0; /* MR14 */
-int MR_ErrorSetComputationActive=0; /* MR14 */
-int MR_MaintainBackTrace=0; /* MR14 */
-set MR_CompromisedRules; /* MR14 */
-
-Junction *MR_RuleBlkWithHalt; /* MR10 */
-
- /* C m d - L i n e O p t i o n s */
-
-int LL_k=1; /* how many tokens of full lookahead */
-int CLL_k= -1; /* how many tokens of compressed lookahead */
-int PrintOut = FALSE; /* print out the grammar */
-int PrintAnnotate = FALSE;/* annotate printout with FIRST sets */
-int CodeGen=TRUE; /* Generate output code? */
-int LexGen=TRUE; /* Generate lexical files? (tokens.h, parser.dlg) */
-int GenAST=FALSE; /* Generate AST's? */
-int GenANSI=FALSE; /* Generate ANSI code where necessary */
-int GenExprSetsOpt=TRUE;/* use sets not (LA(1)==tok) expression lists */
-int GenCR=FALSE; /* Generate cross reference? */
-int GenLineInfo=FALSE; /* Generate # line "file" stuff? */
-int GenLineInfoMS=FALSE;/* Like -gl but replace "\" with "/" for MS C/C++ systems */
-int TraceGen=FALSE; /* Generate code to trace rule invocation */
-int elevel=1; /* error level for ambiguity messages */
-int GenEClasseForRules=0;/* don't generate eclass for each rule */
-int TreeResourceLimit= -1;/* don't limit tree resource */
-int DemandLookahead = 0;/* demand/delayed lookahead or not */
-char *RulePrefix = ""; /* prefix each generated rule with this */
-char *stdpccts = "stdpccts.h";/* where to generate std pccts include file */
-int GenStdPccts = 0; /* don't gen stdpccts.h? */
-int ParseWithPredicates = 1;
-int WarningLevel = 1;
-int UseStdout = 0; /* MR6 */
-int TabWidth = 2; /* MR6 */ /* MR27 */
-int HoistPredicateContext = 0;
-int MRhoisting = 0; /* MR9 */
-int MRhoistingk = 0; /* MR13 */
-int MR_debugGenRule=0; /* MR11 */
-
-int GenCC = 0; /* Generate C++ output */
-
-PointerStack MR_BackTraceStack={0,0,NULL}; /* MR10 */
-PointerStack MR_PredRuleRefStack={0,0,NULL}; /* MR10 */
-PointerStack MR_RuleBlkWithHaltStack={0,0,NULL}; /* MR10 */
-
-/* DontCopyTokens and Pragma_DupLabeledTokens were a bad idea. I've just
- turned them off rather than backpatching the code. Who knows? We
- may need them in the future.
- */
-int DontCopyTokens = 1; /* in C++, don't copy ANTLRToken passed to ANTLR */
-
-/* Remember if LT(i), LA(i), or LATEXT(i) used in an action which is not
- a predicate. If so, give a warning for novice users.
-*/
-
-int LTinTokenAction = 0; /* MR23 */
-int PURIFY = 1; /* MR23 */
-
-int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */
-int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c
deleted file mode 100644
index 68fe8fd227..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * hash.c
- *
- * Manage hash tables.
- *
- * The following functions are visible:
- *
- * char *mystrdup(char *); Make space and copy string
- * Entry **newHashTable(); Create and return initialized hash table
- * Entry *hash_add(Entry **, char *, Entry *)
- * Entry *hash_get(Entry **, char *)
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "pcctscfg.h"
-#include "hash.h"
-
-#ifdef __USE_PROTOS
-#include <stdlib.h>
-#else
-#ifdef VAXC
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif
-#endif
-#include <string.h>
-
-#define StrSame 0
-
-#define fatal(err) \
- {fprintf(stderr, "%s(%d):", __FILE__, __LINE__); \
- fprintf(stderr, " %s\n", err); exit(PCCTS_EXIT_FAILURE);}
-#define require(expr, err) {if ( !(expr) ) fatal(err);}
-
-static unsigned size = HashTableSize;
-static char *strings = NULL;
-static char *strp;
-static unsigned strsize = StrTableSize;
-
-/* create the hash table and string table for terminals (string table only once) */
-Entry **
-#ifdef __USE_PROTOS
-newHashTable( void )
-#else
-newHashTable( )
-#endif
-{
- Entry **table;
-
- table = (Entry **) calloc(size, sizeof(Entry *));
- require( table != NULL, "cannot allocate hash table");
- if ( strings == NULL )
- {
- strings = (char *) calloc(strsize, sizeof(char));
- require( strings != NULL, "cannot allocate string table");
- strp = strings;
- }
- return table;
-}
-
-void
-#ifdef __USE_PROTOS
-killHashTable( Entry **table )
-#else
-killHashTable( table )
-Entry **table;
-#endif
-{
- /* for now, just free table, forget entries */
- free( (char *) table ); /* MR10 cast */
-}
-
-/* Given a table, add 'rec' with key 'key' (add to front of list). return ptr to entry */
-Entry *
-#ifdef __USE_PROTOS
-hash_add( Entry **table, char *key, Entry *rec )
-#else
-hash_add( table, key, rec )
-Entry **table;
-char *key;
-Entry *rec;
-#endif
-{
- unsigned h=0;
- char *p=key;
- require(table!=NULL && key!=NULL && rec!=NULL, "add: invalid addition");
-
- Hash(p,h,size);
- rec->next = table[h]; /* Add to singly-linked list */
- table[h] = rec;
- return rec;
-}
-
-/* Return ptr to 1st entry found in table under key (return NULL if none found) */
-Entry *
-#ifdef __USE_PROTOS
-hash_get( Entry **table, char *key )
-#else
-hash_get( table, key )
-Entry **table;
-char *key;
-#endif
-{
- unsigned h=0;
- char *p=key;
- Entry *q;
-/* require(table!=NULL && key!=NULL, "get: invalid table and/or key");*/
- if ( !(table!=NULL && key!=NULL) ) *((char *) 34) = 3;
-
- Hash(p,h,size);
- for (q = table[h]; q != NULL; q = q->next)
- {
- if ( strcmp(key, q->str) == StrSame ) return( q );
- }
- return( NULL );
-}
-
-#ifdef DEBUG_HASH
-void
-#ifdef __USE_PROTOS
-hashStat( Entry **table )
-#else
-hashStat( table )
-Entry **table;
-#endif
-{
- static unsigned short count[20];
- int i,n=0,low=0, hi=0;
- Entry **p;
- float avg=0.0;
-
- for (i=0; i<20; i++) count[i] = 0;
- for (p=table; p<&(table[size]); p++)
- {
- Entry *q = *p;
- int len;
-
- if ( q != NULL && low==0 ) low = p-table;
- len = 0;
- if ( q != NULL ) fprintf(stderr, "[%d]", p-table);
- while ( q != NULL )
- {
- len++;
- n++;
- fprintf(stderr, " %s", q->str);
- q = q->next;
- if ( q == NULL ) fprintf(stderr, "\n");
- }
- count[len]++;
- if ( *p != NULL ) hi = p-table;
- }
-
- fprintf(stderr, "Storing %d recs used %d hash positions out of %d\n",
- n, size-count[0], size);
- fprintf(stderr, "%f %% utilization\n",
- ((float)(size-count[0]))/((float)size));
- for (i=0; i<20; i++)
- {
- if ( count[i] != 0 )
- {
- avg += (((float)(i*count[i]))/((float)n)) * i;
- fprintf(stderr, "Bucket len %d == %d (%f %% of recs)\n",
- i, count[i], ((float)(i*count[i]))/((float)n));
- }
- }
- fprintf(stderr, "Avg bucket length %f\n", avg);
- fprintf(stderr, "Range of hash function: %d..%d\n", low, hi);
-}
-#endif
-
-/* Add a string to the string table and return a pointer to it.
- * Bump the pointer into the string table to next avail position.
- */
-char *
-#ifdef __USE_PROTOS
-mystrdup( char *s )
-#else
-mystrdup( s )
-char *s;
-#endif
-{
- char *start=strp;
- require(s!=NULL, "mystrdup: NULL string");
-
- while ( *s != '\0' )
- {
- require( strp <= &(strings[strsize-2]),
- "string table overflow\nIncrease StrTableSize in hash.h and recompile hash.c\n");
- *strp++ = *s++;
- }
- *strp++ = '\0';
-
- return( start );
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h
deleted file mode 100644
index 3969c40b4a..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/hash.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * hash.h -- define hash table entries, sizes, hash function...
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
- /* H a s h T a b l e S t u f f */
-
-#ifndef HashTableSize
-#define HashTableSize 553
-#endif
-
-#ifndef StrTableSize
-#ifdef PC32
-#define StrTableSize 1000000
-#endif
-#endif
-
-#ifndef StrTableSize
-#ifdef PC
-#define StrTableSize 655200
-#endif
-#endif
-
-#ifndef StrTableSize
-#define StrTableSize 1000000
-#endif
-
-typedef struct _entry { /* Minimum hash table entry -- superclass */
- char *str;
- struct _entry *next;
- } Entry;
-
-/* Hash 's' using 'size', place into h (s is modified) */
-#define Hash(s,h,size) \
- {while ( *s != '\0' ) h = (h<<1) + *s++; \
- h %= size;}
-
-#ifdef __USE_PROTOS
-Entry *hash_get(Entry **, char *),
- **newHashTable(void),
- *hash_add(Entry **, char *, Entry *);
-
-void killHashTable(Entry **);
-
-#else
-Entry *hash_get(), **newHashTable(), *hash_add();
-void killHashTable(); /* MR9 23-Sep-97 */
-#endif
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
deleted file mode 100644
index a4e7f69b36..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
- * lex.c -- Generate all of the lexical type files: parser.dlg tokens.h
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include <ctype.h>
-/* MR1 */
-/* MR1 10-Apr-97 MR1 Replace use of __STDC__ with __USE_PROTOS */
-/* MR1 */
-#include "pcctscfg.h"
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-
-#define DLGErrorString "invalid token"
-
-/* Generate a complete lexical description of the lexemes found in the grammar */
-void
-#ifdef __USE_PROTOS
-genLexDescr( void )
-#else
-genLexDescr( )
-#endif
-{
- ListNode *p;
- FILE *dlgFile = fopen(OutMetaName(DlgFileName), "w");
- require(dlgFile!=NULL, eMsg1("genLexFile: cannot open %s", OutMetaName(DlgFileName)) );
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(DlgFileName)); /* MR1 */
-#endif
- fprintf(dlgFile, "<<\n");
- fprintf(dlgFile, "/* %s -- DLG Description of scanner\n", DlgFileName);
- fprintf(dlgFile, " *\n");
- fprintf(dlgFile, " * Generated from:");
- {int i; for (i=0; i<NumFiles; i++) fprintf(dlgFile, " %s", FileStr[i]);}
- fprintf(dlgFile, "\n");
- fprintf(dlgFile, " *\n");
- fprintf(dlgFile, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(dlgFile, " * Purdue University Electrical Engineering\n");
- fprintf(dlgFile, " * With AHPCRC, University of Minnesota\n");
- fprintf(dlgFile, " * ANTLR Version %s\n", Version);
- fprintf(dlgFile, " */\n\n");
- if (FirstAction != NULL ) dumpAction( FirstAction, dlgFile, 0, -1, 0, 1 ); /* MR11 MR15b */
- fprintf(dlgFile, "#define ANTLR_VERSION %s\n", VersionDef);
- if ( GenCC )
- {
- if ( !UserDefdTokens ) fprintf(dlgFile, "#include \"%s\"\n", DefFileName);
- else fprintf(dlgFile, "#include %s\n", UserTokenDefsFile);
- fprintf(dlgFile, "#include \"%s\"\n", ATOKEN_H);
- if ( GenAST ) fprintf(dlgFile, "#include \"%s\"\n", ASTBASE_H);
- if ( HdrAction != NULL ) dumpAction( HdrAction, dlgFile, 0, -1, 0, 1 );
- }
- else
- {
- fprintf(dlgFile, "#include \"pcctscfg.h\"\n");
- fprintf(dlgFile, "#include \"pccts_stdio.h\"\n");
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- fprintf(dlgFile, "#define %s %s\n", DefaultParserName, ParserName);
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- fprintf(dlgFile, "#include \"%s\"\n", RemapFileName);
- if ( HdrAction != NULL ) dumpAction( HdrAction, dlgFile, 0, -1, 0, 1 );
- if ( FoundGuessBlk )
- {
- fprintf(dlgFile, "#define ZZCAN_GUESS\n");
- fprintf(dlgFile, "#include \"pccts_setjmp.h\"\n");
- }
- if ( OutputLL_k > 1 ) fprintf(dlgFile, "#define LL_K %d\n", OutputLL_k);
- if ( DemandLookahead ) fprintf(dlgFile, "#define DEMAND_LOOK\n");
- if (TraceGen) {
- fprintf(dlgFile,"#ifndef zzTRACE_RULES\n"); /* MR20 */
- fprintf(dlgFile,"#define zzTRACE_RULES\n"); /* MR20 */
- fprintf(dlgFile,"#endif\n"); /* MR22 */
- };
- fprintf(dlgFile, "#include \"antlr.h\"\n");
- if ( GenAST ) {
- fprintf(dlgFile, "#include \"ast.h\"\n");
- }
- if ( UserDefdTokens )
- fprintf(dlgFile, "#include %s\n", UserTokenDefsFile);
- /* still need this one as it has the func prototypes */
- fprintf(dlgFile, "#include \"%s\"\n", DefFileName);
- fprintf(dlgFile, "#include \"dlgdef.h\"\n");
- fprintf(dlgFile, "LOOKAHEAD\n");
- fprintf(dlgFile, "\n");
- fprintf(dlgFile, "void\n");
- fprintf(dlgFile, "#ifdef __USE_PROTOS\n");
- fprintf(dlgFile, "zzerraction(void)\n");
- fprintf(dlgFile, "#else\n");
- fprintf(dlgFile, "zzerraction()\n");
- fprintf(dlgFile, "#endif\n");
- fprintf(dlgFile, "{\n");
- fprintf(dlgFile, "\t(*zzerr)(\"%s\");\n", DLGErrorString);
- fprintf(dlgFile, "\tzzadvance();\n");
- fprintf(dlgFile, "\tzzskip();\n");
- fprintf(dlgFile, "}\n");
- }
- fprintf(dlgFile, ">>\n\n");
-
- /* dump all actions */
-
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via <<%%lexmember ....>> & <<%%lexprefix ...>> */
-/* MR1 */
- if (LexActions != NULL) {
- for (p = LexActions->next; p!=NULL; p=p->next)
- {
-/* MR1 */ fprintf(dlgFile, "<<%%%%lexaction\n");
- dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 );
- fprintf(dlgFile, ">>\n\n");
- }
- };
-
-/* MR1 */ if (GenCC) {
-/* MR1 */ fprintf(dlgFile,"<<%%%%parserclass %s>>\n\n",CurrentClassName);
-/* MR1 */ };
-
-/* MR1 */ if (LexPrefixActions != NULL) {
-/* MR1 */ for (p = LexPrefixActions->next; p!=NULL; p=p->next)
-/* MR1 */ {
-/* MR1 */ fprintf(dlgFile, "<<%%%%lexprefix\n");
-/* MR1 */ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 );
-/* MR1 */ fprintf(dlgFile, ">>\n\n");
-/* MR1 */ }
-/* MR1 */ };
-
-/* MR1 */ if (LexMemberActions != NULL) {
-/* MR1 */ for (p = LexMemberActions->next; p!=NULL; p=p->next)
-/* MR1 */ {
-/* MR1 */ fprintf(dlgFile, "<<%%%%lexmember\n");
-/* MR1 */ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 );
-/* MR1 */ fprintf(dlgFile, ">>\n\n");
-/* MR1 */ }
-/* MR1 */ };
-
- /* dump all regular expression rules/actions (skip sentinel node) */
- if ( ExprOrder == NULL ) {
- warnNoFL("no regular expressions found in grammar");
- }
- else dumpLexClasses(dlgFile);
- fprintf(dlgFile, "%%%%\n");
- fclose( dlgFile );
-}
-
-/* For each lexical class, scan ExprOrder looking for expressions
- * in that lexical class. Print out only those that match.
- * Each element of the ExprOrder list has both an expr and an lclass
- * field.
- */
-void
-#ifdef __USE_PROTOS
-dumpLexClasses( FILE *dlgFile )
-#else
-dumpLexClasses( dlgFile )
-FILE *dlgFile;
-#endif
-{
- int i;
- TermEntry *t;
- ListNode *p;
- Expr *q;
-
- for (i=0; i<NumLexClasses; i++)
- {
- fprintf(dlgFile, "\n%%%%%s\n\n", lclass[i].classnum);
- for (p=ExprOrder->next; p!=NULL; p=p->next)
- {
- q = (Expr *) p->elem;
- if ( q->lclass != i ) continue;
- lexmode(i);
- t = (TermEntry *) hash_get(Texpr, q->expr);
- require(t!=NULL, eMsg1("genLexDescr: rexpr %s not in hash table",q->expr) );
- if ( t->token == EpToken ) continue;
- fprintf(dlgFile, "%s\n\t<<\n", StripQuotes(q->expr));
- /* replace " killed by StripQuotes() */
- q->expr[ strlen(q->expr) ] = '"';
- if ( !GenCC ) {
- if ( TokenString(t->token) != NULL )
- fprintf(dlgFile, "\t\tNLA = %s;\n", TokenString(t->token));
- else
- fprintf(dlgFile, "\t\tNLA = %d;\n", t->token);
- }
- if ( t->action != NULL ) dumpAction( t->action, dlgFile, 2,-1,0,1 );
- if ( GenCC ) {
- if ( TokenString(t->token) != NULL )
- fprintf(dlgFile, "\t\treturn %s;\n", TokenString(t->token));
- else
- fprintf(dlgFile, "\t\treturn (ANTLRTokenType)%d;\n", t->token);
- }
- fprintf(dlgFile, "\t>>\n\n");
- }
- }
-}
-
-/* Strip the leading path (if any) from a filename */
-char *
-#ifdef __USE_PROTOS
-StripPath( char *fileName )
-#else
-StripPath( fileName )
-char *fileName;
-#endif
-{
- char *p;
- static char dirSym[2] = DirectorySymbol;
-
- if(NULL != (p = strrchr(fileName, dirSym[0])))
- p++;
- else
- p = fileName;
-
- return(p);
-}
-
-/* Generate a list of #defines && list of struct definitions for
- * aggregate retv's */
-void
-#ifdef __USE_PROTOS
-genDefFile( void )
-#else
-genDefFile( )
-#endif
-{
- int i;
-
- /* If C++ mode and #tokdef used, then don't need anything in here since
- * C++ puts all definitions in the class file name.
- */
- if ( GenCC && UserTokenDefsFile ) return;
- if ( MR_Inhibit_Tokens_h_Gen) return;
-
- DefFile = fopen(OutMetaName(DefFileName), "w");
- require(DefFile!=NULL, eMsg1("genDefFile: cannot open %s", OutMetaName(DefFileName)) );
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(DefFileName)); /* MR1 */
-#endif
- fprintf(DefFile, "#ifndef %s\n", StripPath(gate_symbol(DefFileName)));
- fprintf(DefFile, "#define %s\n", StripPath(gate_symbol(DefFileName)));
-
- fprintf(DefFile, "/* %s -- List of labelled tokens and stuff\n", DefFileName);
- fprintf(DefFile, " *\n");
- fprintf(DefFile, " * Generated from:");
- for (i=0; i<NumFiles; i++) fprintf(DefFile, " %s", FileStr[i]);
- fprintf(DefFile, "\n");
- fprintf(DefFile, " *\n");
- fprintf(DefFile, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(DefFile, " * Purdue University Electrical Engineering\n");
- fprintf(DefFile, " * ANTLR Version %s\n", Version);
- fprintf(DefFile, " */\n");
-
- if ( !GenCC && LexGen ) {
- fprintf(DefFile,"#define zzEOF_TOKEN %d\n",
- TokenInd!=NULL?TokenInd[EofToken]:EofToken);
- }
-
- if ( !UserDefdTokens )
- {
- int first=1;
-
- if ( GenCC ) fprintf(DefFile, "enum ANTLRTokenType {\n");
- for (i=1; i<TokenNum; i++)
- {
- /* Don't do EpToken or expr w/o labels */
- if ( TokenString(i)!=NULL && i != EpToken )
- {
- TermEntry *p;
-
- if ( WarningLevel>1 )
- {
- int j;
- /* look in all lexclasses for the reg expr */
-
-/* MR10 Derek Pappas */
-/* MR10 A #tokclass doesn't have associated regular expressiones */
-/* MR10 so don't warn user about it's omission */
-
- p = (TermEntry *) hash_get(Tname, TokenString(i));
-
- if (p != NULL && ! p->classname) {
- for (j=0; j<NumLexClasses; j++)
- {
- lexmode(j);
- if ( ExprString(i)!=NULL ) break;
- }
- if ( j>=NumLexClasses )
- {
- warnNoFL(eMsg1("token label has no associated rexpr: %s",TokenString(i)));
- }
- };
- }
- require((p=(TermEntry *)hash_get(Tname, TokenString(i))) != NULL,
- "token not in sym tab when it should be");
- if ( !p->classname )
- {
- if ( GenCC ) {
- if ( !first ) fprintf(DefFile, ",\n");
- first = 0;
- fprintf(DefFile, "\t%s=%d", TokenString(i), i);
- }
- else
- fprintf(DefFile, "#define %s %d\n", TokenString(i), i);
- }
- }
- }
-/* MR1 */
-/* MR1 10-Apr-97 133MR1 Prevent use of varying sizes of integer */
-/* MR1 for the enum ANTLRTokenType */
-/* MR1 */
- if ( GenCC ) { /* MR1 */
- if ( !first ) fprintf(DefFile, ",\n"); /* MR14 */
- fprintf(DefFile, "\tDLGminToken=0"); /* MR1 */
- fprintf(DefFile, ",\n\tDLGmaxToken=9999};\n"); /* MR1 */
- }; /* MR1 */
- }
-
- if ( !GenCC ) GenRulePrototypes(DefFile, SynDiag);
-
- fprintf(DefFile, "\n#endif\n");
-}
-
-void
-#ifdef __USE_PROTOS
-GenRemapFile( void )
-#else
-GenRemapFile( )
-#endif
-{
- if ( strcmp(ParserName, DefaultParserName)!=0 )
- {
- FILE *f;
- int i;
-
- f = fopen(OutMetaName(RemapFileName), "w");
- require(f!=NULL, eMsg1("GenRemapFile: cannot open %s", OutMetaName(RemapFileName)) );
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(RemapFileName)); /* MR1 */
-#endif
- fprintf(f, "/* %s -- List of symbols to remap\n", RemapFileName);
- fprintf(f, " *\n");
- fprintf(f, " * Generated from:");
- for (i=0; i<NumFiles; i++) fprintf(f, " %s", FileStr[i]);
- fprintf(f, "\n");
- fprintf(f, " *\n");
- fprintf(f, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n");
- fprintf(f, " * Purdue University Electrical Engineering\n");
- fprintf(f, " * ANTLR Version %s\n", Version);
- fprintf(f, " */\n");
-
- GenRuleFuncRedefs(f, SynDiag);
- GenPredefinedSymbolRedefs(f);
- if ( GenAST ) GenASTSymbolRedefs(f);
- GenSetRedefs(f);
-
- fclose(f);
- }
-}
-
-/* Generate a bunch of #defines that rename all functions to be "ParserName_func" */
-void
-#ifdef __USE_PROTOS
-GenRuleFuncRedefs( FILE *f, Junction *p )
-#else
-GenRuleFuncRedefs( f, p )
-FILE *f;
-Junction *p;
-#endif
-{
- fprintf(f, "\n/* rename rule functions to be 'ParserName_func' */\n");
- while ( p!=NULL )
- {
- fprintf(f, "#define %s %s_%s\n", p->rname, ParserName, p->rname);
- p = (Junction *)p->p2;
- }
-}
-
-/* Generate a bunch of #defines that rename all standard symbols to be
- * "ParserName_symbol". The list of standard symbols to change is in
- * globals.c.
- */
-void
-#ifdef __USE_PROTOS
-GenPredefinedSymbolRedefs( FILE *f )
-#else
-GenPredefinedSymbolRedefs( f )
-FILE *f;
-#endif
-{
- char **p;
-
- fprintf(f, "\n/* rename PCCTS-supplied symbols to be 'ParserName_symbol' */\n");
- for (p = &StandardSymbols[0]; *p!=NULL; p++)
- {
- fprintf(f, "#define %s %s_%s\n", *p, ParserName, *p);
- }
-}
-
-/* Generate a bunch of #defines that rename all AST symbols to be
- * "ParserName_symbol". The list of AST symbols to change is in
- * globals.c.
- */
-void
-#ifdef __USE_PROTOS
-GenASTSymbolRedefs( FILE *f )
-#else
-GenASTSymbolRedefs( f )
-FILE *f;
-#endif
-{
- char **p;
-
- fprintf(f, "\n/* rename PCCTS-supplied AST symbols to be 'ParserName_symbol' */\n");
- for (p = &ASTSymbols[0]; *p!=NULL; p++)
- {
- fprintf(f, "#define %s %s_%s\n", *p, ParserName, *p);
- }
-}
-
-/* redefine all sets generated by ANTLR; WARNING: 'zzerr', 'setwd' must match
- * use in bits.c (DumpSetWd() etc...)
- */
-void
-#ifdef __USE_PROTOS
-GenSetRedefs( FILE *f )
-#else
-GenSetRedefs( f )
-FILE *f;
-#endif
-{
- int i;
-
- for (i=1; i<=wordnum; i++)
- {
- fprintf(f, "#define setwd%d %s_setwd%d\n", i, ParserName, i);
- }
- for (i=1; i<=esetnum; i++)
- {
- fprintf(f, "#define zzerr%d %s_err%d\n", i, ParserName, i);
- }
-}
-
-/* Find all return types/parameters that require structs and def
- * all rules with ret types.
- *
- * This is for the declaration, not the definition.
- */
-void
-#ifdef __USE_PROTOS
-GenRulePrototypes( FILE *f, Junction *p )
-#else
-GenRulePrototypes( f, p )
-FILE *f;
-Junction *p;
-#endif
-{
- int i;
-
- i = 1;
- while ( p!=NULL )
- {
- if ( p->ret != NULL )
- {
-/* MR23 */ if ( hasMultipleOperands(p->ret) )
- {
- DumpRetValStruct(f, p->ret, i);
- }
- fprintf(f, "\n#ifdef __USE_PROTOS\n");
-/* MR23 */ if ( hasMultipleOperands(p->ret) )
- {
- fprintf(f, "extern struct _rv%d", i);
- }
- else
- {
- fprintf(f, "extern ");
- DumpType(p->ret, f);
- }
- fprintf(f, " %s%s(", RulePrefix, p->rname);
- DumpANSIFunctionArgDef(f,p,1 /* emit initializers ? */);
- fprintf(f, ";\n");
- fprintf(f, "#else\n");
-/* MR23 */ if ( hasMultipleOperands(p->ret) )
- {
- fprintf(f, "extern struct _rv%d", i);
- }
- else
- {
- fprintf(f, "extern ");
- DumpType(p->ret, f);
- }
- fprintf(f, " %s%s();\n", RulePrefix, p->rname);
- fprintf(f, "#endif\n");
- }
- else
- {
- fprintf(f, "\n#ifdef __USE_PROTOS\n");
- fprintf(f, "void %s%s(", RulePrefix, p->rname);
- DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */ );
- fprintf(f, ";\n");
-#ifdef OLD
- if ( p->pdecl != NULL || GenAST )
- {
- if ( GenAST ) {
- fprintf(f, "AST **%s",(p->pdecl!=NULL)?",":"");
- }
- if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl);
- }
- else fprintf(f, "void");
- fprintf(f, ");\n");
-#endif
- fprintf(f, "#else\n");
- fprintf(f, "extern void %s%s();\n", RulePrefix, p->rname);
- fprintf(f, "#endif\n");
- }
- i++;
- p = (Junction *)p->p2;
- }
-}
-
-/* Define all rules in the class.h file; generate any required
- * struct definitions first, however.
- */
-void
-#ifdef __USE_PROTOS
-GenRuleMemberDeclarationsForCC( FILE *f, Junction *q )
-#else
-GenRuleMemberDeclarationsForCC( f, q )
-FILE *f;
-Junction *q;
-#endif
-{
- Junction *p = q;
- int i;
-
- fprintf(f, "private:\n");
-
- /* Dump dflt handler declaration */
- fprintf(f, "\tvoid zzdflthandlers( int _signal, int *_retsignal );\n\n");
-
- fprintf(f, "public:\n");
-
- /* Dump return value structs */
- i = 1;
- while ( p!=NULL )
- {
- if ( p->ret != NULL )
- {
-/* MR23 */ if ( hasMultipleOperands(p->ret) )
- {
- DumpRetValStruct(f, p->ret, i);
- }
- }
- i++;
- p = (Junction *)p->p2;
- }
-
- /* Dump member func defs && CONSTRUCTOR */
- fprintf(f, "\t%s(ANTLRTokenBuffer *input);\n", CurrentClassName);
-/*
- fprintf(f, "\t%s(ANTLRTokenBuffer *input, ANTLRTokenType eof);\n",
- CurrentClassName);
-*/
-
- i = 1;
- p = q;
- while ( p!=NULL )
- {
- if ( p->ret != NULL )
- {
-/* MR23 */ if ( hasMultipleOperands(p->ret) )
- {
- fprintf(f, "\tstruct _rv%d", i);
- }
- else
- {
- fprintf(f, "\t");
- DumpType(p->ret, f);
- }
- fprintf(f, " %s%s(",RulePrefix,p->rname);
- DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */ );
- fprintf(f, ";\n");
-#ifdef OLD
- if ( p->pdecl != NULL || GenAST )
- {
- if ( GenAST ) fprintf(f, "ASTBase **%s",(p->pdecl!=NULL)?",":"");
- if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl);
- }
- fprintf(f, ");\n");
-#endif
- }
- else
- {
- fprintf(f, "\tvoid %s%s(",RulePrefix,p->rname);
- DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */);
- fprintf(f, ";\n");
-#ifdef OLD
- if ( p->pdecl != NULL || GenAST )
- {
- if ( GenAST ) fprintf(f, "ASTBase **%s",(p->pdecl!=NULL)?",":"");
- if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl);
- }
- fprintf(f, ");\n");
-#endif
- }
- i++;
- p = (Junction *)p->p2;
- }
-}
-
-/* Given a list of ANSI-style parameter declarations, print out a
- * comma-separated list of the symbols (w/o types).
- * Basically, we look for a comma, then work backwards until start of
- * the symbol name. Then print it out until 1st non-alnum char. Now,
- * move on to next parameter.
- *
- */
-
-/* MR5 Jan Mikkelsen 26-May-97 - added initalComma parameter */
-
-void
-#ifdef __USE_PROTOS
-DumpListOfParmNames(char *pdecl, FILE *output, int initialComma) /* MR5 */
-#else
-DumpListOfParmNames(pdecl, output, initialComma) /* MR5 */
-char *pdecl; /* MR5 */
-FILE *output; /* MR5 */
-int initialComma; /* MR5 */
-#endif
-{
- int firstTime = 1, done = 0;
- require(output!=NULL, "DumpListOfParmNames: NULL parm");
-
- if ( pdecl == NULL ) return;
- while ( !done )
- {
- if ( !firstTime || initialComma ) putc(',', output); /* MR5 */
- done = DumpNextNameInDef(&pdecl, output);
- firstTime = 0;
- }
-}
-
-/* given a list of parameters or return values, dump the next
- * name to output. Return 1 if last one just printed, 0 if more to go.
- */
-
-/* MR23 Total rewrite */
-
-int
-#ifdef __USE_PROTOS
-DumpNextNameInDef( char **q, FILE *output )
-#else
-DumpNextNameInDef( q, output )
-char **q;
-FILE *output;
-#endif
-{
- char *p;
- char *t;
- char *pDataType;
- char *pSymbol;
- char *pEqualSign;
- char *pValue;
- char *pSeparator;
- int nest = 0;
-
- p = endFormal(*q,
- &pDataType,
- &pSymbol,
- &pEqualSign,
- &pValue,
- &pSeparator,
- &nest);
-
- /* MR26 Handle rule arguments such as: IIR_Bool (IIR_Decl::*contstraint)()
- For this we need to strip off anything which follows the symbol.
- */
-
-/* MR26 */ t = pSymbol;
-/* MR26 */ if (t != NULL) {
-/* MR26 */ for (t = pSymbol; *t != 0; t++) {
-/* MR26 */ if (! (isalpha(*t) || isdigit(*t) || *t == '_' || *t == '$')) break;
-/* MR26 */ }
-/* MR26 */ }
-/* MR26 */ fprintf(output, "%s", strBetween(pSymbol, t, pSeparator));
-
- *q = p;
- return (*pSeparator == 0);
-}
-
-/* Given a list of ANSI-style parameter declarations, dump K&R-style
- * declarations, one per line for each parameter. Basically, convert
- * comma to semi-colon, newline.
- */
-void
-#ifdef __USE_PROTOS
-DumpOldStyleParms( char *pdecl, FILE *output )
-#else
-DumpOldStyleParms( pdecl, output )
-char *pdecl;
-FILE *output;
-#endif
-{
- require(output!=NULL, "DumpOldStyleParms: NULL parm");
-
- if ( pdecl == NULL ) return;
- while ( *pdecl != '\0' )
- {
- if ( *pdecl == ',' )
- {
- pdecl++;
- putc(';', output); putc('\n', output);
- while ( *pdecl==' ' || *pdecl=='\t' || *pdecl=='\n' ) pdecl++;
- }
- else {putc(*pdecl, output); pdecl++;}
- }
- putc(';', output);
- putc('\n', output);
-}
-
-/* Take in a type definition (type + symbol) and print out type only */
-/* MR23 Total rewrite */
-
-void
-#ifdef __USE_PROTOS
-DumpType( char *s, FILE *f )
-#else
-DumpType( s, f )
-char *s;
-FILE *f;
-#endif
-{
- char *p;
- char *pDataType;
- char *pSymbol;
- char *pEqualSign;
- char *pValue;
- char *pSeparator;
- int nest = 0;
-
- require(s!=NULL, "DumpType: invalid type string");
-
- p = endFormal(s,
- &pDataType,
- &pSymbol,
- &pEqualSign,
- &pValue,
- &pSeparator,
- &nest);
- fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
-}
-
-/* check to see if string e is a word in string s */
-int
-#ifdef __USE_PROTOS
-strmember( char *s, char *e )
-#else
-strmember( s, e )
-char *s;
-char *e;
-#endif
-{
- register char *p;
- require(s!=NULL&&e!=NULL, "strmember: NULL string");
-
- if ( *e=='\0' ) return 1; /* empty string is always member */
- do {
- while ( *s!='\0' && !isalnum(*s) && *s!='_' )
- ++s;
- p = e;
- while ( *p!='\0' && *p==*s ) {p++; s++;}
- if ( *p=='\0' ) {
- if ( *s=='\0' ) return 1;
- if ( !isalnum (*s) && *s != '_' ) return 1;
- }
- while ( isalnum(*s) || *s == '_' )
- ++s;
- } while ( *s!='\0' );
- return 0;
-}
-
-#if 0
-
-/* MR23 Replaced by hasMultipleOperands() */
-
-int
-#ifdef __USE_PROTOS
-HasComma( char *s )
-#else
-HasComma( s )
-char *s;
-#endif
-{
- while (*s!='\0')
- if ( *s++ == ',' ) return 1;
- return 0;
-}
-#endif
-
-
-/* MR23 Total rewrite */
-
-void
-#ifdef __USE_PROTOS
-DumpRetValStruct( FILE *f, char *ret, int i )
-#else
-DumpRetValStruct( f, ret, i )
-FILE *f;
-char *ret;
-int i;
-#endif
-{
- char *p = ret;
- char *pDataType;
- char *pSymbol;
- char *pEqualSign;
- char *pValue;
- char *pSeparator;
- int nest = 0;
-
- fprintf(f, "\nstruct _rv%d {\n", i);
- while (*p != 0 && nest == 0) {
- p = endFormal(p,
- &pDataType,
- &pSymbol,
- &pEqualSign,
- &pValue,
- &pSeparator,
- &nest);
- fprintf(f,"\t");
- fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
- fprintf(f," ");
- fprintf(f, "%s", strBetween(pSymbol, pEqualSign, pSeparator));
- fprintf(f,";\n");
- }
- fprintf(f,"};\n");
-}
-
-/* given "s" yield s -- DESTRUCTIVE (we modify s if starts with " else return s) */
-char *
-#ifdef __USE_PROTOS
-StripQuotes( char *s )
-#else
-StripQuotes( s )
-char *s;
-#endif
-{
- if ( *s == '"' )
- {
- s[ strlen(s)-1 ] = '\0'; /* remove last quote */
- return( s+1 ); /* return address past initial quote */
- }
- return( s );
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
deleted file mode 100644
index 051ee4ec5d..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
+++ /dev/null
@@ -1,1747 +0,0 @@
-/*
- * main.c -- main program for PCCTS ANTLR.
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-/* To set a breakpoint just before exit look for "cleanUp". */
-/* To set a breakpoint for fatal error look for "fatal_intern" */
-
-#include <stdio.h>
-
-#include "pcctscfg.h"
-#include "stdpccts.h"
-
-#define MAX_INT_STACK 50
-static int istack[MAX_INT_STACK]; /* Int stack */
-static int isp = MAX_INT_STACK;
-
-static int DontAcceptFiles = 0; /* if stdin, don't read files */
-static int DontAcceptStdin = 0; /* if files seen first, don't accept stdin */
-
-static int tnodes_used_in_guard_predicates_etc; /* MR10 */
-
- /* C m d - L i n e O p t i o n S t r u c t & F u n c s */
-
-typedef struct _Opt {
- char *option;
- int arg;
-#ifdef __cplusplus
- void (*process)(...);
-#else
- void (*process)();
-#endif
- char *descr;
- } Opt;
-
-#ifdef __USE_PROTOS
-extern void ProcessArgs(int, char **, Opt *);
-#else
-extern void ProcessArgs();
-#endif
-
-#ifdef __USE_PROTOS
-int ci_strequ(char *a,char *b)
-#else
-int ci_strequ(a,b)
- char *a;
- char *b;
-#endif
-{
- for ( ;*a != 0 && *b != 0; a++, b++) {
- if (toupper(*a) != toupper(*b)) return 0;
- }
- return (*a == *b);
-}
-
-static void
-#ifdef __USE_PROTOS
-pStdin( void )
-#else
-pStdin( )
-#endif
-{
- if ( DontAcceptStdin )
- {
- warnNoFL("'-' (stdin) ignored as files were specified first");
- return;
- }
-
- require(NumFiles<MaxNumFiles,"exceeded max # of input files");
- FileStr[NumFiles++] = "stdin";
- DontAcceptFiles = 1;
-}
-
-static void
-#ifdef __USE_PROTOS
-pFile( char *s )
-#else
-pFile( s )
-char *s;
-#endif
-{
- if ( *s=='-' ) { warnNoFL( eMsg1("invalid option: '%s'",s) ); return; }
- if ( DontAcceptFiles )
- {
- warnNoFL(eMsg1("file '%s' ignored as '-' (stdin option) was specified first",s));
- return;
- }
-
- require(NumFiles<MaxNumFiles,"exceeded max # of input files");
- FileStr[NumFiles++] = s;
- DontAcceptStdin = 1;
-}
-
-/* MR14
- Allow input to be a file containing a list of files
- Bernard Giroud (b_giroud@decus.ch)
-*/
-
-static void
-#ifdef __USE_PROTOS
-pFileList( char *s, char *t )
-#else
-pFileList( s, t )
-char *s;
-char *t;
-#endif
-{
-#define MaxFLArea 1024
- FILE *fl;
- static char Fn_in_Fl[MaxFLArea] = "";
- char one_fn[MaxFileName];
- char *flp = &Fn_in_Fl[0];
- int fnl, left = MaxFLArea, i;
-
- if ( *t=='-' ) { warnNoFL( eMsg1("invalid option: '%s'",t) ); return; }
- if ( DontAcceptFiles )
- {
- warnNoFL(eMsg1("file '%s' ignored as '-' (stdin option) was specified first",t));
- return;
- }
-
- if ((fl = fopen(t, "r")) == NULL)
- {
- warnNoFL(eMsg1("file '%s' can't be opened", t));
- return;
- }
- for (;;)
- {
- if (fgets(one_fn, 128 - 1, fl) == NULL)
- break;
- fnl = strlen(one_fn);
- require(fnl<=left, "no more room in File List Area");
- /* drop the trailing LF */
- if (one_fn[fnl - 1] == 0x0a) one_fn[fnl - 1] = ' ';
- strcat(Fn_in_Fl, one_fn);
- left = left - fnl;
- require(NumFiles<MaxNumFiles,"exceeded max # of input files");
- FileStr[NumFiles++] = flp;
- flp = flp + fnl;
- }
- fclose(fl);
- for (i=0;i < MaxFLArea;i++) if (Fn_in_Fl[i] == ' ') Fn_in_Fl[i] = '\0';
- DontAcceptStdin = 1;
-}
-
-static void
-#ifdef __USE_PROTOS
-pLLK( char *s, char *t )
-#else
-pLLK( s, t )
-char *s;
-char *t;
-#endif
-{
- LL_k = atoi(t);
- if ( LL_k <= 0 ) {
- warnNoFL("must have at least one token of lookahead (setting to 1)");
- LL_k = 1;
- }
-}
-
-static void
-#ifdef __USE_PROTOS
-pCk( char *s, char *t )
-#else
-pCk( s, t )
-char *s;
-char *t;
-#endif
-{
- CLL_k = atoi(t);
- if ( CLL_k <= 0 ) {
- warnNoFL("must have at least one token of look-ahead (setting to 1)");
- CLL_k = 1;
- }
-}
-
-static void /* MR6 */
-#ifdef __USE_PROTOS
-pTab( char *s, char *t ) /* MR6 */
-#else
-pTab( s, t ) /* MR6 */
-char *s; /* MR6 */
-char *t; /* MR6 */
-#endif
-{ /* MR6 */
- TabWidth = atoi(t); /* MR6 */
- if ( TabWidth < 0 || TabWidth > 8 ) { /* MR6 */
- warnNoFL("tab width must be between 1 and 8"); /* MR6 */
- TabWidth=0; /* MR6 */
- } /* MR6 */
-} /* MR6 */
-
-static int ambAidDepthSpecified=0; /* MR11 */
-
-static void /* MR11 */
-#ifdef __USE_PROTOS
-pAAd( char *s, char *t ) /* MR11 */
-#else
-pAAd( s, t ) /* MR11 */
-char *s; /* MR11 */
-char *t; /* MR11 */
-#endif
-{ /* MR11 */
- ambAidDepthSpecified=1; /* MR11 */
- MR_AmbAidDepth = atoi(t); /* MR11 */
-} /* MR11 */
-
-static void /* MR11 */
-#ifdef __USE_PROTOS
-pTreport( char *s, char *t ) /* MR11 */
-#else
-pTreport( s, t ) /* MR11 */
- char *s; /* MR11 */
- char *t; /* MR11 */
-#endif
-{ /* MR11 */
- TnodesReportThreshold = atoi(t); /* MR11 */
-} /* MR11 */
-
-#ifdef __USE_PROTOS
-void chkGTFlag(void) /* 7-Apr-97 MR1 */
-#else
-void chkGTFlag() /* 7-Apr-97 MR1 */
-#endif
-{
- if ( !GenAST )
- warn("#-variable or other AST item referenced w/o -gt option");
-}
-
-
-#ifdef __USE_PROTOS
-static void pInfo(char *s, char *t) /* MR10 */
-#else
-static void pInfo(s,t) /* MR10 */
- char *s;
- char *t;
-#endif
-{
- char *p;
- int q;
- for (p=t; *p != 0; p++) {
- q=tolower(*p);
- if (q=='t') {
- InfoT=1;
- } else if (q=='p') {
- InfoP=1;
- } else if (q=='m') {
- InfoM=1;
- } else if (q=='o') {
- InfoO=1;
- } else if (q=='0') {
- ; /* nothing */
- } else if (q=='f') {
- InfoF=1;
- } else {
- warnNoFL(eMsgd("unrecognized -info option \"%c\"",(int)*p));
- };
- };
-}
-
-#ifdef __USE_PROTOS
-static void pCGen(void) { CodeGen = FALSE; LexGen = FALSE; }
-static void pLGen(void) { LexGen = FALSE; }
-static void pXTGen(void){ MR_Inhibit_Tokens_h_Gen = TRUE; }
-static void pTGen(void) { TraceGen = TRUE; }
-static void pSGen(void) { GenExprSetsOpt = FALSE; }
-static void pPrt(void) { PrintOut = TRUE; pCGen(); pLGen(); }
-static void pPrtA(void) { PrintOut = TRUE; PrintAnnotate = TRUE; pCGen(); pLGen(); }
-static void pAst(void) { GenAST = TRUE; }
-static void pANSI(void) { GenANSI = TRUE; }
-static void pCr(void) { GenCR = TRUE; }
-static void pNOPURIFY(void) { PURIFY = FALSE; }
-/*static void pCt(void) { warnNoFL("-ct option is now the default"); }*/
-static void pLI(void) { GenLineInfo = TRUE; GenLineInfoMS = FALSE; } /* MR14 */
-static void pLIms(void) { GenLineInfo = TRUE; GenLineInfoMS = TRUE; } /* MR14 */
-static void pFr(char *s, char *t) {RemapFileName = t;}
-static void pFe(char *s, char *t) {ErrFileName = t;}
-static void pFl(char *s, char *t) {DlgFileName = t;}
-static void pFm(char *s, char *t) {ModeFileName = t;}
-static void pFt(char *s, char *t) {DefFileName = t;}
-
-static void pE1(void) { elevel = 1; }
-static void pE2(void) { elevel = 2; }
-static void pE3(void) { elevel = 3; }
-static void pEGen(void) { GenEClasseForRules = 1; }
-static void pDL(void)
- {
- DemandLookahead = 1;
- if ( GenCC ) {
- warnNoFL("-gk does not work currently in C++ mode; -gk turned off");
- DemandLookahead = 0;
- }
- }
-
-static void pAA(char *s,char *t) {MR_AmbAidRule = t;} /* MR11 */
-static void pAAm(char *s){MR_AmbAidMultiple = 1;} /* MR11 */
-static void pGHdr(void) { GenStdPccts = 1; }
-static void pFHdr(char *s, char *t) { stdpccts = t; pGHdr(); }
-static void pW1(void) { WarningLevel = 1; }
-static void pNewAST(void) { NewAST = 1; } /* MR13 */
-static void ptmakeInParser(void) { tmakeInParser = 1; } /* MR23 */
-static void pAlpha(void) { AlphaBetaTrace = 1; } /* MR14 */
-static void pMR_BlkErr(void) { MR_BlkErr = 1; } /* MR21 */
-static void pStdout(void) {UseStdout = 1; } /* MR6 */
-static void pW2(void) { WarningLevel = 2; }
-static void pCC(void) { GenCC = TRUE; }
-#else
-static void pCGen() { CodeGen = FALSE; LexGen = FALSE; }
-static void pLGen() { LexGen = FALSE; }
-static void pXTGen(){ MR_Inhibit_Tokens_h_Gen = TRUE; } /* MR14 */
-static void pTGen() { TraceGen = TRUE; }
-static void pSGen() { GenExprSetsOpt = FALSE; }
-static void pPrt() { PrintOut = TRUE; pCGen(); pLGen(); }
-static void pPrtA() { PrintOut = TRUE; PrintAnnotate = TRUE; pCGen(); pLGen(); }
-static void pAst() { GenAST = TRUE; }
-static void pANSI() { GenANSI = TRUE; }
-static void pCr() { GenCR = TRUE; }
-static void pNOPURIFY() { PURIFY = FALSE; }
-
-/*static void pCt() { warnNoFL("-ct option is now the default"); }*/
-static void pLI() { GenLineInfo = TRUE; GenLineInfoMS = FALSE; } /* MR14 */
-static void pLIms() { GenLineInfo = TRUE; GenLineInfoMS = TRUE; } /* MR14 */
-static void pFr(s,t) char *s, *t; {RemapFileName = t;}
-static void pFe(s,t) char *s, *t; {ErrFileName = t;}
-static void pFl(s,t) char *s, *t; {DlgFileName = t;}
-static void pFm(s,t) char *s, *t; {ModeFileName = t;}
-static void pFt(s,t) char *s, *t; {DefFileName = t;}
-
-static void pE1() { elevel = 1; }
-static void pE2() { elevel = 2; }
-static void pE3() { elevel = 3; }
-static void pEGen() { GenEClasseForRules = 1; }
-static void pDL()
- {
- DemandLookahead = 1;
- if ( GenCC ) {
- warnNoFL("-gk does not work currently in C++ mode; -gk turned off");
- DemandLookahead = 0;
- }
- }
-
-static void pAA(s,t) char *s; char *t; {MR_AmbAidRule = t;} /* MR11 BJS 20-Mar-98 */
-static void pAAm(s) char *s; {MR_AmbAidMultiple = 1;} /* MR11 BJS 20-Mar-98 */
-static void pGHdr() { GenStdPccts = 1; }
-static void pFHdr(s,t) char *s, *t; { stdpccts = t; pGHdr(); }
-static void pW1() { WarningLevel = 1; }
-static void pNewAST() { NewAST = 1; } /* MR13 */
-static void ptmakeInParser() { tmakeInParser = 1; } /* MR23 */
-static void pAlpha() { AlphaBetaTrace = 1; } /* MR14 */
-static void pMR_BlkErr() { MR_BlkErr = 1; } /* MR21 */
-static void pStdout() {UseStdout = 1; } /* MR6 */
-static void pW2() { WarningLevel = 2; }
-static void pCC() { GenCC = TRUE; }
-#endif
-
-static void
-#ifdef __USE_PROTOS
-pPre( char *s, char *t )
-#else
-pPre( s, t )
-char *s;
-char *t;
-#endif
-{
- RulePrefix = t;
-}
-
-static void
-#ifdef __USE_PROTOS
-pOut( char *s, char *t )
-#else
-pOut( s, t )
-char *s;
-char *t;
-#endif
-{
- OutputDirectory = t;
-}
-
-static void
-#ifdef __USE_PROTOS
-pPred( void )
-#else
-pPred( )
-#endif
-{
- warnNoFL("-pr is no longer used (predicates employed if present); see -prc, -mrhoist, -mrhoistk");
-/*
-** if ( DemandLookahead )
-** warnNoFL("-gk conflicts with -pr; -gk turned off");
-** DemandLookahead = 0;
-** HoistPredicateContext = 0;
-*/
-}
-
-static void
-#ifdef __USE_PROTOS
-pPredCtx( char *s, char *t )
-#else
-pPredCtx(s,t)
-char *s;
-char *t;
-#endif
-{
- if ( ci_strequ(t,"on")) HoistPredicateContext = 1;
- else if ( ci_strequ(t,"off")) HoistPredicateContext = 0;
- if ( DemandLookahead )
- {
- warnNoFL("-gk incompatible with semantic predicate usage; -gk turned off");
- DemandLookahead = 0;
- }
-}
-
-static void
-#ifdef __USE_PROTOS
-pMRhoist( char *s, char *t )
-#else
-pMRhoist(s,t)
-char *s;
-char *t;
-#endif
-{
- if ( ci_strequ(t,"on")) MRhoisting = 1;
- else if ( ci_strequ(t,"off")==0 ) MRhoisting = 0;
- if (MRhoisting) {
- fprintf(stderr,"Maintenance Release style hoisting enabled for predicates with lookahead depth = 1\n");
- fprintf(stderr," No longer considered experimental\n");
- fprintf(stderr," Can't consider suppression for predicates with lookahead depth > 1\n");
- fprintf(stderr," Implies -prc on but does *not* imply -mrhoistk for k>1 predicates\n");
- fprintf(stderr," This is a reminder, not a warning or error.\n");
- };
-}
-
-static void
-#ifdef __USE_PROTOS
-pMRhoistk( char *s, char *t )
-#else
-pMRhoistk(s,t)
-char *s;
-char *t;
-#endif
-{
- if ( ci_strequ(t,"on")) MRhoistingk = 1;
- else if ( ci_strequ(t,"off")==0 ) MRhoistingk = 0;
- if (MRhoistingk) {
- fprintf(stderr,"EXPERIMENTAL Maintenance Release style hoisting enabled\n");
- fprintf(stderr," Applies to predicates with lookahead depth > 1\n");
- fprintf(stderr," Implies -prc on and -mrhoist on\n");
- };
-}
-
-static void
-#ifdef __USE_PROTOS
-pTRes( char *s, char *t )
-#else
-pTRes( s, t )
-char *s;
-char *t;
-#endif
-{
- TreeResourceLimit = atoi(t);
- if ( TreeResourceLimit <= 0 )
- {
- warnNoFL("analysis resource limit (# of tree nodes) must be greater than 0");
- TreeResourceLimit = -1; /* set to no limit */
- }
-}
-
-Opt options[] = {
-#ifdef __cplusplus
- { "-CC", 0, (void (*)(...)) pCC, "Generate C++ output (default=FALSE)"},
- { "-ck", 1, (void (*)(...)) pCk, "Set compressed lookahead depth; fast approximate lookahead"},
- { "-cr", 0, (void (*)(...)) pCr, "Generate cross reference (default=FALSE)"},
- { "-e1", 0, (void (*)(...)) pE1, "Ambiguities/errors shown in low detail (default)"},
- { "-e2", 0, (void (*)(...)) pE2, "Ambiguities/errors shown in more detail"},
- { "-e3", 0, (void (*)(...)) pE3,
- "Ambiguities for k>1 grammars shown with exact tuples (not lookahead sets)"},
- { "-f", 1, (void (*)(...)) pFileList,"Read names of grammar files from specified file"}, /* MR14 */
- { "-fe", 1, (void (*)(...)) pFe, "Rename err.c"},
- { "-fh", 1, (void (*)(...)) pFHdr, "Rename stdpccts.h header (turns on -gh)"},
- { "-fl", 1, (void (*)(...)) pFl, "Rename lexical output--parser.dlg"},
- { "-fm", 1, (void (*)(...)) pFm, "Rename mode.h"},
- { "-fr", 1, (void (*)(...)) pFr, "Rename remap.h"},
- { "-ft", 1, (void (*)(...)) pFt, "Rename tokens.h"},
- { "-ga", 0, (void (*)(...)) pANSI, "Generate ANSI-compatible code (default=FALSE)"},
- { "-gc", 0, (void (*)(...)) pCGen, "Do not generate output parser code (default=FALSE)"},
- { "-gd", 0, (void (*)(...)) pTGen, "Generate code to trace rule invocation (default=FALSE)"},
- { "-ge", 0, (void (*)(...)) pEGen, "Generate an error class for each non-terminal (default=FALSE)"},
- { "-gh", 0, (void (*)(...)) pGHdr, "Generate stdpccts.h for non-ANTLR-generated-files to include"},
- { "-gk", 0, (void (*)(...)) pDL, "Generate parsers that delay lookahead fetches until needed"},
- { "-gl", 0, (void (*)(...)) pLI, "Generate line info about grammar actions in parser"},
- { "-glms", 0, (void (*)(...)) pLIms,"Like -gl but replace '\\' with '/' in #line filenames for MS C/C++ systems"},
- { "-gp", 1, (void (*)(...)) pPre, "Prefix all generated rule functions with a string"},
- { "-gs", 0, (void (*)(...)) pSGen, "Do not generate sets for token expression lists (default=FALSE)"},
- { "-gt", 0, (void (*)(...)) pAst, "Generate code for Abstract-Syntax-Trees (default=FALSE)"},
- { "-gx", 0, (void (*)(...)) pLGen, "Do not generate lexical (dlg-related) files (default=FALSE)"},
- { "-gxt",0, (void (*)(...)) pXTGen, "Do not generate tokens.h (default=FALSE)"},
- { "-k", 1, (void (*)(...)) pLLK, "Set full LL(k) lookahead depth (default==1)"},
- { "-o", 1, (void (*)(...)) pOut, OutputDirectoryOption},
- { "-p", 0, (void (*)(...)) pPrt, "Print out the grammar w/o actions (default=no)"},
- { "-pa", 0, (void (*)(...)) pPrtA, "Print out the grammar w/o actions & w/FIRST sets (default=no)"},
- { "-pr",0, (void (*)(...)) pPred, "no longer used; predicates employed if present"},
- { "-prc", 1, (void (*)(...)) pPredCtx,"Turn on/off computation of context for hoisted predicates"},
- { "-rl", 1, (void (*)(...)) pTRes, "Limit max # of tree nodes used by grammar analysis"},
- { "-stdout",0, (void (*)(...)) pStdout,"Send grammar.c/grammar.cpp to stdout"}, /* MR6 */
- { "-tab", 1, (void (*)(...)) pTab, "Width of tabs (1 to 8) for grammar.c/grammar.cpp files"}, /* MR6 */
- { "-w1", 0, (void (*)(...)) pW1, "Set the warning level to 1 (default)"},
- { "-w2", 0, (void (*)(...)) pW2, "Ambiguities yield warnings even if predicates or (...)? block"},
- { "-", 0, (void (*)(...)) pStdin, "Read grammar from stdin" },
- { "-mrhoist",1, (void (*)(...)) pMRhoist, /* MR9 */
- "Turn on/off k=1 Maintenance Release style hoisting"}, /* MR9 */
- { "-mrhoistk",1, (void (*)(...)) pMRhoistk, /* MR9 */
- "Turn on/off EXPERIMENTAL k>1 Maintenance Release style hoisting"}, /* MR13 */
- { "-aa" , 1, (void (*)(...)) pAA, "Ambiguity aid for a rule (rule name or line number)"}, /* MR11 */
- { "-aam" , 0, (void (*)(...)) pAAm,
- "Lookahead token may appear multiple times in -aa listing"}, /* MR11 */
- { "-aad" , 1, (void (*)(...)) pAAd,
- "Limits exp growth of -aa listing - default=1 (max=ck value)"}, /* MR11 */
- { "-info", 1, (void (*)(...)) pInfo,
- "Extra info: p=pred t=tnodes f=first/follow m=monitor o=orphans 0=noop"}, /* MR12 */
- { "-treport",1,(void (*)(...)) pTreport,
- "Report when tnode usage exceeds value during ambiguity resolution"}, /* MR11 */
- { "-newAST", 0, (void (*)(...)) pNewAST,
- "In C++ mode use \"newAST(...)\" rather than \"new AST(...)\""}, /* MR13 */
- { "-tmake", 0, (void (*)(...)) ptmakeInParser,
- "In C++ mode use parser's tmake method rather than \"ASTBase::tmake(...)\""}, /* MR23 */
- { "-alpha",0,(void (*)(...)) pAlpha,
- "Provide additional information for \"(alpha)? beta\" error messages"}, /* MR14 */
- { "-mrblkerr",0,(void (*)(...)) pMR_BlkErr, /* MR21 */
- "EXPERIMENTAL change to (...)* and (...)+ syntax error sets"}, /* MR21 */
- { "-nopurify",0,(void (*)(...)) pNOPURIFY,
- "Don't use the notorious PURIFY macro (replaced by MR23 initial value syntax) to zero return arguments of rules"}, /* MR23 */
- { "*", 0, (void (*)(...)) pFile, "" }, /* anything else is a file */
-#else
- { "-CC", 0, pCC, "Generate C++ output (default=FALSE)"},
- { "-cr", 0, pCr, "Generate cross reference (default=FALSE)"},
- { "-ck", 1, pCk, "Set compressed lookahead depth; fast approximate lookahead"},
- { "-e1", 0, pE1, "Ambiguities/errors shown in low detail (default)"},
- { "-e2", 0, pE2, "Ambiguities/errors shown in more detail"},
- { "-e3", 0, pE3, "Ambiguities for k>1 grammars shown with exact tuples (not lookahead sets)"},
- { "-f", 1, pFileList,"Read names of grammar files from specified file"}, /* MR14 */
- { "-fe", 1, pFe, "Rename err.c"},
- { "-fh", 1, pFHdr, "Rename stdpccts.h header (turns on -gh)"},
- { "-fl", 1, pFl, "Rename lexical output--parser.dlg"},
- { "-fm", 1, pFm, "Rename mode.h"},
- { "-fr", 1, pFr, "Rename remap.h"},
- { "-ft", 1, pFt, "Rename tokens.h"},
- { "-ga", 0, pANSI, "Generate ANSI-compatible code (default=FALSE)"},
- { "-gc", 0, pCGen, "Do not generate output parser code (default=FALSE)"},
- { "-gd", 0, pTGen, "Generate code to trace rule invocation (default=FALSE)"},
- { "-ge", 0, pEGen, "Generate an error class for each non-terminal (default=FALSE)"},
- { "-gh", 0, pGHdr, "Generate stdpccts.h for non-ANTLR-generated-files to include"},
- { "-gk", 0, pDL, "Generate parsers that delay lookahead fetches until needed"},
- { "-gl", 0, pLI, "Generate line info about grammar actions in C parser"},
- { "-glms", 0, pLIms,"Like -gl but replace '\\' with '/' in #line filenames for MS C/C++ systems"},
- { "-gp", 1, pPre, "Prefix all generated rule functions with a string"},
- { "-gs", 0, pSGen, "Do not generate sets for token expression lists (default=FALSE)"},
- { "-gt", 0, pAst, "Generate code for Abstract-Syntax-Trees (default=FALSE)"},
- { "-gx", 0, pLGen, "Do not generate lexical (dlg-related) files (default=FALSE)"},
- { "-gxt",0, pXTGen, "Do not generate tokens.h (default=FALSE)"},
- { "-k", 1, pLLK, "Set full LL(k) lookahead depth (default==1)"},
- { "-o", 1, pOut, OutputDirectoryOption},
- { "-p", 0, pPrt, "Print out the grammar w/o actions (default=no)"},
- { "-pa", 0, pPrtA, "Print out the grammar w/o actions & w/FIRST sets (default=no)"},
- { "-pr",0, pPred, "no longer used; predicates employed if present"},
- { "-prc", 1, pPredCtx,"Turn on/off computation of context for hoisted predicates"},
- { "-rl", 1, pTRes, "Limit max # of tree nodes used by grammar analysis"},
- { "-stdout",0, pStdout, "Send grammar.c/grammar.cpp to stdout"}, /* MR6 */
- { "-tab", 1, pTab, "Width of tabs (1 to 8) for grammar.c/grammar.cpp files"}, /* MR6 */
- { "-w1", 0, pW1, "Set the warning level to 1 (default)"},
- { "-w2", 0, pW2, "Ambiguities yield warnings even if predicates or (...)? block"},
- { "-mrhoist",1,pMRhoist, /* MR9 */
- "Turn on/off k=1 Maintenance Release style hoisting"}, /* MR9 */
- { "-mrhoistk",1,pMRhoistk, /* MR13 */
- "Turn on/off k>1 EXPERIMENTAL Maintenance Release style hoisting"}, /* MR13 */
- { "-aa" ,1,pAA, "Ambiguity aid for a rule (rule name or line number)"}, /* MR11 */
- { "-aam" ,0,pAAm,
- "Lookahead token may appear multiple times in -aa listing"}, /* MR11 */
- { "-aad" ,1,pAAd,
- "Limits exp growth of -aa listing - default=1 (max=ck value)"}, /* MR11 */
- { "-info",1,pInfo,
- "Extra info: p=pred t=tnodes f=first/follow m=monitor o=orphans 0=noop"}, /* MR11 */
- { "-treport",1,pTreport,
- "Report when tnode usage exceeds value during ambiguity resolution"}, /* MR11 */
- { "-newAST", 0, pNewAST,
- "In C++ mode use \"newAST(...)\" rather than \"new AST(...)\""}, /* MR13 */
- { "-tmake", 0, ptmakeInParser,
- "In C++ mode use parser's tmake method rather than \"ASTBase::tmake(...)\""}, /* MR23 */
- { "-alpha",0, pAlpha,
- "Provide additional information for \"(alpha)? beta\" error messages"}, /* MR14 */
- { "-mrblkerr",0,pMR_BlkErr, /* MR21 */
- "EXPERIMENTAL change to (...)* and (...)+ syntax error sets"}, /* MR21 */
- { "-nopurify",0,pNOPURIFY,
- "Don't use the notorious PURIFY macro (replaced by MR23 initial value syntax) to zero return arguments of rules"}, /* MR23 */
- { "-", 0, pStdin, "Read grammar from stdin" },
- { "*", 0, pFile, "" }, /* anything else is a file */
-#endif
- { NULL, 0, NULL }
- };
-
-void readDescr();
-void cleanUp();
-
-#ifdef __USE_PROTOS
-static void buildRulePtr( void );
-static void help( void );
-static void init( void );
-static void CompleteTokenSetRefs( void );
-static void ensure_no_C_file_collisions(char *);
-static void CompleteContextGuards(void);
-#else
-static void buildRulePtr( );
-static void help( );
-static void init( );
-static void CompleteTokenSetRefs( );
-static void ensure_no_C_file_collisions();
-static void CompleteContextGuards();
-#endif
-
-static void
-#ifdef __USE_PROTOS /* <BJS> */
-report_numericPredLabels(ActionNode *a)
-#else
-report_numericPredLabels(a)
-ActionNode *a;
-#endif
-{ /* MR10 */
- warnFL("numeric references to attributes (e.g. $i or $i.j) in semantic pred will be null during guess mode", /* MR10 */
- FileStr[a->file],a->line); /* MR10 */
-} /* MR10 */
-
- /* M a i n */
-
-int
-#ifdef __USE_PROTOS
-main( int argc, char *argv[] )
-#else
-main( argc, argv )
-int argc;
-char *argv[];
-#endif
-{
- int i;
- static char EPSTR[] = "[Ep]";
-
- Save_argc=argc; /* MR10 */
- Save_argv=argv; /* MR10 */
-
-/* malloc_debug(8);*/
-
-#ifdef SPECIAL_INITS
- special_inits(); /* MR1 */
-#endif
- fprintf(stderr, "Antlr parser generator Version %s 1989-2001\n", Version);
- if ( argc == 1 ) { help(); zzDIE; }
- ProcessArgs(argc-1, &(argv[1]), options);
-
-/* MR14 */ if (MR_AmbAidRule && AlphaBetaTrace) {
-/* MR14 */ fatal("Can't specify both -aa (ambiguity aid) and -alpha (\"(alpha)? beta\" aid)");
-/* MR14 */ }
-
- if (MRhoistingk) { /* MR13 */
- HoistPredicateContext=1; /* MR13 */
- MRhoisting=1; /* MR13 */
- }; /* MR13 */
- if (MRhoisting && ! HoistPredicateContext) {
-/*** warnNoFL("Using \"-mrhoist\" forces \"-prc on\""); ***/
- HoistPredicateContext=1;
- };
- if (HoistPredicateContext && ! MRhoisting) {
- warnNoFL("When using predicate context (-prc on) -mrhoist on is recommended");
- }
- /* Fix lookahead depth */
- /* Compressed lookahead must always be larger than or equal to full lookahead */
- if ( CLL_k < LL_k && CLL_k>0 )
- {
- warnNoFL("must have compressed lookahead >= full LL(k) lookahead (setting -ck to -k)");
- CLL_k = LL_k;
- }
- if ( CLL_k == -1 ) CLL_k = LL_k;
- OutputLL_k = CLL_k;
- if ( ((CLL_k-1)&CLL_k)!=0 ) { /* output ll(k) must be power of 2 */
- int n;
- for(n=1; n<CLL_k; n<<=1) {;}
- OutputLL_k = n;
- };
-
- if (MR_BlkErr) {
- warnNoFL("The -mrblkerr option is EXPERIMENTAL");
- if (LL_k > 1) {
- warnNoFL("The -mrblkerr option is designed only for k=1 ck=1 grammars");
- }
- };
-
- if ( ! ambAidDepthSpecified) {
- MR_AmbAidDepth=1;
- } else {
- if (MR_AmbAidDepth > CLL_k || MR_AmbAidDepth <= 0) {
- warnNoFL(eMsgd(
- "Ambiguity aid depth (\"-aad ...\") must be a number between 1 and max(k,ck)=%d",CLL_k));
- MR_AmbAidDepth=1;
- };
- if (MR_AmbAidDepth == 0) {
- MR_AmbAidDepth=2;
- };
- };
-
- if (MR_AmbAidRule != NULL) MR_AmbAidLine=atoi(MR_AmbAidRule);
-
- fpTrans = &(C_Trans[0]); /* Translate to C Language */
- fpJTrans = &(C_JTrans[0]);
- init();
- lexclass(LexStartSymbol);
-
- readDescr();
- LastTokenCounted = TokenNum;
- RemapForcedTokens();
- if ( CannotContinue ) {cleanUp(); zzDIE;}
- if ( GenCC && no_classes_found ) fatal("required grammar class not found (exiting...)");
- if ( WarningLevel>1 && HdrAction == NULL )
- warnNoFL("no #header action was found");
- if ( FoundAtOperator && ! FoundExceptionGroup) {
- warnNoFL("found the exception operator '@' - but no exception group was found");
- };
- EpToken = addTname(EPSTR); /* add imaginary token epsilon */
- set_orel(EpToken, &imag_tokens);
-
- /* this won't work for hand-built scanners since EofToken is not
- * known. Forces EOF to be token type 1.
- */
- set_orel(EofToken, &imag_tokens);
-
- set_size(NumWords(TokenNum-1));
-
- /* compute the set of all known token types
- * It represents the set of tokens from 1 to last_token_num + the
- * reserved positions above that (if any). Don't include the set of
- * imaginary tokens such as the token/error classes or EOF.
- */
- {
- set a;
- a = set_dup(reserved_positions);
- for (i=1; i<TokenNum; i++) { set_orel(i, &a); }
- all_tokens = set_dif(a, imag_tokens);
- set_free(a);
- }
-
- ComputeTokSets(); /* Compute #tokclass sets */
- CompleteTokenSetRefs(); /* Change complex nodes in syn diag */
- CompleteContextGuards(); /* MR13 */
-
- if ( CodeGen ) genDefFile(); /* create tokens.h */
- if ( LexGen ) genLexDescr(); /* create parser.dlg */
-
- if ( GenStdPccts )
- {
- FILE *f = fopen(OutMetaName(stdpccts), "w");
- if ( f==NULL ) {warnNoFL( eMsg1("can't create %s",OutMetaName(stdpccts)) );}
- else
- {
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(stdpccts)); /* MR1 */
-#endif
- if (strcmp(stdpccts,"stdpccts.h") == 0) { /* MR10 */
- genStdPCCTSIncludeFile(f,NULL); /* MR10 */
- } else { /* MR10 */
- genStdPCCTSIncludeFile(f,pcctsBaseName(stdpccts)); /* MR32 */
- };
- fclose(f);
- }
- }
-
- buildRulePtr(); /* create mapping from rule # to RuleBlk junction */
- ComputeErrorSets();
- FoLink( (Node *)SynDiag ); /* add follow links to end of all rules */
-
- if ( GenCR ) GenCrossRef( SynDiag );
-
- if ( CodeGen )
- {
- if ( SynDiag == NULL )
- {
- warnNoFL("no grammar description recognized");
- cleanUp();
- zzDIE;
- }
- else if ( !GenCC ) {
- ErrFile = fopen(OutMetaName(ErrFileName), "w");
- require(ErrFile != NULL, "main: can't open err file");
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(ErrFileName)); /* MR1 */
-#endif
- NewSetWd();
- GenErrHdr();
- TRANS(SynDiag); /* Translate to the target language */
- DumpSetWd();
- DumpRemainingTokSets();
- fclose( ErrFile );
- }
- else {
- strcpy(Parser_h_Name, CurrentClassName);
- strcat(Parser_h_Name, ".h");
- strcpy(Parser_c_Name, CurrentClassName);
- strcat(Parser_c_Name, CPP_FILE_SUFFIX);
- ensure_no_C_file_collisions(Parser_c_Name);
- Parser_h = fopen(OutMetaName(Parser_h_Name), "w");
- require(Parser_h != NULL, "main: can't open class Parserx.h file");
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(Parser_h_Name)); /* MR1 */
-#endif
- Parser_c = fopen(OutMetaName(Parser_c_Name), "w");
- require(Parser_c != NULL, "main: can't open class Parserx.c file");
-#ifdef SPECIAL_FOPEN
- special_fopen_actions(OutMetaName(Parser_c_Name)); /* MR1 */
-#endif
- GenParser_h_Hdr();
- if ( class_before_actions != NULL )
- {
- ListNode *p;
- for (p = class_before_actions->next; p!=NULL; p=p->next)
- {
- UserAction *ua = (UserAction *)p->elem;
- dumpAction( ua->action, Parser_h, 0, ua->file, ua->line, 1);
- }
- }
- GenParser_c_Hdr();
- fprintf(Parser_h, "protected:\n"); /* MR20 */
- NewSetWd();
- TRANS(SynDiag); /* Translate to the target language */
- DumpSetWd();
- GenRuleMemberDeclarationsForCC(Parser_h, SynDiag);
- if ( class_after_actions != NULL )
- {
- ListNode *p;
- for (p = class_after_actions->next; p!=NULL; p=p->next)
- {
- UserAction *ua = (UserAction *)p->elem;
- dumpAction( ua->action, Parser_h, 0, ua->file, ua->line, 1);
- }
- }
- DumpRemainingTokSets();
- fprintf(Parser_h, "};\n");
- fprintf(Parser_h, "\n#endif /* %s_h */\n", CurrentClassName);
- fclose( Parser_h );
- fclose( Parser_c );
- }
- }
-
- MR_orphanRules(stderr);
- if (LTinTokenAction && WarningLevel >= 2) {
- if (GenCC) {
- warnNoFL("At least one <<action>> following a token match contains a reference to LT(...)\n this will reference the immediately preceding token,\n not the one which follows as is the case with semantic predicates.");
- }
- warnNoFL("At least one <<action>> following a token match contains a reference to LA(...) or LATEXT(...)\n this will reference the immediately preceding token,\n not the one which follows as is the case with semantic predicates.");
- }
-
- if ( PrintOut )
- {
- if ( SynDiag == NULL ) {warnNoFL("no grammar description recognized");}
- else PRINT(SynDiag);
- }
-
-#ifdef DBG_LL1
-#endif
- GenRemapFile(); /* create remap.h */
-/* MR10 */ if (FoundGuessBlk) {
-#ifdef __cplusplus__
-/* MR10 */ list_apply(NumericPredLabels, (void (*)(void *))report_numericPredLabels);
-#else
-#ifdef __USE_PROTOS
-/* MR10 */ list_apply(NumericPredLabels, (void (*)(void *))report_numericPredLabels);
-#else
-/* MR10 */ list_apply(NumericPredLabels,report_numericPredLabels);
-#endif
-#endif
-/* MR10 */ };
-
- if (InfoT && TnodesAllocated > 0) {
- if (TnodesPeak > 10000) {
- fprintf(stdout,"\nTree Nodes: peak %dk created %dk lost %d\n",
- (TnodesPeak/1000),
- (TnodesAllocated/1000),
- TnodesInUse-tnodes_used_in_guard_predicates_etc);
- } else {
- fprintf(stdout,"\nTree Nodes: peak %d created %d lost %d\n",
- TnodesPeak,
- TnodesAllocated,
- TnodesInUse-tnodes_used_in_guard_predicates_etc);
- };
- };
- if (InfoF) {
- DumpFcache();
- };
- if (MR_skipped_e3_report) {
- fprintf(stderr,"note: use -e3 to get exact information on ambiguous tuples\n");
- };
- if (MR_BadExprSets != 0) {
- fprintf(stderr,"note: Unreachable C or C++ code was generated for empty expression sets,\n");
- fprintf(stderr," probably due to undefined rules or infinite left recursion.\n");
- fprintf(stderr," To locate: search the generated code for \"empty set expression\"\n");
- };
- if (MR_AmbAidRule != NULL && MR_matched_AmbAidRule==0) {
- RuleEntry *q = (RuleEntry *) hash_get(Rname,MR_AmbAidRule);
- if (MR_AmbAidLine == 0 && q == NULL) {
- warnNoFL(eMsg2("there is no rule \"%s\" so \"-aa %s\" will never match",
- MR_AmbAidRule,MR_AmbAidRule));
- } else {
- warnNoFL(eMsg1("there was no ambiguity that matched \"-aa %s\"",MR_AmbAidRule));
- };
- };
- if (AlphaBetaTrace) {
-
- if (MR_AlphaBetaMessageCount == 0) {
- fprintf(stderr,"note: there were no messages about \"(alpha)? beta\" blocks added to the generated code\n");
- } else {
- fprintf(stderr,"note: there were %d messages about \"(alpha)? beta\" blocks added to the generated code\n",
- MR_AlphaBetaMessageCount);
- }
-
- if (set_null(MR_CompromisedRules)) {
- fprintf(stderr,"note: the list of rules with compromised follow sets is empty\n");
- } else {
- fprintf(stderr,"note: the following is a list of rules which *may* have incorrect\n");
- fprintf(stderr," follow sets computed as a result of an \"(alpha)? beta\" block\n");
- fprintf(stderr,"\n");
- MR_dumpRuleSet(MR_CompromisedRules);
- fprintf(stderr,"\n");
- }
- }
- cleanUp();
- exit(PCCTS_EXIT_SUCCESS);
- return 0; /* MR11 make compilers happy */
-}
-
-static void
-#ifdef __USE_PROTOS
-init( void )
-#else
-init( )
-#endif
-{
- SignalEntry *q;
-
- Tname = newHashTable();
- Rname = newHashTable();
- Fcache = newHashTable();
- Tcache = newHashTable();
- Sname = newHashTable();
- Pname = newHashTable(); /* MR11 */
-
- /* Add default signal names */
- q = (SignalEntry *)hash_add(Sname,
- "NoViableAlt",
- (Entry *)newSignalEntry("NoViableAlt"));
- require(q!=NULL, "cannot alloc signal entry");
- q->signum = sigNoViableAlt;
- q = (SignalEntry *)hash_add(Sname,
- "MismatchedToken",
- (Entry *)newSignalEntry("MismatchedToken"));
- require(q!=NULL, "cannot alloc signal entry");
- q->signum = sigMismatchedToken;
- q = (SignalEntry *)hash_add(Sname,
- "NoSemViableAlt",
- (Entry *)newSignalEntry("NoSemViableAlt"));
- require(q!=NULL, "cannot alloc signal entry");
- q->signum = sigNoSemViableAlt;
-
- reserved_positions = empty;
- all_tokens = empty;
- imag_tokens = empty;
- tokclasses = empty;
- TokenStr = (char **) calloc(TSChunk, sizeof(char *));
- require(TokenStr!=NULL, "main: cannot allocate TokenStr");
- FoStack = (int **) calloc(CLL_k+1, sizeof(int *));
- require(FoStack!=NULL, "main: cannot allocate FoStack");
- FoTOS = (int **) calloc(CLL_k+1, sizeof(int *));
- require(FoTOS!=NULL, "main: cannot allocate FoTOS");
- Cycles = (ListNode **) calloc(CLL_k+1, sizeof(ListNode *));
- require(Cycles!=NULL, "main: cannot allocate Cycles List");
- MR_CompromisedRules=empty; /* MR14 */
-}
-
-static void
-#ifdef __USE_PROTOS
-help( void )
-#else
-help( )
-#endif
-{
- Opt *p = options;
- fprintf(stderr, "antlr [options] f1 f2 ... fn\n");
- while ( *(p->option) != '*' )
- {
- fprintf(stderr, " %-9s%s %s\n",
- p->option,
- (p->arg)?"___":" ",
- p->descr);
- p++;
- }
-}
-
-/* The RulePtr array is filled in here. RulePtr exists primarily
- * so that sets of rules can be maintained for the FOLLOW caching
- * mechanism found in rJunc(). RulePtr maps a rule num from 1 to n
- * to a pointer to its RuleBlk junction where n is the number of rules.
- */
-static void
-#ifdef __USE_PROTOS
-buildRulePtr( void )
-#else
-buildRulePtr( )
-#endif
-{
- int r=1;
- Junction *p = SynDiag;
- RulePtr = (Junction **) calloc(NumRules+1, sizeof(Junction *));
- require(RulePtr!=NULL, "cannot allocate RulePtr array");
-
- while ( p!=NULL )
- {
- require(r<=NumRules, "too many rules???");
- RulePtr[r++] = p;
- p = (Junction *)p->p2;
- }
-}
-
-void
-#ifdef __USE_PROTOS
-dlgerror(const char *s)
-#else
-dlgerror(s)
-char *s;
-#endif
-{
- fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
- fprintf(stderr, " lexical error: %s (text was '%s')\n",
- ((s == NULL) ? "Lexical error" : s), zzlextext);
-}
-
-void
-#ifdef __USE_PROTOS
-readDescr( void )
-#else
-readDescr( )
-#endif
-{
- zzerr = dlgerror;
- input = NextFile();
- if ( input==NULL ) fatal("No grammar description found (exiting...)");
- ANTLR(grammar(), input);
- tnodes_used_in_guard_predicates_etc=TnodesInUse; /* MR10 */
-}
-
-FILE *
-#ifdef __USE_PROTOS
-NextFile( void )
-#else
-NextFile( )
-#endif
-{
- FILE *f;
-
- for (;;)
- {
- CurFile++;
- if ( CurFile >= NumFiles ) return(NULL);
- if ( ci_strequ(FileStr[CurFile],"stdin")) return stdin;
- f = fopen(FileStr[CurFile], "r");
- if ( f == NULL )
- {
- warnNoFL( eMsg1("file %s doesn't exist; ignored", FileStr[CurFile]) );
- }
- else
- {
- return(f);
- }
- }
-}
-
-/*
- * Return a string corresponding to the output file name associated
- * with the input file name passed in.
- *
- * Observe the following rules:
- *
- * f.e --> f".c"
- * f --> f".c"
- * f. --> f".c"
- * f.e.g --> f.e".c"
- *
- * Where f,e,g are arbitrarily long sequences of characters in a file
- * name.
- *
- * In other words, if a ".x" appears on the end of a file name, make it
- * ".c". If no ".x" appears, append ".c" to the end of the file name.
- *
- * C++ mode using .cpp not .c.
- *
- * Use malloc() for new string.
- */
-
-char *
-#ifdef __USE_PROTOS
-outname( char *fs )
-#else
-outname( fs )
-char *fs;
-#endif
-{
- if ( GenCC) {
- return outnameX(fs,CPP_FILE_SUFFIX);
- } else {
- return outnameX(fs,".c");
- };
-}
-
-char *
-#ifdef __USE_PROTOS
-outnameX( char *fs ,char *suffix)
-#else
-outnameX( fs , suffix )
-char *fs;
-char *suffix;
-#endif
-{
- static char buf[MaxFileName+1];
- char *p;
- require(fs!=NULL&&*fs!='\0', "outname: NULL filename");
-
- p = buf;
- strcpy(buf, fs);
- while ( *p != '\0' ) {p++;} /* Stop on '\0' */
- while ( *p != '.' && p != buf ) {--p;} /* Find '.' */
- if ( p != buf ) *p = '\0'; /* Found '.' */
- require(strlen(buf) + 2 < (size_t)MaxFileName, "outname: filename too big");
- strcat(buf,suffix);
- return( buf );
-}
-
-void
-#ifdef __USE_PROTOS
-fatalFL( char *err_, char *f, int l )
-#else
-fatalFL( err_, f, l )
-char *err_;
-char *f;
-int l;
-#endif
-{
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " %s\n", err_);
- cleanUp();
- exit(PCCTS_EXIT_FAILURE);
-}
-
-void
-#ifdef __USE_PROTOS
-fatal_intern( char *err_, char *f, int l )
-#else
-fatal_intern( err_, f, l )
-char *err_;
-char *f;
-int l;
-#endif
-{
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " #$%%*&@# internal error: %s\n", err_);
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " [complain to nearest government official\n");
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " or send hate-mail to parrt@parr-research.com;\n");
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " please pray to the ``bug'' gods that there is a trival fix.]\n");
- cleanUp();
- exit(PCCTS_EXIT_FAILURE);
-}
-
-void
-#ifdef __USE_PROTOS
-cleanUp( void )
-#else
-cleanUp( )
-#endif
-{
- if ( DefFile != NULL) fclose( DefFile );
-}
-
-/* sprintf up to 3 strings */
-char *
-#ifdef __USE_PROTOS
-eMsg3( char *s, char *a1, char *a2, char *a3 )
-#else
-eMsg3( s, a1, a2, a3 )
-char *s;
-char *a1;
-char *a2;
-char *a3;
-#endif
-{
- static char buf[250]; /* DANGEROUS as hell !!!!!! */
-
- sprintf(buf, s, a1, a2, a3);
- return( buf );
-}
-
-/* sprintf a decimal */
-char *
-#ifdef __USE_PROTOS
-eMsgd( char *s, int d )
-#else
-eMsgd( s, d )
-char *s;
-int d;
-#endif
-{
- static char buf[250]; /* DANGEROUS as hell !!!!!! */
-
- sprintf(buf, s, d);
- return( buf );
-}
-
-char *
-#ifdef __USE_PROTOS
-eMsgd2( char *s, int d1,int d2)
-#else
-eMsgd2( s, d1, d2 )
-char *s;
-int d1;
-int d2;
-#endif
-{
- static char buf[250]; /* DANGEROUS as hell !!!!!! */
-
- sprintf(buf, s, d1, d2);
- return( buf );
-}
-
-void
-#ifdef __USE_PROTOS
-s_fprT( FILE *f, set e )
-#else
-s_fprT( f, e )
-FILE *f;
-set e;
-#endif
-{
- register unsigned *p;
- unsigned *q;
-
- if ( set_nil(e) ) return;
- if ( (q=p=set_pdq(e)) == NULL ) fatal_internal("Can't alloc space for set_pdq");
- fprintf(f, "{");
- while ( *p != nil )
- {
- fprintf(f, " %s", TerminalString(*p));
- p++;
- }
- fprintf(f, " }");
- free((char *)q);
-}
-
-/* Return the token name or regular expression for a token number. */
-char *
-#ifdef __USE_PROTOS
-TerminalString( int token )
-#else
-TerminalString( token )
-int token;
-#endif
-{
- int j;
- static char imag_name[20];
-
- /* look in all lexclasses for the token */
- if ( TokenString(token) != NULL ) return TokenString(token);
- for (j=0; j<NumLexClasses; j++)
- {
- lexmode(j);
- if ( ExprString(token) != NULL ) return ExprString(token);
- }
-
- if (1) {
- sprintf(imag_name,"UnknownToken#%d",token); /* MR13 */
- return imag_name; /* MR13 */
- }
-
- require(j<NumLexClasses, eMsgd("No label or expr for token %d",token));
- return "invalid";
-}
-
- /* S i m p l e I n t S t a c k */
-
-void
-#ifdef __USE_PROTOS
-pushint( int i )
-#else
-pushint( i )
-int i;
-#endif
-{
- require(isp>0, "pushint: stack overflow");
- istack[--isp] = i;
-}
-
-int
-#ifdef __USE_PROTOS
-popint( void )
-#else
-popint( )
-#endif
-{
- require(isp<MAX_INT_STACK, "popint: stack underflow");
- return istack[isp++];
-}
-
-int
-#ifdef __USE_PROTOS
-istacksize( void )
-#else
-istacksize( )
-#endif
-{
- return MAX_INT_STACK-isp;
-}
-
-void
-#ifdef __USE_PROTOS
-istackreset( void )
-#else
-istackreset( )
-#endif
-{
- isp = MAX_INT_STACK;
-}
-
-int
-#ifdef __USE_PROTOS
-istackempty( void )
-#else
-istackempty( )
-#endif
-{
- return isp==MAX_INT_STACK;
-}
-
-int
-#ifdef __USE_PROTOS
-topint( void )
-#else
-topint( )
-#endif
-{
- require(isp<MAX_INT_STACK, "topint: stack underflow");
- return istack[isp];
-}
-
-void
-#ifdef __USE_PROTOS
-ProcessArgs( int argc, char **argv, Opt *options )
-#else
-ProcessArgs( argc, argv, options )
-int argc;
-char **argv;
-Opt *options;
-#endif
-{
- Opt *p;
- require(argv!=NULL, "ProcessArgs: command line NULL");
-
- while ( argc-- > 0 )
- {
- p = options;
- while ( p->option != NULL )
- {
- if ( strcmp(p->option, "*") == 0 ||
- ci_strequ(p->option, *argv) == 1 )
- {
- if ( p->arg )
- {
-/* MR9 26-Sep-97 Check for argv valid */
- if (argc-- > 0) {
- (*p->process)( *argv, *(argv+1) );
- argv++;
- } else {
-fprintf(stderr,"error: required argument for option %s omitted\n",*argv);
-exit(PCCTS_EXIT_FAILURE);
- };
- }
- else
- (*p->process)( *argv );
- break;
- }
- p++;
- }
- argv++;
- }
-}
-
-static void
-#ifdef __USE_PROTOS
-CompleteContextGuards(void)
-#else
-CompleteContextGuards()
-#endif
-{
- ListNode * p;
- Predicate * pred;
-
- if (ContextGuardPredicateList == NULL) return;
-
- for (p=ContextGuardPredicateList->next; p != NULL; p=p->next) {
- pred=(Predicate *)p->elem;
- recomputeContextGuard(pred);
- }
-}
-
-/* Go back into the syntax diagram and compute all meta tokens; i.e.
- * turn all '.', ranges, token class refs etc... into actual token sets
- */
-static void
-#ifdef __USE_PROTOS
-CompleteTokenSetRefs(void)
-#else
-CompleteTokenSetRefs()
-#endif
-{
- ListNode *p;
-
- if ( MetaTokenNodes==NULL ) return;
- for (p = MetaTokenNodes->next; p!=NULL; p=p->next)
- {
- set a,b;
-
- TokNode *q = (TokNode *)p->elem;
- if ( q->wild_card )
- {
- q->tset = all_tokens;
- }
- else if ( q->tclass!=NULL )
- {
- if ( q->complement ) q->tset = set_dif(all_tokens, q->tclass->tset);
- else q->tset = q->tclass->tset;
- }
- else if ( q->upper_range!=0 )
- {
- /* we have a range on our hands: make a set from q->token .. q->upper_range */
- int i;
- a = empty;
- for (i=q->token; i<=q->upper_range; i++) { set_orel(i, &a); } /* MR13 */
-
-/* MR13 */ if (q->complement) {
-/* MR13 */ q->tset = set_dif(all_tokens, a);
-/* MR13 */ set_free(a);
-/* MR13 */ } else {
-/* MR13 */ q->tset = a;
-/* MR13 */ }
-
- }
-
- /* at this point, it can only be a complemented single token */
- else if ( q->complement )
- {
- a = set_of(q->token);
- b = set_dif(all_tokens, a);
- set_free(a);
- q->tset=b;
- }
- else fatal("invalid meta token");
- }
-}
-
-/* MR10: Jeff Vincent
- MR10: Changed to remove directory information from n only if
- MR10: if OutputDirectory was changed by user (-o option)
-*/
-
-char *
-#ifdef __USE_PROTOS
-OutMetaName(char *n)
-#else
-OutMetaName(n)
-char *n;
-#endif
-{
- static char *dir_sym = DirectorySymbol;
- static char newname[MaxFileName+1];
- char *p;
-
- /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */
- if (strcmp(OutputDirectory, TopDirectory) == 0) /* TopDirectory is "." on Unix. */
- return n;
-
- /* p will point to filename without path information */
- if ((p = strrchr(n, *dir_sym)) != NULL) /* Directory symbol is "/" on Unix. */
- p++;
- else
- p = n;
-
- /* Copy new output directory into newname[] */
- strcpy(newname, OutputDirectory);
-
- /* if new output directory does not have trailing dir_sym, add it! */
- if (newname[strlen(newname)-1] != *dir_sym) {
- strcat(newname, dir_sym);
- }
- strcat(newname, p);
- return newname;
-}
-
-char *
-#ifdef __USE_PROTOS
-pcctsBaseName(char *n) /* MR32 */
-#else
-pcctsBaseName(n)
-char *n;
-#endif
-{
- static char newname[MaxFileName+1];
- static char* dir_sym = DirectorySymbol;
- int count = 0;
- char *p;
-
- p = n;
-
- while ( *p != '\0' ) {p++;} /* go to end of string */
- while ( (*p != *dir_sym) && (p != n) ) {--p;} /* Find last DirectorySymbol */
- while ( *p == *dir_sym) p++; /* step forward if we're on a dir symbol */
- while ( *p != '\0' && *p != '.')
- {
- newname[count++] = *p;
- p++;
- } /* create a new name */
- newname[count] = '\0';
- return newname;
-}
-
-static void
-#ifdef __USE_PROTOS
-ensure_no_C_file_collisions(char *class_c_file)
-#else
-ensure_no_C_file_collisions(class_c_file)
-char *class_c_file;
-#endif
-{
- int i;
-
- for (i=0; i<NumFiles; i++)
- {
-
-#ifdef PCCTS_CASE_INSENSITIVE_FILE_NAME
- /* assume that file names are case insensitive */
- if ( STRICMP(outname(FileStr[i]), class_c_file)==0 )
-#else
- if ( strcmp(outname(FileStr[i]), class_c_file)==0 )
-#endif
- {
- fatal(eMsg1("class def output file conflicts with parser output file: %s",
- outname(FileStr[i])));
- }
- }
-}
-
-void
-#ifdef __USE_PROTOS
-warnNoFL(char *err)
-#else
-warnNoFL(err)
-char *err;
-#endif
-{
- fprintf(stderr, "warning: %s\n", err);
-}
-
-void
-#ifdef __USE_PROTOS
-warnFL(char *err,char *f,int l)
-#else
-warnFL(err,f,l)
-char *f;
-int l;
-char *err;
-#endif
-{
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " warning: %s\n", err);
-}
-
-void
-#ifdef __USE_PROTOS
-warn(char *err)
-#else
-warn(err)
-char *err;
-#endif
-{
- /* back up the file number if we hit an error at the end of the last file */
- if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
- fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
- fprintf(stderr, " warning: %s\n", err);
-}
-
-void
-#ifdef __USE_PROTOS
-warnNoCR( char *err )
-#else
-warnNoCR( err )
-char *err;
-#endif
-{
- /* back up the file number if we hit an error at the end of the last file */
- if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
- fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
- fprintf(stderr, " warning: %s", err);
-}
-
-void
-#ifdef __USE_PROTOS
-errNoFL(char *err)
-#else
-errNoFL(err)
-char *err;
-#endif
-{
- fprintf(stderr, "error: %s\n", err);
-}
-
-void
-#ifdef __USE_PROTOS
-errFL(char *err,char *f,int l)
-#else
-errFL(err,f,l)
-char *err;
-char *f;
-int l;
-#endif
-{
- fprintf(stderr, ErrHdr, f, l);
- fprintf(stderr, " error: %s\n", err);
-}
-
-void
-#ifdef __USE_PROTOS
-err(char *err)
-#else
-err(err)
-char *err;
-#endif
-{
- /* back up the file number if we hit an error at the end of the last file */
- if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
- fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
- fprintf(stderr, " error: %s\n", err);
-}
-
-void
-#ifdef __USE_PROTOS
-errNoCR( char *err )
-#else
-errNoCR( err )
-char *err;
-#endif
-{
- /* back up the file number if we hit an error at the end of the last file */
- if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--;
- fprintf(stderr, ErrHdr, FileStr[CurFile], zzline);
- fprintf(stderr, " error: %s", err);
-}
-
-UserAction *
-#ifdef __USE_PROTOS
-newUserAction(char *s)
-#else
-newUserAction(s)
-char *s;
-#endif
-{
- UserAction *ua = (UserAction *) calloc(1, sizeof(UserAction));
- require(ua!=NULL, "cannot allocate UserAction");
-
- ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
- strcpy(ua->action, s);
- return ua;
-}
-
-/* Added by TJP September 1994 */
-/* Take in file.h and return file_h; names w/o '.'s are left alone */
-char *
-#ifdef __USE_PROTOS
-gate_symbol(char *name)
-#else
-gate_symbol(name)
-char *name;
-#endif
-{
- static char buf[100];
- char *p;
- sprintf(buf, "%s", name);
-
- for (p=buf; *p!='\0'; p++)
- {
- if ( *p=='.' ) *p = '_';
- }
- return buf;
-}
-
-char *
-#ifdef __USE_PROTOS
-makeAltID(int blockid, int altnum)
-#else
-makeAltID(blockid, altnum)
-int blockid;
-int altnum;
-#endif
-{
- static char buf[100];
- char *p;
- sprintf(buf, "_blk%d_alt%d", blockid, altnum);
- p = (char *)malloc(strlen(buf)+1);
- strcpy(p, buf);
- return p;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
deleted file mode 100644
index 8f2cc78c59..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
+++ /dev/null
@@ -1,221 +0,0 @@
-#
-# Makefile for ANTLR 1.33
-#
-# SOFTWARE RIGHTS
-#
-# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
-# Set (PCCTS) -- PCCTS is in the public domain. An individual or
-# company may do whatever they wish with source code distributed with
-# PCCTS or the code generated by PCCTS, including the incorporation of
-# PCCTS, or its output, into commerical software.
-#
-# We encourage users to develop software with PCCTS. However, we do ask
-# that credit is given to us for developing PCCTS. By "credit",
-# we mean that if you incorporate our source code into one of your
-# programs (commercial product, research project, or otherwise) that you
-# acknowledge this fact somewhere in the documentation, research report,
-# etc... If you like PCCTS and have developed a nice tool with the
-# output, please mention that you developed it using PCCTS. In
-# addition, we ask that this header remain intact in our source code.
-# As long as these guidelines are kept, we expect to continue enhancing
-# this system and expect to make other tools available as they are
-# completed.
-#
-# ANTLR 1.33
-# Terence Parr
-# Parr Research Corporation
-# with Purdue University
-# and AHPCRC, University of Minnesota
-# 1989-1995
-#
-# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
-# Ed Harfmann
-# Micro Data Base Systems
-# Lafayette, Indiana
-#
-SET=../support/set
-PCCTS_H=../h
-
-##
-## Uncomment the appropriate section to build
-## (both targets and 'make' variable definitions)
-## Note that UNIX is the default
-##
-
-#
-# OS/2 & DOS 16 bit using MSC 6.0
-#
-#CC=cl
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
-#OUT_OBJ = -Fo
-#LIBS=/NOD:LLIBCE LLIBCEP
-#OBJ_EXT = obj
-#
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egamn.obj
-# link @<<
-#$** /NOI
-#$@ /STACK:14336
-#
-#$(LIBS: = +^
-#)
-#$(DEF_FILE) $(LFLAGS) ;
-#<<
-# bind $@ c:\os2\doscalls.lib
-# copy *.exe ..\bin
-#
-
-#
-# Borland C++ for DOS
-#
-#CC=bcc
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= emu mathl cl
-#OBJ_EXT = obj
-#
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
-# tlink @&&|
-#C0L $**
-#$@ /Tde /c
-#
-#$(LIBS)
-#$(DEF_FILE) $(LFLAGS) ;
-#|
-# copy *.exe ..\bin
-#
-
-#
-# C-Set/2 for OS/2
-#
-#CC=icc
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /Sa /W3 -DUSER_ZZSYN -D__STDC__
-#OUT_OBJ = -Fo
-#LIBS=
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#OBJ_EXT = obj
-#
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
-# link386 @<<
-#$** /NOI
-#$@ /STACK:32768
-#
-#$(LIBS: = +^
-#)
-#$(DEF_FILE) $(LFLAGS) ;
-#<<
-# copy *.exe ..\bin
-#
-
-#
-# Borland C++ for OS/2
-#
-#CC=bcc
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -v -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= c2 os2
-#
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#OBJ_EXT = obj
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
-# tlink @&&|
-#c02 $** -c -v
-#antlr.exe
-#
-#C2 os2
-#
-#|
-# copy *.exe ..\bin
-#
-
-# *********** Target list of PC machines ***********
-#
-# Don't worry about the ambiguity messages coming from antlr
-# for making antlr.c etc... [should be 10 of them, I think]
-#
-#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
-# $(ANTLR) antlr.g
-#
-#antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
-#
-#scan.$(OBJ_EXT): scan.c mode.h tokens.h
-#
-#scan.c mode.h: parser.dlg
-# $(DLG) -C2 parser.dlg scan.c
-#
-#set.$(OBJ_EXT): $(SET)/set.c
-# $(BUILD_CC) $(BUILD_CFLAGS) -c $(OUT_OBJ)set.$(OBJ_EXT) $(SET)/set.c
-
-
-
-#
-# UNIX (default)
-#
-BUILD_CC?=gcc
-COPT=-O
-ANTLR=${BIN_DIR}/antlr
-DLG=${BIN_DIR}/dlg
-OBJ_EXT=o
-OUT_OBJ = -o
-BUILD_CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) -DZZLEXBUFSIZE=65536
-BUILD_CPPFLAGS=
-#
-# SGI Users, use this CFLAGS
-#
-#CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -woff 3262
-OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o gen.o \
- globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o fcache.o
-
-$(BIN_DIR)/antlr : $(OBJ) $(SRC)
- $(BUILD_CC) $(BUILD_CFLAGS) -o $(BIN_DIR)/antlr $(OBJ)
-
-# what files does PCCTS generate (both ANTLR and DLG)
-PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
-
-SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
- hash.c lex.c main.c misc.c $(SET)/set.c pred.c egman.c mrhoist.c fcache.c
-
-#
-# Don't worry about the ambiguity messages coming from antlr
-# for making antlr.c etc... [should be 10 of them, I think]
-#
-#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
-# $(ANTLR) -gh antlr.g
-
-antlr.o : antlr.c mode.h tokens.h
-
-scan.o : scan.c mode.h tokens.h
-
-#scan.c mode.h: parser.dlg
-# $(DLG) -C2 parser.dlg scan.c
-
-set.o : $(SET)/set.c
- $(BUILD_CC) $(BUILD_CFLAGS) -c -o set.o $(SET)/set.c
-
-%.o : %.c
- $(BUILD_CC) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
-
-#
-# ****** These next targets are common to UNIX and PC world ********
-#
-
-#clean up all the intermediate files
-clean:
- rm -f $(BIN_DIR)/antlr *.$(OBJ_EXT) core
-
-#remove everything in clean plus the PCCTS files generated
-scrub:
- rm -f $(PCCTS_GEN) *.$(OBJ_EXT) core
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin
deleted file mode 100644
index 956de0be07..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile.cygwin
+++ /dev/null
@@ -1,219 +0,0 @@
-#
-# Makefile for ANTLR 1.33
-#
-# SOFTWARE RIGHTS
-#
-# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
-# Set (PCCTS) -- PCCTS is in the public domain. An individual or
-# company may do whatever they wish with source code distributed with
-# PCCTS or the code generated by PCCTS, including the incorporation of
-# PCCTS, or its output, into commerical software.
-#
-# We encourage users to develop software with PCCTS. However, we do ask
-# that credit is given to us for developing PCCTS. By "credit",
-# we mean that if you incorporate our source code into one of your
-# programs (commercial product, research project, or otherwise) that you
-# acknowledge this fact somewhere in the documentation, research report,
-# etc... If you like PCCTS and have developed a nice tool with the
-# output, please mention that you developed it using PCCTS. In
-# addition, we ask that this header remain intact in our source code.
-# As long as these guidelines are kept, we expect to continue enhancing
-# this system and expect to make other tools available as they are
-# completed.
-#
-# ANTLR 1.33
-# Terence Parr
-# Parr Research Corporation
-# with Purdue University
-# and AHPCRC, University of Minnesota
-# 1989-1995
-#
-# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
-# Ed Harfmann
-# Micro Data Base Systems
-# Lafayette, Indiana
-#
-SET=../support/set
-PCCTS_H=../h
-
-##
-## Uncomment the appropriate section to build
-## (both targets and 'make' variable definitions)
-## Note that UNIX is the default
-##
-
-#
-# OS/2 & DOS 16 bit using MSC 6.0
-#
-#CC=cl
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /AL /Za /W3 -DPC -DUSER_ZZSYN
-#OUT_OBJ = -Fo
-#LIBS=/NOD:LLIBCE LLIBCEP
-#OBJ_EXT = obj
-#
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egamn.obj
-# link @<<
-#$** /NOI
-#$@ /STACK:14336
-#
-#$(LIBS: = +^
-#)
-#$(DEF_FILE) $(LFLAGS) ;
-#<<
-# bind $@ c:\os2\doscalls.lib
-# copy *.exe ..\bin
-#
-
-#
-# Borland C++ for DOS
-#
-#CC=bcc
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -ml -ff- -w- -DPC -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= emu mathl cl
-#OBJ_EXT = obj
-#
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
-# tlink @&&|
-#C0L $**
-#$@ /Tde /c
-#
-#$(LIBS)
-#$(DEF_FILE) $(LFLAGS) ;
-#|
-# copy *.exe ..\bin
-#
-
-#
-# C-Set/2 for OS/2
-#
-#CC=icc
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) /Sa /W3 -DUSER_ZZSYN -D__STDC__
-#OUT_OBJ = -Fo
-#LIBS=
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#OBJ_EXT = obj
-#
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
-# link386 @<<
-#$** /NOI
-#$@ /STACK:32768
-#
-#$(LIBS: = +^
-#)
-#$(DEF_FILE) $(LFLAGS) ;
-#<<
-# copy *.exe ..\bin
-#
-
-#
-# Borland C++ for OS/2
-#
-#CC=bcc
-#CFLAGS= -I. -I$(SET) -I$(PCCTS_H) -w- -v -DUSER_ZZSYN
-#OUT_OBJ = -o
-#LIBS= c2 os2
-#
-#ANTLR=..\bin\antlr
-#DLG=..\bin\dlg
-#OBJ_EXT = obj
-#antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
-# fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
-# misc.obj set.obj pred.obj egman.obj mrhoist.obj fcache.obj
-# tlink @&&|
-#c02 $** -c -v
-#antlr.exe
-#
-#C2 os2
-#
-#|
-# copy *.exe ..\bin
-#
-
-# *********** Target list of PC machines ***********
-#
-# Don't worry about the ambiguity messages coming from antlr
-# for making antlr.c etc... [should be 10 of them, I think]
-#
-#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
-# $(ANTLR) antlr.g
-#
-#antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
-#
-#scan.$(OBJ_EXT): scan.c mode.h tokens.h
-#
-#scan.c mode.h: parser.dlg
-# $(DLG) -C2 parser.dlg scan.c
-#
-#set.$(OBJ_EXT): $(SET)/set.c
-# $(CC) $(CFLAGS) -c $(OUT_OBJ)set.$(OBJ_EXT) $(SET)/set.c
-
-
-
-#
-# UNIX (default)
-#
-BIN_DIR=../../../../bin
-CC=gcc
-COPT=-O
-ANTLR=$(BIN_DIR)/antlr.exe
-DLG=${BIN_DIR}/dlg.exe
-OBJ_EXT=o
-OUT_OBJ = -o
-CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) -DZZLEXBUFSIZE=65536
-#
-# SGI Users, use this CFLAGS
-#
-#CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -woff 3262
-OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o gen.o \
- globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o fcache.o
-
-antlr : $(OBJ) $(SRC)
- $(CC) $(CFLAGS) -o $(BIN_DIR)/antlr.exe $(OBJ)
-
-# what files does PCCTS generate (both ANTLR and DLG)
-PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
-
-SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
- hash.c lex.c main.c misc.c $(SET)/set.c pred.c egman.c mrhoist.c fcache.c
-
-#
-# Don't worry about the ambiguity messages coming from antlr
-# for making antlr.c etc... [should be 10 of them, I think]
-#
-#antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
-# $(ANTLR) -gh antlr.g
-
-antlr.o : antlr.c mode.h tokens.h
-
-scan.o : scan.c mode.h tokens.h
-
-#scan.c mode.h: parser.dlg
-# $(DLG) -C2 parser.dlg scan.c
-
-set.o : $(SET)/set.c
- $(CC) $(CFLAGS) -c -o set.o $(SET)/set.c
-
-
-#
-# ****** These next targets are common to UNIX and PC world ********
-#
-
-#clean up all the intermediate files
-clean:
- rm -f *.$(OBJ_EXT) core
-
-#remove everything in clean plus the PCCTS files generated
-scrub:
- rm -f $(PCCTS_GEN) *.$(OBJ_EXT) core
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile1 b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile1
deleted file mode 100644
index dffc709478..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile1
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Makefile for ANTLR 1.33
-#
-# SOFTWARE RIGHTS
-#
-# We reserve no LEGAL rights to the Purdue Compiler Construction Tool
-# Set (PCCTS) -- PCCTS is in the public domain. An individual or
-# company may do whatever they wish with source code distributed with
-# PCCTS or the code generated by PCCTS, including the incorporation of
-# PCCTS, or its output, into commerical software.
-#
-# We encourage users to develop software with PCCTS. However, we do ask
-# that credit is given to us for developing PCCTS. By "credit",
-# we mean that if you incorporate our source code into one of your
-# programs (commercial product, research project, or otherwise) that you
-# acknowledge this fact somewhere in the documentation, research report,
-# etc... If you like PCCTS and have developed a nice tool with the
-# output, please mention that you developed it using PCCTS. In
-# addition, we ask that this header remain intact in our source code.
-# As long as these guidelines are kept, we expect to continue enhancing
-# this system and expect to make other tools available as they are
-# completed.
-#
-# ANTLR 1.33
-# Terence Parr
-# Parr Research Corporation
-# with Purdue University
-# and AHPCRC, University of Minnesota
-# 1989-1995
-#
-# Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
-# Ed Harfmann
-# Micro Data Base Systems
-# Lafayette, Indiana
-#
-SET=../support/set
-PCCTS_H=../h
-
-#
-# UNIX (default)
-#
-CC=cc
-ANTLR=${WORKSPACE}/Tools/bin/antlr
-DLG=${WORKSPACE}/Tools/bin/dlg
-OBJ_EXT=o
-OUT_OBJ = -o
-ANSI=-ansi
-AOTHER=
-CFLAGS= -O0 -g -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) $(ANSI) -DZZLEXBUFSIZE=32000
-#
-# SGI Users, use this CFLAGS
-#
-#CFLAGS= -O -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -woff 3262
-
-OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o gen.o \
- globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o fcache.o $(OBJOTHER)
-
-antlr : $(OBJ) $(SRC)
- $(CC) $(CFLAGS) -o antlr $(OBJ)
- mv antlr ${WORKSPACE}/Tools/bin
-
-# what files does PCCTS generate (both ANTLR and DLG)
-PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
-
-SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
- hash.c lex.c main.c misc.c $(SET)/set.c pred.c egman.c mrhoist.c fcache.c
-
-#
-# Don't worry about the ambiguity messages coming from antlr
-# for making antlr.c etc... [should be 10 of them, I think]
-#
-antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
- $(ANTLR) -gh antlr.g $(AOTHER)
-
-antlr.o : antlr.c mode.h tokens.h
-
-scan.o : scan.c mode.h tokens.h
-
-scan.c mode.h: parser.dlg
- $(DLG) -C2 parser.dlg scan.c
-
-set.o : $(SET)/set.c
- $(CC) $(CFLAGS) -c -o set.o $(SET)/set.c
-
-
-#
-# ****** These next targets are common to UNIX and PC world ********
-#
-
-#clean up all the intermediate files
-clean:
- rm -f *.$(OBJ_EXT) core
-
-#remove everything in clean plus the PCCTS files generated
-scrub:
- rm -f $(PCCTS_GEN) *.$(OBJ_EXT) core
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c
deleted file mode 100644
index 3f58da34c5..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/misc.c
+++ /dev/null
@@ -1,1864 +0,0 @@
-/*
- * misc.c
- *
- * Manage tokens, regular expressions.
- * Print methods for debugging
- * Compute follow lists onto tail ends of rules.
- *
- * The following functions are visible:
- *
- * int addTname(char *); Add token name
- * int addTexpr(char *); Add token expression
- * int Tnum(char *); Get number of expr/token
- * void Tklink(char *, char *); Link a name with an expression
- * int hasAction(expr); Does expr already have action assigned?
- * void setHasAction(expr); Indicate that expr now has an action
- * Entry *newEntry(char *,int); Create new table entry with certain size
- * void list_add(ListNode **list, char *e)
- * void list_free(ListNode **list, int freeData); *** MR10 ***
- * void list_apply(ListNode *list, void (*f)())
- * void lexclass(char *m); switch to new/old lexical class
- * void lexmode(int i); switch to old lexical class i
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "pcctscfg.h"
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-#include <ctype.h>
-
-static int tsize=TSChunk; /* size of token str arrays */
-
-static void
-#ifdef __USE_PROTOS
-RemapForcedTokensInSyntaxDiagram(Node *);
-#else
-RemapForcedTokensInSyntaxDiagram();
-#endif
-
- /* T o k e n M a n i p u l a t i o n */
-
-/*
- * add token 't' to the TokenStr/Expr array. Make more room if necessary.
- * 't' is either an expression or a token name.
- *
- * There is only one TokenStr array, but multiple ExprStr's. Therefore,
- * for each lex class (element of lclass) we must extend the ExprStr array.
- * ExprStr's and TokenStr are always all the same size.
- *
- * Also, there is a Texpr hash table for each automaton.
- */
-static void
-#ifdef __USE_PROTOS
-Ttrack( char *t )
-#else
-Ttrack( t )
-char *t;
-#endif
-{
- if ( TokenNum >= tsize ) /* terminal table overflow? */
- {
- char **p;
- int i, more, j;
-
- more = TSChunk * (1 + ((TokenNum-tsize) / TSChunk));
- tsize += more;
- TokenStr = (char **) realloc((char *)TokenStr, tsize*sizeof(char *));
- require(TokenStr != NULL, "Ttrack: can't extend TokenStr");
- for (i=0; i<NumLexClasses; i++)
- {
- lclass[i].exprs = (char **)
- realloc((char *)lclass[i].exprs, tsize*sizeof(char *));
- require(lclass[i].exprs != NULL, "Ttrack: can't extend ExprStr");
- for (p= &lclass[i].exprs[tsize-more],j=1; j<=more; j++) *p++ = NULL;
- }
- for (p= &TokenStr[tsize-more],i=1; i<=more; i++) *p++ = NULL;
- lexmode( CurrentLexClass ); /* reset ExprStr in case table moved */
- }
- /* note: we use the actual ExprStr/TokenStr array
- * here as TokenInd doesn't exist yet
- */
- if ( *t == '"' ) ExprStr[TokenNum] = t;
- else TokenStr[TokenNum] = t;
-}
-
-static Expr *
-#ifdef __USE_PROTOS
-newExpr( char *e )
-#else
-newExpr( e )
-char *e;
-#endif
-{
- Expr *p = (Expr *) calloc(1, sizeof(Expr));
- require(p!=NULL, "newExpr: cannot alloc Expr node");
-
- p->expr = e;
- p->lclass = CurrentLexClass;
- return p;
-}
-
-/* switch to lexical class/mode m. This amounts to creating a new
- * lex mode if one does not already exist and making ExprStr point
- * to the correct char string array. We must also switch Texpr tables.
- *
- * BTW, we need multiple ExprStr arrays because more than one automaton
- * may have the same label for a token, but with different expressions.
- * We need to track an expr for each automaton. If we disallowed this
- * feature, only one ExprStr would be required.
- */
-void
-#ifdef __USE_PROTOS
-lexclass( char *m )
-#else
-lexclass( m )
-char *m;
-#endif
-{
- int i;
- TermEntry *p;
- static char EOFSTR[] = "\"@\"";
-
- if ( hash_get(Tname, m) != NULL )
- {
- warn(eMsg1("lexclass name conflicts with token/errclass label '%s'",m));
- }
- /* does m already exist? */
- i = LexClassIndex(m);
- if ( i != -1 ) {lexmode(i); return;}
- /* must make new one */
- NumLexClasses++;
- CurrentLexClass = NumLexClasses-1;
- require(NumLexClasses<=MaxLexClasses, "number of allowable lexclasses exceeded\nIncrease MaxLexClasses in generic.h and recompile all C files");
- lclass[CurrentLexClass].classnum = m;
- lclass[CurrentLexClass].exprs = (char **) calloc(tsize, sizeof(char *));
- require(lclass[CurrentLexClass].exprs!=NULL,
- "lexclass: cannot allocate ExprStr");
- lclass[CurrentLexClass].htable = newHashTable();
- ExprStr = lclass[CurrentLexClass].exprs;
- Texpr = lclass[CurrentLexClass].htable;
- /* define EOF for each automaton */
- p = newTermEntry( EOFSTR );
- p->token = EofToken; /* couldn't have remapped tokens yet, use EofToken */
- hash_add(Texpr, EOFSTR, (Entry *)p);
- list_add(&ExprOrder, (void *)newExpr(EOFSTR));
- /* note: we use the actual ExprStr array
- * here as TokenInd doesn't exist yet
- */
- ExprStr[EofToken] = EOFSTR;
-}
-
-void
-#ifdef __USE_PROTOS
-lexmode( int i )
-#else
-lexmode( i )
-int i;
-#endif
-{
- require(i<NumLexClasses, "lexmode: invalid mode");
- ExprStr = lclass[i].exprs;
- Texpr = lclass[i].htable;
- CurrentLexClass = i;
-}
-
-/* return index into lclass array of lexical class. return -1 if nonexistent */
-int
-#ifdef __USE_PROTOS
-LexClassIndex( char *cl )
-#else
-LexClassIndex( cl )
-char *cl;
-#endif
-{
- int i;
-
- for (i=0; i<NumLexClasses; i++)
- {
- if ( strcmp(lclass[i].classnum, cl) == 0 ) return i;
- }
- return -1;
-}
-
-int
-#ifdef __USE_PROTOS
-hasAction( char *expr )
-#else
-hasAction( expr )
-char *expr;
-#endif
-{
- TermEntry *p;
- require(expr!=NULL, "hasAction: invalid expr");
-
- p = (TermEntry *) hash_get(Texpr, expr);
- require(p!=NULL, eMsg1("hasAction: expr '%s' doesn't exist",expr));
- return (p->action!=NULL);
-}
-
-void
-#ifdef __USE_PROTOS
-setHasAction( char *expr, char *action )
-#else
-setHasAction( expr, action )
-char *expr;
-char *action;
-#endif
-{
- TermEntry *p;
- require(expr!=NULL, "setHasAction: invalid expr");
-
- p = (TermEntry *) hash_get(Texpr, expr);
- require(p!=NULL, eMsg1("setHasAction: expr '%s' doesn't exist",expr));
- p->action = action;
-}
-
-ForcedToken *
-#ifdef __USE_PROTOS
-newForcedToken(char *token, int tnum)
-#else
-newForcedToken(token, tnum)
-char *token;
-int tnum;
-#endif
-{
- ForcedToken *ft = (ForcedToken *) calloc(1, sizeof(ForcedToken));
- require(ft!=NULL, "out of memory");
- ft->token = token;
- ft->tnum = tnum;
- return ft;
-}
-
-/*
- * Make a token indirection array that remaps token numbers and then walk
- * the appropriate symbol tables and SynDiag to change token numbers
- */
-void
-#ifdef __USE_PROTOS
-RemapForcedTokens(void)
-#else
-RemapForcedTokens()
-#endif
-{
- ListNode *p;
- ForcedToken *q;
- int max_token_number=0; /* MR9 23-Sep-97 Removed "unsigned" */
- int i;
-
- if ( ForcedTokens == NULL ) return;
-
- /* find max token num */
- for (p = ForcedTokens->next; p!=NULL; p=p->next)
- {
- q = (ForcedToken *) p->elem;
- if ( q->tnum > max_token_number ) max_token_number = q->tnum;
- }
- fprintf(stderr, "max token number is %d\n", max_token_number);
-
- /* make token indirection array */
- TokenInd = (int *) calloc(max_token_number+1, sizeof(int));
- LastTokenCounted = TokenNum;
- TokenNum = max_token_number+1;
- require(TokenInd!=NULL, "RemapForcedTokens: cannot allocate TokenInd");
-
- /* fill token indirection array and change token id htable ; swap token indices */
- for (i=1; i<TokenNum; i++) TokenInd[i] = i;
- for (p = ForcedTokens->next; p!=NULL; p=p->next)
- {
- TermEntry *te;
- int old_pos, t;
-
- q = (ForcedToken *) p->elem;
- fprintf(stderr, "%s forced to %d\n", q->token, q->tnum);
- te = (TermEntry *) hash_get(Tname, q->token);
- require(te!=NULL, "RemapForcedTokens: token not in hash table");
- old_pos = te->token;
- fprintf(stderr, "Before: TokenInd[old_pos==%d] is %d\n", old_pos, TokenInd[old_pos]);
- fprintf(stderr, "Before: TokenInd[target==%d] is %d\n", q->tnum, TokenInd[q->tnum]);
- q = (ForcedToken *) p->elem;
- t = TokenInd[old_pos];
- TokenInd[old_pos] = q->tnum;
- TokenInd[q->tnum] = t;
- te->token = q->tnum; /* update token type id symbol table */
- fprintf(stderr, "After: TokenInd[old_pos==%d] is %d\n", old_pos, TokenInd[old_pos]);
- fprintf(stderr, "After: TokenInd[target==%d] is %d\n", q->tnum, TokenInd[q->tnum]);
-
- /* Change the token number in the sym tab entry for the exprs
- * at the old position of the token id and the target position
- */
- /* update expr at target (if any) of forced token id */
- if ( q->tnum < TokenNum ) /* is it a valid position? */
- {
- for (i=0; i<NumLexClasses; i++)
- {
- if ( lclass[i].exprs[q->tnum]!=NULL )
- {
- /* update the symbol table for this expr */
- TermEntry *e = (TermEntry *) hash_get(lclass[i].htable, lclass[i].exprs[q->tnum]);
- require(e!=NULL, "RemapForcedTokens: expr not in hash table");
- e->token = old_pos;
- fprintf(stderr, "found expr '%s' at target %d in lclass[%d]; changed to %d\n",
- lclass[i].exprs[q->tnum], q->tnum, i, old_pos);
- }
- }
- }
- /* update expr at old position (if any) of forced token id */
- for (i=0; i<NumLexClasses; i++)
- {
- if ( lclass[i].exprs[old_pos]!=NULL )
- {
- /* update the symbol table for this expr */
- TermEntry *e = (TermEntry *) hash_get(lclass[i].htable, lclass[i].exprs[old_pos]);
- require(e!=NULL, "RemapForcedTokens: expr not in hash table");
- e->token = q->tnum;
- fprintf(stderr, "found expr '%s' for id %s in lclass[%d]; changed to %d\n",
- lclass[i].exprs[old_pos], q->token, i, q->tnum);
- }
- }
- }
-
- /* Update SynDiag */
- RemapForcedTokensInSyntaxDiagram((Node *)SynDiag);
-}
-
-static void
-#ifdef __USE_PROTOS
-RemapForcedTokensInSyntaxDiagram(Node *p)
-#else
-RemapForcedTokensInSyntaxDiagram(p)
-Node *p;
-#endif
-{
- Junction *j = (Junction *) p;
- RuleRefNode *r = (RuleRefNode *) p;
- TokNode *t = (TokNode *)p;
-
- if ( p==NULL ) return;
- require(p->ntype>=1 && p->ntype<=NumNodeTypes, "Remap...: invalid diagram node");
- switch ( p->ntype )
- {
- case nJunction :
- if ( j->visited ) return;
- if ( j->jtype == EndRule ) return;
- j->visited = TRUE;
- RemapForcedTokensInSyntaxDiagram( j->p1 );
- RemapForcedTokensInSyntaxDiagram( j->p2 );
- j->visited = FALSE;
- return;
- case nRuleRef :
- RemapForcedTokensInSyntaxDiagram( r->next );
- return;
- case nToken :
- if ( t->remapped ) return; /* we've been here before */
- t->remapped = 1;
- fprintf(stderr, "remapping %d to %d\n", t->token, TokenInd[t->token]);
- t->token = TokenInd[t->token];
- RemapForcedTokensInSyntaxDiagram( t->next );
- return;
- case nAction :
- RemapForcedTokensInSyntaxDiagram( ((ActionNode *)p)->next );
- return;
- default :
- fatal_internal("invalid node type");
- }
-}
-
-/*
- * Add a token name. Return the token number associated with it. If it already
- * exists, then return the token number assigned to it.
- *
- * Track the order in which tokens are found so that the DLG output maintains
- * that order. It also lets us map token numbers to strings.
- */
-int
-#ifdef __USE_PROTOS
-addTname( char *token )
-#else
-addTname( token )
-char *token;
-#endif
-{
- TermEntry *p;
- require(token!=NULL, "addTname: invalid token name");
-
- if ( (p=(TermEntry *)hash_get(Tname, token)) != NULL ) return p->token;
- p = newTermEntry( token );
- Ttrack( p->str );
- p->token = TokenNum++;
- hash_add(Tname, token, (Entry *)p);
- return p->token;
-}
-
-/* This is the same as addTname except we force the TokenNum to be tnum.
- * We don't have to use the Forced token stuff as no tokens will have
- * been defined with #tokens when this is called. This is only called
- * when a #tokdefs meta-op is used.
- */
-int
-#ifdef __USE_PROTOS
-addForcedTname( char *token, int tnum )
-#else
-addForcedTname( token, tnum )
-char *token;
-int tnum;
-#endif
-{
- TermEntry *p;
- require(token!=NULL, "addTname: invalid token name");
-
- if ( (p=(TermEntry *)hash_get(Tname, token)) != NULL ) return p->token;
- p = newTermEntry( token );
- Ttrack( p->str );
- p->token = tnum;
- hash_add(Tname, token, (Entry *)p);
- return p->token;
-}
-
-/*
- * Add a token expr. Return the token number associated with it. If it already
- * exists, then return the token number assigned to it.
- */
-int
-#ifdef __USE_PROTOS
-addTexpr( char *expr )
-#else
-addTexpr( expr )
-char *expr;
-#endif
-{
- TermEntry *p;
- require(expr!=NULL, "addTexpr: invalid regular expression");
-
- if ( (p=(TermEntry *)hash_get(Texpr, expr)) != NULL ) return p->token;
- p = newTermEntry( expr );
- Ttrack( p->str );
- /* track the order in which they occur */
- list_add(&ExprOrder, (void *)newExpr(p->str));
- p->token = TokenNum++;
- hash_add(Texpr, expr, (Entry *)p);
- return p->token;
-}
-
-/* return the token number of 'term'. Return 0 if no 'term' exists */
-int
-#ifdef __USE_PROTOS
-Tnum( char *term )
-#else
-Tnum( term )
-char *term;
-#endif
-{
- TermEntry *p;
- require(term!=NULL, "Tnum: invalid terminal");
-
- if ( *term=='"' ) p = (TermEntry *) hash_get(Texpr, term);
- else p = (TermEntry *) hash_get(Tname, term);
- if ( p == NULL ) return 0;
- else return p->token;
-}
-
-/* associate a Name with an expr. If both have been already assigned
- * token numbers, then an error is reported. Add the token or expr
- * that has not been added if no error. This 'represents' the #token
- * ANTLR pseudo-op. If both have not been defined, define them both
- * linked to same token number.
- */
-void
-#ifdef __USE_PROTOS
-Tklink( char *token, char *expr )
-#else
-Tklink( token, expr )
-char *token;
-char *expr;
-#endif
-{
- TermEntry *p, *q;
- require(token!=NULL && expr!=NULL, "Tklink: invalid token name and/or expr");
-
- p = (TermEntry *) hash_get(Tname, token);
- q = (TermEntry *) hash_get(Texpr, expr);
- if ( p != NULL && q != NULL ) /* both defined */
- {
- warn( eMsg2("token name %s and rexpr %s already defined; ignored",
- token, expr) );
- return;
- }
- if ( p==NULL && q==NULL ) /* both not defined */
- {
- int t = addTname( token );
- q = newTermEntry( expr );
- hash_add(Texpr, expr, (Entry *)q);
- q->token = t;
- /* note: we use the actual ExprStr array
- * here as TokenInd doesn't exist yet
- */
- ExprStr[t] = q->str;
- /* track the order in which they occur */
- list_add(&ExprOrder, (void *)newExpr(q->str));
- return;
- }
- if ( p != NULL ) /* one is defined, one is not */
- {
- q = newTermEntry( expr );
- hash_add(Texpr, expr, (Entry *)q);
- q->token = p->token;
- ExprStr[p->token] = q->str; /* both expr and token str defined now */
- list_add(&ExprOrder, (void *)newExpr(q->str));
- }
- else /* trying to associate name with expr here*/
- {
- p = newTermEntry( token );
- hash_add(Tname, token, (Entry *)p);
- p->token = q->token;
- TokenStr[p->token] = p->str;/* both expr and token str defined now */
- }
-}
-
-/*
- * Given a string, this function allocates and returns a pointer to a
- * hash table record of size 'sz' whose "str" pointer is reset to a position
- * in the string table.
- */
-Entry *
-#ifdef __USE_PROTOS
-newEntry( char *text, int sz )
-#else
-newEntry( text, sz )
-char *text;
-int sz;
-#endif
-{
- Entry *p;
- require(text!=NULL, "new: NULL terminal");
-
- if ( (p = (Entry *) calloc(1,sz)) == 0 )
- {
- fatal_internal("newEntry: out of memory for terminals\n");
- exit(PCCTS_EXIT_FAILURE);
- }
- p->str = mystrdup(text);
-
- return(p);
-}
-
-/*
- * add an element to a list.
- *
- * Any non-empty list has a sentinel node whose 'elem' pointer is really
- * a pointer to the last element. (i.e. length(list) = #elemIn(list)+1).
- * Elements are appended to the list.
- */
-void
-#ifdef __USE_PROTOS
-list_add( ListNode **list, void *e )
-#else
-list_add( list, e )
-ListNode **list;
-void *e;
-#endif
-{
- ListNode *p, *tail;
- require(e!=NULL, "list_add: attempting to add NULL list element");
-
- p = newListNode;
- require(p!=NULL, "list_add: cannot alloc new list node");
- p->elem = e;
- if ( *list == NULL )
- {
- ListNode *sentinel = newListNode;
- require(sentinel!=NULL, "list_add: cannot alloc sentinel node");
- *list=sentinel;
- sentinel->next = p;
- sentinel->elem = (char *)p; /* set tail pointer */
- }
- else /* find end of list */
- {
- tail = (ListNode *) (*list)->elem; /* get tail pointer */
- tail->next = p;
- (*list)->elem = (char *) p; /* reset tail */
- }
-}
-
-/* MR10 list_free() frees the ListNode elements in the list */
-/* MR10 if freeData then free the data elements of the list too */
-
-void
-#ifdef __USE_PROTOS
-list_free(ListNode **list,int freeData)
-#else
-list_free(list,freeData)
- ListNode **list;
- int freeData;
-#endif
-{
- ListNode *p;
- ListNode *next;
-
- if (list == NULL) return;
- if (*list == NULL) return;
- for (p=*list; p != NULL; p=next) {
- next=p->next;
- if (freeData && p->elem != NULL) {
- free( (char *) p->elem);
- };
- free( (char *) p);
- };
- *list=NULL;
-}
-
-void
-#ifdef __USE_PROTOS
-list_apply( ListNode *list, void (*f)(void *) )
-#else
-list_apply( list, f )
-ListNode *list;
-void (*f)();
-#endif
-{
- ListNode *p;
- require(f!=NULL, "list_apply: NULL function to apply");
-
- if ( list == NULL ) return;
- for (p = list->next; p!=NULL; p=p->next) (*f)( p->elem );
-}
-
-/* MR27 */
-
-#ifdef __USE_PROTOS
-int list_search_cstring(ListNode *list, char * cstring)
-#else
-int list_search_cstring(list, cstring)
- ListNode * list;
- char * cstring;
-#endif
-{
- ListNode *p;
- if (list == NULL ) return 0;
- for (p = list->next; p!=NULL; p=p->next) {
- if (p->elem == NULL) continue;
- if (0 == strcmp((char *) p->elem , cstring)) return 1;
- }
- return 0;
-}
-
- /* F O L L O W C y c l e S t u f f */
-
-/* make a key based upon (rulename, computation, k value).
- * Computation values are 'i'==FIRST, 'o'==FOLLOW.
- */
-
-/* MR10 Make the key all characters so it can be read easily */
-/* MR10 by a simple dump program. Also, separates */
-/* MR10 'o' and 'i' from rule name */
-
-char *
-#ifdef __USE_PROTOS
-Fkey( char *rule, int computation, int k )
-#else
-Fkey( rule, computation, k )
-char *rule;
-int computation;
-int k;
-#endif
-{
- static char key[MaxRuleName+2+2+1]; /* MR10 */
- int i;
-
- if ( k > 99 ) /* MR10 */
- fatal("k>99 is too big for this implementation of ANTLR!\n"); /* MR10 */
- if ( (i=strlen(rule)) > MaxRuleName ) /* MR10 */
- fatal( eMsgd("rule name > max of %d\n", MaxRuleName) ); /* MR10 */
- strcpy(key,rule);
-
-/* MR10 */ key[i]='*';
-/* MR10 */ key[i+1] = (char) computation; /* MR20 G. Hobbelt */
-/* MR10 */ if (k < 10) {
-/* MR10 */ key[i+2] = (char) ( '0' + k);
-/* MR10 */ key[i+3] = '\0';
-/* MR10 */ } else {
-/* MR10 */ key[i+2] = (char) ( '0' + k/10);
-/* MR10 */ key[i+3] = (char) ( '0' + k % 10);
-/* MR10 */ key[i+4] = '\0';
-/* MR10 */ };
-
- return key;
-}
-
-/* Push a rule onto the kth FOLLOW stack */
-void
-#ifdef __USE_PROTOS
-FoPush( char *rule, int k )
-#else
-FoPush( rule, k )
-char *rule;
-int k;
-#endif
-{
- RuleEntry *r;
- require(rule!=NULL, "FoPush: tried to push NULL rule");
- require(k<=CLL_k, "FoPush: tried to access non-existent stack");
-
- /*fprintf(stderr, "FoPush(%s)\n", rule);*/
- r = (RuleEntry *) hash_get(Rname, rule);
- if ( r == NULL ) {fatal_internal( eMsg1("rule %s must be defined but isn't", rule) );}
- if ( FoStack[k] == NULL ) /* Does the kth stack exist yet? */
- {
- /*fprintf(stderr, "allocating FoStack\n");*/
- FoStack[k] = (int *) calloc(FoStackSize, sizeof(int));
- require(FoStack[k]!=NULL, "FoPush: cannot allocate FOLLOW stack\n");
- }
- if ( FoTOS[k] == NULL )
- {
- FoTOS[k]=FoStack[k];
- *(FoTOS[k]) = r->rulenum;
- }
- else
- {
-#ifdef MEMCHK
- require(valid(FoStack[k]), "FoPush: invalid FoStack");
-#endif
- if ( FoTOS[k] >= &(FoStack[k][FoStackSize-1]) )
- fatal( eMsgd("exceeded max depth of FOLLOW recursion (%d)\n",
- FoStackSize) );
- require(FoTOS[k]>=FoStack[k],
- eMsg1("FoPush: FoStack stack-ptr is playing out of its sandbox",
- rule));
- ++(FoTOS[k]);
- *(FoTOS[k]) = r->rulenum;
- }
- {
- /*
-**** int *p;
-**** fprintf(stderr, "FoStack[k=%d]:\n", k);
-**** for (p=FoStack[k]; p<=FoTOS[k]; p++)
-**** {
-**** fprintf(stderr, "\t%s\n", RulePtr[*p]->rname);
-**** }
- */
- }
-}
-
-/* Pop one rule off of the FOLLOW stack. TOS ptr is NULL if empty. */
-void
-#ifdef __USE_PROTOS
-FoPop( int k )
-#else
-FoPop( k )
-int k;
-#endif
-{
- require(k<=CLL_k, "FoPop: tried to access non-existent stack");
- /*fprintf(stderr, "FoPop\n");*/
- require(FoTOS[k]>=FoStack[k]&&FoTOS[k]<=&(FoStack[k][FoStackSize-1]),
- "FoPop: FoStack stack-ptr is playing out of its sandbox");
- if ( FoTOS[k] == FoStack[k] ) FoTOS[k] = NULL;
- else (FoTOS[k])--;
-}
-
-/* Compute FOLLOW cycle.
- * Mark all FOLLOW sets for rules in cycle as incomplete.
- * Then, save cycle on the cycle list (Cycles) for later resolution.
- * The Cycle is stored in the form:
- * (head of cycle==croot, rest of rules in cycle==cyclicDep)
- *
- * e.g. (Fo means "FOLLOW of", "-->" means requires or depends on)
- *
- * Fo(x)-->Fo(a)-->Fo(b)-->Fo(c)-->Fo(x)
- * ^----Infinite recursion (cycle)
- *
- * the cycle would be: x -> {a,b,c} or stored as (x,{a,b,c}). Fo(x) depends
- * on the FOLLOW of a,b, and c. The root of a cycle is always complete after
- * Fo(x) finishes. Fo(a,b,c) however are not. It turns out that all rules
- * in a FOLLOW cycle have the same FOLLOW set.
- */
-void
-#ifdef __USE_PROTOS
-RegisterCycle( char *rule, int k )
-#else
-RegisterCycle( rule, k )
-char *rule;
-int k;
-#endif
-{
- CacheEntry *f;
- Cycle *c;
- int *p;
- RuleEntry *r;
- require(rule!=NULL, "RegisterCycle: tried to register NULL rule");
- require(k<=CLL_k, "RegisterCycle: tried to access non-existent stack");
-
- /*fprintf(stderr, "RegisterCycle(%s)\n", rule);*/
- /* Find cycle start */
- r = (RuleEntry *) hash_get(Rname, rule);
- require(r!=NULL,eMsg1("rule %s must be defined but isn't", rule));
- require(FoTOS[k]>=FoStack[k]&&FoTOS[k]<=&(FoStack[k][FoStackSize-1]),
- eMsg1("RegisterCycle(%s): FoStack stack-ptr is playing out of its sandbox",
- rule));
-/*** if ( FoTOS[k]<FoStack[k]||FoTOS[k]>&(FoStack[k][FoStackSize-1]) )
-**** {
-**** fprintf(stderr, "RegisterCycle(%s): FoStack stack-ptr is playing out of its sandbox\n",
-**** rule);
-**** fprintf(stderr, "RegisterCycle: sp==0x%x out of bounds 0x%x...0x%x\n",
-**** FoTOS[k], FoStack[k], &(FoStack[k][FoStackSize-1]));
-**** exit(PCCTS_EXIT_FAILURE);
-**** }
-****/
-
-#ifdef MEMCHK
- require(valid(FoStack[k]), "RegisterCycle: invalid FoStack");
-#endif
- for (p=FoTOS[k]; *p != r->rulenum && p >= FoStack[k]; --p) {;}
- require(p>=FoStack[k], "RegisterCycle: FoStack is screwed up beyond belief");
- if ( p == FoTOS[k] ) return; /* don't worry about cycles to oneself */
-
- /* compute cyclic dependents (rules in cycle except head) */
- c = newCycle;
- require(c!=NULL, "RegisterCycle: couldn't alloc new cycle");
- c->cyclicDep = empty;
- c->croot = *p++; /* record root of cycle */
- for (; p<=FoTOS[k]; p++)
- {
- /* Mark all dependent rules as incomplete */
- f = (CacheEntry *) hash_get(Fcache, Fkey(RulePtr[*p]->rname,'o',k));
- if ( f==NULL )
- {
- f = newCacheEntry( Fkey(RulePtr[*p]->rname,'o',k) );
- hash_add(Fcache, Fkey(RulePtr[*p]->rname,'o',k), (Entry *)f);
- }
- f->incomplete = TRUE;
-
- set_orel(*p, &(c->cyclicDep)); /* mark rule as dependent of croot */
- }
- list_add(&(Cycles[k]), (void *)c);
-}
-
-/* make all rules in cycle complete
- *
- * while ( some set has changed ) do
- * for each cycle do
- * if degree of FOLLOW set for croot > old degree then
- * update all FOLLOW sets for rules in cyclic dependency
- * change = TRUE
- * endif
- * endfor
- * endwhile
- */
-void
-#ifdef __USE_PROTOS
-ResolveFoCycles( int k )
-#else
-ResolveFoCycles( k )
-int k;
-#endif
-{
- ListNode *p, *q;
- Cycle *c;
- int changed = 1;
- CacheEntry *f,*g;
- int r;
-/* int i; */ /* MR10 not useful */
- unsigned d;
-
- unsigned *cursor; /* MR10 */
- unsigned *origin; /* MR10 */
-
- /*fprintf(stderr, "Resolving following cycles for %d\n", k);*/
- while ( changed )
- {
- changed = 0;
-/* MR10 i = 0; */
- for (p = Cycles[k]->next; p!=NULL; p=p->next)
- {
- c = (Cycle *) p->elem;
- /*fprintf(stderr, "cycle %d: %s -->", i++, RulePtr[c->croot]->rname);*/
- /*s_fprT(stderr, c->cyclicDep);*/
- /*fprintf(stderr, "\n");*/
- f = (CacheEntry *)
- hash_get(Fcache, Fkey(RulePtr[c->croot]->rname,'o',k));
- require(f!=NULL, eMsg1("FOLLOW(%s) must be in cache but isn't", RulePtr[c->croot]->rname) );
- if ( (d=set_deg(f->fset)) > c->deg )
- {
- /*fprintf(stderr, "Fo(%s) has changed\n", RulePtr[c->croot]->rname);*/
- changed = 1;
- c->deg = d; /* update cycle FOLLOW set degree */
-
-/* MR10 */ origin=set_pdq(c->cyclicDep);
-/* MR10 */ for (cursor=origin; *cursor != nil; cursor++) {
-/* MR10 */ r=*cursor;
-
-/******** while ( !set_nil(c->cyclicDep) ) { *****/
-/******** r = set_int(c->cyclicDep); *****/
-/******** set_rm(r, c->cyclicDep); *****/
-
- /*fprintf(stderr, "updating Fo(%s)\n", RulePtr[r]->rname);*/
- g = (CacheEntry *)
- hash_get(Fcache, Fkey(RulePtr[r]->rname,'o',k));
- require(g!=NULL, eMsg1("FOLLOW(%s) must be in cache but isn't", RulePtr[r]->rname) );
- set_orin(&(g->fset), f->fset);
- g->incomplete = FALSE;
- }
-/* MR10 */ free( (char *) origin);
-/* MR10 */ origin=NULL;
- }
- }
-/* MR10 - this if statement appears to be meaningless since i is always 0 */
-/* MR10 if ( i == 1 ) changed = 0; */ /* if only 1 cycle, no need to repeat */
- }
- /* kill Cycle list */
- for (q = Cycles[k]->next; q != NULL; q=p)
- {
- p = q->next;
- set_free( ((Cycle *)q->elem)->cyclicDep );
- free((char *)q);
- }
- free( (char *)Cycles[k] );
- Cycles[k] = NULL;
-}
-
-
- /* P r i n t i n g S y n t a x D i a g r a m s */
-
-static void
-#ifdef __USE_PROTOS
-pBlk( Junction *q, int btype )
-#else
-pBlk( q, btype )
-Junction *q;
-int btype;
-#endif
-{
- int k,a;
- Junction *alt, *p;
-
- q->end->pvisited = TRUE;
- if ( btype == aLoopBegin )
- {
- require(q->p2!=NULL, "pBlk: invalid ()* block");
- PRINT(q->p1);
- alt = (Junction *)q->p2;
- PRINT(alt->p1);
- if ( PrintAnnotate )
- {
- printf(" /* Opt ");
- k = 1;
- while ( !set_nil(alt->fset[k]) )
- {
- s_fprT(stdout, alt->fset[k]);
- if ( k++ == CLL_k ) break;
- if ( !set_nil(alt->fset[k]) ) printf(", ");
- }
- printf(" */\n");
- }
- return;
- }
- for (a=1,alt=q; alt != NULL; alt= (Junction *) alt->p2, a++)
- {
- if ( alt->p1 != NULL ) PRINT(alt->p1);
- if ( PrintAnnotate )
- {
- printf( " /* [%d] ", alt->altnum);
- k = 1;
- while ( !set_nil(alt->fset[k]) )
- {
- s_fprT(stdout, alt->fset[k]);
- if ( k++ == CLL_k ) break;
- if ( !set_nil(alt->fset[k]) ) printf(", ");
- }
- if ( alt->p2 == NULL && btype == aOptBlk )
- printf( " (optional branch) */\n");
- else printf( " */\n");
- }
-
- /* ignore implied empty alt of Plus blocks */
- if ( alt->p2 != NULL && ((Junction *)alt->p2)->ignore ) break;
-
- if ( alt->p2 != NULL && !(((Junction *)alt->p2)->p2==NULL && btype == aOptBlk) )
- {
- if ( pLevel == 1 )
- {
- printf("\n");
- if ( a+1==pAlt1 || a+1==pAlt2 ) printf("=>");
- printf("\t");
- }
- else printf(" ");
- printf("|");
- if ( pLevel == 1 )
- {
- p = (Junction *) ((Junction *)alt->p2)->p1;
- while ( p!=NULL )
- {
- if ( p->ntype==nAction )
- {
- p=(Junction *)((ActionNode *)p)->next;
- continue;
- }
- if ( p->ntype!=nJunction )
- {
- break;
- }
- if ( p->jtype==EndBlk || p->jtype==EndRule )
- {
- p = NULL;
- break;
- }
- p = (Junction *)p->p1;
- }
- if ( p==NULL ) printf("\n\t"); /* Empty alt? */
- }
- }
- }
- q->end->pvisited = FALSE;
-}
-
-/* How to print out a junction */
-void
-#ifdef __USE_PROTOS
-pJunc( Junction *q )
-#else
-pJunc( q )
-Junction *q;
-#endif
-{
- int dum_k;
- int doing_rule;
- require(q!=NULL, "pJunc: NULL node");
- require(q->ntype==nJunction, "pJunc: not junction");
-
- if ( q->pvisited == TRUE ) return;
- q->pvisited = TRUE;
- switch ( q->jtype )
- {
- case aSubBlk :
- if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
- if ( q->end->p1 != NULL && ((Junction *)q->end->p1)->ntype==nJunction &&
- ((Junction *)q->end->p1)->jtype == EndRule ) doing_rule = 1;
- else doing_rule = 0;
- pLevel++;
- if ( pLevel==1 )
- {
- if ( pAlt1==1 ) printf("=>");
- printf("\t");
- }
- else printf(" ");
- if ( doing_rule )
- {
- if ( pLevel==1 ) printf(" ");
- pBlk(q,q->jtype);
- }
- else {
- printf("(");
- if ( pLevel==1 ) printf(" ");
- pBlk(q,q->jtype);
- if ( pLevel>1 ) printf(" ");
- printf(")");
- }
- if ( q->guess ) printf("?");
- pLevel--;
- if ( PrintAnnotate ) freeBlkFsets(q);
- if ( q->end->p1 != NULL ) PRINT(q->end->p1);
- break;
- case aOptBlk :
- if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
- pLevel++;
- if ( pLevel==1 )
- {
- if ( pAlt1==1 ) printf("=>");
- printf("\t");
- }
- else printf(" ");
- printf("{");
- if ( pLevel==1 ) printf(" ");
- pBlk(q,q->jtype);
- if ( pLevel>1 ) printf(" ");
- else printf("\n\t");
- printf("}");
- pLevel--;
- if ( PrintAnnotate ) freeBlkFsets(q);
- if ( q->end->p1 != NULL ) PRINT(q->end->p1);
- break;
- case aLoopBegin :
- if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
- pLevel++;
- if ( pLevel==1 )
- {
- if ( pAlt1==1 ) printf("=>");
- printf("\t");
- }
- else printf(" ");
- printf("(");
- if ( pLevel==1 ) printf(" ");
- pBlk(q,q->jtype);
- if ( pLevel>1 ) printf(" ");
- else printf("\n\t");
- printf(")*");
- pLevel--;
- if ( PrintAnnotate ) freeBlkFsets(q);
- if ( q->end->p1 != NULL ) PRINT(q->end->p1);
- break;
- case aLoopBlk :
- if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
- pBlk(q,q->jtype);
- if ( PrintAnnotate ) freeBlkFsets(q);
- break;
- case aPlusBlk :
- if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k);
- pLevel++;
- if ( pLevel==1 )
- {
- if ( pAlt1==1 ) printf("=>");
- printf("\t");
- }
- else printf(" ");
- printf("(");
- if ( pLevel==1 ) printf(" ");
- pBlk(q,q->jtype);
- if ( pLevel>1 ) printf(" ");
- printf(")+");
- pLevel--;
- if ( PrintAnnotate ) freeBlkFsets(q);
- if ( q->end->p1 != NULL ) PRINT(q->end->p1);
- break;
- case EndBlk :
- break;
- case RuleBlk :
- printf( "\n%s :\n", q->rname);
- PRINT(q->p1);
- if ( q->p2 != NULL ) PRINT(q->p2);
- break;
- case Generic :
- if ( q->p1 != NULL ) PRINT(q->p1);
- q->pvisited = FALSE;
- if ( q->p2 != NULL ) PRINT(q->p2);
- break;
- case EndRule :
- printf( "\n\t;\n");
- break;
- }
- q->pvisited = FALSE;
-}
-
-/* How to print out a rule reference node */
-void
-#ifdef __USE_PROTOS
-pRuleRef( RuleRefNode *p )
-#else
-pRuleRef( p )
-RuleRefNode *p;
-#endif
-{
- require(p!=NULL, "pRuleRef: NULL node");
- require(p->ntype==nRuleRef, "pRuleRef: not rule ref node");
-
- printf( " %s", p->text);
- PRINT(p->next);
-}
-
-/* How to print out a terminal node */
-void
-#ifdef __USE_PROTOS
-pToken( TokNode *p )
-#else
-pToken( p )
-TokNode *p;
-#endif
-{
- require(p!=NULL, "pToken: NULL node");
- require(p->ntype==nToken, "pToken: not token node");
-
- if ( p->wild_card ) printf(" .");
- printf( " %s", TerminalString(p->token));
- PRINT(p->next);
-}
-
-/* How to print out a terminal node */
-void
-#ifdef __USE_PROTOS
-pAction( ActionNode *p )
-#else
-pAction( p )
-ActionNode *p;
-#endif
-{
- require(p!=NULL, "pAction: NULL node");
- require(p->ntype==nAction, "pAction: not action node");
-
- PRINT(p->next);
-}
-
- /* F i l l F o l l o w L i s t s */
-
-/*
- * Search all rules for all rule reference nodes, q to rule, r.
- * Add q->next to follow list dangling off of rule r.
- * i.e.
- *
- * r: -o-R-o-->o--> Ptr to node following rule r in another rule
- * |
- * o--> Ptr to node following another reference to r.
- *
- * This is the data structure employed to avoid FOLLOW set computation. We
- * simply compute the FIRST (reach) of the EndRule Node which follows the
- * list found at the end of all rules which are referenced elsewhere. Rules
- * not invoked by other rules have no follow list (r->end->p1==NULL).
- * Generally, only start symbols are not invoked by another rule.
- *
- * Note that this mechanism also gives a free cross-reference mechanism.
- *
- * The entire syntax diagram is layed out like this:
- *
- * SynDiag
- * |
- * v
- * o-->R1--o
- * |
- * o-->R2--o
- * |
- * ...
- * |
- * o-->Rn--o
- *
- */
-void
-#ifdef __USE_PROTOS
-FoLink( Node *p )
-#else
-FoLink( p )
-Node *p;
-#endif
-{
- RuleEntry *q;
- Junction *j = (Junction *) p;
- RuleRefNode *r = (RuleRefNode *) p;
-
- if ( p==NULL ) return;
- require(p->ntype>=1 && p->ntype<=NumNodeTypes,
- eMsgd("FoLink: invalid diagram node: ntype==%d",p->ntype));
- switch ( p->ntype )
- {
- case nJunction :
- if ( j->fvisited ) return;
- if ( j->jtype == EndRule ) return;
- j->fvisited = TRUE;
- FoLink( j->p1 );
- FoLink( j->p2 );
-/* MR14 */
-/* MR14 */ /* Need to determine whether the guess block is an */
-/* MR14 */ /* of the form (alpha)? beta before follow sets are */
-/* MR14 */ /* computed. This is necessary to solve problem */
-/* MR14 */ /* of doing follow on the alpha of an (alpha)? beta block. */
-/* MR14 */
-/* MR14 */ /* This is performed by analysis_point as a side-effect. */
-/* MR14 */
-/* MR14 */
-/* MR14 */ if (j->jtype == aSubBlk && j->guess) {
-/* MR14 */ Junction *ignore;
-/* MR14 */ ignore=analysis_point(j);
-/* MR14 */ }
-/* MR14 */
- return;
- case nRuleRef :
- if ( r->linked ) return;
- q = (RuleEntry *) hash_get(Rname, r->text);
- if ( q == NULL )
- {
- warnFL( eMsg1("rule %s not defined",r->text), FileStr[r->file], r->line );
- }
- else
- {
- if ( r->parms!=NULL && RulePtr[q->rulenum]->pdecl==NULL )
- {
- warnFL( eMsg1("rule %s accepts no parameter(s)", r->text),
- FileStr[r->file], r->line );
- }
- if ( r->parms==NULL && RulePtr[q->rulenum]->pdecl!=NULL )
- {
- warnFL( eMsg1("rule %s requires parameter(s)", r->text),
- FileStr[r->file], r->line );
- }
- if ( r->assign!=NULL && RulePtr[q->rulenum]->ret==NULL )
- {
- warnFL( eMsg1("rule %s yields no return value(s)", r->text),
- FileStr[r->file], r->line );
- }
- if ( r->assign==NULL && RulePtr[q->rulenum]->ret!=NULL )
- {
- warnFL( eMsg1("rule %s returns a value(s)", r->text),
- FileStr[r->file], r->line );
- }
- if ( !r->linked )
- {
- addFoLink( r->next, r->rname, RulePtr[q->rulenum] );
- r->linked = TRUE;
- }
- }
- FoLink( r->next );
- return;
- case nToken :
- FoLink( ((TokNode *)p)->next );
- return;
- case nAction :
- FoLink( ((ActionNode *)p)->next );
- return;
- default :
- fatal_internal("invalid node type");
- }
-}
-
-/*
- * Add a reference to the end of a rule.
- *
- * 'r' points to the RuleBlk node in a rule. r->end points to the last node
- * (EndRule jtype) in a rule.
- *
- * Initial:
- * r->end --> o
- *
- * After:
- * r->end --> o-->o--> Ptr to node following rule r in another rule
- * |
- * o--> Ptr to node following another reference to r.
- *
- * Note that the links are added to the head of the list so that r->end->p1
- * always points to the most recently added follow-link. At the end, it should
- * point to the last reference found in the grammar (starting from the 1st rule).
- */
-void
-#ifdef __USE_PROTOS
-addFoLink( Node *p, char *rname, Junction *r )
-#else
-addFoLink( p, rname, r )
-Node *p;
-char *rname;
-Junction *r;
-#endif
-{
- Junction *j;
- require(r!=NULL, "addFoLink: incorrect rule graph");
- require(r->end!=NULL, "addFoLink: incorrect rule graph");
- require(r->end->jtype==EndRule, "addFoLink: incorrect rule graph");
- require(p!=NULL, "addFoLink: NULL FOLLOW link");
-
- j = newJunction();
- j->rname = rname; /* rname on follow links point to target rule */
- j->p1 = p; /* link to other rule */
- j->p2 = (Node *) r->end->p1;/* point to head of list */
- r->end->p1 = (Node *) j; /* reset head to point to new node */
-}
-
-void
-#ifdef __USE_PROTOS
-GenCrossRef( Junction *p )
-#else
-GenCrossRef( p )
-Junction *p;
-#endif
-{
- set a;
- Junction *j;
- RuleEntry *q;
- unsigned e;
- require(p!=NULL, "GenCrossRef: why are you passing me a null grammar?");
-
- printf("Cross Reference:\n\n");
- a = empty;
- for (; p!=NULL; p = (Junction *)p->p2)
- {
- printf("Rule %20s referenced by {", p->rname);
- /* make a set of rules for uniqueness */
- for (j = (Junction *)(p->end)->p1; j!=NULL; j = (Junction *)j->p2)
- {
- q = (RuleEntry *) hash_get(Rname, j->rname);
- require(q!=NULL, "GenCrossRef: FoLinks are screwed up");
- set_orel(q->rulenum, &a);
- }
- for (; !set_nil(a); set_rm(e, a))
- {
- e = set_int(a);
- printf(" %s", RulePtr[e]->rname);
- }
- printf(" }\n");
- }
- set_free( a );
-}
-
-/*
- The single argument is a pointer to the start of an element of a
- C++ style function prototypet list. Given a pointer to the start of
- an formal we must locate the comma (or the end of the string)
- and locate the datatype, formal name, and initial value expression.
-
- The function returns a pointer to the character following the comma
- which terminates the formal declaration, or a pointer to the end of
- the string if none was found.
-
- I thought we were parsing specialists, how come I'm doing this by
- hand written code ?
-
- Examples of input:
-
- Foo f,
- Foo f = Foo(1),
- Foo f = Foo(1,2),
- Foo f = &farray[1,2],
- Foo f = ",",
- Foo f = ',',
- TFoo<int,char> f = TFoo<int,char>(1,2),
-
- A non-zero value for nesting indicates a problem matching '(' and ')',
- '[' and ']', '<' and '>', '{' and '}', or improperly terminated string
- or character literal.
-
-*/
-
-
-/*
- * Don't care if it is a valid string literal or not, just find the end
- * Start with pointer to leading "\""
- */
-
-#ifdef __USE_PROTOS
-char * skipStringLiteral(char *pCurrent)
-#else
-char * skipStringLiteral(pCurrent)
-char *pCurrent;
-#endif
-{
- char *p = pCurrent;
- if (*p == 0) return p;
- require (*p == '\"', "skipStringLiteral")
- p++;
- for (p = p; *p != 0; p++) {
- if (*p == '\\') {
- p++;
- if (*p == 0) break;
- p++;
- }
- if (*p == '\"') {
- p++;
- break;
- }
- }
- return p;
-}
-
-/*
- * Don't care if it is a valid character literal or not, just find the end
- * Start with pointer to leading "'"
- */
-
-#ifdef __USE_PROTOS
-char * skipCharLiteral(char *pStart)
-#else
-char * skipCharLiteral(pStart)
- char *pStart;
-#endif
-{
- char *p = pStart;
- if (*p == 0) return p;
- require (*p == '\'', "skipCharLiteral")
- p++;
- for (p = p; *p != 0; p++) {
- if (*p == '\\') {
- p++;
- if (*p == 0) break;
- p++;
- }
- if (*p == '\'') {
- p++;
- break;
- }
- }
- return p;
-}
-
-#ifdef __USE_PROTOS
-char * skipSpaces(char *pStart)
-#else
-char * skipSpaces(pStart)
-char * pStart;
-#endif
-{
- char *p = pStart;
- while (*p != 0 && isspace(*p)) p++;
- return p;
-}
-
-#ifdef __USE_PROTOS
-char * skipToSeparatorOrEqualSign(char *pStart, int *pNest)
-#else
-char * skipToSeparatorOrEqualSign(pStart, pNest)
-char *pStart;
-int *pNest;
-#endif
-{
- char *p = pStart;
-
- int nest = 0;
-
- *pNest = (-1);
-
- while (*p != 0) {
- switch (*p) {
-
- case '(' :
- case '[' :
- case '<' :
- case '{' :
- nest++;
- p++;
- break;
-
- case ')' :
- case ']' :
- case '>' :
- case '}' :
- nest--;
- p++;
- break;
-
- case '"' :
- p = skipStringLiteral(p);
- break;
-
- case '\'' :
- p = skipCharLiteral(p);
- break;
-
- case '\\':
- p++;
- if (*p == 0) goto EXIT;
- p++;
- break;
-
- case ',':
- case '=':
- if (nest == 0) goto EXIT;
- p++;
- break;
-
- default:
- p++;
- }
- }
-EXIT:
- *pNest = nest;
- return p;
-}
-
-#ifdef __USE_PROTOS
-char * skipToSeparator(char *pStart, int *pNest)
-#else
-char * skipToSeparator(pStart, pNest)
-char *pStart;
-int *pNest;
-#endif
-{
- char * p = pStart;
- for ( ; ; ) {
- p = skipToSeparatorOrEqualSign(p, pNest);
- if (*pNest != 0) return p;
- if (*p == ',') return p;
- if (*p == 0) return p;
- p++;
- }
-}
-
-/* skip to just past the "=" separating the declaration from the initialization value */
-
-#ifdef __USE_PROTOS
-char * getInitializer(char *pStart)
-#else
-char * getInitializer(pStart)
-char * pStart;
-#endif
-{
- char *p;
- char *pDataType;
- char *pSymbol;
- char *pEqualSign;
- char *pValue;
- char *pSeparator;
- int nest = 0;
-
- require(pStart!=NULL, "getInitializer: invalid string");
-
- p = endFormal(pStart,
- &pDataType,
- &pSymbol,
- &pEqualSign,
- &pValue,
- &pSeparator,
- &nest);
- if (nest != 0) return NULL;
- if (pEqualSign == NULL) return NULL;
- if (pValue == NULL) return NULL;
- return strBetween(pValue, NULL, pSeparator);
-}
-
-/*
- Examines the string from pStart to pEnd-1.
- If the string has 0 length or is entirely white space
- returns 1. Otherwise 0.
-*/
-
-#ifdef __USE_PROTOS
-int isWhiteString(const char *pStart, const char *pEnd)
-#else
-int isWhiteString(pStart, pEnd)
-const char *pStart;
-const char *pEnd;
-#endif
-{
- const char *p;
- for (p = pStart; p < pEnd; p++) {
- if (! isspace(*p)) return 0;
- }
- return 1;
-}
-
-/*
- This replaces HasComma() which couldn't distinguish
-
- foo ["a,b"]
-
- from:
-
- foo[a,b]
-
-*/
-
-#ifdef __USE_PROTOS
-int hasMultipleOperands(char *pStart)
-#else
-int hasMultipleOperands(pStart)
-char *pStart;
-#endif
-{
- char *p = pStart;
- int nest = 0;
-
- p = skipSpaces(p);
- if (*p == 0) return 0;
- p = skipToSeparator(p, &nest);
- if (nest == 0 && *p == ',') return 1;
- return 0;
-}
-
-
-#define MAX_STR_BETWEEN_WORK_AREA 1000
-
-static char strBetweenWorkArea[MAX_STR_BETWEEN_WORK_AREA];
-
-
-/*
- strBetween(pStart, pNext, pStop)
-
- Creates a null terminated string by copying the text between two pointers
- to a work area. The start of the string is pStart. The end of the string
- is the character before pNext, or if pNext is null then the character before
- pStop. Trailing spaces are not included in the copy operation.
-
- This is used when a string contains several parts. The pNext part may be
- optional. The pStop will stop the scan when the optional part is not present
- (is a null pointer).
-*/
-
-#ifdef __USE_PROTOS
-char *strBetween(char *pStart, char *pNext, char *pStop)
-#else
-char *strBetween(pStart, pNext, pStop)
-char *pStart;
-char *pNext;
-char *pStop;
-#endif
-{
- char *p;
- char *q = strBetweenWorkArea;
- const char *pEnd;
-
- pEnd = (pNext != NULL) ? pNext : pStop;
-
- require (pEnd != NULL, "pEnd == NULL");
- require (pEnd >= pStart, "pEnd < pStart");
- for (pEnd--; pEnd >= pStart; pEnd--) { /* MR31 */
- if (! isspace(*pEnd)) break;
- }
- for (p = pStart;
- p <= pEnd && q < &strBetweenWorkArea[MAX_STR_BETWEEN_WORK_AREA-2];
- p++, q++) {
- *q = *p;
- }
- *q = 0;
- return strBetweenWorkArea;
-}
-
-/*
- function Returns pointer to character following separator at
- value which to continue search for next formal. If at the
- end of the string a pointer to the null byte at the
- end of the string is returned.
-
- pStart Pointer to the starting position of the formal list
-
- This may be the middle of a longer string, for example
- when looking for the end of formal #3 starting from
- the middle of the complete formal list.
-
- ppDataType Returns a pointer to the start of the data type in the
- formal. Example: pointer to "Foo".
-
- ppSymbol Returns a pointer to the start of the formal symbol.
- Example: pointer to "f".
-
- ppEqualSign Returns a pointer to the equal sign separating the
- formal symbol from the initial value. If there is
- no "=" then this will be NULL.
-
- ppValue Returns a pointer to the initial value part of the
- formal declaration. Example: pointer to "&farray[1,2]"
-
- ppSeparator Returns a pointer to the character which terminated the
- scan. This should be a pointer to a comma or a null
- byte which terminates the string.
-
- pNest Returns the nesting level when a separator was found.
- This is non-zero for any kind of error. This is zero
- for a successful parse of this portion of the formal
- list.
-
-*/
-
-#ifdef __USE_PROTOS
-char * endFormal(char *pStart,
- char **ppDataType,
- char **ppSymbol,
- char **ppEqualSign,
- char **ppValue,
- char **ppSeparator,
- int *pNest)
-#else
-char * endFormal(pStart,
- ppDataType,
- ppSymbol,
- ppEqualSign,
- ppValue,
- ppSeparator,
- pNest)
-char *pStart;
-char **ppDataType;
-char **ppSymbol;
-char **ppEqualSign;
-char **ppValue;
-char **ppSeparator;
-int *pNest;
-
-#endif
-{
- char *p = pStart;
- char *q;
-
- *ppDataType = NULL;
- *ppSymbol = NULL;
- *ppEqualSign = NULL;
- *ppValue = NULL;
- *ppSeparator = NULL;
-
- *pNest = 0;
-
- /* The first non-blank is the start of the datatype */
-
- p = skipSpaces(p);
- if (*p == 0) goto EXIT;
- *ppDataType = p;
-
- /* We are not looking for the symbol, we are looking
- for the separator that follows the symbol. Then
- we'll back up.
-
- Search for the ',' or '=" or null terminator.
- */
-
- p = skipToSeparatorOrEqualSign(p, pNest);
-
- if (*pNest != 0) goto EXIT;
-
- /*
- Work backwards to find start of symbol
- Skip spaces between the end of symbol and separator
- Assume that there are no spaces in the formal, but
- there is a space preceding the formal
- */
-
- for (q = &p[-1]; q >= *ppDataType; q--) {
- if (! isspace(*q)) break;
- }
- if (q < *ppDataType) goto EXIT;
-
- /*
- MR26 Handle things like: IIR_Bool (IIR_Decl::*constraint)()
- Backup until we hit the end of a symbol string, then find the
- start of the symbol string. This wont' work for functions
- with prototypes, but works for the most common cases. For
- others, use typedef names.
- */
-
-/* MR26 */ for (q = q; q >= *ppDataType; q--) {
-/* MR26 */ if (isalpha(*q) || isdigit(*q) || *q == '_' || *q == '$') break;
-/* MR26 */ }
-/* MR26 */ if (q < *ppDataType) goto EXIT;
-
- for (q = q; q >= *ppDataType; q--) {
- if ( ! (isalpha(*q) || isdigit(*q) || *q == '_' || *q == '$')) break;
- }
-
- *ppSymbol = &q[1];
-
- if (*p == ',' || *p == 0) {
- *ppSeparator = p;
- goto EXIT;
- }
-
- *ppEqualSign = p;
- p = skipSpaces(++p);
- *ppValue = p;
- if (*p == 0) goto EXIT;
-
-
- while (*p != 0 && *pNest == 0 && *p != ',') {
- p = skipToSeparator(p, pNest);
- }
- if (*pNest == 0) *ppSeparator = p;
-
-EXIT:
- if (*p == ',') p++;
- return p;
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h
deleted file mode 100644
index c08bf31ac7..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/mode.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#define START 0
-#define STRINGS 1
-#define ACTION_STRINGS 2
-#define ACTION_CHARS 3
-#define ACTION_COMMENTS 4
-#define TOK_DEF_COMMENTS 5
-#define TOK_DEF_CPP_COMMENTS 6
-#define ACTION_CPP_COMMENTS 7
-#define CPP_COMMENTS 8
-#define COMMENTS 9
-#define ACTIONS 10
-#define PARSE_ENUM_FILE 11
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c
deleted file mode 100644
index 110bf5996f..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/mrhoist.c
+++ /dev/null
@@ -1,3030 +0,0 @@
-/*
- * mrhoist.c
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33MR10
- *
- */
-
-#include <stdio.h>
-
-#include "pcctscfg.h"
-
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-#include <ctype.h>
-
-#ifdef __USE_PROTOS
-void dumppred(Predicate *);
-#else
-void dumppred();
-#endif
-
-/*
- Try to determine whether predicate "first" is true for
- all cases where "second" is true. Comparison takes place
- without regard to context.
- Assumes that predicate symbols have been expanded.
- Assumes that there are no NAND or NOR nodes
-
-*/
-
-#ifdef __USE_PROTOS
-int MR_secondPredicateUnreachable(Predicate *first,Predicate *second)
-#else
-int MR_secondPredicateUnreachable(first,second)
- Predicate *first;
- Predicate *second;
-#endif
-{
- Predicate *f;
- Predicate *s;
-
- if (first == NULL) {
- return 1;
- } else if (second == NULL) {
- return 0;
- } else if (first->down == NULL && second->down == NULL) {
- if (first->source == second->source &&
- first->inverted == second->inverted) {
- return 1; /* look identical - will never reach alt2 */
- } else {
- return 0; /* look different */
- };
- } else if (first->down == NULL && second->down != NULL) {
-
- if (second->expr == PRED_AND_LIST) {
-
- /* unreachable if first covers any child of second */
-
- for (s=second->down; s != NULL; s=s->right) {
- if (MR_secondPredicateUnreachable(first,s)) {
- return 1;
- };
- };
- return 0;
- } else if (second->expr == PRED_OR_LIST) {
-
- /* unreachable if first covers every child of second */
-
- for (s=second->down; s != NULL; s=s->right) {
- if (!MR_secondPredicateUnreachable(first,s)) {
- return 0;
- };
- };
- return 1;
- } else {
- require (0,"Illegal pred->expr");
- return 0; /* MR20 Make compiler happy */
- };
- } else if (first->down != NULL && second->down == NULL) {
- if (first->expr == PRED_AND_LIST) {
-
- /* unreachable if every child of first covers second */
-
- for (f=first->down; f != NULL; f=f->right) {
- if (!MR_secondPredicateUnreachable(f,second)) {
- return 0;
- };
- };
- return 1;
- } else if (first->expr == PRED_OR_LIST) {
-
- /* unreachable if any child of first covers second */
-
- for (f=first->down; f != NULL; f=f->right) {
- if (MR_secondPredicateUnreachable(f,second)) {
- return 1;
- };
- };
- return 0;
- } else {
- require (0,"Illegal predicate->expr");
- return 0; /* MR20 Make compiler happy */
- };
- } else {
-
- if (first->expr == PRED_AND_LIST && second->expr == PRED_AND_LIST) {
-
- /* unreachable if each child of first covers at least one child of second */
-
- for (f=first->down; f != NULL ; f=f->right) {
- for (s=second->down; s != NULL ; s=s->right) {
- if (MR_secondPredicateUnreachable(f,s)) goto A_next_f;
- };
- return 0;
-A_next_f:
- continue;
- };
- return 1;
-
- } else if (first->expr == PRED_AND_LIST && second->expr == PRED_OR_LIST) {
-
- /* unreachable if each child of first covers ALL of second's children */
-
- for (f=first->down; f != NULL ; f=f->right) {
- for (s=second->down; s != NULL ; s=s->right) {
- if (!MR_secondPredicateUnreachable(f,s)) return 0;
- };
- };
- return 1;
-
- } else if (first->expr == PRED_OR_LIST && second->expr == PRED_AND_LIST) {
-
- /* unreachable if any child of second is covered by any child of first */
-
- for (f=first->down; f != NULL ; f=f->right) {
- for (s=second->down; s != NULL ; s=s->right) {
- if (MR_secondPredicateUnreachable(f,s)) return 1;
- };
- };
- return 0;
-
- } else if (first->expr == PRED_OR_LIST && second->expr == PRED_OR_LIST) {
-
- /* unreachable if every child of second is covered by some child of first */
-
- for (f=first->down; f != NULL ; f=f->right) {
- for (s=second->down; s != NULL ; s=s->right) {
- if (MR_secondPredicateUnreachable(f,s)) goto B_next_f;
- };
- return 0;
-B_next_f:
- continue;
- };
- return 1;
-
- } else {
- require (0,"Illegal predicate->expr");
- return 0; /* MR20 Make compiler happy */
- };
- };
- return 0; /* MR20 MSVC 5.0 complains about missing return statement */
-}
-
-#ifdef __USE_PROTOS
-void MR_xxxIndent(FILE *f,int depth)
-#else
-void MR_xxxIndent(f,depth)
- FILE *f;
- int depth;
-#endif
-{
- int i;
-
- for (i=0; i<depth ; i++) {
- fprintf(f," ");
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_stderrIndent(int depth)
-#else
-void MR_stderrIndent(depth)
- int depth;
-#endif
-{
- MR_xxxIndent(stderr,depth);
-}
-
-#ifdef __USE_PROTOS
-void MR_outputIndent(int depth)
-#else
-void MR_outputIndent(depth)
- int depth;
-#endif
-{
- MR_xxxIndent(output,depth);
-}
-
-#ifdef __USE_PROTOS
-void MR_set_reuse(set *s)
-#else
-void MR_set_reuse(s)
- set *s;
-#endif
-{
- set_free(*s);
- *s=empty;
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpPredRuleRefStack(FILE *iounit,int indent)
-#else
-void MR_dumpPredRuleRefStack(iounit,indent)
- FILE *iounit;
- int indent;
-#endif
-{
- int i;
- int j;
- int count=MR_PredRuleRefStack.count;
- RuleRefNode *rrn=NULL;
- Junction *lastOne;
-
- if (count == 0) {
- fprintf(iounit,"empty\n");
- return;
- };
- for (i=0; i < count; i++) {
- rrn=(RuleRefNode *) MR_PredRuleRefStack.data[i];
- for (j=0; j<indent; j++) fprintf(iounit," ");
- fprintf(iounit,"#%-2d in rule %s (line %d %s) to rule %s\n",
- i,rrn->rname,rrn->line,FileStr[rrn->file],rrn->text);
- };
- lastOne=MR_ruleReferenced(rrn);
- if (lastOne != NULL) {
- for (j=0; j<indent; j++) fprintf(iounit," ");
- fprintf(iounit,"#%-2d in rule %s (line %d %s)\n",
- count,lastOne->rname,lastOne->line,FileStr[lastOne->file]);
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpTreeF(FILE *f,int depth,Tree *tree,int across)
-#else
-void MR_dumpTreeF(f,depth,tree,across)
- FILE *f;
- Tree *tree;
- int depth;
- int across;
-#endif
-{
- int newAcross=across;
-
- if (tree == NULL ) return;
- if (tree->down != NULL ) {
- fprintf(output,"\n");
- MR_outputIndent(depth);
- fprintf(output, "(root =");
- };
- if (tree->token == ALT ) {
- fprintf(output," %-16s","Alt");
- } else if (tree->token==EpToken ) {
- fprintf(output,"(%d)%13s",tree->v.rk," ");
- } else {
- fprintf(output," %-16s",TerminalString(tree->token));
- };
- if (tree->down != NULL) {
- fprintf(output,"\n");
- MR_outputIndent(depth+1);
- MR_dumpTreeF(f,depth+1,tree->down,1);
- newAcross=0;
- fprintf(output,"\n");
- MR_outputIndent(depth);
- fprintf(output,")");
- };
- if (newAcross > 3) {
- fprintf(output,"\n");
- MR_outputIndent(depth);
- newAcross=0;
- };
- MR_dumpTreeF(f,depth,tree->right,newAcross+1);
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpTreeX(int depth,Tree *tree,int across)
-#else
-void MR_dumpTreeX(depth,tree,across)
- Tree *tree;
- int depth;
- int across;
-#endif
-{
- MR_dumpTreeF(output,depth,tree,across);
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpTokenSet(FILE *f,int depth,set s)
-#else
-void MR_dumpTokenSet(f,depth,s)
- FILE *f;
- int depth;
- set s;
-#endif
-{
- int i;
- int j;
-
- unsigned *pdq;
-
- if (set_nil(s)) {
- fprintf(f,"\n");
- MR_xxxIndent(f,depth+1);
- fprintf(f,"nil\n");
- return;
- };
-
- pdq=set_pdq(s);
- require(pdq != NULL,"set_pdq failed");
- i=0;
- for (i=0 ; ; i=i+4) {
- fprintf(f,"\n");
- MR_xxxIndent(f,depth+1);
- for (j=0; j < 4 ; j++) {
- if (pdq[i+j] == nil) break;
- fprintf(f," %-16s",TerminalString(pdq[i+j]));
- };
- if (pdq[i+j] == nil) break;
- };
- fprintf(f,"\n");
- free( (char *) pdq);
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpPred1(int depth,Predicate *p,int withContext)
-#else
-void MR_dumpPred1(depth,p,withContext)
- int depth;
- Predicate *p;
- int withContext;
-#endif
-{
- unsigned k;
-
- if (p == NULL) {
- MR_outputIndent(depth);
- fprintf(output,"The predicate is empty (or always true)\n\n");
- return;
- };
- if (p->down != NULL) {
- MR_outputIndent(depth);
- if (p->inverted) {
-
- /* MR14a Left out print expression in fprintf
- Reported by Manuel Kessler (mlkessle@cip.physik.uni-wuerzburg.de)
- */
-
- if (p->expr == PRED_AND_LIST) fprintf(output,"%s NAND (not AND) expr\n\n",p->expr);
- if (p->expr == PRED_OR_LIST) fprintf(output,"%s NOR (not OR) expr\n\n",p->expr);
- } else {
- fprintf(output,"%s expr\n\n",p->expr);
- };
- } else {
- MR_outputIndent(depth);
- fprintf(output,"pred %s <<%s>>?\n",
- (p->inverted ? " *not*" : ""),
- (p->expr == NULL ? "null expr" : p->expr));
- MR_outputIndent(depth+1);
- fprintf(output," ");
- fprintf(output," depth=k=%d",p->k);
- if (p->source != NULL && p->source->guardpred) {
- fprintf(output," (\"=>\" guard)");
- }
- if (p->source != NULL && p->source->ampersandPred != NULL) {
- fprintf(output," (\"&&\" guard)");
- };
- k=set_int(p->completionSet);
- if (k != nil) {
- fprintf(output," Incomplete Set at k=%d !",k);
- };
- k=set_int(p->completionTree);
- if (k != nil) {
- fprintf(output," Incomplete Tree at k=%d !",k);
- };
- if (p->source != NULL) {
- fprintf(output," rule %s line %d %s",
- p->source->rname,p->source->line,FileStr[p->source->file]);
- };
- fprintf(output,"\n");
- if (withContext &&
- (HoistPredicateContext ||
- ! set_nil(p->scontext[1]) ||
- p->tcontext != NULL)) {
- if (p->k == 1) {
- MR_outputIndent(depth+1);
- fprintf(output,"set context: ");
- MR_dumpTokenSet(output,depth+1,p->scontext[1]);
- }
- if (p->k != 1) {
- MR_outputIndent(depth+1);
- fprintf(output,"tree context:");
- if (p->tcontext == NULL) {
- fprintf(output," null");
- } else {
- MR_dumpTreeX(depth+2,p->tcontext,0);
- };
- fprintf(output,"\n");
- };
- };
- fprintf(output,"\n");
- };
- if (p->down != NULL) {
- MR_dumpPred1(depth+1,p->down,withContext);
- };
- if (p->right != NULL) {
- MR_dumpPred1(depth,p->right,withContext);
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpPred(Predicate *p,int withContext)
-#else
-void MR_dumpPred(p,withContext)
- Predicate *p;
- int withContext;
-#endif
-{
- MR_dumpPred1(0,p,withContext);
-}
-
-#ifdef __USE_PROTOS
-Tree * MR_make_tree_from_set(set s)
-#else
-Tree * MR_make_tree_from_set(s)
- set s;
-#endif
-{
- Tree *t=NULL;
- Tree *node;
- Tree **tp=&t;
- int i;
-
- unsigned *pdq=set_pdq(s);
-
- if (pdq != NULL) {
- for (i=0 ; pdq[i] != nil ; i++) {
- node=tnode( (int) pdq[i]);
- *tp=node;
- tp=&(node->right);
- };
- *tp=NULL;
- free ( (char *) pdq);
- };
- return t;
-}
-
-#ifdef __USE_PROTOS
-void MR_check_pred_too_long(Predicate *p,set completion)
-#else
-void MR_check_pred_too_long(p,completion)
- Predicate *p;
- set completion;
-#endif
-{
- if (p != NULL &&
- p->source != NULL &&
- ! p->source->predTooLong) {
- if ( !set_nil(completion)) {
- p->source->predTooLong=1;
-warnFL("It is unusual (but ok) for a semantic predicate to test context past the end of its own rule",
- FileStr[p->source->file],p->source->line);
- };
- };
-}
-
-#ifdef __USE_PROTOS
-int MR_predicate_context_completed(Predicate *p)
-#else
-int MR_predicate_context_completed(p)
- Predicate *p;
-#endif
-{
- if (p == NULL) return 1;
- if (p->expr != PRED_AND_LIST &&
- p->expr != PRED_OR_LIST) {
- if ( ! set_nil(p->completionSet)) return 0;
- if ( ! set_nil(p->completionTree)) return 0;
- };
- return MR_predicate_context_completed(p->down) &
- MR_predicate_context_completed(p->right);
-}
-
-#ifdef __USE_PROTOS
-Node * MR_advance(Node *n)
-#else
-Node * MR_advance(n)
- Node *n;
-#endif
-{
- if (n == NULL) return NULL;
- switch (n->ntype) {
- case nJunction: return ((Junction *)n)->p1;
- case nToken: return ((TokNode *)n)->next;
- case nRuleRef: return ((RuleRefNode *)n)->next;
- case nAction: return ((ActionNode *)n)->next;
- default: return NULL;
- };
- return NULL; /* MSVC 5.0 complains about missing return statement */
-}
-
-#ifdef __USE_PROTOS
-Junction * MR_find_endRule(Node *n)
-#else
-Junction * MR_find_endRule(n)
- Node *n;
-#endif
-{
- Node *next;
- if (n == NULL) return NULL;
- for (next=n; next != NULL; next=MR_advance(next)) {
- if (next->ntype == nJunction &&
- ( (Junction *) next)->jtype == EndRule) {
- break;
- };
- };
- return (Junction *)next;
-}
-
-/*
- Intersection: a branch which is shorter is chosen
- over one which is longer: (A B C) intersect (A B) yields (A B).
-
- AND: a branch which is longer is chosen over the one
- which is shorter: (A B C) AND (A B) yields (A B C)
-
-*/
-
-#ifdef __USE_PROTOS
-Tree *MR_computeTreeIntersection(Tree *l,Tree *r)
-#else
-Tree *MR_computeTreeIntersection(l,r)
- Tree *l;
- Tree *r;
-#endif
-{
- Tree *result=NULL;
- Tree **tail;
- Tree *p;
- Tree *q;
- Tree *match;
-
- if (l == NULL || r == NULL) return NULL;
- for (p=l; p != NULL; p=p->right) {
- require(p->token != EpToken,"MR_computeTreeIntersection: p->EpToken unexpected\n");
- require (p->token != ALT,"MR_computeTreeIntersection: p->ALT unexpected\n");
- };
- for (q=r; q != NULL; q=q->right) {
- require(q->token != EpToken,"MR_computeTreeIntersection: q->EpToken unexpected\n");
- require(q->token != ALT,"MR_computeTreeIntersection: q->ALT unexpected\n");
- };
-
- result=tnode(ALT);
- tail=&(result->down);
-
- for (p=l; p != NULL ; p=p->right) {
- for (q=r; q != NULL ; q=q->right) {
- if (p->token == q->token) {
- match=tnode(p->token);
- match->down=MR_computeTreeIntersection(p->down,q->down);
- *tail=match;
- tail=&(match->right);
- };
- };
- };
-
- *tail=NULL;
- result=tshrink(result);
- result=tflatten( result );
- result=tleft_factor( result );
- return result;
-}
-
-/* the predicates which are ANDed together have a common
- context: they must all have common roots. Thus the
- AND operation is more like an OR operation because
- branches which are longer are grafted onto shorter
- branches of the AND tree. For instance combining
- (A B C) with (A B C D) gives (A B C D). There
- should never be a case of (A B C) and (A B D) because
- they have the same context.
-
- Actually, this may not be true once one throws in
- guard predicates which are defined by the user, not
- the context.
-*/
-
-/* requires input trees to be in "canonical" format */
-
-#ifdef __USE_PROTOS
-Tree *MR_computeTreeAND(Tree *l,Tree *r)
-#else
-Tree *MR_computeTreeAND(l,r)
- Tree *l;
- Tree *r;
-#endif
-{
- Tree *result=NULL;
- Tree **tail;
- Tree *p;
- Tree *q;
- Tree *match;
-
- if (l == NULL) return tdup(r);
- if (r == NULL) return tdup(l);
-
- for (p=l; p != NULL; p=p->right) {
-/**** require(p->token != EpToken,"MR_computeTreeAND: p->EpToken unexpected\n"); ****/
- require (p->token != ALT,"MR_computeTreeAND: p->ALT unexpected\n");
- };
- for (q=r; q != NULL; q=q->right) {
-/**** require(q->token != EpToken,"MR_computeTreeAND: q->EpToken unexpected\n"); ****/
- require(q->token != ALT,"MR_computeTreeAND: q->ALT unexpected\n");
- };
-
- result=tnode(ALT);
- tail=&(result->down);
-
- for (p=l; p != NULL ; p=p->right) {
- for (q=r; q != NULL ; q=q->right) {
- if (p->token == q->token) {
- match=tnode(p->token);
- match->down=MR_computeTreeAND(p->down,q->down);
- *tail=match;
- tail=&(match->right);
- };
- };
- };
-
- *tail=NULL;
- result=tshrink(result);
- result=tflatten( result );
- result=tleft_factor( result );
- return result;
-}
-
-#ifdef __USE_PROTOS
-void MR_union_plain_sets1(Predicate *p,set *theUnion)
-#else
-void MR_union_plain_sets1(p,theUnion)
- Predicate *p;
- set *theUnion;
-#endif
-{
- if (p == NULL) return;
- MR_union_plain_sets1(p->down,theUnion);
- MR_union_plain_sets1(p->right,theUnion);
- set_orin(theUnion,p->plainSet);
- return;
-}
-
-#ifdef __USE_PROTOS
-set MR_union_plain_sets(Predicate *p)
-#else
-set MR_union_plain_sets(p)
- Predicate *p;
-#endif
-{
- set theUnion;
-
- theUnion=empty;
-
- MR_union_plain_sets1(p,&theUnion);
- return theUnion;
-}
-
-/* does NOT left factor: do not want to merge
- (A B) with (A) to get (A B)
- in fact the opposite: (A B) with (A) gives (A)
-*/
-
-#ifdef __USE_PROTOS
-Tree *MR_compute_pred_tree_ctxXX(Predicate *p)
-#else
-Tree *MR_compute_pred_tree_ctxXX(p)
- Predicate *p;
-#endif
-{
- Tree *result=NULL;
- Predicate *q;
- Tree *t;
-
- if (p == NULL) return NULL;
-
-/* this appears strange: why do we OR the context
- of and AND predicate ? It is because of the way
- that predicates are evaluated: if the context is
- wrong then it's the same as if the predicate was
- true. That means that even when one leg of an
- AND has unmatched context, if the other leg has
- matched context and is true then the predicate
- succeeds. It's only when all the legs have unmatched
- context that this one can skip evaluation of the
- predicates.
-*/
- if (p->expr == PRED_OR_LIST ||
- p->expr == PRED_AND_LIST) {
- for (q=p->down; q != NULL ; q=q->right) {
- t=MR_compute_pred_tree_ctxXX(q);
- result=tappend(result,t);
- t=NULL;
- };
-
- result=tshrink(result);
- result=tflatten( result );
-
-/* does NOT left factor: do not want to merge
- (A B) with (A) to get (A B)
- in fact the opposite: (A B) with (A) gives (A)
-*/
-
-/**** result=tleft_factor( result ); ****/
- return result;
- };
-
-#if 0
-** if (p->expr == PRED_AND_LIST) {
-**
-** Predicate *l;
-** Predicate *r;
-** Tree *l1;
-** Tree *r1;
-** Tree *prevl1;
-**
-** l=p->down;
-** require (l->right != NULL,"MR_compute_pred_tree - AND has only one child");
-**
-**/* l1 and r1 should already be in "canonical" format */
-**
-** l1=MR_compute_pred_tree(l);
-** for (r=l->right; r != NULL; r=r->right) {
-** r1=MR_compute_pred_tree(r);
-** prevl1=l1;
-** l1=MR_computeTreeAND(l1,r1);
-** Tfree(r1);
-** Tfree(prevl1);
-** };
-**
-**/* result from computeTreeAND should be in "canonical" format */
-**
-** result=l1;
-**
-**/* result of MR_computeTreeAND should be in "canonical" format */
-**
-** return result;
-** };
-#endif
-
- if (p->k == 1) {
- result=MR_make_tree_from_set(p->scontext[1]);
- } else {
- result=tdup(p->tcontext);
- result=MR_remove_epsilon_from_tree(result);
- result=tshrink(result);
- result=tflatten(result);
- result=tleft_factor(result);
- };
- return result;
-}
-
-#ifdef __USE_PROTOS
-void MR_pred_depth(Predicate *p,int *maxDepth)
-#else
-void MR_pred_depth(p,maxDepth)
- Predicate *p;
- int *maxDepth;
-#endif
-{
- if (p == NULL) return;
- if (p->expr != PRED_OR_LIST &&
- p->expr != PRED_AND_LIST) {
- if (p->k > *maxDepth) *maxDepth=p->k;
- };
- MR_pred_depth(p->down,maxDepth);
- MR_pred_depth(p->right,maxDepth);
-}
-
-/* this computes the OR of all the contexts */
-
-#ifdef __USE_PROTOS
-set MR_compute_pred_set(Predicate *p)
-#else
-set MR_compute_pred_set(p)
- Predicate *p;
-#endif
-{
- set result;
- Predicate *q;
-
- result=empty;
-
- if (p == NULL) return empty;
-
- if (p->expr == PRED_OR_LIST ||
- p->expr == PRED_AND_LIST) { /* yes, I do mean PRED_AND_LIST ! */
- /* remember: r1: (A)? => <<p>>? r2; */
- /* r2: (B)? => <<q>>? r3; */
- set t;
-
- t=empty;
- result=empty;
-
- for (q=p->down; q != NULL; q=q->right) {
- t=MR_compute_pred_set(q);
- set_orin(&result,t);
- set_free(t);
- };
- return result;
- } else if (p->k > 1) {
- return empty;
- } else {
- return set_dup(p->scontext[1]);
- };
-}
-
-#ifdef __USE_PROTOS
-set MR_First(int ck,Junction *j,set *incomplete)
-#else
-set MR_First(ck,j,incomplete)
- int ck;
- Junction *j;
- set *incomplete;
-#endif
-{
- Junction *p;
- set tokensUsed;
-
- tokensUsed=empty;
-
- require(j->ntype==nJunction, "MR_First: non junction passed");
-
- p = analysis_point((Junction *)j->p1);
-
- REACH(p,ck,incomplete,tokensUsed);
-
- return tokensUsed;
-}
-
-#ifdef __USE_PROTOS
-void MR_cleanup_pred_trees(Predicate *p)
-#else
-void MR_cleanup_pred_trees(p)
- Predicate *p;
-#endif
-{
- Tree *t;
-
- if (p == NULL) return;
- if (p->expr != PRED_OR_LIST &&
- p->expr != PRED_AND_LIST) {
- t=p->tcontext;
- t=tshrink(t);
- t=tflatten(t);
- t=tleft_factor(t);
- p->tcontext=t;
- };
- MR_cleanup_pred_trees(p->down);
- MR_cleanup_pred_trees(p->right);
-}
-
-/* does NOT return canonical tree */
-
-#ifdef __USE_PROTOS
-Tree * MR_remove_epsilon_from_tree(Tree *t)
-#else
-Tree * MR_remove_epsilon_from_tree(t)
- Tree *t;
-#endif
-{
- if (t == NULL) return NULL;
-
- /* I think ALT can be ignored as a special case */
-
- if (t->token != EpToken) {
- t->down=MR_remove_epsilon_from_tree(t->down);
- t->right=MR_remove_epsilon_from_tree(t->right);
- return t;
- } else {
- Tree *u;
- u=MR_remove_epsilon_from_tree(t->right);
- t->right=NULL;
- Tfree(t);
- return u;
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_complete_set(int predDepth,set *tokensUsed,set *incomplete)
-#else
-void MR_complete_set(predDepth,tokensUsed,incomplete)
- int predDepth;
- set *tokensUsed;
- set *incomplete;
-#endif
-{
- int i;
- RuleRefNode *ruleRef;
- set rk2;
- set b;
- int k2;
- Junction *save_MR_RuleBlkWithHalt;
-
- if (set_int(*incomplete) > (unsigned) predDepth) {
- return;
- };
-
- require(MR_PredRuleRefStack.count == MR_RuleBlkWithHaltStack.count,
- "RuleRefStack and RuleBlkWithHaltStack not same size");
-
- require(MR_RuleBlkWithHalt == NULL ||
- (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE),
- "RuleBlkWithHalt has no halt set");
-
- save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt;
-
- if (MR_RuleBlkWithHalt != NULL) {
- MR_RuleBlkWithHalt->end->halt=FALSE;
- };
-
- for (i=MR_PredRuleRefStack.count-1; i >= 0 ; i--) {
- ruleRef=(RuleRefNode *)MR_PredRuleRefStack.data[i];
- if (ruleRef == NULL) continue;
-
- MR_RuleBlkWithHalt=(Junction *)MR_RuleBlkWithHaltStack.data[i];
- if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=TRUE;
-
- rk2=empty;
- b=empty;
-
- while ( !set_nil(*incomplete) ) {
- k2=set_int(*incomplete);
- if (k2 > predDepth) break; /* <=== another exit from loop */
- set_rm(k2,*incomplete);
- REACH(ruleRef->next,k2,&rk2,b);
- set_orin(tokensUsed,b);
- set_free(b);
- };
-
- if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=FALSE;
-
- set_orin(incomplete,rk2); /* remember what we couldn't do */
- set_free(rk2);
- if (set_int(*incomplete) > (unsigned) predDepth) break; /* <=== another exit from loop */
- };
-
- MR_RuleBlkWithHalt=save_MR_RuleBlkWithHalt;
- if (MR_RuleBlkWithHalt != NULL) {
- MR_RuleBlkWithHalt->end->halt=TRUE;
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_complete_tree(int predDepth,Tree **t,set *incomplete)
-#else
-void MR_complete_tree(predDepth,t,incomplete)
- int predDepth;
- Tree **t;
- set *incomplete;
-#endif
-{
- int i;
- RuleRefNode *ruleRef;
- set rk2;
- Tree *u;
- unsigned k2;
- Junction *save_MR_RuleBlkWithHalt;
- int saveConstrainSearch;
-
- if (set_int(*incomplete) > (unsigned) predDepth) {
- return;
- };
-
- require(MR_PredRuleRefStack.count == MR_RuleBlkWithHaltStack.count,
- "RuleRefStack and RuleBlkWithHaltStack not same size");
-
- require(MR_RuleBlkWithHalt == NULL ||
- (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE),
- "RuleBlkWithHalt has no halt set");
-
- save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt;
- saveConstrainSearch=ConstrainSearch;
- ConstrainSearch=0;
-
- if (MR_RuleBlkWithHalt != NULL) {
- MR_RuleBlkWithHalt->end->halt=FALSE;
- };
-
- for (i=MR_PredRuleRefStack.count-1; i >= 0 ; i--) {
- ruleRef=(RuleRefNode *)MR_PredRuleRefStack.data[i];
- if (ruleRef == NULL) continue;
-
- MR_RuleBlkWithHalt=(Junction *)MR_RuleBlkWithHaltStack.data[i];
-
- if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=TRUE;
-
- rk2=empty;
-
- while ( !set_nil(*incomplete) ) {
- k2 = set_int(*incomplete);
- if (k2 > (unsigned) predDepth) break; /* <=== another exit from loop */
- set_rm(k2,*incomplete);
- u = NULL;
-
- TRAV(ruleRef->next,k2,&rk2,u);
-
- /* any subtrees missing k2 tokens, add u onto end */
-
- *t=tlink(*t,u,k2);
- Tfree(u);
- }
-
- set_orin(incomplete,rk2); /* remember what we couldn't do */
- set_free(rk2);
-
- if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=FALSE;
-
- if (set_int(*incomplete) > (unsigned) predDepth) break; /* <=== another exit from loop */
- };
-
- MR_RuleBlkWithHalt=save_MR_RuleBlkWithHalt;
-
- if (MR_RuleBlkWithHalt != NULL) {
- MR_RuleBlkWithHalt->end->halt=TRUE;
- };
- ConstrainSearch=saveConstrainSearch;
-}
-
-#ifdef __USE_PROTOS
-void MR_complete_predicates(int predDepth,Predicate *pred)
-#else
-void MR_complete_predicates(predDepth,pred)
- int predDepth;
- Predicate *pred;
-#endif
-{
- if (pred == NULL) return;
- if (pred->expr != PRED_AND_LIST &&
- pred->expr != PRED_OR_LIST) {
- MR_complete_set(predDepth,&(pred->scontext[1]),&(pred->completionSet));
- MR_complete_tree(predDepth,&(pred->tcontext),&(pred->completionTree));
- };
- MR_complete_predicates(predDepth,pred->down);
- MR_complete_predicates(predDepth,pred->right);
-}
-
-#ifdef __USE_PROTOS
-Junction * MR_junctionWithoutP2(Junction *j)
-#else
-Junction * MR_junctionWithoutP2(j)
- Junction *j;
-#endif
-{
- Junction *thisAlt;
-
-/* don't want to follow p2 to the next alternative of this rule */
-/* insert a generic node with null p2 if necessary */
-/* however FIRST requires a junction */
-
- thisAlt=j;
- if (thisAlt->p2 != NULL) {
- if (thisAlt->p1->ntype == nJunction) {
- thisAlt=(Junction *) thisAlt->p1;
- } else {
- thisAlt=newJunction();
- thisAlt->p1=j->p1;
- thisAlt->rname=j->rname;
- thisAlt->file=j->file;
- thisAlt->line=j->line;
- j->p1=(Node *)thisAlt;
- };
- };
- return thisAlt;
-}
-
-#ifdef __USE_PROTOS
-int MR_tree_equ(Tree *big, Tree *small) {
-#else
-int MR_tree_equ(big,small)
- Tree *big;
- Tree *small;
-{
-#endif
-
- Tree *b;
- Tree *s;
- int bcount=0;
- int scount=0;
-
- if (small == NULL && big == NULL) return 1;
- if (small == NULL) return 0;
- if (big == NULL) return 0;
-
- if (small->token == ALT) {
- require(small->right == NULL,
- "MR_tree_equ: small: ALT node has siblings");
- return MR_tree_equ(big,small->down);
- };
- if (big->token == ALT) {
- require(big->right == NULL,
- "MR_tree_equ: big: ALT node has siblings");
- return MR_tree_equ(big->down,small);
- };
- for (s=small; s != NULL; s=s->right) {
- scount++;
- require(s->token != EpToken,"MR_tree_equ: s->EpToken unexpected\n");
- };
- for (b=big; b != NULL; b=b->right) {
- bcount++;
- require(b->token != EpToken,"MR_tree_equ: b->EpToken unexpected\n");
- };
-
- if (bcount != scount) return 0;
-
- for (s=small; s != NULL; s=s->right) {
- for (b=big; b!= NULL; b=b->right) {
- if (s->token == b->token) {
- if (MR_tree_equ(b->down,s->down)) goto next_s;
- };
- };
- return 0;
-next_s:
- continue;
- };
- return 1;
-}
-
-/* this does not compare sources - only contexts ! */
-
-#ifdef __USE_PROTOS
-int MR_identicalContext(Predicate *p,Predicate *q)
-#else
-int MR_identicalContext(p,q)
- Predicate *p;
- Predicate *q;
-#endif
-{
- if (p->k != q->k) return 0;
- require ( (p->tcontext == NULL) == (q->tcontext == NULL),
- "tcontext inconsistent");
- if (p->k == 1) {
- return set_equ(p->scontext[1],q->scontext[1]);
- } else {
- return MR_tree_equ(p->tcontext,q->tcontext);
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_reportSetSuppression(int predDepth,
- set predSet,set plainSet,Junction *jPred,Junction *jPlain,Predicate *p)
-#else
-void MR_reportSetSuppression(predDepth,predSet,plainSet,jPred,jPlain,p)
- int predDepth;
- set predSet;
- set plainSet;
- Junction *jPred;
- Junction *jPlain;
- Predicate *p;
-#endif
-{
- if (InfoP) {
- fprintf(output,"\n#if 0\n\n");
- fprintf(output,"Hoisting of predicate suppressed by alternative without predicate.\n");
- fprintf(output,"The alt without the predicate includes all cases where the predicate is false.\n\n");
- fprintf(output," WITH predicate: line %d %s\n",jPred->line,FileStr[jPred->file]);
- if (jPlain != NULL) {
- fprintf(output," WITHOUT predicate: line %d %s\n",jPlain->line,FileStr[jPlain->file]);
- } else {
- fprintf(output," WITHOUT predicate: all alternatives without predicates (combined)\n");
- };
- if (predDepth == 1) {
- fprintf(output,"\nThe context set for the predicate:\n");
- MR_dumpTokenSet(output,1,predSet);
- };
- fprintf(output,"\nThe lookahead set for the alt WITHOUT the semantic predicate:\n");
- MR_dumpTokenSet(output,1,plainSet);
- fprintf(output,"\nThe predicate:\n\n");
- MR_dumpPred1(1,p,1);
- fprintf(output,"Chain of referenced rules:\n\n");
- MR_dumpPredRuleRefStack(output,4);
- fprintf(output,"\n#endif\n");
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_reportSetRestriction(int predDepth,set predSet,set plainSet,
- Junction *jPred,Junction *jPlain,Predicate *origPred,Predicate *newPred)
-#else
-void MR_reportSetRestriction(predDepth,predSet,plainSet,jPred,jPlain,origPred,newPred)
- int predDepth;
- set predSet;
- set plainSet;
- Junction *jPred;
- Junction *jPlain;
- Predicate *origPred;
- Predicate *newPred;
-#endif
-{
- set intersect;
-
- intersect=empty;
-
- if (! InfoP) return;
- fprintf(output,"\n#if 0\n\n");
- fprintf(output,"Restricting the context of a predicate because of overlap in the lookahead set\n");
- fprintf(output," between the alternative with the semantic predicate and one without\n");
- fprintf(output,"Without this restriction the alternative without the predicate could not\n");
- fprintf(output," be reached when input matched the context of the predicate and the predicate\n");
- fprintf(output," was false.\n\n");
-
- fprintf(output," WITH predicate: line %d %s\n",jPred->line,FileStr[jPred->file]);
- if (jPlain != NULL) {
- fprintf(output," WITHOUT predicate: line %d %s\n",jPlain->line,FileStr[jPlain->file]);
- } else {
- fprintf(output," WITHOUT predicate: all alternatives without predicates (combined)\n");
- };
- if (predDepth == 1) {
- fprintf(output,"\nThe original context set for the predicate:\n");
- MR_dumpTokenSet(output,1,predSet);
- };
- fprintf(output,"\nThe lookahead set for the alt WITHOUT the semantic predicate:\n");
- MR_dumpTokenSet(output,1,plainSet);
- if (predDepth == 1) {
- fprintf(output,"\nThe intersection of the two sets\n");
- intersect=set_and(predSet,plainSet);
- MR_dumpTokenSet(output,1,intersect);
- set_free(intersect);
- };
- fprintf(output,"\nThe original predicate:\n\n");
- MR_dumpPred1(1,origPred,1);
- fprintf(output,"The new (modified) form of the predicate:\n\n");
- MR_dumpPred1(1,newPred,1);
- fprintf(output,"#endif\n");
-}
-
-/* don't use Pass3 by itself unless you know that inverted is not important */
-
-#ifdef __USE_PROTOS
-Predicate * MR_removeRedundantPredPass3(Predicate *p)
-#else
-Predicate * MR_removeRedundantPredPass3(p)
- Predicate *p;
-#endif
-{
- Predicate *q;
-
- if (p == NULL) return NULL;
- p->right=MR_removeRedundantPredPass3(p->right);
- p->down=MR_removeRedundantPredPass3(p->down);
- if (p->redundant) {
- q=p->right;
- p->right=NULL;
- predicate_free(p);
- return q;
- };
- if (p->expr == PRED_AND_LIST ||
- p->expr == PRED_OR_LIST) {
- if (p->down == NULL) {
- q=p->right;
- p->right=NULL;
- predicate_free(p);
- return q;
- };
- if (p->down != NULL && p->down->right == NULL) {
- q=p->down;
- q->right=p->right;
- p->right=NULL;
- p->down=NULL;
- return q;
- };
- };
- return p;
-}
-
-#ifdef __USE_PROTOS
-void MR_removeRedundantPredPass2(Predicate *p)
-#else
-void MR_removeRedundantPredPass2(p)
- Predicate *p;
-#endif
-{
- Predicate *q;
-
- if (p == NULL) return;
-
- if (p->expr == PRED_AND_LIST) {
- for (q=p->down ; q != NULL ; q=q->right) {
- MR_removeRedundantPredPass2(q);
- if (q->isConst) {
- if (q->constValue == 0) {
- p->isConst=1;
- p->constValue=0;
- return;
- } else {
- q->redundant=1;
- };
- };
- };
- };
-
- if (p->expr == PRED_OR_LIST) {
- for (q=p->down ; q != NULL ; q=q->right) {
- MR_removeRedundantPredPass2(q);
- if (q->isConst) {
- if (q->constValue == 0) {
- q->redundant=1;
- } else {
- p->isConst=1;
- p->constValue=1;
- return;
- };
- };
- };
- };
-
- return;
-}
-
-#if 0
- this totally ignores the implications of guarded predicates
- in which the part after the guard could possibly cover a predicate.
- that would be much harder:
-
- rule : (A)? => <<p>>? sub1; /* 1 */
- | (B)? => <<r>>? sub2 /* 2 */
- sub1 : (A)? => <<q>>? A B /* 3 */
- | B /* 4 - suppresses line 2 */
- ;
-#endif
-
-#ifdef __USE_PROTOS
-void MR_apply_restriction1(Predicate *pred,set *plainSet,int *changed)
-#else
-void MR_apply_restriction1(pred,plainSet,changed)
- Predicate *pred;
- set *plainSet;
- int *changed;
-#endif
-{
- if (pred == NULL) return;
- MR_apply_restriction1(pred->right,plainSet,changed);
- if (pred->down != NULL) {
- MR_apply_restriction1(pred->down,plainSet,changed);
- } else {
- set t;
- if (pred->k == 1) {
- t=set_dif(pred->scontext[1],*plainSet);
- if (*changed == 0 &&
- !set_equ(t,pred->scontext[1])) {
- *changed=1;
- };
- if (set_nil(t)) {
- pred->redundant=1;
- };
- set_free(pred->scontext[1]);
- pred->scontext[1]=t;
- };
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_orin_plainSet(Predicate *p,set plainSet)
-#else
-void MR_orin_plainSet(p,plainSet)
- Predicate *p;
- set plainSet;
-#endif
-{
- if (p == NULL) return;
- MR_orin_plainSet(p->down,plainSet);
- MR_orin_plainSet(p->right,plainSet);
- set_orin(&p->plainSet,plainSet);
-}
-
-Predicate *PRED_SUPPRESS;
-
-#ifdef __USE_PROTOS
-Predicate * MR_find_in_aSubBlk(Junction *alt)
-#else
-Predicate * MR_find_in_aSubBlk(alt)
- Junction *alt;
-#endif
-{
- Predicate *root=NULL;
- Predicate **tail=NULL;
-
- Junction *p;
-
- int nAlts=0;
- Junction **jList;
- Predicate **predList;
- int *matchList;
- set predSet;
- int i;
- int j;
- int m;
- int predDepth;
- set incomplete;
- set union_plainSet;
- set setChange;
- int changed;
- Predicate *newPred;
- set setDif;
- Predicate *origPred;
- int depth1=1; /* const int */
- set *plainContext;
- set plainSet;
-
- predSet=empty;
- incomplete=empty;
- union_plainSet=empty;
- setChange=empty;
- setDif=empty;
- plainSet=empty;
-
- if (PRED_SUPPRESS == NULL) {
- PRED_SUPPRESS=new_pred();
- PRED_SUPPRESS->expr="Predicate Suppressed";
- };
-
- /* this section just counts the number of "interesting" alternatives */
- /* in order to allocate arrays */
-
- for (p=alt; p!=NULL; p=(Junction *)p->p2) {
- /* ignore empty alts */
- if ( p->p1->ntype != nJunction ||
- ((Junction *)p->p1)->jtype != EndBlk ) {
- nAlts++;
- };
- };
-
- /* if this is a (...)+ block then don't count the last alt because
- it can't be taken until at least one time through the block.
- In other words it isn't a real choice until the (...)+ is entered
- at which point the hoisting issue is moot.
- Maybe look at "ignore" instead ?
- */
-
- if (alt->jtype == aPlusBlk) {
- nAlts--;
- };
-
- jList=(Junction **)calloc(nAlts,sizeof(Junction *));
- require(jList!=NULL,"cannot allocate MR_find_in_aSubBlk jList");
-
- plainContext=(set *)calloc(nAlts,sizeof(set));
- require(plainContext!=NULL,"cannot allocate MR_find_in_aSubBlk plainContext");
- for (m=0; m < nAlts; m++) plainContext[m]=empty;
-
- predList=(Predicate **)calloc(nAlts,sizeof(Predicate *));
- require(predList!=NULL,"cannot allocate MR_find_in_aSubBlk predList");
-
- matchList=(int *)calloc(nAlts,sizeof(int));
- require(matchList!=NULL,"cannot allocate MR_find_in_aSubBlk matchList");
-
- /* this section just fills in the arrays previously allocated */
- /* the most interesting one is matchList[] */
- /* */
- /* bit 0 => this alt has a semantic pred which is "covered" */
- /* by an alt without a semantic pred. Don't hoist. */
-
- for (i=0,p=alt;
- p!=NULL && i<nAlts;
- i++,p=(Junction *)p->p2) {
-
- /* ignore empty alts */
-
- if ( p->p1->ntype != nJunction ||
- ((Junction *)p->p1)->jtype != EndBlk ) {
- jList[i]=MR_junctionWithoutP2(p);
- predList[i]=find_predicates(p->p1); /* should be jList ????? */
- if (predList[i] != NULL) {
- MR_cleanup_pred_trees(predList[i]); /* flatten & left factor */
- plainContext[i]=MR_union_plain_sets(predList[i]);
- } else {
- MR_set_reuse(&plainSet);
- MR_set_reuse(&incomplete);
- plainSet=MR_First(depth1,jList[i],&incomplete);
- MR_complete_set(depth1,&plainSet,&incomplete);
- require(set_nil(incomplete),"couldn't complete k=1");
- plainContext[i]=plainSet;
- plainSet=empty;
- };
- set_orin(&union_plainSet,plainContext[i]);
- };
- };
-
- if (nAlts == 1) {
- goto EXIT_SIMPLE;
- };
-
-/*
- * Looking for cases where alt i has a semantic pred and alt j does not.
- * Don't care about cases where lookahead for semantic predicates overlap
- * because normal predicate hoisting does the correct thing automatically.
- * Don't care about cases where lookahead for alts without semantic predicates
- * overlap because normal prediction does the correct thing automatically.
- *
- * When we find such a case check for one of three subcases:
- *
- * 1. if lookahead for alt i is contained in the lookahead for any
- * alt j then ignore semantic predicate of alt i
- * 2. if lookahead for alt i is not contained in the lookahead for
- * any alt j then add add predicate i to the OR list to be hoisted
- * 3. if lookahead for alt i overlaps the lookahead for some alt j then
- * add a dummy semantic predicate for alt j
- *
- * There is an implicit assumption that the context of all alternatives following
- * the rule being processed here are identical (but may vary from hoist to
- * hoist depending on the place where the rule was invoked that led to hoisting
- * these predicates. In othere words in the fragment:
- *
- * ( <<a>>? a1 a2 a3 | <<b>>? b1 b2 b3 )
- *
- * both a3 and b3 have the same follow sets because they are both at the end of
- * alternatives in the same block.
- */
-
- for (i=0; i < nAlts; i++) {
- if (jList[i] == NULL) continue;
- if (predList[i] == NULL) continue;
-
- /* if the predicate depth turns out to be one token only */
- /* then it is can be easily represented as a set and */
- /* compared to the junction set create by MR_First() */
-
- predDepth=0;
- MR_pred_depth(predList[i],&predDepth);
- require (predDepth >= 1,"MR_find_in_aSubBlk: pred depth < 1");
- require (predDepth <= CLL_k,"MR_find_in_aSubBlk: predDepth > CLL_k");
-
- /* complete predicates to predDepth
- If completed to depth=1 then the context would be incomplete.
- The context would be truncated and the predicate simplify routine
- would have incomplete information. It would lead to
- either false matches of failure to find true matches.
- */
-
- MR_complete_predicates(predDepth,predList[i]);
-
- if (predList[i] != NULL) {
- MR_cleanup_pred_trees(predList[i]); /* flatten & left factor */
- };
-
- /* If the predicate depth is 1 then it is possible to suppress
- a predicate completely using a single plain alt. Check for suppression
- by a single plain alt first because it gives better messages. If that
- fails try the union of all the plain alts.
- */
-
- if (predDepth == 1) {
-
- MR_set_reuse(&predSet);
- predSet=MR_compute_pred_set(predList[i]); /* ignores k>1 predicates */
-
- for (j=0; j < nAlts; j++) {
- if (jList[j] == NULL) continue;
- if (j == i) continue;
-
- MR_set_reuse(&setDif);
- setDif=set_dif(predSet,plainContext[j]);
- if (set_nil(setDif)) {
- matchList[i] |= 1;
- MR_reportSetSuppression(predDepth,predSet,plainContext[j],jList[i],jList[j],predList[i]);
- predicate_free(predList[i]);
- predList[i]=PRED_SUPPRESS;
- goto next_i;
- };
-
- }; /* end loop on j */
-
- changed=0;
-
- /* predicate_dup is only to give good error messages */
- /* remember to do a predicate_free() */
-
- origPred=predicate_dup(predList[i]);
- MR_apply_restriction1(predList[i],&union_plainSet,&changed);
- if (changed) {
-
- /* don't use Pass3 by itself unless you know that inverted is not important */
-
- newPred=MR_removeRedundantPredPass3(predList[i]);
- newPred=MR_predSimplifyALL(newPred);
- if (newPred == NULL) {
- matchList[i] |= 1;
- MR_reportSetSuppression(predDepth,predSet,union_plainSet,jList[i],
- NULL,origPred);
- predList[i]=PRED_SUPPRESS;
- } else {
- MR_reportSetRestriction(predDepth,predSet,union_plainSet,jList[i],
- NULL,origPred,newPred);
- predList[i]=newPred;
- };
- };
- predicate_free(origPred);
- origPred=NULL;
- };
-
- /*
- If the predicate depth is > 1 then it can't be suppressed completely
- because the code doesn't support inspection of such things. They're
- much messier than k=1 sets.
- */
-
- if (predDepth > 1 ) {
-
- changed=0;
-
- /* predicate_dup is only to give good error messages */
- /* remember to do a predicate_free() */
-
- origPred=predicate_dup(predList[i]);
- MR_apply_restriction1(predList[i],&union_plainSet,&changed);
- if (changed) {
- newPred=MR_removeRedundantPredPass3(predList[i]);
- newPred=MR_predSimplifyALL(newPred);
- if (newPred == NULL) {
- matchList[i] |= 1;
- MR_reportSetSuppression(predDepth,predSet,union_plainSet,jList[i],
- NULL,origPred);
- predList[i]=PRED_SUPPRESS;
- } else {
- MR_reportSetRestriction(predDepth,predSet,union_plainSet,jList[i],
- NULL,origPred,newPred);
- predList[i]=newPred;
- };
- };
- predicate_free(origPred);
- origPred=NULL;
- };
-next_i:
- continue;
- };
-
-EXIT_SIMPLE:
-
- root = new_pred();
- root->expr=PRED_OR_LIST;
- tail = &(root->down);
-
- for (i=0 ; i< nAlts ; i++) {
- if (jList[i] == NULL) continue;
-
- if (predList[i] == NULL) {
- continue;
- } else if ( (matchList[i] & 1) != 0) {
- if (predList[i] != PRED_SUPPRESS) {
- predicate_free(predList[i]);
- };
- continue;
- };
-
- /* make an OR list of predicates */
-
- *tail=predList[i];
- tail=&(predList[i]->right);
- };
-
- /* if just one pred, remove OR root */
-
- if (root->down == NULL) {
- predicate_free(root);
- root=NULL;
- } else if (root->down->right == NULL) {
- Predicate *p=root->down;
- root->down=NULL;
- predicate_free(root);
- root=p;
- }
-
- root=MR_predSimplifyALL(root);
-
- MR_orin_plainSet(root,union_plainSet);
-
- set_free(predSet);
- set_free(union_plainSet);
- set_free(incomplete);
- set_free(setChange);
- set_free(setDif);
-
- for (m=0; m < nAlts; m++) set_free(plainContext[m]);
-
- free ( (char *) jList);
- free ( (char *) predList);
- free ( (char *) matchList);
- free ( (char *) plainContext);
-
- return root;
-}
-
-#ifdef __USE_PROTOS
-void MR_predContextPresent(Predicate *p,int *allHaveContext,int *noneHaveContext)
-#else
-void MR_predContextPresent(p,allHaveContext,noneHaveContext)
- Predicate *p;
- int *allHaveContext;
- int *noneHaveContext;
-#endif
-{
- if (p == NULL) return;
- MR_predContextPresent(p->right,allHaveContext,noneHaveContext);
- if (p->expr != PRED_AND_LIST &&
- p->expr != PRED_OR_LIST) {
- if (set_nil(p->scontext[1]) == 0 ||
- (p->tcontext != NULL)) {
- *noneHaveContext=0;
- } else {
- *allHaveContext=0;
- };
- };
- MR_predContextPresent(p->down,allHaveContext,noneHaveContext);
-}
-
-#ifdef __USE_PROTOS
-int MR_pointerStackPush(PointerStack *ps,void *dataPointer)
-#else
-int MR_pointerStackPush(ps,dataPointer)
- PointerStack *ps;
- void *dataPointer;
-#endif
-{
- void **newStack;
- int newSize;
- int i;
-
- if (ps->count == ps->size) {
- newSize=20+ps->size*2;
- newStack=(void **)calloc(newSize,sizeof(void *));
- require (newStack != NULL,"cannot allocate PointerStack");
- for (i=0; i < ps->size; i++) {
- newStack[i]=ps->data[i];
- };
- if (ps->data != NULL) free( (char *) ps->data);
- ps->data=newStack;
- ps->size=newSize;
- };
- ps->data[ps->count]=dataPointer;
- ps->count++;
- return ps->count-1;
-}
-
-#ifdef __USE_PROTOS
-void * MR_pointerStackPop(PointerStack *ps)
-#else
-void * MR_pointerStackPop(ps)
- PointerStack *ps;
-#endif
-{
- void *dataPointer;
-
- require(ps->count > 0,"MR_pointerStackPop underflow");
-
- dataPointer=ps->data[ps->count-1];
- ps->data[ps->count-1]=NULL;
- (ps->count)--;
- return dataPointer;
-}
-
-#ifdef __USE_PROTOS
-void * MR_pointerStackTop(PointerStack *ps)
-#else
-void * MR_pointerStackTop(ps)
- PointerStack *ps;
-#endif
-{
- require(ps->count > 0,"MR_pointerStackTop underflow");
- return ps->data[ps->count-1];
-}
-
-#ifdef __USE_PROTOS
-void MR_pointerStackReset(PointerStack *ps)
-#else
-void MR_pointerStackReset(ps)
- PointerStack *ps;
-#endif
-{
- int i;
- if (ps->data != NULL) {
- for (i=0; i < ps->count ; i++) {
- ps->data[i]=NULL;
- };
- };
- ps->count=0;
-}
-
-#ifdef __USE_PROTOS
-Junction *MR_nameToRuleBlk(char *name)
-#else
-Junction *MR_nameToRuleBlk(name)
- char *name;
-#endif
-{
- RuleEntry *q;
-
- require (RulePtr != NULL,"MR_nameToRule: RulePtr not initialized");
-
- if (name == NULL) return NULL;
-
- q = (RuleEntry *) hash_get(Rname,name);
-
- if ( q == NULL ) {
- return NULL;
- } else {
- return RulePtr[q->rulenum];
- };
-}
-
-#ifdef __USE_PROTOS
-Junction * MR_ruleReferenced(RuleRefNode *rrn)
-#else
-Junction * MR_ruleReferenced(rrn)
- RuleRefNode *rrn;
-#endif
-{
- return MR_nameToRuleBlk(rrn->text);
-}
-
-#ifdef __USE_PROTOS
-void MR_comparePredLeaves(Predicate *me,Predicate *myParent,Predicate *him,Predicate *hisParent)
-#else
-void MR_comparePredLeaves(me,myParent,him,hisParent)
- Predicate *me;
- Predicate *myParent;
- Predicate *him;
- Predicate *hisParent;
-#endif
-{
- if (me == NULL) return;
- if (me == him) {
- MR_comparePredLeaves(me->right,myParent,him,hisParent);
- return;
- } else if (me->expr == PRED_AND_LIST ||
- me->expr == PRED_OR_LIST) {
- MR_comparePredLeaves(me->down,me,him,hisParent);
- MR_comparePredLeaves(me->right,myParent,him,hisParent);
- return;
- } else {
- if (me->source != NULL) {
-
- /* predicate->invert can be set only in the predEntry predicates */
- /* thus they are only visible after the predEntry predicates have been "unfolded" */
-
- int sameSource=(me->source == him->source);
- int sameInvert=1 &
- (1 + me->inverted + him->inverted + me->source->inverted + him->source->inverted);
- int samePredEntry=(me->source->predEntry != NULL
- && him->source->predEntry != NULL
- && me->source->predEntry == him->source->predEntry);
- if (sameInvert && (sameSource || samePredEntry)) {
- if (MR_identicalContext(me,him)) {
-
- /* identical predicates */
-
- if (hisParent->expr == PRED_OR_LIST &&
- myParent->expr == PRED_OR_LIST) {
- me->redundant=1;
- } else if (hisParent->expr == PRED_AND_LIST &&
- myParent->expr == PRED_AND_LIST) {
- me->redundant=1;
- } else if ( (hisParent->expr == PRED_OR_LIST &&
- myParent->expr == PRED_AND_LIST)
- ||
- (hisParent->expr == PRED_AND_LIST &&
- myParent->expr == PRED_OR_LIST)
- ) {
- myParent->redundant=1;
- } else {
- require (0,"MR_comparePredLeaves: not both PRED_LIST");
- };
- };
- }; /* end same source or same predEntrr with same invert sense */
-
- /* same predEntry but opposite invert sense */
-
- if (!sameInvert && (sameSource || samePredEntry)) {
- if (MR_identicalContext(me,him)) {
- if (hisParent->expr == PRED_OR_LIST &&
- myParent->expr == PRED_OR_LIST) {
- myParent->isConst=1;
- myParent->constValue=1;
- } else if (hisParent->expr == PRED_AND_LIST &&
- myParent->expr == PRED_AND_LIST) {
- myParent->isConst=1;
- myParent->constValue=0;
- } else if ( (hisParent->expr == PRED_OR_LIST &&
- myParent->expr == PRED_AND_LIST)
- ||
- (hisParent->expr == PRED_AND_LIST &&
- myParent->expr == PRED_OR_LIST)
- ) {
- me->redundant=1;
- } else {
- require (0,"MR_comparePredLeaves: not both PRED_LIST");
- };
- };
- }; /* end same predEntry with opposite invert sense */
- };
-
- MR_comparePredLeaves(me->right,myParent,him,hisParent);
- return;
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_removeRedundantPredPass1(Predicate *me,Predicate *myParent)
-#else
-void MR_removeRedundantPredPass1(me,myParent)
- Predicate *me;
- Predicate *myParent;
-#endif
-{
- if (me == NULL) return;
- if (me->redundant) {
- MR_removeRedundantPredPass1(me->right,myParent);
- return;
- };
- if (me->expr == PRED_AND_LIST ||
- me->expr == PRED_OR_LIST) {
- MR_removeRedundantPredPass1(me->down,me);
- MR_removeRedundantPredPass1(me->right,myParent);
- } else {
- require (me->source != NULL,"me->source == NULL");
- if (myParent != NULL) {
- MR_comparePredLeaves(myParent->down,myParent,me,myParent);
- };
- MR_removeRedundantPredPass1(me->right,myParent);
- };
-}
-
-/* pretty much ignores things with the inverted bit set */
-
-#ifdef __USE_PROTOS
-Predicate *MR_predFlatten(Predicate *p)
-#else
-Predicate *MR_predFlatten(p)
- Predicate *p;
-#endif
-{
- if (p == NULL) return NULL;
- if (p->expr == PRED_OR_LIST
- || p->expr == PRED_AND_LIST) {
-
- Predicate *child;
- Predicate *gchild;
- Predicate **tail;
- Predicate *next;
- char *PRED_XXX_LIST=p->expr;
-
- require (p->down != NULL,"MR_predFlatten AND/OR no child");
-
-
- p->down=MR_predFlatten(p->down);
- p->right=MR_predFlatten(p->right);
- child=p->down;
- if (child->right == NULL) {
- child->right=p->right;
- p->right=NULL;
- p->down=NULL;
- if (p->inverted) child->inverted=!child->inverted;
- predicate_free(p);
- return child;
- };
-
- /* make a single list of all children and grandchildren */
-
- tail=&(p->down);
- for (child=p->down; child != NULL; child=next) {
- if (child->expr != PRED_XXX_LIST
- || child->inverted
- || child->predEntry != NULL) {
- *tail=child;
- tail=&(child->right);
- next=child->right;
- } else {
- for (gchild=child->down;
- gchild != NULL;
- gchild=gchild->right) {
- *tail=gchild;
- tail=&(gchild->right);
- };
- next=child->right;
- child->right=NULL;
- child->down=NULL;
- predicate_free(child);
- };
- };
- *tail=NULL;
- return p;
- } else {
- p->right=MR_predFlatten(p->right);
- return p;
- };
-}
-
-static char *alwaysFalseWarning=NULL;
-
-#ifdef __USE_PROTOS
-Predicate *checkPredicateConflict(Predicate *p)
-#else
-Predicate *checkPredicateConflict(p)
- Predicate *p;
-#endif
-{
- if (p->isConst) {
- if (p->constValue == 1) {
- predicate_free(p);
- return NULL;
- } else {
- if (InfoP && !p->conflictReported) {
- p->conflictReported=1;
- fprintf(output,"\n#if 0\n\n");
- fprintf(output,"The following predicate expression will always be false:\n\n");
- MR_dumpPred1(1,p,1);
- fprintf(output,"\n#endif\n");
- };
-
- if (alwaysFalseWarning != CurRule) {
- alwaysFalseWarning=CurRule;
- if (InfoP) {
- warnNoFL(eMsg1("one (or more) predicate expression hoisted into rule \"%s\" are always false \
-- see output file for more information",CurRule));
- } else {
- warnNoFL(eMsg1("one (or more) predicate expressions hoisted into rule \"%s\" are always false \
-- use \"-info p\" for more information",CurRule));
- };
- };
- };
- };
- return p;
-}
-
-
-#ifdef __USE_PROTOS
-int MR_countPredNodes(Predicate *p)
-#else
-int MR_countPredNodes(p)
- Predicate *p;
-#endif
-{
- if (p == NULL) return 0;
- return 1 + MR_countPredNodes(p->down) + MR_countPredNodes(p->right);
-}
-
-#ifdef __USE_PROTOS
-Predicate *MR_predSimplifyALLX(Predicate *p,int skipPass3)
-#else
-Predicate *MR_predSimplifyALLX(p,skipPass3)
- Predicate *p;
- int skipPass3;
-#endif
-{
- int countBefore;
- int countAfter;
-
- countAfter=MR_countPredNodes(p);
-
- do {
- if (p == NULL) return NULL;
- if (p->right == NULL && p->down == NULL) return p;
- countBefore=countAfter;
- MR_simplifyInverted(p,0);
- p=MR_predFlatten(p);
- MR_removeRedundantPredPass1(p,NULL);
- MR_removeRedundantPredPass2(p);
- if (! skipPass3) {
- p=checkPredicateConflict(p);
- p=MR_removeRedundantPredPass3(p);
- };
- countAfter=MR_countPredNodes(p);
- } while (countBefore != countAfter);
-
- return p;
-}
-
-#ifdef __USE_PROTOS
-Predicate *MR_predSimplifyALL(Predicate *p)
-#else
-Predicate *MR_predSimplifyALL(p)
- Predicate *p;
-#endif
-{
- return MR_predSimplifyALLX(p,0);
-}
-
-#ifdef __USE_PROTOS
-void MR_releaseResourcesUsedInRule(Node *n)
-#else
-void MR_releaseResourcesUsedInRule(n)
- Node *n;
-#endif
-{
- Node *next;
- Junction *j;
- int i;
-
- if (n == NULL) return;
- if (n->ntype == nJunction) {
- j=(Junction *) n;
-
- if (j->predicate != NULL) {
- predicate_free(j->predicate);
- j->predicate=NULL;
- };
- for (i=0; i< CLL_k; i++) {
- set_free(j->fset[i]);
- j->fset[i]=empty;
- };
- if (j->ftree != NULL) {
- Tfree(j->ftree);
- j->ftree=NULL;
- };
- if (j->jtype == EndRule) return;
- if (j->jtype != RuleBlk && j->jtype != EndBlk) {
- if (j->p2 != NULL && !j->ignore) { /* MR11 */
- MR_releaseResourcesUsedInRule(j->p2);
- };
- };
- };
- next=MR_advance(n);
- MR_releaseResourcesUsedInRule(next);
-}
-
-#ifdef __USE_PROTOS
-int MR_allPredLeaves(Predicate *p)
-#else
-int MR_allPredLeaves(p)
- Predicate *p;
-#endif
-{
- Predicate *q;
-
- if (p == NULL) return 1;
-
- for (q=p; q != NULL; q=q->right) {
- if (q->down != NULL) return 0;
- };
- return 1;
-}
-
-/* make sure it works for the last rule in a file */
-
-#ifdef __USE_PROTOS
-int MR_offsetFromRule(Node *n)
-#else
-int MR_offsetFromRule(n)
- Node *n;
-#endif
-{
- Junction *j;
- int offset=(-1);
-
- for (j=SynDiag; j != NULL; j=(Junction *)j->p2) {
-
- require (j->ntype == nJunction && j->jtype == RuleBlk,"Not a rule block");
-
- if (n->file < j->file) {
- return offset;
- };
- if (n->file == j->file) {
- if (n->line < j->line) {
- return (offset < 0) ? 0 : offset;
- } else {
- offset=n->line - j->line;
- if (offset == 0) return 0;
- };
- };
- };
- return offset;
-}
-
-#define ruleNameMax 50
-
-static char ruleNameStatic1[ruleNameMax];
-static char ruleNameStatic2[ruleNameMax+10];
-
-#ifdef __USE_PROTOS
-char * MR_ruleNamePlusOffset(Node *n)
-#else
-char * MR_ruleNamePlusOffset(n)
- Node *n;
-#endif
-{
- int offset=MR_offsetFromRule(n);
-
- strncpy(ruleNameStatic1,n->rname,ruleNameMax);
- if (offset < 0) {
- sprintf(ruleNameStatic2,"%s/?",ruleNameStatic1);
- } else {
- sprintf(ruleNameStatic2,"%s/%d",ruleNameStatic1,offset+1);
- };
- return ruleNameStatic2;
-}
-
-#ifdef __USE_PROTOS
-int MR_max_height_of_tree(Tree *t)
-#else
-int MR_max_height_of_tree(t)
- Tree *t;
-#endif
-{
- int h;
- int height=0;
- Tree *u;
-
- if (t == NULL) return 0;
-
- require (t->token != ALT && t->token != EpToken,"MR_max_height_of_tree ALT or EpToken");
-
- for (u=t; u != NULL; u=u->right) {
- h=MR_max_height_of_tree(u->down)+1;
- if (h > height) height=h;
- };
- return height;
-}
-
-#ifdef __USE_PROTOS
-int MR_all_leaves_same_height(Tree *t,int depth)
-#else
-int MR_all_leaves_same_height(t,depth)
- Tree *t;
- int depth;
-#endif
-{
- if (t == NULL) {
- return (depth==0);
- };
-
- require (t->token != ALT && t->token != EpToken,"MR_all_leaves_same_height ALT or EpToken");
-
- if (depth == 0) {
- return 0;
- } else {
- if ( ! MR_all_leaves_same_height(t->down,depth-1)) {
- return 0;
- };
- if (t->right == NULL) {
- return 1;
- } else {
- return MR_all_leaves_same_height(t->right,depth);
- };
- };
-}
-
-#ifdef __USE_PROTOS
-void MR_projectTreeOntoSet(Tree *tree,int ck,set *ckset)
-#else
-void MR_projectTreeOntoSet(tree,ck,ckset)
- Tree *tree;
- int ck;
- set *ckset;
-#endif
-{
- if (tree == NULL) return;
-
- require(tree->token != EpToken,"MR_projectTreeOntoSet: EpToken unexpected\n");
-
- MR_projectTreeOntoSet(tree->right,ck,ckset);
- if (tree->token == ALT) {
- MR_projectTreeOntoSet(tree->down,ck,ckset);
- } else {
- if (ck > 1) {
- MR_projectTreeOntoSet(tree->down,ck-1,ckset);
- } else {
- set_orel(tree->token,ckset);
- };
- };
-}
-
-#ifdef __USE_PROTOS
-int MR_comparePredicates(Predicate *a,Predicate *b)
-#else
-int MR_comparePredicates(a,b)
- Predicate *a;
- Predicate *b;
-#endif
-{
- Predicate *p;
- Predicate *q;
-
- if (a == b) return 1;
- if (a == NULL || b == NULL ) return 0;
- if (a->down == NULL && b->down == NULL) {
-
- /* predicate->invert can be set only in the predEntry predicates */
- /* thus they are only visible after the predEntry predicates have been "unfolded" */
-
- int sameSource=(a->source == b->source);
- int sameInvert= 1 & (1 +a->inverted + b->inverted +
- a->source->inverted + b->source->inverted);
- int samePredEntry=(a->source->predEntry != NULL
- && b->source->predEntry != NULL
- && a->source->predEntry == b->source->predEntry);
- if (sameInvert && (sameSource || samePredEntry)) {
- if (MR_identicalContext(a,b)) {
- return 1;
- };
- };
- return 0;
- };
- if (a->down == NULL || b->down == NULL) return 0;
- if (a->expr != b->expr) return 0;
-
- for (p=a->down; p != NULL; p=p->right) {
- for (q=b->down; q != NULL; q=q->right) {
- if (MR_comparePredicates(p,q)) goto NEXT_P;
- };
- return 0;
-NEXT_P:
- continue;
- };
- return 1;
-}
-
-/*
- * action->inverted can be set only when a predicate symbol appears in
- * a rule: "rule : <<!XXX>>? X". It cannot be set under any
- * other circumstances. In particular it cannot be set by
- * "#pred NotA !A" or by "#pred Nota <<!A>>?". The first case
- * creates a predEntry and the predicate expression of that predEntry
- * has inverted set. In the second case, the code for handling "!"
- * is only present in buildAction, which is not called by the #pred
- * semantic routines, only when a <<...>>? is recognized as part of
- * a rule definition.
- *
- * predicate->inverted can only be set by a predicate created by a #pred
- * expression, such as "#pred NotA !A" or "#pred NotXY ! (X && Y) or
- * "#pred XbarY !(X && Y)". In particular, it cannot be set by any
- * predicate expression occurring under any other circumstances.
- * The #pred predicate expresssions are stored with in predEntry->pred
- * and do not normally appear anywhere else until the predicates are
- * "unfolded" in order to recognize redundancies, conflicts, and
- * tautologies.
- *
- * The unfold routine expands all references to #pred expressions.
- *
- * The simplifyInvert goes through and propagates the invert bit so that
- * all OR and AND nodes are un-inverted.
- *
- * Note that !(A and B) => (!A or !B)
- * !(A or B) => (!A and !B)
- *
- * MR_unfold() is called to expand predicate symbols by replacing predicates
- * that reference predicate entries with the copies of the predicate entries.
- * Each reference receives a duplicate of the original. This is necessary
- * because the next phase involves simplification and removal of redundant
- * predicate nodes. Anyway, the point I'm making is that predicate->invert
- * should not be set in any predicate until it has been expanded.
- *
- * This is a recursive structure, but there is no need for "recursive expansion"
- * by which I mean a predicate symbol refers to other predicate symbols which
- * must also be expanded.
- *
- * Recursive expansion is *not* performed by this routine because it is not
- * necessary. Expansion of references is performed by predPrimary when
- * a new predicate symbol is created by referring to others in the pred expr.
- */
-
-#ifdef __USE_PROTOS
-Predicate *MR_unfold(Predicate *pred)
-#else
-Predicate *MR_unfold(pred)
- Predicate *pred;
-#endif
-{
- Predicate *result;
-
- if (pred == NULL) return NULL;
-
- pred->right=MR_unfold(pred->right);
-
- if (pred->down == NULL) {
- if (pred->source->predEntry != NULL) {
- if (pred->source->predEntry->pred == NULL) {
- ; /* do nothing */ /* a reference to a literal #pred (perhaps with "!" */
- } else {
- result=predicate_dup_without_context(pred->source->predEntry->pred);
- if (pred->inverted) {
- result->inverted=!result->inverted;
- };
- if (pred->source->inverted) {
- result->inverted=!result->inverted;
- };
- result->right=pred->right;
- pred->right=NULL;
- predicate_free(pred);
-/*** result=MR_unfold(result); *** not necessary */ /* recursive expansion */
- return result;
- };
- } else {
- ; /* do nothing */ /* an inline literal predicate */
- };
- } else {
- pred->down=MR_unfold(pred->down);
- };
- return pred;
-}
-
-/* this should be called immediately after MR_unfold() and
- at no other times
-*/
-
-#ifdef __USE_PROTOS
-void MR_simplifyInverted(Predicate *pred,int inverted)
-#else
-void MR_simplifyInverted(pred,inverted)
- Predicate *pred;
- int inverted;
-#endif
-{
- int newInverted;
-
- if (pred == NULL) return;
-
- MR_simplifyInverted(pred->right,inverted);
-
- newInverted= 1 & (inverted + pred->inverted);
-
- if (pred->down == NULL) {
- pred->inverted=newInverted;
- } else {
- if (newInverted != 0) {
- if (pred->expr == PRED_AND_LIST) {
- pred->expr=PRED_OR_LIST;
- } else {
- pred->expr=PRED_AND_LIST;
- };
- };
- pred->inverted=0;
- MR_simplifyInverted(pred->down,newInverted);
- };
-}
-
-/* only remove it from AND and OR nodes, not leaves */
-
-#ifdef __USE_PROTOS
-void MR_clearPredEntry(Predicate *p)
-#else
-void MR_clearPredEntry(p)
- Predicate *p;
-#endif
-{
- if (p == NULL) return;
- MR_clearPredEntry(p->down);
- MR_clearPredEntry(p->right);
- if (p->down != NULL) p->predEntry=NULL;
-}
-
-
-#ifdef __USE_PROTOS
-void MR_orphanRules(FILE *f)
-#else
-void MR_orphanRules(f)
- FILE *f;
-#endif
-{
- set a;
- Junction *p;
- unsigned e;
- RuleEntry *re;
-
- a=empty;
-
- if (! InfoO) return;
-
- for (p=SynDiag; p!=NULL; p = (Junction *)p->p2) {
- if ( (Junction *) (p->end)->p1 == NULL) {
- re=(RuleEntry *) hash_get(Rname,p->rname);
- require (re != NULL,"RuleEntry == NULL");
- set_orel(re->rulenum, &a);
- }
- }
-
- if (set_deg(a) > 1) {
- fprintf(f,"note: Start rules: {");
- for (; !set_nil(a); set_rm(e,a)) {
- e=set_int(a);
- fprintf(f," %s",RulePtr[e]->rname);
- };
- fprintf(f," }\n");
- };
- set_free( a );
-}
-
-/* merge (X Y) and (X) to create (X) */
-
-static int *mergeChain;
-static Tree *mergeTree;
-
-#ifdef __USE_PROTOS
-Tree *MR_merge_tree_contexts_client(Tree *t,int chain[])
-#else
-Tree *MR_merge_tree_contexts_client(t,chain)
- Tree *t;
- int chain[];
-#endif
-{
- if (t == NULL) return NULL;
- if (chain[0] == 0) {
- Tree *u=t->right;
- t->right=NULL;
- Tfree(t);
- return MR_merge_tree_contexts_client(u,&chain[0]);
- }
- if (chain[0] == t->token) {
- t->down=MR_merge_tree_contexts_client(t->down,&chain[1]);
- };
- t->right=MR_merge_tree_contexts_client(t->right,&chain[0]);
- return t;
-}
-
-#ifdef __USE_PROTOS
-void MR_iterateOverTreeContexts(Tree *t,int chain[])
-#else
-void MR_iterateOverTreeContexts(t,chain)
- Tree *t;
- int chain[];
-#endif
-{
- if (t == NULL) return;
- chain[0]=t->token;
- if (t->down != NULL) {
- MR_iterateOverTreeContexts(t->down,&chain[1]);
- } else {
- MR_merge_tree_contexts_client(mergeTree,mergeChain);
- };
- MR_iterateOverTreeContexts(t->right,&chain[0]);
- chain[0]=0;
-}
-
-#ifdef __USE_PROTOS
-Tree *MR_merge_tree_contexts(Tree *t)
-#else
-Tree *MR_merge_tree_contexts(t)
- Tree *t;
-#endif
-{
- int h=MR_max_height_of_tree(t);
-
- mergeTree=t;
- mergeChain=(int *) calloc(h+1,sizeof(int));
- require (mergeChain != NULL,"MR_merge_tree_contexts: can't alloc chain");
- MR_iterateOverTreeContexts(t,mergeChain);
- t=tshrink(t);
- t=tflatten(t);
- t=tleft_factor(t);
- free ( (char *) mergeChain);
- mergeChain=NULL;
- return t;
-}
-
-#ifdef __USE_PROTOS
-Tree *MR_compute_pred_tree_context(Predicate *p)
-#else
-Tree *MR_compute_pred_tree_context(p)
- Predicate *p;
-#endif
-{
- Tree *t;
-
- t=MR_compute_pred_tree_ctxXX(p);
- MR_merge_tree_contexts(t);
- return t;
-}
-
-#ifdef __USE_PROTOS
-void MR_guardPred_plainSet(ActionNode *anode,Predicate *pred)
-#else
-void MR_guardPred_plainSet(anode,pred)
- ActionNode *anode;
- Predicate *pred;
-#endif
-{
- Junction *j;
- Predicate *workPred;
- set maskSet;
-
- maskSet=empty;
-
- if (!MRhoisting) return;
-
- /* it doesn't really matter whether the predicate has
- depth k=1 or k>1 because we're not really looking
- at the predicate itself, just the stuff "behind"
- the predicate.
- */
-
- /* shouldn't have to worry about REACHing off the end
- of the rule containing the predicate because the
- Rule->end->halt should have been set already by the
- the code which handles RuleRef nodes.
-
- We don't want to REACH off the end of the rule because
- this would give the "global" follow context rather than
- the "local" context.
-
- r1a : (A)? => <<p>>? r2 (A|B)
- r1b : (A)? => <<p>>? r2 (A|C)
- r2 : ();
-
- For r1a we want follow of predicate = {A B}
- we want plainSet = {B}
- For r1b we want follow of predicate = {A C}
- we want plainSet = {C}
- */
-
- require (anode->next->ntype == nJunction,"MR_guardpred_plainSet not Junction");
- j=(Junction *)(anode->next);
-
- workPred=predicate_dup_without_context(pred);
- workPred->k=1;
- workPred->scontext[1]=MR_First(1,j, &(workPred->completionSet) );
- MR_complete_predicates(1,workPred);
- if (pred->k == 1) {
- maskSet=pred->scontext[1];
- } else {
- MR_projectTreeOntoSet(pred->tcontext,1,&maskSet);
- }
- pred->plainSet=set_dif(workPred->scontext[1],maskSet);
- predicate_free(workPred);
-}
-
-/*******************************************************************************/
-
-static Tree * suppressTree;
-static int * suppressChain; /* element 0 not used */
-static set * suppressSets;
-static Node * suppressNode;
-static int suppressChainLength;
-int MR_SuppressSearch=0;
-static int suppressSucceeded;
-static Predicate * suppressPredicate;
-
-#ifdef __USE_PROTOS
-int MR_isChain(Tree *t)
-#else
-int MR_isChain(t)
- Tree *t;
-#endif
-{
- Tree *u;
-
- for (u=t; u != NULL; u=u->down) {
- if (u->right != NULL) return 0;
- }
- return 1;
-}
-
-#ifdef __USE_PROTOS
-int MR_suppressK_client(Tree *tree,int tokensInChain[])
-#else
-int MR_suppressK_client(tree,tokensInChain)
- Tree *tree;
- int tokensInChain[];
-#endif
-{
- int i;
- set *save_fset;
- int save_ConstrainSearch;
- set incomplete;
- Tree *t;
-
- suppressSucceeded=0; /* volatile */
-
- if (suppressSets == NULL) {
- suppressSets=(set *) calloc (CLL_k+1,sizeof(set));
- require (suppressSets != NULL,"MR_suppressK_client: suppressSets alloc");
- };
-
- for (suppressChainLength=1;
- tokensInChain[suppressChainLength+1] != 0;
- suppressChainLength++) {};
-
- require (suppressChainLength != 0,"MR_suppressK_client: chain empty");
-
- for (i=1 ; i <= suppressChainLength ; i++) {
- set_clr(suppressSets[i]);
- set_orel( (unsigned) tokensInChain[i],
- &suppressSets[i]);
- };
-
- save_fset=fset;
- save_ConstrainSearch=ConstrainSearch;
-
- fset=suppressSets;
-
- MR_SuppressSearch=1;
- MR_AmbSourceSearch=1;
- MR_MaintainBackTrace=1;
- ConstrainSearch=1;
-
- maxk = suppressChainLength;
-
- incomplete=empty;
- t=NULL;
-
-/*** constrain = &(fset[1]); ***/
-
- MR_setConstrainPointer(&(fset[1])); /* MR18 */
-
- MR_pointerStackReset(&MR_BackTraceStack);
-
- TRAV(suppressNode,maxk,&incomplete,t);
-
- Tfree(t);
-
- require (set_nil(incomplete),"MR_suppressK_client TRAV incomplete");
- require (MR_BackTraceStack.count == 0,
- "MR_suppressK_client: MR_BackTraceStack.count != 0");
- set_free(incomplete);
-
- ConstrainSearch=save_ConstrainSearch;
- fset=save_fset;
-
- MR_AmbSourceSearch=0;
- MR_MaintainBackTrace=0;
- MR_SuppressSearch=0;
- return suppressSucceeded;
-}
-
-#ifdef __USE_PROTOS
-Tree * MR_iterateOverTreeSuppressK(Tree *t,int chain[])
-#else
-Tree * MR_iterateOverTreeSuppressK(t,chain)
- Tree *t;
- int chain[];
-#endif
-{
- if (t == NULL) return NULL;
- t->right=MR_iterateOverTreeSuppressK(t->right,&chain[0]);
- chain[0]=t->token;
- if (t->down != NULL) {
- t->down=MR_iterateOverTreeSuppressK(t->down,&chain[1]);
- if (t->down == NULL) {
- Tree *u=t->right;
- t->right=NULL;
- Tfree(t);
- chain[0]=0;
- return u;
- };
- } else {
- MR_suppressK_client(suppressTree,suppressChain);
- if (suppressSucceeded) {
- Tree *u=t->right;
- t->right=NULL;
- Tfree(t);
- chain[0]=0;
- return u;
- };
- };
- chain[0]=0;
- return t;
-}
-
-/* @@@ */
-
-#ifdef __USE_PROTOS
-Predicate * MR_suppressK(Node *j,Predicate *p)
-#else
-Predicate * MR_suppressK(j,p)
- Node *j;
- Predicate *p;
-#endif
-{
- Predicate *result;
- int guardPred=0;
- int ampersandPred=0;
- Node *nodePrime;
-
- if (! MRhoistingk) {
- return p;
- }
-
- if (! MRhoisting) return p;
- if (CLL_k == 1) return p;
-
- if (suppressChain == NULL) {
- suppressChain=(int *) calloc(CLL_k+2,sizeof(int));
- require (suppressChain != NULL,"MR_suppressK: can't allocate chain");
- }
-
- if (p == NULL) return NULL;
-
- if (j->ntype == nJunction) {
- nodePrime=(Node *) MR_junctionWithoutP2( (Junction *) j);
- } else {
- nodePrime=j;
- };
-
- p->down=MR_suppressK(j,p->down);
- p->right=MR_suppressK(j,p->right);
- if (p->down != NULL) {
- result=p;
- goto EXIT;
- };
- if (p->k == 1) {
- result=p;
- goto EXIT;
- };
-
- if (p->source != NULL) {
- if (p->source->guardpred != NULL) guardPred=1;
- if (p->source->ampersandPred != NULL) ampersandPred=1;
- }
-
- suppressPredicate=p;
- suppressNode=nodePrime; /* was j*/
-
- suppressTree=p->tcontext;
-
- if (guardPred || ampersandPred) {
- p->tcontext=MR_iterateOverTreeSuppressK(suppressTree,&suppressChain[1]);
- if (p->tcontext == NULL) {
- predicate_free(p);
- result=NULL;
- goto EXIT;
- };
- } else {
- if (MR_isChain(p->tcontext)) {
- p->tcontext=MR_iterateOverTreeSuppressK(suppressTree,&suppressChain[1]);
- if (p->tcontext == NULL) {
- predicate_free(p);
- result=NULL;
- goto EXIT;
- };
- }
- }
- result=p;
-EXIT:
- return result;
-}
-
-#ifdef __USE_PROTOS
-void MR_suppressSearchReport(void)
-#else
-void MR_suppressSearchReport()
-#endif
-{
- int i;
- Node *p;
- TokNode *tn;
- int depth;
- set setAnd;
-
- /* number of tokens in back trace stack matches length of chain */
-
- depth=0;
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- p=(Node *) MR_BackTraceStack.data[i];
- if (p->ntype == nToken) depth++;
- };
-
- require (depth == suppressChainLength,"depth > suppressChainLength");
-
- /* token codes match chain */
-
- depth=0;
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- p=(Node *) MR_BackTraceStack.data[i];
- if (p->ntype != nToken) continue;
- tn=(TokNode *) p;
- depth++;
- if (set_nil(tn->tset)) {
- require(set_el( (unsigned) tn->token,fset[depth]),
- "MR_suppressSearchReport: no match to #token in chain");
- } else {
- setAnd=set_and(fset[depth],tn->tset);
- require(!set_nil(setAnd),
- "MR_suppressSearchReport: no match to #token set in chain");
- set_free(setAnd);
- };
- };
-
- /* have a match - now remove it from the predicate */
-
- suppressSucceeded=1;
-
- if (suppressSucceeded) {
- fprintf(output,"\n");
- fprintf(output,"#if 0\n");
- fprintf(output,"\n");
- fprintf(output,"Part (or all) of predicate with depth > 1 suppressed by ");
- fprintf(output,"alternative without predicate\n\n");
- MR_dumpPred(suppressPredicate,1);
- fprintf(output,"The token sequence which is suppressed:");
- fprintf(output," (");
- for (i=1; i <= suppressChainLength; i++) {
- fprintf(output," %s",TerminalString(suppressChain[i]));
- };
- fprintf(output," )\n");
- fprintf(output,"The sequence of references which generate that sequence of tokens:\n\n");
-
- MR_backTraceDumpItemReset();
-
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- MR_backTraceDumpItem(output,0,(Node *) MR_BackTraceStack.data[i]);
- };
- fprintf(output,"\n");
- fprintf(output,"#endif\n");
- }
-}
-
-#ifdef __USE_PROTOS
-void MR_markCompromisedRule(Node *n)
-#else
-void MR_markCompromisedRule(n)
- Node *n;
-#endif
-{
- RuleEntry *q;
- Node *mark=NULL;
- Junction *j;
-
- if (n->ntype == nRuleRef) {
- mark=(Node *) MR_ruleReferenced( (RuleRefNode *) n);
- } else if (n->ntype == nToken) {
- mark=n;
- } else if (n->ntype == nJunction) {
- j=(Junction *)n;
- switch (j->jtype) {
- case aOptBlk:
- case aLoopBlk:
- case RuleBlk:
- case EndRule:
- case aPlusBlk:
- case aLoopBegin:
- mark=n;
- break;
- default:
- break;
- };
- }
-
- if (mark == NULL) return;
-
- require (RulePtr != NULL,"RulePtr not initialized");
-
- q = (RuleEntry *) hash_get(Rname,mark->rname);
- require (q != NULL,"RuleEntry not found");
- set_orel(q->rulenum,&MR_CompromisedRules);
-}
-
-#ifdef __USE_PROTOS
-void MR_alphaBetaTraceReport(void)
-#else
-void MR_alphaBetaTraceReport()
-#endif
-{
- int i;
-
- if (! AlphaBetaTrace) return;
-
- MR_AlphaBetaMessageCount++;
-
- fprintf(output,"\n");
- fprintf(output,"#if 0\n");
- fprintf(output,"\n");
- fprintf(output,"Trace of references leading to attempt to compute the follow set of\n");
- fprintf(output,"alpha in an \"(alpha)? beta\" block. It is not possible for antlr to\n");
- fprintf(output,"compute this follow set because it is not known what part of beta has\n");
- fprintf(output,"already been matched by alpha and what part remains to be matched.\n");
- fprintf(output,"\n");
- fprintf(output,"Rules which make use of the incorrect follow set will also be incorrect\n");
- fprintf(output,"\n");
-
- MR_backTraceDumpItemReset();
-
- for (i=0; i < MR_BackTraceStack.count ; i++) {
- MR_backTraceDumpItem(output,0,(Node *) MR_BackTraceStack.data[i]);
- if (i < MR_BackTraceStack.count-1) {
- MR_markCompromisedRule( (Node *) MR_BackTraceStack.data[i]);
- };
- };
- fprintf(output,"\n");
- fprintf(output,"#endif\n");
-}
-
-#ifdef __USE_PROTOS
-void MR_dumpRuleSet(set s)
-#else
-void MR_dumpRuleSet(s)
- set s;
-#endif
-{
- unsigned *cursor;
- unsigned *origin=set_pdq(s);
-
- require(origin != NULL,"set_pdq failed");
-
- if (RulePtr == NULL) {
- fprintf(stderr,"RulePtr[] not yet initialized");
- } else {
- for (cursor=origin; *cursor != nil ; cursor++) {
-/**** if (cursor != origin) fprintf(stderr,","); ****/
- fprintf(stderr," %s",RulePtr[*cursor]->rname);
- fprintf(stderr,"\n");
- };
- free( (char *) origin);
- };
-}
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg b/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg
deleted file mode 100644
index 8c43dff300..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/parser.dlg
+++ /dev/null
@@ -1,1387 +0,0 @@
-<<
-/* parser.dlg -- DLG Description of scanner
- *
- * Generated from: antlr.g
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include "pcctscfg.h"
-#include "set.h"
-#include <ctype.h>
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#define zzcr_attr(attr,tok,t)
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-LOOKAHEAD
-
-void
-#ifdef __USE_PROTOS
-zzerraction(void)
-#else
-zzerraction()
-#endif
-{
- (*zzerr)("invalid token");
- zzadvance();
- zzskip();
-}
->>
-
-<<%%lexaction
-
-/* maintained, but not used for now */
-set AST_nodes_refd_in_actions = set_init;
-int inAlt = 0;
-set attribsRefdFromAction = set_init; /* MR20 */
-int UsedOldStyleAttrib = 0;
-int UsedNewStyleLabel = 0;
-#ifdef __USE_PROTOS
-char *inline_set(char *);
-#else
-char *inline_set();
-#endif
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
-/* MR1 in DLG action */
-
-int tokenActionActive=0; /* MR1 */
-
-
->>
-
-<<%%lexaction
-
-
-static char *
-#ifdef __USE_PROTOS
-getFileNameFromTheLineInfo(char *toStr, char *fromStr)
-#else
-getFileNameFromTheLineInfo(toStr, fromStr)
-char *toStr, *fromStr;
-#endif
-{
- int i, j, k;
-
- if (!fromStr || !toStr) return toStr;
-
- /* find the first " */
-
- for (i=0;
- (i<MaxFileName) &&
- (fromStr[i] != '\n') &&
- (fromStr[i] != '\r') &&
- (fromStr[i] != '\"');
- i++) /* nothing */ ;
-
- if ( (i == MaxFileName) ||
- (fromStr[i] == '\n') ||
- (fromStr[i] == '\r') ) {
- return toStr;
-}
-
- /* find the second " */
-
- for (j=i+1;
-(j<MaxFileName) &&
-(fromStr[j] != '\n') &&
-(fromStr[j] != '\r') &&
-(fromStr[j] != '\"');
-j++) /* nothing */ ;
-
- if ((j == MaxFileName) ||
-(fromStr[j] == '\n') ||
-(fromStr[j] == '\r') ) {
- return toStr;
-}
-
- /* go back until the last / or \ */
-
- for (k=j-1;
-(fromStr[k] != '\"') &&
-(fromStr[k] != '/') &&
-(fromStr[k] != '\\');
-k--) /* nothing */ ;
-
- /* copy the string after " / or \ into toStr */
-
- for (i=k+1; fromStr[i] != '\"'; i++) {
-toStr[i-k-1] = fromStr[i];
-}
-
- toStr[i-k-1] = '\0';
-
- return toStr;
-}
-
-/* MR14 end of a block to support #line in antlr source code */
-
-
->>
-
-<<%%lexaction
-
-#ifdef __USE_PROTOS
-void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
-#else
-void mark_label_used_in_sem_pred(le) /* MR10 */
-LabelEntry *le;
-#endif
-{
- TokNode *tn;
- require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
- tn=(TokNode *)le->elem;
- require (tn->label != 0,"mark_label_used... TokNode has no label");
- tn->label_used_in_semantic_pred=1;
-}
->>
-
-
-%%START
-
-@
- <<
- NLA = Eof;
- /* L o o k F o r A n o t h e r F i l e */
- {
- FILE *new_input;
- new_input = NextFile();
- if ( new_input == NULL ) { NLA=Eof; return; }
- fclose( input );
- input = new_input;
- zzrdstream( input );
- zzskip(); /* Skip the Eof (@) char i.e continue */
- }
- >>
-
-[\t\ ]+
- <<
- NLA = 76;
- zzskip();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 77;
- zzline++; zzskip();
- >>
-
-\[
- <<
- NLA = 78;
- zzmode(ACTIONS); zzmore();
- istackreset();
- pushint(']');
- >>
-
-\<\<
- <<
- NLA = 79;
- action_file=CurFile; action_line=zzline;
- zzmode(ACTIONS); zzmore();
- list_free(&CurActionLabels,0); /* MR10 */
- numericActionLabel=0; /* MR10 */
- istackreset();
- pushint('>');
- >>
-
-\"
- <<
- NLA = 80;
- zzmode(STRINGS); zzmore();
- >>
-
-/\*
- <<
- NLA = 81;
- zzmode(COMMENTS); zzskip();
- >>
-
-\*/
- <<
- NLA = 82;
- warn("Missing /*; found dangling */"); zzskip();
- >>
-
-//
- <<
- NLA = 83;
- zzmode(CPP_COMMENTS); zzskip();
- >>
-
-#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)
- <<
- NLA = 84;
-
- zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
- getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
- >>
-
-#line ~[\n\r]* (\n|\r|\r\n)
- <<
- NLA = 85;
-
- zzline++; zzmore();
- >>
-
-\>\>
- <<
- NLA = 86;
- warn("Missing <<; found dangling \>\>"); zzskip();
- >>
-
-.
- <<
- NLA = WildCard;
- >>
-
-\@
- <<
- NLA = 88;
- FoundException = 1; /* MR6 */
- FoundAtOperator = 1;
- >>
-
-{\\}#pragma
- <<
- NLA = Pragma;
- >>
-
-{\\}#FirstSetSymbol
- <<
- NLA = FirstSetSymbol;
- >>
-
-{\\}#header
- <<
- NLA = 94;
- >>
-
-{\\}#first
- <<
- NLA = 95;
- >>
-
-{\\}#parser
- <<
- NLA = 96;
- >>
-
-{\\}#tokdefs
- <<
- NLA = 97;
- >>
-
-\}
- <<
- NLA = 98;
- >>
-
-class
- <<
- NLA = 99;
- >>
-
-\{
- <<
- NLA = 102;
- >>
-
-!
- <<
- NLA = 103;
- >>
-
-\<
- <<
- NLA = 104;
- >>
-
-\>
- <<
- NLA = 105;
- >>
-
-:
- <<
- NLA = 106;
- >>
-
-;
- <<
- NLA = 107;
- >>
-
-{\\}#lexaction
- <<
- NLA = 108;
- >>
-
-{\\}#lexmember
- <<
- NLA = 109;
- >>
-
-{\\}#lexprefix
- <<
- NLA = 110;
- >>
-
-{\\}#pred
- <<
- NLA = 111;
- >>
-
-\|\|
- <<
- NLA = 112;
- >>
-
-&&
- <<
- NLA = 113;
- >>
-
-\(
- <<
- NLA = 114;
- >>
-
-\)
- <<
- NLA = 115;
- >>
-
-{\\}#lexclass
- <<
- NLA = 116;
- >>
-
-{\\}#errclass
- <<
- NLA = 117;
- >>
-
-{\\}#tokclass
- <<
- NLA = 118;
- >>
-
-..
- <<
- NLA = 119;
- >>
-
-{\\}#token
- <<
- NLA = 120;
- >>
-
-=
- <<
- NLA = 121;
- >>
-
-[0-9]+
- <<
- NLA = 122;
- >>
-
-\|
- <<
- NLA = 123;
- >>
-
-\~
- <<
- NLA = 124;
- >>
-
-^
- <<
- NLA = 125;
- >>
-
-approx
- <<
- NLA = 126;
- >>
-
-LL\(1\)
- <<
- NLA = 127;
- >>
-
-LL\(2\)
- <<
- NLA = 128;
- >>
-
-\*
- <<
- NLA = 129;
- >>
-
-\+
- <<
- NLA = 130;
- >>
-
-?
- <<
- NLA = 131;
- >>
-
-=>
- <<
- NLA = 132;
- >>
-
-exception
- <<
- NLA = 133;
- >>
-
-default
- <<
- NLA = 134;
- >>
-
-catch
- <<
- NLA = 135;
- >>
-
-[a-z] [A-Za-z0-9_]*
- <<
- NLA = NonTerminal;
-
- while ( zzchar==' ' || zzchar=='\t' ) {
- zzadvance();
- }
- if ( zzchar == ':' && inAlt ) NLA = LABEL;
- >>
-
-[A-Z] [A-Za-z0-9_]*
- <<
- NLA = TokenTerm;
-
- while ( zzchar==' ' || zzchar=='\t' ) {
- zzadvance();
- }
- if ( zzchar == ':' && inAlt ) NLA = LABEL;
- >>
-
-{\\}#[A-Za-z0-9_]*
- <<
- NLA = 136;
- warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip();
- >>
-
-
-%%STRINGS
-
-@
- <<
- NLA = Eof;
- >>
-
-\"
- <<
- NLA = QuotedTerm;
- zzmode(START);
- >>
-
-\n|\r|\r\n
- <<
- NLA = 3;
-
- zzline++;
- warn("eoln found in string");
- zzskip();
- >>
-
-\\(\n|\r|\r\n)
- <<
- NLA = 4;
- zzline++; zzmore();
- >>
-
-\\~[]
- <<
- NLA = 5;
- zzmore();
- >>
-
-~[\n\r\"\\]+
- <<
- NLA = 6;
- zzmore();
- >>
-
-
-%%ACTION_STRINGS
-
-@
- <<
- NLA = Eof;
- >>
-
-\"
- <<
- NLA = 7;
- zzmode(ACTIONS); zzmore();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 8;
-
- zzline++;
- warn("eoln found in string (in user action)");
- zzskip();
- >>
-
-\\(\n|\r|\r\n)
- <<
- NLA = 9;
- zzline++; zzmore();
- >>
-
-\\~[]
- <<
- NLA = 10;
- zzmore();
- >>
-
-~[\n\r\"\\]+
- <<
- NLA = 11;
- zzmore();
- >>
-
-
-%%ACTION_CHARS
-
-@
- <<
- NLA = Eof;
- >>
-
-'
- <<
- NLA = 12;
- zzmode(ACTIONS); zzmore();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 13;
-
- zzline++;
- warn("eoln found in char literal (in user action)");
- zzskip();
- >>
-
-\\~[]
- <<
- NLA = 14;
- zzmore();
- >>
-
-~[\n\r'\\]+
- <<
- NLA = 15;
- zzmore();
- >>
-
-
-%%ACTION_COMMENTS
-
-@
- <<
- NLA = Eof;
- >>
-
-\*/
- <<
- NLA = 16;
- zzmode(ACTIONS); zzmore();
- >>
-
-\*
- <<
- NLA = 17;
- zzmore();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 18;
- zzline++; zzmore(); DAWDLE;
- >>
-
-~[\n\r\*]+
- <<
- NLA = 19;
- zzmore();
- >>
-
-
-%%TOK_DEF_COMMENTS
-
-@
- <<
- NLA = Eof;
- >>
-
-\*/
- <<
- NLA = 20;
- zzmode(PARSE_ENUM_FILE);
- zzmore();
- >>
-
-\*
- <<
- NLA = 21;
- zzmore();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 22;
- zzline++; zzmore(); DAWDLE;
- >>
-
-~[\n\r\*]+
- <<
- NLA = 23;
- zzmore();
- >>
-
-
-%%TOK_DEF_CPP_COMMENTS
-
-@
- <<
- NLA = Eof;
- >>
-
-\n|\r|\r\n
- <<
- NLA = 24;
- zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE;
- >>
-
-~[\n\r]+
- <<
- NLA = 25;
- zzskip();
- >>
-
-
-%%ACTION_CPP_COMMENTS
-
-@
- <<
- NLA = Eof;
- >>
-
-\n|\r|\r\n
- <<
- NLA = 26;
- zzline++; zzmode(ACTIONS); zzmore(); DAWDLE;
- >>
-
-~[\n\r]+
- <<
- NLA = 27;
- zzmore();
- >>
-
-
-%%CPP_COMMENTS
-
-@
- <<
- NLA = Eof;
- >>
-
-\n|\r|\r\n
- <<
- NLA = 28;
- zzline++; zzmode(START); zzskip(); DAWDLE;
- >>
-
-~[\n\r]+
- <<
- NLA = 29;
- zzskip();
- >>
-
-
-%%COMMENTS
-
-@
- <<
- NLA = Eof;
- >>
-
-\*/
- <<
- NLA = 30;
- zzmode(START); zzskip();
- >>
-
-\*
- <<
- NLA = 31;
- zzskip();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 32;
- zzline++; zzskip(); DAWDLE;
- >>
-
-~[\n\r\*]+
- <<
- NLA = 33;
- zzskip();
- >>
-
-
-%%ACTIONS
-
-@
- <<
- NLA = Eof;
- >>
-
-\>\>
- <<
- NLA = Action;
- /* these do not nest */
- zzmode(START);
- NLATEXT[0] = ' ';
- NLATEXT[1] = ' ';
- zzbegexpr[0] = ' ';
- zzbegexpr[1] = ' ';
- if ( zzbufovf ) {
- err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE));
- }
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
- /* MR1 in DLG action */
- /* MR1 Doesn't matter what kind of action it is - reset*/
-
- tokenActionActive=0; /* MR1 */
- >>
-
-\>\>?
- <<
- NLA = Pred;
- /* these do not nest */
- zzmode(START);
- NLATEXT[0] = ' ';
- NLATEXT[1] = ' ';
- zzbegexpr[0] = '\0';
- if ( zzbufovf ) {
- err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE));
- };
-#ifdef __cplusplus__
- /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-#ifdef __STDC__
- /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-#ifdef __USE_PROTOS
- /* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
- /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);
-#endif
-#endif
-#endif
- >>
-
-\]
- <<
- NLA = PassAction;
- if ( topint() == ']' ) {
- popint();
- if ( istackempty() ) /* terminate action */
- {
- zzmode(START);
- NLATEXT[0] = ' ';
- zzbegexpr[0] = ' ';
- if ( zzbufovf ) {
- err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE));
- }
- }
- else {
- /* terminate $[..] and #[..] */
- if ( GenCC ) zzreplstr("))");
- else zzreplstr(")");
- zzmore();
- }
- }
- else if ( topint() == '|' ) { /* end of simple [...] */
- popint();
- zzmore();
- }
- else zzmore();
- >>
-
-consumeUntil\( [\ \t]* \{~[\}]+\} [\ \t]* \)
- <<
- NLA = 37;
-
- zzmore();
- zzreplstr(inline_set(zzbegexpr+
- strlen("consumeUntil(")));
- >>
-
-consumeUntil\( ~[\)]+ \)
- <<
- NLA = 38;
- zzmore();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 39;
- zzline++; zzmore(); DAWDLE;
- >>
-
-\>
- <<
- NLA = 40;
- zzmore();
- >>
-
-$
- <<
- NLA = 41;
- zzmore();
- >>
-
-$$
- <<
- NLA = 42;
- if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();}
- else err("$$ use invalid in C++ mode");
- >>
-
-$\[\]
- <<
- NLA = 43;
- if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();}
- else err("$[] use invalid in C++ mode");
- >>
-
-$\[
- <<
- NLA = 44;
-
- pushint(']');
- if ( !GenCC ) zzreplstr("zzconstr_attr(");
- else err("$[..] use invalid in C++ mode");
- zzmore();
- >>
-
-$[0-9]+
- <<
- NLA = 45;
- {
- static char buf[100];
- numericActionLabel=1; /* MR10 */
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("$i attrib ref too big");
- set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)",
- BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"_t%d%s",
- BlkLevel-1,zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- >>
-
-$[0-9]+.
- <<
- NLA = 46;
- {
- static char buf[100];
- numericActionLabel=1; /* MR10 */
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("$i.field attrib ref too big");
- zzbegexpr[strlen(zzbegexpr)-1] = ' ';
- set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).",
- BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"_t%d%s.",
- BlkLevel-1,zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- >>
-
-$[0-9]+.[0-9]+
- <<
- NLA = 47;
- {
- static char buf[100];
- static char i[20], j[20];
- char *p,*q;
- numericActionLabel=1; /* MR10 */
- if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big");
- for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) {
- if ( q == &i[20] )
- fatalFL("i of $i.j attrib ref too big",
- FileStr[CurFile], zzline );
- *q++ = *p;
- }
- *q = '\0';
- for (p++, q= &j[0]; *p!='\0'; p++) {
- if ( q == &j[20] )
- fatalFL("j of $i.j attrib ref too big",
- FileStr[CurFile], zzline );
- *q++ = *p;
- }
- *q = '\0';
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j);
- else sprintf(buf,"_t%s%s",i,j);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- >>
-
-$[_a-zA-Z][_a-zA-Z0-9]*
- <<
- NLA = 48;
- { static char buf[300]; LabelEntry *el;
- zzbegexpr[0] = ' ';
- if ( CurRule != NULL &&
- strcmp(CurRule, &zzbegexpr[1])==0 ) {
- if ( !GenCC ) zzreplstr("zzaRet");
- }
- else if ( CurRetDef != NULL &&
- strmember(CurRetDef, &zzbegexpr[1])) {
- if ( hasMultipleOperands( CurRetDef ) ) {
- require (strlen(zzbegexpr)<=(size_t)285,
- "$retval attrib ref too big");
- sprintf(buf,"_retv.%s",&zzbegexpr[1]);
- zzreplstr(buf);
- }
- else zzreplstr("_retv");
- }
- else if ( CurParmDef != NULL &&
- strmember(CurParmDef, &zzbegexpr[1])) {
- ;
- }
- else if ( Elabel==NULL ) {
- { err("$-variables in actions outside of rules are not allowed"); }
- } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) {
- /* MR10 */
- /* MR10 */ /* element labels might exist without an elem when */
- /* MR10 */ /* it is a forward reference (to a rule) */
- /* MR10 */
- /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) )
- /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); }
- /* MR10 */
- /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) {
- /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs");
- /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...\>\>\")");
- /* MR10 */ };
- /* MR10 */
- /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */
- /* MR10 */ /* element labels contain pointer to the owners node */
- /* MR10 */
- /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) {
- /* MR10 */ list_add(&CurActionLabels,el);
- /* MR10 */ };
-}
-else
-warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));
-}
-zzmore();
- >>
-
-#0
- <<
- NLA = 49;
- zzreplstr("(*_root)"); zzmore(); chkGTFlag();
- >>
-
-#\[\]
- <<
- NLA = 50;
- if ( GenCC ) {
- if (NewAST) zzreplstr("(newAST)");
- else zzreplstr("(new AST)");}
- else {zzreplstr("zzastnew()");} zzmore();
- chkGTFlag();
- >>
-
-#\(\)
- <<
- NLA = 51;
- zzreplstr("NULL"); zzmore(); chkGTFlag();
- >>
-
-#[0-9]+
- <<
- NLA = 52;
- {
- static char buf[100];
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("#i AST ref too big");
- if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"zzastArg(%s)",zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions);
- chkGTFlag();
- }
- >>
-
-#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n)
- <<
- NLA = 53;
-
- zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
- getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
- >>
-
-#line ~[\n\r]* (\n|\r|\r\n)
- <<
- NLA = 54;
-
- zzline++; zzmore();
- >>
-
-#[_a-zA-Z][_a-zA-Z0-9]*
- <<
- NLA = 55;
-
- if ( !(strcmp(zzbegexpr, "#ifdef")==0 ||
- strcmp(zzbegexpr, "#if")==0 ||
- strcmp(zzbegexpr, "#else")==0 ||
- strcmp(zzbegexpr, "#endif")==0 ||
- strcmp(zzbegexpr, "#ifndef")==0 ||
- strcmp(zzbegexpr, "#define")==0 ||
- strcmp(zzbegexpr, "#pragma")==0 ||
- strcmp(zzbegexpr, "#undef")==0 ||
- strcmp(zzbegexpr, "#import")==0 ||
- strcmp(zzbegexpr, "#line")==0 ||
- strcmp(zzbegexpr, "#include")==0 ||
- strcmp(zzbegexpr, "#error")==0) )
- {
- static char buf[100];
- sprintf(buf, "%s_ast", zzbegexpr+1);
- /* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1));
- zzreplstr(buf);
- chkGTFlag();
- }
- zzmore();
- >>
-
-#\[
- <<
- NLA = 56;
-
- pushint(']');
- if ( GenCC ) {
- if (NewAST) zzreplstr("(newAST(");
- else zzreplstr("(new AST("); }
- else zzreplstr("zzmk_ast(zzastnew(),");
- zzmore();
- chkGTFlag();
- >>
-
-#\(
- <<
- NLA = 57;
-
- pushint('}');
- if ( GenCC ) {
- if (tmakeInParser) {
- zzreplstr("tmake(");
- }
- else {
- zzreplstr("ASTBase::tmake(");
- }
- }
- else {
- zzreplstr("zztmake(");
- }
- zzmore();
- chkGTFlag();
- >>
-
-#
- <<
- NLA = 58;
- zzmore();
- >>
-
-\)
- <<
- NLA = 59;
-
- if ( istackempty() )
- zzmore();
- else if ( topint()==')' ) {
- popint();
- }
- else if ( topint()=='}' ) {
- popint();
- /* terminate #(..) */
- zzreplstr(", NULL)");
- }
- zzmore();
- >>
-
-\[
- <<
- NLA = 60;
-
- pushint('|'); /* look for '|' to terminate simple [...] */
- zzmore();
- >>
-
-\(
- <<
- NLA = 61;
-
- pushint(')');
- zzmore();
- >>
-
-\\\]
- <<
- NLA = 62;
- zzreplstr("]"); zzmore();
- >>
-
-\\\)
- <<
- NLA = 63;
- zzreplstr(")"); zzmore();
- >>
-
-\\>
- <<
- NLA = 64;
- if (! tokenActionActive) zzreplstr(">"); /* MR1 */
- zzmore(); /* MR1 */
- >>
-
-'
- <<
- NLA = 65;
- zzmode(ACTION_CHARS); zzmore();
- >>
-
-\"
- <<
- NLA = 66;
- zzmode(ACTION_STRINGS); zzmore();
- >>
-
-\\$
- <<
- NLA = 67;
- zzreplstr("$"); zzmore();
- >>
-
-\\#
- <<
- NLA = 68;
- zzreplstr("#"); zzmore();
- >>
-
-\\(\n|\r|\r\n)
- <<
- NLA = 69;
- zzline++; zzmore();
- >>
-
-\\~[\]\)>$#]
- <<
- NLA = 70;
- zzmore();
- >>
-
-/
- <<
- NLA = 71;
- zzmore();
- >>
-
-/\*
- <<
- NLA = 72;
- zzmode(ACTION_COMMENTS); zzmore();
- >>
-
-\*/
- <<
- NLA = 73;
- warn("Missing /*; found dangling */ in action"); zzmore();
- >>
-
-//
- <<
- NLA = 74;
- zzmode(ACTION_CPP_COMMENTS); zzmore();
- >>
-
-~[\n\r\)\(\\$#\>\]\[\"'/]+
- <<
- NLA = 75;
- zzmore();
- >>
-
-
-%%PARSE_ENUM_FILE
-
-@
- <<
- NLA = Eof;
- ;
- >>
-
-[\t\ ]+
- <<
- NLA = 137;
- zzskip();
- >>
-
-\n|\r|\r\n
- <<
- NLA = 138;
- zzline++; zzskip();
- >>
-
-//
- <<
- NLA = 139;
- zzmode(TOK_DEF_CPP_COMMENTS); zzmore();
- >>
-
-/\*
- <<
- NLA = 140;
- zzmode(TOK_DEF_COMMENTS); zzskip();
- >>
-
-#ifdef
- <<
- NLA = 141;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- >>
-
-#if
- <<
- NLA = 142;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- >>
-
-#ifndef
- <<
- NLA = 143;
- ;
- >>
-
-#else
- <<
- NLA = 144;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- >>
-
-#endif
- <<
- NLA = 145;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- >>
-
-#undef
- <<
- NLA = 146;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- >>
-
-#import
- <<
- NLA = 147;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- >>
-
-#define
- <<
- NLA = 149;
- >>
-
-enum
- <<
- NLA = 151;
- >>
-
-\{
- <<
- NLA = 152;
- >>
-
-=
- <<
- NLA = 153;
- >>
-
-,
- <<
- NLA = 154;
- >>
-
-\}
- <<
- NLA = 155;
- >>
-
-;
- <<
- NLA = 156;
- >>
-
-[0-9]+
- <<
- NLA = INT;
- >>
-
-[a-zA-Z_][_a-zA-Z0-9]*
- <<
- NLA = ID;
- >>
-
-%%
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c
deleted file mode 100644
index eb11c4d950..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/pred.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/*
- * pred.c -- source for predicate detection, manipulation
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include <stdio.h>
-#include "pcctscfg.h"
-#include "set.h"
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#include "dlgdef.h"
-#include <ctype.h>
-
-#ifdef __USE_PROTOS
-static void complete_context_sets(RuleRefNode *, Predicate *);
-static void complete_context_trees(RuleRefNode *, Predicate *);
-#else
-static void complete_context_sets();
-static void complete_context_trees();
-#endif
-
-char *PRED_AND_LIST = "AND";
-char *PRED_OR_LIST = "OR";
-
-/*
- * In C mode, return the largest constant integer found as the
- * sole argument to LATEXT(i).
- *
- * In C++ mode, return the largest constant integer found as the
- * sole argument to LT(i) given that the char before is nonalpha.
- */
-
-int
-#ifdef __USE_PROTOS
-predicateLookaheadDepth(ActionNode *a)
-#else
-predicateLookaheadDepth(a)
-ActionNode *a;
-#endif
-{
- int max_k=0;
-
- if (a->predEntry != NULL) {
- MR_pred_depth(a->predEntry->pred,&max_k);
- goto PREDENTRY_EXIT;
- }
-
- if ( GenCC )
- {
- /* scan for LT(i) */
- int k = 0;
- char *p = a->action;
- while ( p!=NULL )
- {
- p = strstr(p, "LT(");
- if ( p!=NULL )
- {
- if ( p>=a->action && !isalpha(*(p-1)) )
- {
- k = atoi(p+strlen("LT("));
- if ( k>max_k ) max_k=k;
- }
- p += strlen("LT(");
- }
- }
- }
- else {
- /* scan for LATEXT(i) */
- int k = 0;
- char *p = a->action;
- while ( p!=NULL )
- {
- p = strstr(p, "LATEXT(");
- if ( p!=NULL )
- {
- p += strlen("LATEXT(");
- k = atoi(p);
- if ( k>max_k ) max_k=k;
- }
- }
- }
-
- if (max_k==0) {
- max_k = 1; /* MR33 Badly designed if didn't set max_k when CLL_k = 1 */
- if (CLL_k > 1) /* MR27 Don't warn if max(k,ck) == 1 */
- {
- if ( !a->frmwarned )
- {
- a->frmwarned = 1;
- warnFL(eMsg1("predicate: %s missing, bad, or with i=0; assuming i=1",
- GenCC?"LT(i)":"LATEXT(i)"),
- FileStr[a->file], a->line);
- }
- }
- }
-
-/* MR10 */ if ( max_k > CLL_k) {
-/* MR10 */ if ( !a->frmwarned )
-/* MR10 */ {
-/* MR10 */ a->frmwarned = 1;
-/* MR11 */ errFL(eMsgd2("predicate refers to lookahead token %d. Semantic lookahead is limited to max(k,ck)==%d",
-/* MR10 */ max_k,CLL_k),
-/* MR10 */ FileStr[a->file],a->line);
-/* MR10 */ if (max_k >= OutputLL_k) {
-/* MR10 */ if (!GenCC) {
-/* MR10 */ errFL(eMsgd(" the lookahead buffer size in C mode is %d token(s) (including the one just recognized)",
-/* MR10 */ OutputLL_k),
-/* MR10 */ FileStr[a->file],a->line);
-/* MR10 */ };
-/* MR10 */ };
-/* MR10 */ };
-/* MR10 */ max_k= CLL_k;
-/* MR10 */ };
-
-PREDENTRY_EXIT:
- return max_k;
-}
-
-/* Find all predicates in a block of alternatives. DO NOT find predicates
- * behind the block because that predicate could depend on things set in
- * one of the nonoptional blocks
- */
-
-Predicate *
-#ifdef __USE_PROTOS
-find_in_aSubBlk( Junction *alt )
-#else
-find_in_aSubBlk( alt )
-Junction *alt;
-#endif
-{
- Predicate *a, *head=NULL, *tail=NULL, *root=NULL;
- Junction *p = alt;
-
- if (MRhoisting) {
- return MR_find_in_aSubBlk(alt);
- };
- for (; p!=NULL; p=(Junction *)p->p2)
- {
- /* ignore empty alts */
- if ( p->p1->ntype != nJunction ||
- ((Junction *)p->p1)->jtype != EndBlk )
- {
- a = find_predicates(p->p1); /* get preds for this alt */
- if ( a==NULL ) continue;
-
- /* make an OR list of predicates */
- if ( head==NULL )
- {
- root = new_pred();
- root->expr = PRED_OR_LIST;
- head = tail = a;
- root->down = head;
- }
- else {
- tail->right = a;
- a->left = tail;
- a->up = tail->up;
- tail = a;
- }
- }
- }
-
- /* if just one pred, remove OR root */
- if ( root!=NULL && root->down->right == NULL )
- {
- Predicate *d = root->down;
- free( (char *) root);
- return d;
- }
-
- return root;
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-find_in_aOptBlk( Junction *alt )
-#else
-find_in_aOptBlk( alt )
-Junction *alt;
-#endif
-{
- return find_in_aSubBlk( alt );
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-find_in_aLoopBegin( Junction *alt )
-#else
-find_in_aLoopBegin( alt )
-Junction *alt;
-#endif
-{
- return find_in_aSubBlk( (Junction *) alt->p1 ); /* get preds in alts */
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-find_in_aPlusBlk( Junction *alt )
-#else
-find_in_aPlusBlk( alt )
-Junction *alt;
-#endif
-{
- require(alt!=NULL&&alt->p2!=NULL, "invalid aPlusBlk");
- return find_in_aSubBlk( alt );
-}
-
-/* Look for a predicate;
- *
- * Do not pass anything but Junction nodes; no Actions, Tokens, RuleRefs.
- * This means that a "hoisting distance" of zero is the only distance
- * allowable. Init actions are ignored.
- *
- * WARNING:
- * Assumes no (..)? block after predicate for the moment.
- * Does not check to see if pred is in production that can generate
- * a sequence contained in the set of ambiguous tuples.
- *
- * Return the predicate found if any.
- */
-
-
-Predicate *
-#ifdef __USE_PROTOS
-find_predicates( Node *alt )
-#else
-find_predicates( alt )
-Node *alt;
-#endif
-{
-#ifdef DBG_PRED
- Junction *j;
- RuleRefNode *r;
- TokNode *t;
-#endif
- Predicate *pred;
-
- if ( alt==NULL ) return NULL;
-
-#ifdef DBG_PRED
- switch ( alt->ntype )
- {
- case nJunction :
- j = (Junction *) alt;
- fprintf(stderr, "Junction(in %s)", j->rname);
- switch ( j->jtype )
- {
- case aSubBlk :
- fprintf(stderr,"aSubBlk\n");
- break;
- case aOptBlk :
- fprintf(stderr,"aOptBlk\n");
- break;
- case aLoopBegin :
- fprintf(stderr,"aLoopBeginBlk\n");
- break;
- case aLoopBlk :
- fprintf(stderr,"aLoopBlk\n");
- break;
- case aPlusBlk :
- fprintf(stderr,"aPlusBlk\n");
- break;
- case EndBlk :
- fprintf(stderr,"EndBlk\n");
- break;
- case RuleBlk :
- fprintf(stderr,"RuleBlk\n");
- break;
- case Generic :
- fprintf(stderr,"Generic\n");
- break;
- case EndRule :
- fprintf(stderr,"EndRule\n");
- break;
- }
- break;
- case nRuleRef :
- r = (RuleRefNode *) alt;
- fprintf(stderr, "RuleRef(in %s)\n", r->rname);
- break;
- case nToken :
- t = (TokNode *) alt;
- fprintf(stderr, "TokenNode(in %s)%s\n", t->rname, TokenString(t->token));
- break;
- case nAction :
- fprintf(stderr, "Action\n");
- break;
- }
-#endif
-
- switch ( alt->ntype )
- {
- case nJunction :
- {
- Predicate *a, *b;
- Junction *p = (Junction *) alt;
-
- /* lock nodes */
- if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
- p->jtype==aPlusBlk || p->jtype==EndRule )
- {
- require(p->pred_lock!=NULL, "rJunc: lock array is NULL");
- if ( p->pred_lock[1] )
- {
- return NULL;
- }
- p->pred_lock[1] = TRUE;
- }
-
- switch ( p->jtype )
- {
- case aSubBlk :
- a = find_in_aSubBlk(p);
- return a; /* nothing is visible past this guy */
- case aOptBlk :
- a = find_in_aOptBlk(p);
- return a;
- case aLoopBegin :
- a = find_in_aLoopBegin(p);
- return a;
- case aLoopBlk :
- a = find_in_aSubBlk(p);
- p->pred_lock[1] = FALSE;
- return a;
- case aPlusBlk :
- a = find_in_aPlusBlk(p);
- p->pred_lock[1] = FALSE;
- return a; /* nothing is visible past this guy */
- case RuleBlk :
- a = find_predicates(p->p1);
- p->pred_lock[1] = FALSE;
- return a;
- case Generic :
- a = find_predicates(p->p1);
- b = find_predicates(p->p2);
- if ( p->pred_lock!=NULL ) p->pred_lock[1] = FALSE;
- if ( a==NULL ) return b;
- if ( b==NULL ) return a;
- /* otherwise OR the two preds together */
- {
- fatal_internal("hit unknown situation during predicate hoisting");
- }
- case EndBlk :
- case EndRule : /* Find no predicates after a rule ref */
- return NULL;
- default:
- fatal_internal("this cannot be printed\n");
- break;
- }
- }
- case nAction :
- {
- ActionNode *p = (ActionNode *) alt;
- if ( p->noHoist) return NULL; /* MR12c */
- if ( p->init_action ) return find_predicates(p->next);
- if ( p->is_predicate )
- {
- Tree *t=NULL;
-#ifdef DBG_PRED
- fprintf(stderr, "predicate: <<%s>>?\n", p->action);
-#endif
- if ( p->guardpred!=NULL )
- {
- pred = predicate_dup(p->guardpred);
- MR_guardPred_plainSet(p,pred); /* MR12c */
- }
- else
- {
- pred = new_pred();
- pred->k = predicateLookaheadDepth(p);
- pred->source = p;
- pred->expr = p->action;
- if ( HoistPredicateContext && pred->k > 1 )
- {
- /* MR30 No need to use first_item_is_guess_block_extra
- since we know this is an action, not a (...)* or
- (...)+ block.
- */
-
- if ( first_item_is_guess_block((Junction *)p->next) )
- {
- warnFL("cannot compute context of predicate in front of (..)? block",
- FileStr[p->file], p->line);
- }
- else
- {
- ConstrainSearch = 0;
-/* MR11 */ if (p->ampersandPred != NULL) {
-/* MR11 */ TRAV(p,
-/* MR11 */ pred->k,
-/* MR11 */ &(pred->completionTree), t);
-/* MR11 */ } else {
- TRAV(p->next,
- pred->k,
- &(pred->completionTree), t);
- };
- pred->tcontext = t;
- MR_check_pred_too_long(pred,pred->completionTree);
-#ifdef DBG_PRED
- fprintf(stderr, "LL(%d) context:", pred->k);
- preorder(t);
- fprintf(stderr, "\n");
-#endif
- }
- }
- else if ( HoistPredicateContext && pred->k == 1 )
- {
- pred->scontext[1] = empty;
- /* MR30 No need to use first_item_is_guess_block_extra
- since we know this is an action.
- */
- if ( first_item_is_guess_block((Junction *)p->next) )
- {
- warnFL("cannot compute context of predicate in front of (..)? block",
- FileStr[p->file], p->line);
- }
- else
- {
- REACH((Junction *)p->next,
- 1,
- &(pred->completionSet),
- pred->scontext[1]);
- MR_check_pred_too_long(pred,pred->completionSet);
-#ifdef DBG_PRED
- fprintf(stderr, "LL(1) context:");
- s_fprT(stderr, pred->scontext[1]);
- fprintf(stderr, "\n");
-#endif
- }
- }
- }
- {
- Predicate *d = find_predicates(p->next);
- Predicate *root;
-
-/* Warning: Doesn't seem like the up pointers will all be set correctly;
- * TJP: that's ok, we're not using them now.
- */
- if ( d!=NULL )
- {
- root = new_pred();
- root->expr = PRED_AND_LIST;
- root->down = pred;
- pred->right = d;
- pred->up = root;
- d->left = pred;
- d->up = pred->up;
- return root;
- }
- }
- return pred;
- }
- return NULL;
- }
- case nRuleRef :
- {
- Predicate *a;
- RuleRefNode *p = (RuleRefNode *) alt;
- Junction *r;
- Junction *save_MR_RuleBlkWithHalt;
-
- RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
- if ( q == NULL )
- {
- warnFL( eMsg1("rule %s not defined",p->text), FileStr[p->file], p->line );
- return NULL;
- }
- r = RulePtr[q->rulenum];
- if ( r->pred_lock[1] )
- {
- /* infinite left-recursion; ignore 'cause LL sup 1 (k) analysis
- * must have seen it earlier.
- */
- return NULL;
- }
-
- /* MR10 There should only be one halt set at a time. */
- /* MR10 Life would have been easier with a global variable */
- /* MR10 (at least for this particular need) */
- /* MR10 Unset the old one and set the new one, later undo. */
-
- require(r->end->halt == FALSE,"should only have one halt at a time");
-
-/* MR10 */ require(MR_RuleBlkWithHalt == NULL ||
-/* MR10 */ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE),
-/* MR10 */ "RuleBlkWithHalt->end not RuleBlk or does not have halt set");
-/* MR10 */ if (MR_RuleBlkWithHalt != NULL) {
-/* MR10 */ MR_RuleBlkWithHalt->end->halt=FALSE;
-/* MR10 */ };
-
-/*** fprintf(stderr,"\nSetting halt on junction #%d\n",r->end->seq); ***/
-
- require(r->end->halt == FALSE,"rule->end->halt already set");
-
- save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt;
-
-/* MR10 */ MR_pointerStackPush(&MR_RuleBlkWithHaltStack,MR_RuleBlkWithHalt);
-/* MR10 */ MR_pointerStackPush(&MR_PredRuleRefStack,p);
-
- r->end->halt = TRUE;
-/* MR10 */ MR_RuleBlkWithHalt=r;
-
- a = find_predicates((Node *)r);
-
- require(r->end->halt == TRUE,"rule->end->halt not set");
- r->end->halt = FALSE;
-
-/* MR10 */ MR_pointerStackPop(&MR_PredRuleRefStack);
-/* MR10 */ MR_RuleBlkWithHalt=(Junction *) MR_pointerStackPop(&MR_RuleBlkWithHaltStack);
-
- require (MR_RuleBlkWithHalt==save_MR_RuleBlkWithHalt,
- "RuleBlkWithHaltStack not consistent");
-
-/* MR10 */ require(MR_RuleBlkWithHalt == NULL ||
-/* MR10 */ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == FALSE),
-/* MR10 */ "RuleBlkWithHalt->end not RuleBlk or has no halt set");
-/* MR10 */ if (MR_RuleBlkWithHalt != NULL) {
-/* MR10 */ MR_RuleBlkWithHalt->end->halt=TRUE;
-/* MR10 */ };
-
-/*** fprintf(stderr,"\nRestoring halt on junction #%d\n",r->end->seq); ***/
-
- if ( a==NULL ) return NULL;
-
- /* attempt to compute the "local" FOLLOW just like in normal lookahead
- * computation if needed
- */
-
- complete_context_sets(p,a);
- complete_context_trees(p,a);
-
-/* MR10 */ MR_cleanup_pred_trees(a);
-
- return a;
- }
- case nToken :
- break;
- }
-
- return NULL;
-}
-
-#ifdef __USE_PROTOS
-Predicate *MR_find_predicates_and_supp(Node *alt)
-#else
-Predicate *MR_find_predicates_and_supp(alt)
- Node *alt;
-#endif
-{
- Predicate *p;
-
- p=find_predicates(alt);
- p=MR_suppressK(alt,p);
- return p;
-}
-
-Predicate *
-#ifdef __USE_PROTOS
-new_pred( void )
-#else
-new_pred( )
-#endif
-{
- Predicate *p = (Predicate *) calloc(1,sizeof(Predicate)); /* MR10 */
- require(p!=NULL, "new_pred: cannot alloc predicate");
- p->scontext[0]=empty;
- p->scontext[1]=empty;
- p->completionTree=empty;
- p->completionSet=empty;
- p->plainSet=empty;
- return p;
-}
-
-static void
-#ifdef __USE_PROTOS
-complete_context_sets( RuleRefNode *p, Predicate *a )
-#else
-complete_context_sets( p, a )
-RuleRefNode *p;
-Predicate *a;
-#endif
-{
- set rk2, b;
- int k2;
-
-#ifdef DBG_PRED
- fprintf(stderr, "enter complete_context_sets\n");
-#endif
- for (; a!=NULL; a=a->right)
- {
- if ( a->expr == PRED_AND_LIST || a->expr == PRED_OR_LIST )
- {
- complete_context_sets(p,a->down);
- continue;
- }
- rk2 = b = empty;
- while ( !set_nil(a->completionSet) )
- {
- k2 = set_int(a->completionSet);
- set_rm(k2, a->completionSet);
-
- REACH(p->next, k2, &rk2, b);
- set_orin(&(a->scontext[1]), b);
- set_free(b);
- }
-
- set_orin(&(a->completionSet), rk2);/* remember what we couldn't do */
- set_free(rk2);
-#ifdef DBG_PRED
- fprintf(stderr, "LL(1) context for %s(addr 0x%x) after ruleref:", a->expr, a);
- s_fprT(stderr, a->scontext[1]);
- fprintf(stderr, "\n");
-#endif
-/* complete_context_sets(p, a->down);*/
- }
-#ifdef DBG_PRED
- fprintf(stderr, "exit complete_context_sets\n");
-#endif
-}
-
-static void
-#ifdef __USE_PROTOS
-complete_context_trees( RuleRefNode *p, Predicate *a )
-#else
-complete_context_trees( p, a )
-RuleRefNode *p;
-Predicate *a;
-#endif
-{
- set rk2;
- int k2;
- Tree *u;
-
-#ifdef DBG_PRED
- fprintf(stderr, "enter complete_context_trees\n");
-#endif
- for (; a!=NULL; a=a->right)
- {
- if ( a->expr == PRED_AND_LIST || a->expr == PRED_OR_LIST )
- {
- complete_context_trees(p, a->down);
- continue;
- }
- rk2 = empty;
-
- /* any k left to do? if so, link onto tree */
- while ( !set_nil(a->completionTree) )
- {
- k2 = set_int(a->completionTree);
- set_rm(k2, a->completionTree);
- u = NULL;
-
- TRAV(p->next, k2, &rk2, u);
-
- /* any subtrees missing k2 tokens, add u onto end */
- a->tcontext = tlink(a->tcontext, u, k2);
- Tfree(u); /* MR10 */
- }
- set_orin(&(a->completionTree), rk2);/* remember what we couldn't do */
- set_free(rk2);
-#ifdef DBG_PRED
- fprintf(stderr, "LL(i<%d) context after ruleref:", LL_k);
- preorder(a->tcontext);
- fprintf(stderr, "\n");
-#endif
-/* complete_context_trees(p, a->down);*/
- }
-#ifdef DBG_PRED
- fprintf(stderr, "exit complete_context_trees\n");
-#endif
-}
-
-/* Walk a list of predicates and return the set of all tokens in scontext[1]'s */
-set
-#ifdef __USE_PROTOS
-covered_set( Predicate *p )
-#else
-covered_set( p )
-Predicate *p;
-#endif
-{
- set a;
-
- a = empty;
- for (; p!=NULL; p=p->right)
- {
- if ( p->expr == PRED_AND_LIST || p->expr == PRED_OR_LIST )
- {
- set_orin(&a, covered_set(p->down));
- continue;
- }
- set_orin(&a, p->scontext[1]);
- set_orin(&a, covered_set(p->down));
- }
- return a;
-}
-
-/* MR10 predicate_free()
- MR10 Don't free the leaf nodes since they are part of the action node
-*/
-
-#ifdef __USE_PROTOS
-void predicate_free(Predicate *p)
-#else
-void predicate_free(p)
- Predicate *p;
-#endif
-{
- if (p == NULL) return;
- predicate_free(p->right);
- predicate_free(p->down);
- if (p->cloned ||
- p->source == NULL ||
- p->source->guardpred == NULL ||
- p->expr == PRED_AND_LIST ||
- p->expr == PRED_OR_LIST) {
- set_free(p->scontext[1]);
- set_free(p->completionSet);
- set_free(p->completionTree);
- set_free(p->plainSet);
- Tfree(p->tcontext);
- free( (char *) p);
- } else {
- p->right=NULL;
- p->down=NULL; /* MR13 *** debug */
- };
-}
-
-/* MR10 predicate_dup() */
-
-#ifdef __USE_PROTOS
-Predicate * predicate_dup_xxx(Predicate *p,int contextToo)
-#else
-Predicate * predicate_dup_xxx(p,contextToo)
- Predicate *p;
- int contextToo;
-#endif
-{
- Predicate *q;
-
- if (p == NULL) return NULL;
- q=new_pred();
- q->down=predicate_dup(p->down);
- q->right=predicate_dup(p->right);
-
- /*
- don't replicate expr - it is read-only
- and address comparison is used to look
- for identical predicates.
- */
-
- q->expr=p->expr;
- q->k=p->k;
- q->source=p->source;
- q->cloned=1;
- q->ampersandStyle=p->ampersandStyle;
- q->inverted=p->inverted;
- q->predEntry=p->predEntry;
- q->plainSet=set_dup(p->plainSet);
-
- if (contextToo) {
- q->tcontext=tdup(p->tcontext);
- q->scontext[0]=set_dup(p->scontext[0]);
- q->scontext[1]=set_dup(p->scontext[1]);
- q->completionTree=set_dup(p->completionTree);
- q->completionSet=set_dup(p->completionSet);
- };
-
- /* don't need to dup "redundant" */
-
- return q;
-
-}
-
-#ifdef __USE_PROTOS
-Predicate * predicate_dup_without_context(Predicate *p)
-#else
-Predicate * predicate_dup_without_context(p)
- Predicate *p;
-#endif
-{
- return predicate_dup_xxx(p,0);
-}
-
-#ifdef __USE_PROTOS
-Predicate * predicate_dup(Predicate *p)
-#else
-Predicate * predicate_dup(p)
- Predicate *p;
-#endif
-{
- return predicate_dup_xxx(p,1);
-}
-
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h
deleted file mode 100644
index 53035e720e..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/proto.h
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- * proto.h -- function prototypes
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
- /* V a r i a b l e s */
-
-extern int tp;
-extern Junction *SynDiag;
-extern char Version[];
-extern char VersionDef[];
-#ifdef __cplusplus
-extern void (*fpPrint[])(...);
-#else
-extern void (*fpPrint[])();
-#endif
-#ifdef __cplusplus
-extern struct _set (*fpReach[])(...);
-#else
-extern struct _set (*fpReach[])();
-#endif
-#ifdef __cplusplus
-extern struct _tree *(*fpTraverse[])(...);
-#else
-extern struct _tree *(*fpTraverse[])();
-#endif
-#ifdef __cplusplus
-extern void (**fpTrans)(...);
-#else
-extern void (**fpTrans)();
-#endif
-#ifdef __cplusplus
-extern void (**fpJTrans)(...);
-#else
-extern void (**fpJTrans)();
-#endif
-#ifdef __cplusplus
-extern void (*C_Trans[NumNodeTypes+1])(...);
-#else
-extern void (*C_Trans[])();
-#endif
-#ifdef __cplusplus
-extern void (*C_JTrans[NumJuncTypes+1])(...);
-#else
-extern void (*C_JTrans[])();
-#endif
-extern int BlkLevel;
-extern int CurFile;
-extern char *CurPredName;
-extern char *CurRule;
-extern int CurRuleDebug; /* MR13 */
-extern Junction *CurRuleBlk;
-extern RuleEntry *CurRuleNode;
-extern ListNode *CurElementLabels;
-extern ListNode *CurAstLabelsInActions; /* MR27 */
-extern ListNode *ContextGuardPredicateList; /* MR13 */
-extern ListNode *CurActionLabels;
-extern int numericActionLabel; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */
-extern ListNode *NumericPredLabels; /* MR10 << ... $1 ... >>? ONLY */
-extern char *FileStr[];
-extern int NumFiles;
-extern int EpToken;
-extern int WildCardToken;
-extern Entry **Tname,
- **Texpr,
- **Rname,
- **Fcache,
- **Tcache,
- **Elabel,
- **Sname,
- **Pname; /* MR11 */
-extern ListNode *ExprOrder;
-extern ListNode **Cycles;
-extern int TokenNum;
-extern int LastTokenCounted;
-extern ListNode *BeforeActions, *AfterActions, *LexActions;
-
-/* MR1 */
-/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */
-/* MR1 via #lexmember <<....>> & #lexprefix <<...>> */
-/* MR1 */
-
-extern ListNode *LexMemberActions; /* MR1 */
-extern ListNode *LexPrefixActions; /* MR1 */
-
-extern set *fset; /* for constrained search */ /* MR11 */
-extern int maxk; /* for constrained search */ /* MR11 */
-extern int Save_argc; /* MR10 */
-extern char **Save_argv; /* MR10 */
-extern ListNode *eclasses, *tclasses;
-extern char *HdrAction;
-extern char *FirstAction; /* MR11 */
-extern FILE *ErrFile;
-extern char *RemapFileName;
-extern char *ErrFileName;
-extern char *DlgFileName;
-extern char *DefFileName;
-extern char *ModeFileName;
-extern char *StdMsgName;
-extern int NumRules;
-extern Junction **RulePtr;
-extern int LL_k;
-extern int CLL_k;
-extern char *decodeJType[];
-extern int PrintOut;
-extern int PrintAnnotate;
-extern int CodeGen;
-extern int LexGen;
-extern int esetnum;
-extern int setnum;
-extern int wordnum;
-extern int GenAST;
-extern int GenANSI;
-extern int **FoStack;
-extern int **FoTOS;
-extern int GenExprSetsOpt;
-extern FILE *DefFile;
-extern int CannotContinue;
-extern int GenCR;
-extern int GenLineInfo;
-extern int GenLineInfoMS;
-extern int action_file, action_line;
-extern int TraceGen;
-extern int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile;
-extern char *CurAmbigbtype;
-extern int elevel;
-extern int GenEClasseForRules;
-extern FILE *input, *output;
-extern char **TokenStr, **ExprStr;
-extern int CurrentLexClass, NumLexClasses;
-extern LClass lclass[];
-extern char LexStartSymbol[];
-extern char *CurRetDef;
-extern char *CurParmDef;
-extern int OutputLL_k;
-extern int TreeResourceLimit;
-extern int DemandLookahead;
-extern char *RulePrefix;
-extern int GenStdPccts;
-extern char *stdpccts;
-extern int ParseWithPredicates;
-extern int ConstrainSearch;
-extern int PURIFY; /* MR23 */
-
-extern set MR_CompromisedRules; /* MR14 */
-extern int MR_AmbSourceSearch; /* MR11 */
-extern int MR_SuppressSearch; /* MR13 */
-extern int MR_AmbSourceSearchGroup; /* MR11 */
-extern int MR_AmbSourceSearchChoice; /* MR11 */
-extern int MR_AmbSourceSearchLimit; /* MR11 */
-extern int MR_usingPredNames; /* MR11 */
-extern int MR_ErrorSetComputationActive; /* MR14 */
-extern char *MR_AmbAidRule; /* MR11 */
-extern int MR_AmbAidLine; /* MR11 */
-extern int MR_AmbAidMultiple; /* MR11 */
-extern int MR_AmbAidDepth; /* MR11 */
-extern int MR_skipped_e3_report; /* MR11 */
-extern int MR_matched_AmbAidRule; /* MR11 */
-extern int MR_Inhibit_Tokens_h_Gen; /* MR13 */
-extern int NewAST; /* MR13 */
-extern int tmakeInParser; /* MR23 */
-extern int AlphaBetaTrace; /* MR14 */
-extern int MR_BlkErr; /* MR21 */
-extern int MR_AlphaBetaWarning; /* MR14 */
-extern int MR_AlphaBetaMessageCount; /* MR14 */
-extern int MR_MaintainBackTrace; /* MR14 */
-extern int MR_BadExprSets; /* MR13 */
-extern int FoundGuessBlk;
-extern int FoundException;
-extern int FoundAtOperator; /* MR6 */
-extern int FoundExceptionGroup; /* MR6 */
-extern int WarningLevel;
-extern int UseStdout; /* MR6 */
-extern int TabWidth; /* MR6 */
-extern int pLevel;
-extern int pAlt1;
-extern int pAlt2;
-extern int AImode;
-extern int HoistPredicateContext;
-extern int MRhoisting; /* MR9 */
-extern int MRhoistingk; /* MR13 */
-extern int MR_debugGenRule; /* MR11 */
-extern int GenCC;
-extern char *ParserName;
-extern char *StandardSymbols[];
-extern char *ASTSymbols[];
-extern set reserved_positions;
-extern set all_tokens;
-extern set imag_tokens;
-extern set tokclasses;
-extern ListNode *ForcedTokens;
-extern int *TokenInd;
-extern FILE *Parser_h, *Parser_c;
-extern char CurrentClassName[];
-extern int no_classes_found;
-extern char Parser_h_Name[];
-extern char Parser_c_Name[];
-extern char MRinfoFile_Name[]; /* MR10 */
-extern FILE *MRinfoFile; /* MR10 */
-extern int MRinfo; /* MR10 */
-extern int MRinfoSeq; /* MR10 */
-extern int InfoP; /* MR10 */
-extern int InfoT; /* MR10 */
-extern int InfoF; /* MR10 */
-extern int InfoM; /* MR10 */
-extern int InfoO; /* MR12 */
-extern int PotentialSuppression; /* MR10 */
-extern int PotentialDummy; /* MR10 */
-extern int TnodesInUse; /* MR10 */
-extern int TnodesPeak; /* MR10 */
-extern int TnodesReportThreshold; /* MR11 */
-extern int TnodesAllocated; /* MR10 */
-extern char *ClassDeclStuff; /* MR10 */
-extern char *BaseClassName; /* MR22 */
-extern ListNode *class_before_actions, *class_after_actions;
-extern char *UserTokenDefsFile;
-extern int UserDefdTokens;
-extern ListNode *MetaTokenNodes;
-extern char *OutputDirectory;
-extern int DontCopyTokens;
-extern int LTinTokenAction; /* MR23 */
-extern set AST_nodes_refd_in_actions;
-extern ListNode *CurExGroups;
-extern int CurBlockID;
-extern int CurAltNum;
-extern Junction *CurAltStart;
-extern Junction *OuterAltStart; /* chain exception groups MR7 */
-extern ExceptionGroup *DefaultExGroup;
-extern int NumSignals;
-extern int ContextGuardTRAV;
-extern Junction *MR_RuleBlkWithHalt; /* MR10 */
-extern PointerStack MR_BackTraceStack; /* MR10 */
-extern PointerStack MR_PredRuleRefStack; /* MR10 */
-extern PointerStack MR_RuleBlkWithHaltStack; /* MR10 */
-
-/* */
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
-/* MR1 in DLG action */
-/* */
-extern int tokenActionActive; /* MR1 */
-
-extern char *PRED_OR_LIST; /* MR10 */
-extern char *PRED_AND_LIST; /* MR10 */
-
-#ifdef __VMS
-#define STRICMP strcasecmp /* MR21 */
-#else
-#define STRICMP stricmp /* MR21 */
-#endif
-
-/* MR26 */
-#ifdef PCCTS_USE_STDARG
-extern Tree *tmake(Tree *root, ...);
-#else
-extern Tree *tmake();
-#endif
-
-#ifdef __USE_PROTOS
-extern int STRICMP(const char*, const char*);
-extern void istackreset(void);
-extern int istacksize(void);
-extern void pushint(int);
-extern int popint( void );
-extern int istackempty( void );
-extern int topint( void );
-extern void NewSetWd( void );
-extern void DumpSetWd( void );
-extern void DumpSetWdForC( void );
-extern void DumpSetWdForCC( void );
-extern void NewSet( void );
-extern void FillSet( set );
-extern void ComputeErrorSets( void );
-extern void ComputeTokSets( void );
-extern void SubstErrorClass( set * );
-extern int DefErrSet( set *, int, char * );
-extern int DefErrSetForC( set *, int, char * );
-extern int DefErrSetForCC( set *, int, char * );
-extern int DefErrSet1(int, set *, int, char *); /* MR21 */
-extern int DefErrSetForC1(int, set *, int, char *, const char* ); /* MR21 */
-extern int DefErrSetForCC1(int, set *, int, char *, const char* ); /* MR21 */
-extern int DefErrSetWithSuffix(int, set *, int, char *, const char *); /* MR21 */
-extern void GenErrHdr( void );
-extern void dumpExpr( FILE *, char * );
-extern void addParm( Node *, char * );
-extern Graph buildAction( char *, int, int, int );
-extern Graph buildToken( char * );
-extern Graph buildWildCard( char * );
-extern Graph buildRuleRef( char * );
-extern Graph Or( Graph, Graph );
-extern Graph Cat( Graph, Graph );
-extern Graph makeOpt( Graph, int, char *);
-extern Graph makeBlk( Graph, int, char *);
-extern Graph makeLoop( Graph, int, char *);
-extern Graph makePlus( Graph, int, char *);
-extern Graph emptyAlt( void );
-extern Graph emptyAlt3( void );
-extern TokNode * newTokNode( void );
-extern RuleRefNode * newRNode( void );
-extern Junction * newJunction( void );
-extern ActionNode * newActionNode( void );
-extern char * makelocks( void );
-extern void preorder( Tree * );
-extern Tree * tnode( int );
-extern void _Tfree( Tree * );
-extern Tree * tdup( Tree * );
-extern int is_single_tuple( Tree * );
-extern Tree * tappend( Tree *, Tree * );
-extern void Tfree( Tree * );
-extern Tree * tlink( Tree *, Tree *, int );
-extern Tree * tshrink( Tree * );
-extern Tree * tflatten( Tree * );
-extern Tree * tJunc( Junction *, int, set * );
-extern Tree * tRuleRef( RuleRefNode *, int, set * );
-extern Tree * tToken( TokNode *, int, set * );
-extern Tree * tAction( ActionNode *, int, set * );
-extern int tmember( Tree *, Tree * );
-extern int tmember_constrained( Tree *, Tree * );
-extern Tree * tleft_factor( Tree * );
-extern Tree * trm_perm( Tree *, Tree * );
-extern void tcvt( set *, Tree * );
-extern Tree * permute( int, int );
-extern Tree * VerifyAmbig( Junction *, Junction *, unsigned **, set *, Tree **, Tree **, int * );
-extern set rJunc( Junction *, int, set * );
-extern set rRuleRef( RuleRefNode *, int, set * );
-extern set rToken( TokNode *, int, set * );
-extern set rAction( ActionNode *, int, set * );
-extern void HandleAmbiguity( Junction *, Junction *, Junction *, int );
-extern set First( Junction *, int, int, int * );
-extern void freeBlkFsets( Junction * );
-extern void genAction( ActionNode * );
-extern void genRuleRef( RuleRefNode * );
-extern void genToken( TokNode * );
-extern void genOptBlk( Junction * );
-extern void genLoopBlk( Junction *, Junction *, Junction *, int );
-extern void genLoopBegin( Junction * );
-extern void genPlusBlk( Junction * );
-extern void genSubBlk( Junction * );
-extern void genRule( Junction * );
-extern void genJunction( Junction * );
-extern void genEndBlk( Junction * );
-extern void genEndRule( Junction * );
-extern void genHdr( int );
-extern void genHdr1( int );
-extern void dumpAction( char *, FILE *, int, int, int, int );
-extern void dumpActionPlus(ActionNode*, char *, FILE *, int, int, int, int ); /* MR21 */
-extern Entry ** newHashTable( void );
-extern Entry * hash_add( Entry **, char *, Entry * );
-extern Entry * hash_get( Entry **, char * );
-extern void hashStat( Entry ** );
-extern char * mystrdup( char * );
-extern void genLexDescr( void );
-extern void dumpLexClasses( FILE * );
-extern void genDefFile( void );
-extern void DumpListOfParmNames( char *, FILE *, int ); /* MR5 janm 26-May-97 */
-extern int DumpNextNameInDef( char **, FILE * );
-extern void DumpOldStyleParms( char *, FILE * );
-extern void DumpType( char *, FILE * );
-extern int strmember( char *, char * );
-/* extern int HasComma( char * ); MR23 Replaced by hasMultipleOperands() */
-extern void DumpRetValStruct( FILE *, char *, int );
-extern char * StripQuotes( char * );
-extern int main( int, char *[] );
-extern void readDescr( void );
-extern FILE * NextFile( void );
-extern char * outnameX( char *, char *);
-extern char * outname( char * );
-extern void fatalFL( char *, char *, int );
-extern void fatal_intern( char *, char *, int );
-extern void cleanUp( void );
-extern char * eMsg3( char *, char *, char *, char * );
-extern char * eMsgd( char *, int );
-extern char * eMsgd2( char *, int, int );
-extern void s_fprT( FILE *, set );
-extern char * TerminalString( int );
-extern void lexclass( char * );
-extern void lexmode( int );
-extern int LexClassIndex( char * );
-extern int hasAction( char * );
-extern void setHasAction( char *, char * );
-extern int addTname( char * );
-extern int addTexpr( char * );
-extern int Tnum( char * );
-extern void Tklink( char *, char * );
-extern Entry * newEntry( char *, int );
-extern void list_add( ListNode **, void * );
-extern void list_free( ListNode **, int freeData ); /* MR10 */
-extern void list_apply( ListNode *, void (*)(void *) );
-extern int list_search_cstring (ListNode *, char *); /* MR27 */
-extern char * Fkey( char *, int, int );
-extern void FoPush( char *, int );
-extern void FoPop( int );
-extern void RegisterCycle( char *, int );
-extern void ResolveFoCycles( int );
-extern void pJunc( Junction * );
-extern void pRuleRef( RuleRefNode * );
-extern void pToken( TokNode * );
-extern void pAction( ActionNode * );
-extern void FoLink( Node * );
-extern void addFoLink( Node *, char *, Junction * );
-extern void GenCrossRef( Junction * );
-extern void defErr( char *, long, long, long, long, long, long );
-extern void genStdPCCTSIncludeFile(FILE *,char *); /* MR10 */
-extern char * pcctsBaseName(char *); /* MR32 */
-extern Predicate *find_predicates(Node *); /* MR10 */
-extern Predicate *MR_find_predicates_and_supp(Node *); /* MR13 */
-extern int predicateLookaheadDepth(ActionNode *); /* MR10 */
-extern void predicate_free(Predicate *); /* MR10 */
-extern Predicate * predicate_dup(Predicate *); /* MR10 */
-extern Predicate * predicate_dup_without_context(Predicate *); /* MR11 */
-extern void GenRulePrototypes(FILE *, Junction *);
-extern Junction *first_item_is_guess_block(Junction *);
-extern Junction *first_item_is_guess_block_extra(Junction * q); /* MR30 */
-extern Junction *analysis_point(Junction *);
-extern Tree *make_tree_from_sets(set *, set *);
-extern Tree *tdup_chain(Tree *);
-extern Tree *tdif(Tree *, Predicate *, set *, set *);
-extern set covered_set(Predicate *);
-extern void AmbiguityDialog(Junction *, int, Junction *, Junction *, int *, int *);
-extern void dumpAmbigMsg(set *, FILE *, int);
-extern void GenRuleFuncRedefs(FILE *, Junction *);
-extern void GenPredefinedSymbolRedefs(FILE *);
-extern void GenASTSymbolRedefs(FILE *);
-extern void GenRemapFile(void);
-extern void GenSetRedefs(FILE *);
-extern ForcedToken *newForcedToken(char *, int);
-extern void RemapForcedTokens(void);
-extern char *TokenOrExpr(int);
-extern void setUpperRange(TokNode *, char *);
-extern void GenParser_c_Hdr(void);
-extern void GenParser_h_Hdr(void);
-extern void GenRuleMemberDeclarationsForCC(FILE *, Junction *);
-extern int addForcedTname( char *, int );
-extern char *OutMetaName(char *);
-extern void OutFirstSetSymbol(Junction *q, char *); /* MR21 */
-extern void warnNoFL(char *err);
-extern void warnFL(char *err,char *f,int l);
-extern void warn(char *err);
-extern void warnNoCR( char *err );
-extern void errNoFL(char *err);
-extern void errFL(char *err,char *f,int l);
-extern void err(char *err);
-extern void errNoCR( char *err );
-extern void genPredTree( Predicate *p, Node *j, int ,int);
-extern UserAction *newUserAction(char *);
-extern char *gate_symbol(char *name);
-extern char *makeAltID(int blockid, int altnum);
-extern void DumpRemainingTokSets(void);
-extern void DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInit); /* MR23 */
-extern void DumpFormals(FILE *, char *, int bInit); /* MR23 */
-extern char* hideDefaultArgs(const char* pdecl); /* MR22 VHS */
-extern Predicate *computePredFromContextGuard(Graph,int *msgDone); /* MR21 */
-extern void recomputeContextGuard(Predicate *); /* MR13 */
-extern Predicate *new_pred(void);
-extern void chkGTFlag(void);
-extern void leAdd(LabelEntry *); /* MR7 */
-extern void leFixup(void); /* MR7 */
-extern void egAdd(ExceptionGroup *); /* MR7 */
-extern void egFixup(void); /* MR7 */
-extern void altAdd(Junction *); /* MR7 */
-extern void altFixup(void); /* MR7 */
-extern Predicate * MR_find_in_aSubBlk(Junction *alt); /* MR10 */
-extern Predicate * MR_predFlatten(Predicate *p); /* MR10 */
-extern Predicate * MR_predSimplifyALL(Predicate *p); /* MR10 */
-extern Predicate * MR_predSimplifyALLX(Predicate *p,int skipPass3); /* MR10 */
-extern int MR_allPredLeaves(Predicate *p); /* MR10 */
-extern void MR_cleanup_pred_trees(Predicate *p); /* MR10 */
-extern int MR_predicate_context_completed(Predicate *p); /* MR10 */
-extern void MR_check_pred_too_long(Predicate *p,set completion); /* MR10 */
-extern Tree * MR_remove_epsilon_from_tree(Tree *t); /* MR10 */
-extern Tree * MR_computeTreeAND(Tree *l,Tree *r); /* MR10 */
-extern int MR_tree_equ(Tree *big, Tree *small); /* MR10 */
-extern set MR_First(int ck,Junction *j,set *incomplete); /* MR10 */
-extern set MR_compute_pred_set(Predicate *p); /* MR10 */
-extern Tree * MR_compute_pred_tree_context(Predicate *p); /* MR10 */
-extern int MR_pointerStackPush(PointerStack *,void *); /* MR10 */
-extern void * MR_pointerStackPop(PointerStack *); /* MR10 */
-extern void * MR_pointerStackTop(PointerStack *); /* MR10 */
-extern void MR_pointerStackReset(PointerStack *); /* MR10 */
-extern void MR_backTraceReport(void); /* MR10 */
-extern void MR_alphaBetaTraceReport(void); /* MR14 */
-extern void MR_dumpRuleSet(set); /* MR14 */
-extern void MR_predContextPresent(Predicate *p,int *,int *); /* MR10 */
-extern void MR_dumpPred(Predicate *p,int withContext); /* MR10 */
-extern void MR_dumpPred1(int,Predicate *p,int withContext); /* MR10 */
-extern void MR_xxxIndent(FILE *f,int depth); /* MR11 */
-extern void MR_outputIndent(int depth); /* MR11 */
-extern void MR_stderrIndent(int depth); /* MR11 */
-extern Junction * MR_ruleReferenced(RuleRefNode *rrn); /* MR10 */
-extern Junction * MR_nameToRuleBlk(char *); /* MR10 */
-extern void MR_releaseResourcesUsedInRule(Node *); /* MR10 */
-extern void MR_dumpTreeX(int depth,Tree *t,int across); /* MR10 */
-extern void MR_dumpTreeF(FILE *f,int depth,Tree *t,int across); /* MR10 */
-extern void DumpFcache(void); /* MR10 */
-extern void MR_dumpTokenSet(FILE *f,int depth,set s); /* MR10 */
-extern void MR_traceAmbSource(set *,Junction *,Junction *); /* MR11 */
-extern void MR_traceAmbSourceK(Tree *,Junction *a1,Junction *a2); /* MR11 */
-extern void MR_traceAmbSourceKclient(void); /* MR20 */
-extern Node *MR_advance(Node *); /* MR11 */
-extern int MR_offsetFromRule(Node *); /* MR11 */
-extern char *MR_ruleNamePlusOffset(Node *); /* MR11 */
-extern int MR_max_height_of_tree(Tree *); /* MR11 */
-extern int MR_all_leaves_same_height(Tree *,int); /* MR11 */
-extern void MR_projectTreeOntoSet(Tree *t,int k,set *); /* MR11 */
-extern Tree *MR_make_tree_from_set(set); /* MR11 */
-extern Predicate *MR_removeRedundantPredPass3(Predicate *); /* MR11 */
-extern void MR_pred_depth(Predicate *,int *); /* MR11 */
-extern int MR_comparePredicates(Predicate *,Predicate *); /* MR11 */
-extern Predicate * MR_unfold(Predicate *); /* MR11 */
-extern void MR_simplifyInverted(Predicate *,int); /* MR11 */
-extern int MR_secondPredicateUnreachable /* MR11 */
- (Predicate *first,Predicate *second); /* MR11 */
-extern void MR_clearPredEntry(Predicate *); /* MR11 */
-extern void MR_orphanRules(FILE *); /* MR12 */
-extern void MR_merge_contexts(Tree *); /* MR12 */
-extern int ci_strequ(char *,char *); /* MR12 */
-extern void MR_guardPred_plainSet(ActionNode *anode,Predicate *); /* MR12c */
-extern void MR_suppressSearchReport(void); /* MR12c */
-extern Predicate * MR_suppressK(Node *,Predicate *); /* MR13 */
-extern void MR_backTraceDumpItem(FILE *,int skip,Node *n); /* MR13 */
-extern void MR_backTraceDumpItemReset(void); /* MR13 */
-extern Junction * MR_junctionWithoutP2(Junction *); /* MR13 */
-extern void MR_setConstrainPointer(set *); /* MR18 */
-extern void BlockPreambleOption(Junction *q, char * pSymbol); /* MR23 */
-extern char* getInitializer(char *); /* MR23 */
-extern char *endFormal(char *pStart, /* MR23 */
- char **ppDataType, /* MR23 */
- char **ppSymbol, /* MR23 */
- char **ppEqualSign, /* MR23 */
- char **ppValue, /* MR23 */
- char **ppSeparator, /* MR23 */
- int *pNext); /* MR23 */
-extern char *strBetween(char *pStart, /* MR23 */
- char *pNext, /* MR23 */
- char *pStop); /* MR23 */
-extern int hasMultipleOperands(char *); /* MR23 */
-extern void DumpInitializers(FILE*, RuleEntry*, char*); /* MR23 */
-extern int isTermEntryTokClass(TermEntry *); /* MR23 */
-extern int isEmptyAlt(Node *, Node *); /* MR23 */
-#else
-extern int STRICMP();
-extern void istackreset();
-extern int istacksize();
-extern void pushint();
-extern int popint();
-extern int istackempty();
-extern int topint();
-extern void NewSetWd();
-extern void DumpSetWd();
-extern void DumpSetWdForC();
-extern void DumpSetWdForCC();
-extern void NewSet();
-extern void FillSet();
-extern void ComputeErrorSets();
-extern void ComputeTokSets();
-extern void SubstErrorClass();
-extern int DefErrSet();
-extern int DefErrSetForC();
-extern int DefErrSetForCC();
-extern int DefErrSet1();
-extern int DefErrSetForC1();
-extern int DefErrSetForCC1();
-extern int DefErrSetWithSuffix(); /* MR21 */
-extern void GenErrHdr();
-extern void dumpExpr();
-extern void addParm();
-extern Graph buildAction();
-extern Graph buildToken();
-extern Graph buildWildCard();
-extern Graph buildRuleRef();
-extern Graph Or();
-extern Graph Cat();
-extern Graph makeOpt();
-extern Graph makeBlk();
-extern Graph makeLoop();
-extern Graph makePlus();
-extern Graph emptyAlt();
-extern Graph emptyAlt3();
-extern TokNode * newTokNode();
-extern RuleRefNode * newRNode();
-extern Junction * newJunction();
-extern ActionNode * newActionNode();
-extern char * makelocks();
-extern void preorder();
-extern Tree * tnode();
-extern void _Tfree();
-extern Tree * tdup();
-extern int is_single_tuple();
-extern Tree * tappend();
-extern void Tfree();
-extern Tree * tlink();
-extern Tree * tshrink();
-extern Tree * tflatten();
-extern Tree * tJunc();
-extern Tree * tRuleRef();
-extern Tree * tToken();
-extern Tree * tAction();
-extern int tmember();
-extern int tmember_constrained();
-extern Tree * tleft_factor();
-extern Tree * trm_perm();
-extern void tcvt();
-extern Tree * permute();
-extern Tree * VerifyAmbig();
-extern set rJunc();
-extern set rRuleRef();
-extern set rToken();
-extern set rAction();
-extern void HandleAmbiguity();
-extern set First();
-extern void freeBlkFsets();
-extern void genAction();
-extern void genRuleRef();
-extern void genToken();
-extern void genOptBlk();
-extern void genLoopBlk();
-extern void genLoopBegin();
-extern void genPlusBlk();
-extern void genSubBlk();
-extern void genRule();
-extern void genJunction();
-extern void genEndBlk();
-extern void genEndRule();
-extern void genHdr();
-extern void genHdr1();
-extern void dumpAction();
-extern void dumpActionPlus(); /* MR21 */
-extern Entry ** newHashTable();
-extern Entry * hash_add();
-extern Entry * hash_get();
-extern void hashStat();
-extern char * mystrdup();
-extern void genLexDescr();
-extern void dumpLexClasses();
-extern void genDefFile();
-extern void DumpListOfParmNames(); /* MR5 janm 26-May-97 */
-extern int DumpNextNameInDef();
-extern void DumpOldStyleParms();
-extern void DumpType();
-extern int strmember();
-/* extern int HasComma(); MR23 Replaced by hasMultipleOperands() */
-extern void DumpRetValStruct();
-extern char * StripQuotes();
-extern int main();
-extern void readDescr();
-extern FILE * NextFile();
-extern char * outnameX();
-extern char * outname();
-extern void fatalFL();
-extern void fatal_intern();
-extern void cleanUp();
-extern char * eMsg3();
-extern char * eMsgd();
-extern char * eMsgd2();
-extern void s_fprT();
-extern char * TerminalString();
-extern void lexclass();
-extern void lexmode();
-extern int LexClassIndex();
-extern int hasAction();
-extern void setHasAction();
-extern int addTname();
-extern int addTexpr();
-extern int Tnum();
-extern void Tklink();
-extern Entry * newEntry();
-extern void list_add();
-extern void list_free(); /* MR10 */
-extern void list_apply();
-extern int list_search_cstring (); /* MR27 */
-extern char * Fkey();
-extern void FoPush();
-extern void FoPop();
-extern void RegisterCycle();
-extern void ResolveFoCycles();
-extern void pJunc();
-extern void pRuleRef();
-extern void pToken();
-extern void pAction();
-extern void FoLink();
-extern void addFoLink();
-extern void GenCrossRef();
-extern void defErr();
-extern void genStdPCCTSIncludeFile();
-extern char * pcctsBaseName(); /* MR32 */
-extern Predicate *find_predicates();
-extern Predicate *MR_find_predicates_and_supp(); /* MR13 */
-extern int predicateLookaheadDepth(); /* MR10 */
-extern void predicate_free(); /* MR10 */
-extern Predicate * predicate_dup(); /* MR10 */
-extern Predicate * predicate_dup_without_context(); /* MR11 */
-extern void GenRulePrototypes();
-extern Junction *first_item_is_guess_block();
-extern Junction *first_item_is_guess_block_extra(); /* MR30 */
-extern Junction *analysis_point();
-extern Tree *make_tree_from_sets();
-extern Tree *tdup_chain();
-extern Tree *tdif();
-extern set covered_set();
-extern void AmbiguityDialog();
-extern void dumpAmbigMsg();
-extern void GenRuleFuncRedefs();
-extern void GenPredefinedSymbolRedefs();
-extern void GenASTSymbolRedefs();
-extern void GenRemapFile();
-extern void GenSetRedefs();
-extern ForcedToken *newForcedToken();
-extern void RemapForcedTokens();
-extern char *TokenOrExpr();
-extern void setUpperRange();
-extern void GenParser_c_Hdr();
-extern void GenParser_h_Hdr();
-extern void GenRuleMemberDeclarationsForCC();
-extern int addForcedTname();
-extern char *OutMetaName();
-extern void OutFirstSetSymbol(); /* MR21 */
-extern void warnNoFL();
-extern void warnFL();
-extern void warn();
-extern void warnNoCR();
-extern void errNoFL();
-extern void errFL();
-extern void err();
-extern void errNoCR();
-extern void genPredTree();
-extern UserAction *newUserAction();
-extern char *gate_symbol();
-extern char *makeAltID();
-extern void DumpRemainingTokSets();
-extern void DumpANSIFunctionArgDef();
-extern void DumpFormals(); /* MR23 */
-extern char* hideDefaultArgs(); /* MR22 VHS */
-extern Predicate *computePredFromContextGuard();
-extern void recomputeContextGuard(); /* MR13 */
-extern Predicate *new_pred();
-extern void chkGTFlag();
-extern void leAdd(); /* MR7 */
-extern void leFixup(); /* MR7 */
-extern void egAdd(); /* MR7 */
-extern void egFixup(); /* MR7 */
-extern void altAdd(); /* MR7 */
-extern void altFixup(); /* MR7 */
-extern Predicate * MR_find_in_aSubBlk(); /* MR10 */
-extern Predicate * MR_predFlatten(); /* MR10 */
-extern Predicate * MR_predSimplifyALL(); /* MR10 */
-extern Predicate * MR_predSimplifyALLX(); /* MR10 */
-extern void MR_cleanup_pred_trees(); /* MR10 */
-extern int MR_allPredLeaves(); /* MR10 */
-extern int MR_predicate_context_completed(); /* MR10 */
-extern void MR_check_pred_too_long(); /* MR10 */
-extern Tree * MR_remove_epsilon_from_tree(); /* MR10 */
-extern Tree * MR_computeTreeAND(); /* MR10 */
-extern int MR_tree_equ(); /* MR10 */
-extern set MR_First(); /* MR10 */
-extern set MR_compute_pred_set(); /* MR10 */
-extern Tree * MR_compute_pred_tree_context(); /* MR10 */
-extern int MR_pointerStackPush(); /* MR10 */
-extern void * MR_pointerStackPop(); /* MR10 */
-extern void * MR_pointerStackTop(); /* MR10 */
-extern void MR_pointerStackReset(); /* MR10 */
-extern void MR_backTraceReport(); /* MR10 */
-extern void MR_alphaBetaTraceReport(); /* MR14 */
-extern void MR_dumpRuleSet(); /* MR14 */
-extern void MR_predContextPresent(); /* MR10 */
-extern void MR_dumpPred(); /* MR10 */
-extern void MR_dumpPred1(); /* MR10 */
-extern void MR_xxxIndent(); /* MR11 */
-extern void MR_stderrIndent(); /* MR11 */
-extern void MR_outputIndent(); /* MR11 */
-extern Junction * MR_ruleReferenced(); /* MR10 */
-extern void MR_releaseResourcesUsedInRule(); /* MR10 */
-extern void MR_dumpTreeX(); /* MR10 */
-extern void MR_dumpTreeF(); /* MR10 */
-extern void DumpFcache(); /* MR10 */
-extern void MR_dumpTokenSet(); /* MR10 */
-extern void MR_traceAmbSource(); /* MR11 */
-extern Node *MR_advance(); /* MR11 */
-extern int MR_offsetFromRule(); /* MR11 */
-extern char *MR_ruleNamePlusOffset(); /* MR11 */
-extern void MR_traceAmbSourceK(); /* MR11 */
-extern void MR_traceAmbSourceKclient(); /* [i_a] added */
-extern int MR_max_height_of_tree(); /* MR11 */
-extern int MR_all_leaves_same_height(); /* MR11 */
-extern void MR_projectTreeOntoSet(); /* MR11 */
-extern Tree *MR_make_tree_from_set(); /* MR11 */
-extern Predicate *MR_removeRedundantPredPass3(); /* MR11 */
-extern void MR_pred_depth(); /* MR11 */
-extern int MR_comparePredicates(); /* MR11 */
-extern Predicate * MR_unfold(); /* MR11 */
-extern void MR_simplifyInverted(); /* MR11 */
-extern int MR_secondPredicateUnreachable(); /* MR11 */
-extern Junction * MR_nameToRuleBlk(); /* MR10 */
-extern void MR_clearPredEntry(); /* MR11 */
-extern void MR_orphanRules(); /* MR12 */
-extern void MR_merge_contexts(); /* MR12 */
-extern int ci_strequ(); /* MR12 */
-extern void MR_guardPred_plainSet(); /* MR12c */
-extern void MR_suppressSearchReport(); /* MR12c */
-extern Predicate * MR_suppressK(); /* MR13 */
-extern void MR_backTraceDumpItem(); /* MR13 */
-extern void MR_backTraceDumpItemReset(); /* MR13 */
-extern Junction * MR_junctionWithoutP2(); /* MR13 */
-extern void MR_setConstrainPointer(); /* MR18 */
-extern void BlockPreambleOption(); /* MR23 */
-extern char* getInitializer(); /* MR23 */
-extern int hasMultipleOperands(); /* MR23 */
-extern char *endFormal(); /* MR23 */
-extern char *strBetween(); /* MR23 */
-extern void DumpInitializers(); /* MR23 */
-extern int isTermEntryTokClass(); /* MR23 */
-extern int isEmptyAlt();
-
-#endif
-
-#ifdef __USE_PROTOS
-#include <stdlib.h>
-#endif
-
-/* MR20 G. Hobbelt Create proper externs for dlg variables */
-
-extern set attribsRefdFromAction;
-extern int inAlt;
-extern int UsedOldStyleAttrib;
-extern int UsedNewStyleLabel;
-
-#define MAX_BLK_LEVEL 100 /* MR23 */
-extern int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */
-extern int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c
deleted file mode 100644
index 9b4bde08e6..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/scan.c
+++ /dev/null
@@ -1,5735 +0,0 @@
-
-/* parser.dlg -- DLG Description of scanner
- *
- * Generated from: antlr.g
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#define ANTLR_VERSION 13333
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include "pcctscfg.h"
-#include "set.h"
-#include <ctype.h>
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#define zzcr_attr(attr,tok,t)
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-LOOKAHEAD
-
-void
-#ifdef __USE_PROTOS
-zzerraction(void)
-#else
-zzerraction()
-#endif
-{
- (*zzerr)("invalid token");
- zzadvance();
- zzskip();
-}
-/*
- * D L G tables
- *
- * Generated from: parser.dlg
- *
- * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz
- * Purdue University Electrical Engineering
- * DLG Version 1.33MR33
- */
-
-#include "mode.h"
-
-
-
-
-/* maintained, but not used for now */
-set AST_nodes_refd_in_actions = set_init;
-int inAlt = 0;
-set attribsRefdFromAction = set_init; /* MR20 */
-int UsedOldStyleAttrib = 0;
-int UsedNewStyleLabel = 0;
-#ifdef __USE_PROTOS
-char *inline_set(char *);
-#else
-char *inline_set();
-#endif
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
-/* MR1 in DLG action */
-
-int tokenActionActive=0; /* MR1 */
-
-
-
-
-
-static char *
-#ifdef __USE_PROTOS
-getFileNameFromTheLineInfo(char *toStr, char *fromStr)
-#else
-getFileNameFromTheLineInfo(toStr, fromStr)
-char *toStr, *fromStr;
-#endif
-{
- int i, j, k;
-
- if (!fromStr || !toStr) return toStr;
-
- /* find the first " */
-
- for (i=0;
- (i<MaxFileName) &&
- (fromStr[i] != '\n') &&
- (fromStr[i] != '\r') &&
- (fromStr[i] != '\"');
- i++) /* nothing */ ;
-
- if ( (i == MaxFileName) ||
- (fromStr[i] == '\n') ||
- (fromStr[i] == '\r') ) {
- return toStr;
-}
-
- /* find the second " */
-
- for (j=i+1;
-(j<MaxFileName) &&
-(fromStr[j] != '\n') &&
-(fromStr[j] != '\r') &&
-(fromStr[j] != '\"');
-j++) /* nothing */ ;
-
- if ((j == MaxFileName) ||
-(fromStr[j] == '\n') ||
-(fromStr[j] == '\r') ) {
- return toStr;
-}
-
- /* go back until the last / or \ */
-
- for (k=j-1;
-(fromStr[k] != '\"') &&
-(fromStr[k] != '/') &&
-(fromStr[k] != '\\');
-k--) /* nothing */ ;
-
- /* copy the string after " / or \ into toStr */
-
- for (i=k+1; fromStr[i] != '\"'; i++) {
-toStr[i-k-1] = fromStr[i];
-}
-
- toStr[i-k-1] = '\0';
-
- return toStr;
-}
-
-/* MR14 end of a block to support #line in antlr source code */
-
-
-
-
-#ifdef __USE_PROTOS
-void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */
-#else
-void mark_label_used_in_sem_pred(le) /* MR10 */
-LabelEntry *le;
-#endif
-{
- TokNode *tn;
- require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken");
- tn=(TokNode *)le->elem;
- require (tn->label != 0,"mark_label_used... TokNode has no label");
- tn->label_used_in_semantic_pred=1;
-}
-
-static void act1()
-{
- NLA = Eof;
- /* L o o k F o r A n o t h e r F i l e */
- {
- FILE *new_input;
- new_input = NextFile();
- if ( new_input == NULL ) { NLA=Eof; return; }
- fclose( input );
- input = new_input;
- zzrdstream( input );
- zzskip(); /* Skip the Eof (@) char i.e continue */
- }
- }
-
-
-static void act2()
-{
- NLA = 76;
- zzskip();
- }
-
-
-static void act3()
-{
- NLA = 77;
- zzline++; zzskip();
- }
-
-
-static void act4()
-{
- NLA = 78;
- zzmode(ACTIONS); zzmore();
- istackreset();
- pushint(']');
- }
-
-
-static void act5()
-{
- NLA = 79;
- action_file=CurFile; action_line=zzline;
- zzmode(ACTIONS); zzmore();
- list_free(&CurActionLabels,0); /* MR10 */
- numericActionLabel=0; /* MR10 */
- istackreset();
- pushint('>');
- }
-
-
-static void act6()
-{
- NLA = 80;
- zzmode(STRINGS); zzmore();
- }
-
-
-static void act7()
-{
- NLA = 81;
- zzmode(COMMENTS); zzskip();
- }
-
-
-static void act8()
-{
- NLA = 82;
- warn("Missing /*; found dangling */"); zzskip();
- }
-
-
-static void act9()
-{
- NLA = 83;
- zzmode(CPP_COMMENTS); zzskip();
- }
-
-
-static void act10()
-{
- NLA = 84;
-
- zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
- getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
- }
-
-
-static void act11()
-{
- NLA = 85;
-
- zzline++; zzmore();
- }
-
-
-static void act12()
-{
- NLA = 86;
- warn("Missing <<; found dangling >>"); zzskip();
- }
-
-
-static void act13()
-{
- NLA = WildCard;
- }
-
-
-static void act14()
-{
- NLA = 88;
- FoundException = 1; /* MR6 */
- FoundAtOperator = 1;
- }
-
-
-static void act15()
-{
- NLA = Pragma;
- }
-
-
-static void act16()
-{
- NLA = FirstSetSymbol;
- }
-
-
-static void act17()
-{
- NLA = 94;
- }
-
-
-static void act18()
-{
- NLA = 95;
- }
-
-
-static void act19()
-{
- NLA = 96;
- }
-
-
-static void act20()
-{
- NLA = 97;
- }
-
-
-static void act21()
-{
- NLA = 98;
- }
-
-
-static void act22()
-{
- NLA = 99;
- }
-
-
-static void act23()
-{
- NLA = 102;
- }
-
-
-static void act24()
-{
- NLA = 103;
- }
-
-
-static void act25()
-{
- NLA = 104;
- }
-
-
-static void act26()
-{
- NLA = 105;
- }
-
-
-static void act27()
-{
- NLA = 106;
- }
-
-
-static void act28()
-{
- NLA = 107;
- }
-
-
-static void act29()
-{
- NLA = 108;
- }
-
-
-static void act30()
-{
- NLA = 109;
- }
-
-
-static void act31()
-{
- NLA = 110;
- }
-
-
-static void act32()
-{
- NLA = 111;
- }
-
-
-static void act33()
-{
- NLA = 112;
- }
-
-
-static void act34()
-{
- NLA = 113;
- }
-
-
-static void act35()
-{
- NLA = 114;
- }
-
-
-static void act36()
-{
- NLA = 115;
- }
-
-
-static void act37()
-{
- NLA = 116;
- }
-
-
-static void act38()
-{
- NLA = 117;
- }
-
-
-static void act39()
-{
- NLA = 118;
- }
-
-
-static void act40()
-{
- NLA = 119;
- }
-
-
-static void act41()
-{
- NLA = 120;
- }
-
-
-static void act42()
-{
- NLA = 121;
- }
-
-
-static void act43()
-{
- NLA = 122;
- }
-
-
-static void act44()
-{
- NLA = 123;
- }
-
-
-static void act45()
-{
- NLA = 124;
- }
-
-
-static void act46()
-{
- NLA = 125;
- }
-
-
-static void act47()
-{
- NLA = 126;
- }
-
-
-static void act48()
-{
- NLA = 127;
- }
-
-
-static void act49()
-{
- NLA = 128;
- }
-
-
-static void act50()
-{
- NLA = 129;
- }
-
-
-static void act51()
-{
- NLA = 130;
- }
-
-
-static void act52()
-{
- NLA = 131;
- }
-
-
-static void act53()
-{
- NLA = 132;
- }
-
-
-static void act54()
-{
- NLA = 133;
- }
-
-
-static void act55()
-{
- NLA = 134;
- }
-
-
-static void act56()
-{
- NLA = 135;
- }
-
-
-static void act57()
-{
- NLA = NonTerminal;
-
- while ( zzchar==' ' || zzchar=='\t' ) {
- zzadvance();
- }
- if ( zzchar == ':' && inAlt ) NLA = LABEL;
- }
-
-
-static void act58()
-{
- NLA = TokenTerm;
-
- while ( zzchar==' ' || zzchar=='\t' ) {
- zzadvance();
- }
- if ( zzchar == ':' && inAlt ) NLA = LABEL;
- }
-
-
-static void act59()
-{
- NLA = 136;
- warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip();
- }
-
-static unsigned char shift0[257] = {
- 0, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 1, 2, 58, 58, 3, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 1, 40, 6, 9, 58, 58, 45,
- 58, 46, 47, 8, 52, 58, 58, 18, 7, 16,
- 14, 15, 16, 16, 16, 16, 16, 16, 16, 41,
- 42, 5, 48, 17, 53, 19, 56, 56, 56, 56,
- 56, 26, 56, 56, 56, 56, 56, 51, 56, 56,
- 56, 56, 56, 56, 29, 56, 56, 56, 56, 56,
- 56, 56, 4, 20, 58, 50, 57, 58, 23, 31,
- 38, 34, 13, 35, 24, 33, 11, 55, 36, 10,
- 25, 12, 32, 21, 55, 22, 27, 28, 54, 55,
- 55, 43, 30, 55, 39, 44, 37, 49, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58
-};
-
-
-static void act60()
-{
- NLA = Eof;
- }
-
-
-static void act61()
-{
- NLA = QuotedTerm;
- zzmode(START);
- }
-
-
-static void act62()
-{
- NLA = 3;
-
- zzline++;
- warn("eoln found in string");
- zzskip();
- }
-
-
-static void act63()
-{
- NLA = 4;
- zzline++; zzmore();
- }
-
-
-static void act64()
-{
- NLA = 5;
- zzmore();
- }
-
-
-static void act65()
-{
- NLA = 6;
- zzmore();
- }
-
-static unsigned char shift1[257] = {
- 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 2, 5, 5, 3, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 1, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 4, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
-};
-
-
-static void act66()
-{
- NLA = Eof;
- }
-
-
-static void act67()
-{
- NLA = 7;
- zzmode(ACTIONS); zzmore();
- }
-
-
-static void act68()
-{
- NLA = 8;
-
- zzline++;
- warn("eoln found in string (in user action)");
- zzskip();
- }
-
-
-static void act69()
-{
- NLA = 9;
- zzline++; zzmore();
- }
-
-
-static void act70()
-{
- NLA = 10;
- zzmore();
- }
-
-
-static void act71()
-{
- NLA = 11;
- zzmore();
- }
-
-static unsigned char shift2[257] = {
- 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 2, 5, 5, 3, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 1, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 4, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
-};
-
-
-static void act72()
-{
- NLA = Eof;
- }
-
-
-static void act73()
-{
- NLA = 12;
- zzmode(ACTIONS); zzmore();
- }
-
-
-static void act74()
-{
- NLA = 13;
-
- zzline++;
- warn("eoln found in char literal (in user action)");
- zzskip();
- }
-
-
-static void act75()
-{
- NLA = 14;
- zzmore();
- }
-
-
-static void act76()
-{
- NLA = 15;
- zzmore();
- }
-
-static unsigned char shift3[257] = {
- 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 2, 5, 5, 3, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 1, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 4, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
-};
-
-
-static void act77()
-{
- NLA = Eof;
- }
-
-
-static void act78()
-{
- NLA = 16;
- zzmode(ACTIONS); zzmore();
- }
-
-
-static void act79()
-{
- NLA = 17;
- zzmore();
- }
-
-
-static void act80()
-{
- NLA = 18;
- zzline++; zzmore(); DAWDLE;
- }
-
-
-static void act81()
-{
- NLA = 19;
- zzmore();
- }
-
-static unsigned char shift4[257] = {
- 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 3, 5, 5, 4, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 1, 5, 5, 5, 5, 2, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
-};
-
-
-static void act82()
-{
- NLA = Eof;
- }
-
-
-static void act83()
-{
- NLA = 20;
- zzmode(PARSE_ENUM_FILE);
- zzmore();
- }
-
-
-static void act84()
-{
- NLA = 21;
- zzmore();
- }
-
-
-static void act85()
-{
- NLA = 22;
- zzline++; zzmore(); DAWDLE;
- }
-
-
-static void act86()
-{
- NLA = 23;
- zzmore();
- }
-
-static unsigned char shift5[257] = {
- 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 3, 5, 5, 4, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 1, 5, 5, 5, 5, 2, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
-};
-
-
-static void act87()
-{
- NLA = Eof;
- }
-
-
-static void act88()
-{
- NLA = 24;
- zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE;
- }
-
-
-static void act89()
-{
- NLA = 25;
- zzskip();
- }
-
-static unsigned char shift6[257] = {
- 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 1, 3, 3, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3
-};
-
-
-static void act90()
-{
- NLA = Eof;
- }
-
-
-static void act91()
-{
- NLA = 26;
- zzline++; zzmode(ACTIONS); zzmore(); DAWDLE;
- }
-
-
-static void act92()
-{
- NLA = 27;
- zzmore();
- }
-
-static unsigned char shift7[257] = {
- 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 1, 3, 3, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3
-};
-
-
-static void act93()
-{
- NLA = Eof;
- }
-
-
-static void act94()
-{
- NLA = 28;
- zzline++; zzmode(START); zzskip(); DAWDLE;
- }
-
-
-static void act95()
-{
- NLA = 29;
- zzskip();
- }
-
-static unsigned char shift8[257] = {
- 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 1, 3, 3, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3
-};
-
-
-static void act96()
-{
- NLA = Eof;
- }
-
-
-static void act97()
-{
- NLA = 30;
- zzmode(START); zzskip();
- }
-
-
-static void act98()
-{
- NLA = 31;
- zzskip();
- }
-
-
-static void act99()
-{
- NLA = 32;
- zzline++; zzskip(); DAWDLE;
- }
-
-
-static void act100()
-{
- NLA = 33;
- zzskip();
- }
-
-static unsigned char shift9[257] = {
- 0, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 3, 5, 5, 4, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 1, 5, 5, 5, 5, 2, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
-};
-
-
-static void act101()
-{
- NLA = Eof;
- }
-
-
-static void act102()
-{
- NLA = Action;
- /* these do not nest */
- zzmode(START);
- NLATEXT[0] = ' ';
- NLATEXT[1] = ' ';
- zzbegexpr[0] = ' ';
- zzbegexpr[1] = ' ';
- if ( zzbufovf ) {
- err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE));
- }
-
-/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */
- /* MR1 in DLG action */
- /* MR1 Doesn't matter what kind of action it is - reset*/
-
- tokenActionActive=0; /* MR1 */
- }
-
-
-static void act103()
-{
- NLA = Pred;
- /* these do not nest */
- zzmode(START);
- NLATEXT[0] = ' ';
- NLATEXT[1] = ' ';
- zzbegexpr[0] = '\0';
- if ( zzbufovf ) {
- err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE));
- };
-#ifdef __cplusplus__
- /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-#ifdef __STDC__
- /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
-#ifdef __USE_PROTOS
- /* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);
-#else
- /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);
-#endif
-#endif
-#endif
- }
-
-
-static void act104()
-{
- NLA = PassAction;
- if ( topint() == ']' ) {
- popint();
- if ( istackempty() ) /* terminate action */
- {
- zzmode(START);
- NLATEXT[0] = ' ';
- zzbegexpr[0] = ' ';
- if ( zzbufovf ) {
- err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE));
- }
- }
- else {
- /* terminate $[..] and #[..] */
- if ( GenCC ) zzreplstr("))");
- else zzreplstr(")");
- zzmore();
- }
- }
- else if ( topint() == '|' ) { /* end of simple [...] */
- popint();
- zzmore();
- }
- else zzmore();
- }
-
-
-static void act105()
-{
- NLA = 37;
-
- zzmore();
- zzreplstr(inline_set(zzbegexpr+
- strlen("consumeUntil(")));
- }
-
-
-static void act106()
-{
- NLA = 38;
- zzmore();
- }
-
-
-static void act107()
-{
- NLA = 39;
- zzline++; zzmore(); DAWDLE;
- }
-
-
-static void act108()
-{
- NLA = 40;
- zzmore();
- }
-
-
-static void act109()
-{
- NLA = 41;
- zzmore();
- }
-
-
-static void act110()
-{
- NLA = 42;
- if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();}
- else err("$$ use invalid in C++ mode");
- }
-
-
-static void act111()
-{
- NLA = 43;
- if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();}
- else err("$[] use invalid in C++ mode");
- }
-
-
-static void act112()
-{
- NLA = 44;
-
- pushint(']');
- if ( !GenCC ) zzreplstr("zzconstr_attr(");
- else err("$[..] use invalid in C++ mode");
- zzmore();
- }
-
-
-static void act113()
-{
- NLA = 45;
- {
- static char buf[100];
- numericActionLabel=1; /* MR10 */
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("$i attrib ref too big");
- set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)",
- BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"_t%d%s",
- BlkLevel-1,zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- }
-
-
-static void act114()
-{
- NLA = 46;
- {
- static char buf[100];
- numericActionLabel=1; /* MR10 */
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("$i.field attrib ref too big");
- zzbegexpr[strlen(zzbegexpr)-1] = ' ';
- set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction);
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).",
- BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"_t%d%s.",
- BlkLevel-1,zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- }
-
-
-static void act115()
-{
- NLA = 47;
- {
- static char buf[100];
- static char i[20], j[20];
- char *p,*q;
- numericActionLabel=1; /* MR10 */
- if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big");
- for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) {
- if ( q == &i[20] )
- fatalFL("i of $i.j attrib ref too big",
- FileStr[CurFile], zzline );
- *q++ = *p;
- }
- *q = '\0';
- for (p++, q= &j[0]; *p!='\0'; p++) {
- if ( q == &j[20] )
- fatalFL("j of $i.j attrib ref too big",
- FileStr[CurFile], zzline );
- *q++ = *p;
- }
- *q = '\0';
- if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j);
- else sprintf(buf,"_t%s%s",i,j);
- zzreplstr(buf);
- zzmore();
- UsedOldStyleAttrib = 1;
- if ( UsedNewStyleLabel )
- err("cannot mix old-style $i with new-style labels");
- }
- }
-
-
-static void act116()
-{
- NLA = 48;
- { static char buf[300]; LabelEntry *el;
- zzbegexpr[0] = ' ';
- if ( CurRule != NULL &&
- strcmp(CurRule, &zzbegexpr[1])==0 ) {
- if ( !GenCC ) zzreplstr("zzaRet");
- }
- else if ( CurRetDef != NULL &&
- strmember(CurRetDef, &zzbegexpr[1])) {
- if ( hasMultipleOperands( CurRetDef ) ) {
- require (strlen(zzbegexpr)<=(size_t)285,
- "$retval attrib ref too big");
- sprintf(buf,"_retv.%s",&zzbegexpr[1]);
- zzreplstr(buf);
- }
- else zzreplstr("_retv");
- }
- else if ( CurParmDef != NULL &&
- strmember(CurParmDef, &zzbegexpr[1])) {
- ;
- }
- else if ( Elabel==NULL ) {
- { err("$-variables in actions outside of rules are not allowed"); }
- } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) {
- /* MR10 */
- /* MR10 */ /* element labels might exist without an elem when */
- /* MR10 */ /* it is a forward reference (to a rule) */
- /* MR10 */
- /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) )
- /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); }
- /* MR10 */
- /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) {
- /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs");
- /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...>>\")");
- /* MR10 */ };
- /* MR10 */
- /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */
- /* MR10 */ /* element labels contain pointer to the owners node */
- /* MR10 */
- /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) {
- /* MR10 */ list_add(&CurActionLabels,el);
- /* MR10 */ };
-}
-else
-warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));
-}
-zzmore();
- }
-
-
-static void act117()
-{
- NLA = 49;
- zzreplstr("(*_root)"); zzmore(); chkGTFlag();
- }
-
-
-static void act118()
-{
- NLA = 50;
- if ( GenCC ) {
- if (NewAST) zzreplstr("(newAST)");
- else zzreplstr("(new AST)");}
- else {zzreplstr("zzastnew()");} zzmore();
- chkGTFlag();
- }
-
-
-static void act119()
-{
- NLA = 51;
- zzreplstr("NULL"); zzmore(); chkGTFlag();
- }
-
-
-static void act120()
-{
- NLA = 52;
- {
- static char buf[100];
- if ( strlen(zzbegexpr)>(size_t)85 )
- fatal("#i AST ref too big");
- if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1);
- else sprintf(buf,"zzastArg(%s)",zzbegexpr+1);
- zzreplstr(buf);
- zzmore();
- set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions);
- chkGTFlag();
- }
- }
-
-
-static void act121()
-{
- NLA = 53;
-
- zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore();
- getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr);
- }
-
-
-static void act122()
-{
- NLA = 54;
-
- zzline++; zzmore();
- }
-
-
-static void act123()
-{
- NLA = 55;
-
- if ( !(strcmp(zzbegexpr, "#ifdef")==0 ||
- strcmp(zzbegexpr, "#if")==0 ||
- strcmp(zzbegexpr, "#else")==0 ||
- strcmp(zzbegexpr, "#endif")==0 ||
- strcmp(zzbegexpr, "#ifndef")==0 ||
- strcmp(zzbegexpr, "#define")==0 ||
- strcmp(zzbegexpr, "#pragma")==0 ||
- strcmp(zzbegexpr, "#undef")==0 ||
- strcmp(zzbegexpr, "#import")==0 ||
- strcmp(zzbegexpr, "#line")==0 ||
- strcmp(zzbegexpr, "#include")==0 ||
- strcmp(zzbegexpr, "#error")==0) )
- {
- static char buf[100];
- sprintf(buf, "%s_ast", zzbegexpr+1);
- /* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1));
- zzreplstr(buf);
- chkGTFlag();
- }
- zzmore();
- }
-
-
-static void act124()
-{
- NLA = 56;
-
- pushint(']');
- if ( GenCC ) {
- if (NewAST) zzreplstr("(newAST(");
- else zzreplstr("(new AST("); }
- else zzreplstr("zzmk_ast(zzastnew(),");
- zzmore();
- chkGTFlag();
- }
-
-
-static void act125()
-{
- NLA = 57;
-
- pushint('}');
- if ( GenCC ) {
- if (tmakeInParser) {
- zzreplstr("tmake(");
- }
- else {
- zzreplstr("ASTBase::tmake(");
- }
- }
- else {
- zzreplstr("zztmake(");
- }
- zzmore();
- chkGTFlag();
- }
-
-
-static void act126()
-{
- NLA = 58;
- zzmore();
- }
-
-
-static void act127()
-{
- NLA = 59;
-
- if ( istackempty() )
- zzmore();
- else if ( topint()==')' ) {
- popint();
- }
- else if ( topint()=='}' ) {
- popint();
- /* terminate #(..) */
- zzreplstr(", NULL)");
- }
- zzmore();
- }
-
-
-static void act128()
-{
- NLA = 60;
-
- pushint('|'); /* look for '|' to terminate simple [...] */
- zzmore();
- }
-
-
-static void act129()
-{
- NLA = 61;
-
- pushint(')');
- zzmore();
- }
-
-
-static void act130()
-{
- NLA = 62;
- zzreplstr("]"); zzmore();
- }
-
-
-static void act131()
-{
- NLA = 63;
- zzreplstr(")"); zzmore();
- }
-
-
-static void act132()
-{
- NLA = 64;
- if (! tokenActionActive) zzreplstr(">"); /* MR1 */
- zzmore(); /* MR1 */
- }
-
-
-static void act133()
-{
- NLA = 65;
- zzmode(ACTION_CHARS); zzmore();
- }
-
-
-static void act134()
-{
- NLA = 66;
- zzmode(ACTION_STRINGS); zzmore();
- }
-
-
-static void act135()
-{
- NLA = 67;
- zzreplstr("$"); zzmore();
- }
-
-
-static void act136()
-{
- NLA = 68;
- zzreplstr("#"); zzmore();
- }
-
-
-static void act137()
-{
- NLA = 69;
- zzline++; zzmore();
- }
-
-
-static void act138()
-{
- NLA = 70;
- zzmore();
- }
-
-
-static void act139()
-{
- NLA = 71;
- zzmore();
- }
-
-
-static void act140()
-{
- NLA = 72;
- zzmode(ACTION_COMMENTS); zzmore();
- }
-
-
-static void act141()
-{
- NLA = 73;
- warn("Missing /*; found dangling */ in action"); zzmore();
- }
-
-
-static void act142()
-{
- NLA = 74;
- zzmode(ACTION_CPP_COMMENTS); zzmore();
- }
-
-
-static void act143()
-{
- NLA = 75;
- zzmore();
- }
-
-static unsigned char shift10[257] = {
- 0, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 16, 19, 33, 33, 20, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 16, 33, 28, 27, 21, 33, 33,
- 30, 15, 18, 32, 33, 33, 33, 25, 31, 23,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 33,
- 33, 33, 33, 1, 2, 33, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 11, 26, 26, 26,
- 26, 26, 22, 29, 3, 33, 26, 33, 26, 26,
- 4, 26, 10, 26, 26, 26, 13, 26, 26, 14,
- 9, 6, 5, 26, 26, 26, 7, 12, 8, 26,
- 26, 26, 26, 26, 17, 33, 34, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33
-};
-
-
-static void act144()
-{
- NLA = Eof;
- ;
- }
-
-
-static void act145()
-{
- NLA = 137;
- zzskip();
- }
-
-
-static void act146()
-{
- NLA = 138;
- zzline++; zzskip();
- }
-
-
-static void act147()
-{
- NLA = 139;
- zzmode(TOK_DEF_CPP_COMMENTS); zzmore();
- }
-
-
-static void act148()
-{
- NLA = 140;
- zzmode(TOK_DEF_COMMENTS); zzskip();
- }
-
-
-static void act149()
-{
- NLA = 141;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- }
-
-
-static void act150()
-{
- NLA = 142;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- }
-
-
-static void act151()
-{
- NLA = 143;
- ;
- }
-
-
-static void act152()
-{
- NLA = 144;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- }
-
-
-static void act153()
-{
- NLA = 145;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- }
-
-
-static void act154()
-{
- NLA = 146;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- }
-
-
-static void act155()
-{
- NLA = 147;
- zzmode(TOK_DEF_CPP_COMMENTS); zzskip();
- }
-
-
-static void act156()
-{
- NLA = 149;
- }
-
-
-static void act157()
-{
- NLA = 151;
- }
-
-
-static void act158()
-{
- NLA = 152;
- }
-
-
-static void act159()
-{
- NLA = 153;
- }
-
-
-static void act160()
-{
- NLA = 154;
- }
-
-
-static void act161()
-{
- NLA = 155;
- }
-
-
-static void act162()
-{
- NLA = 156;
- }
-
-
-static void act163()
-{
- NLA = INT;
- }
-
-
-static void act164()
-{
- NLA = ID;
- }
-
-static unsigned char shift11[257] = {
- 0, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 1, 2, 27, 27, 3, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 1, 27, 27, 6, 27, 27, 27,
- 27, 27, 27, 5, 27, 22, 27, 27, 4, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 27,
- 24, 27, 21, 27, 27, 27, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 27, 27, 27, 27, 26, 27, 26, 26,
- 26, 9, 10, 8, 26, 26, 7, 26, 26, 12,
- 15, 11, 17, 16, 26, 18, 13, 19, 14, 26,
- 26, 26, 26, 26, 20, 27, 23, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 27, 27, 27
-};
-
-#define DfaStates 436
-typedef unsigned short DfaState;
-
-static DfaState st0[60] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 11, 11, 12, 13, 13, 13, 14, 15, 16,
- 17, 11, 11, 18, 11, 11, 19, 11, 11, 19,
- 11, 11, 11, 11, 20, 11, 11, 21, 22, 23,
- 24, 25, 26, 11, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 11, 11, 19, 436, 436, 436
-};
-
-static DfaState st1[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st2[60] = {
- 436, 2, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st3[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st4[60] = {
- 436, 436, 37, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st5[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st6[60] = {
- 436, 436, 436, 436, 436, 38, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st7[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st8[60] = {
- 436, 436, 436, 436, 436, 436, 436, 39, 40, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st9[60] = {
- 436, 436, 436, 436, 436, 436, 436, 41, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st10[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 42, 43, 43, 44, 43, 43, 43, 436, 436, 436,
- 436, 45, 43, 43, 43, 43, 46, 43, 47, 43,
- 43, 43, 43, 48, 43, 49, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st11[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st12[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 51, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st13[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 13, 13, 13, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st14[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 52, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st15[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 53, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st16[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st17[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 54,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st18[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 55, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st19[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
- 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
- 436, 436, 436, 56, 436, 436, 436, 436, 436, 436,
- 436, 56, 436, 436, 56, 56, 56, 56, 436, 436
-};
-
-static DfaState st20[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 57, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st21[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st22[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 58, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 59, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st23[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st24[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st25[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st26[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st27[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 60, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st28[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 61, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st29[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st30[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st31[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 62, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st32[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st33[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st34[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
- 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
- 436, 436, 436, 56, 436, 436, 436, 436, 436, 436,
- 436, 63, 436, 436, 56, 56, 56, 56, 436, 436
-};
-
-static DfaState st35[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st36[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st37[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st38[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st39[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st40[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st41[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st42[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 64, 43, 65, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st43[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st44[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 66, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st45[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 67, 68, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st46[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 69, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st47[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 70, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st48[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 71, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st49[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 72, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st50[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st51[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 73, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st52[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st53[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st54[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 74, 43, 43, 44, 43, 43, 43, 436, 436, 436,
- 436, 45, 43, 43, 43, 43, 46, 43, 47, 43,
- 43, 43, 43, 48, 43, 49, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st55[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 75, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st56[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
- 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
- 436, 436, 436, 56, 436, 436, 436, 436, 436, 436,
- 436, 56, 436, 436, 56, 56, 56, 56, 436, 436
-};
-
-static DfaState st57[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 76, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st58[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 77, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st59[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 78, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st60[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st61[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st62[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st63[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 56, 56, 56, 56, 56, 56, 56, 436, 436, 436,
- 436, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 436, 56, 436,
- 436, 436, 436, 56, 436, 436, 79, 436, 436, 436,
- 436, 56, 436, 436, 56, 56, 56, 56, 436, 436
-};
-
-static DfaState st64[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 80, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st65[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 81, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st66[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 82, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st67[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 83, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 84, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st68[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 85, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st69[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 86, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st70[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 87, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st71[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 88, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st72[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 89, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st73[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 90, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st74[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 65, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st75[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 91, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st76[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 92, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st77[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 93, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st78[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 94, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st79[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 95, 96, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st80[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 97, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st81[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 98, 43, 99, 43, 100, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 101, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st82[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 102, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st83[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 103, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st84[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 104, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st85[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 105, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st86[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 106, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st87[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 107, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 108, 43, 43, 436, 109, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st88[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 110, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st89[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 111, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st90[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 112, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st91[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 113, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st92[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 114, 50, 50, 50, 436, 436
-};
-
-static DfaState st93[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 115, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st94[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 116, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st95[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 117, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st96[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 118, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st97[60] = {
- 436, 119, 120, 121, 122, 122, 122, 122, 122, 122,
- 123, 123, 123, 123, 124, 124, 124, 122, 122, 122,
- 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 122, 123, 122,
- 122, 122, 122, 123, 122, 122, 122, 122, 122, 122,
- 122, 123, 122, 122, 123, 123, 123, 123, 122, 436
-};
-
-static DfaState st98[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 125, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st99[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 126, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st100[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 127, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st101[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 128, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st102[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 129, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st103[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st104[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 130, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st105[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 131, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st106[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 132, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st107[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 133, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st108[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 134, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st109[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 135, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st110[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 136, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st111[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 137, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st112[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 138, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st113[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 139, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st114[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 140, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st115[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st116[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st117[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st118[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st119[60] = {
- 436, 119, 120, 121, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 141, 141, 141, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st120[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st121[60] = {
- 436, 436, 142, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st122[60] = {
- 436, 122, 120, 121, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st123[60] = {
- 436, 122, 120, 121, 122, 122, 122, 122, 122, 122,
- 123, 123, 123, 123, 123, 123, 123, 122, 122, 122,
- 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 122, 123, 122,
- 122, 122, 122, 123, 122, 122, 122, 122, 122, 122,
- 122, 123, 122, 122, 123, 123, 123, 123, 122, 436
-};
-
-static DfaState st124[60] = {
- 436, 143, 144, 145, 122, 122, 146, 122, 122, 122,
- 123, 123, 123, 123, 124, 124, 124, 122, 122, 122,
- 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 122, 123, 122,
- 122, 122, 122, 123, 122, 122, 122, 122, 122, 122,
- 122, 123, 122, 122, 123, 123, 123, 123, 122, 436
-};
-
-static DfaState st125[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 147, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st126[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 148, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st127[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 149, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st128[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 150, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st129[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 151, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st130[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 152, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st131[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 153, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st132[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 154,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st133[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st134[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 155, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st135[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 156, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st136[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 157, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st137[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st138[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 158, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st139[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st140[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 159, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st141[60] = {
- 436, 143, 144, 145, 122, 122, 146, 122, 122, 122,
- 122, 122, 122, 122, 141, 141, 141, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st142[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st143[60] = {
- 436, 143, 120, 121, 122, 122, 146, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st144[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st145[60] = {
- 436, 436, 160, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st146[60] = {
- 436, 161, 162, 163, 161, 161, 122, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 436
-};
-
-static DfaState st147[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 164, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st148[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 165, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st149[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 166, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st150[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 167, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st151[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 168, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st152[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st153[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st154[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 169, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st155[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 170, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st156[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 171, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st157[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st158[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 172, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st159[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st160[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st161[60] = {
- 436, 161, 162, 163, 161, 161, 173, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 161, 161, 161, 161, 161, 161, 161, 436
-};
-
-static DfaState st162[60] = {
- 436, 174, 174, 174, 174, 174, 175, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
-};
-
-static DfaState st163[60] = {
- 436, 174, 176, 174, 174, 174, 175, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
-};
-
-static DfaState st164[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 177, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st165[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 178, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st166[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 179, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st167[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 180, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st168[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 181, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st169[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 182, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st170[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st171[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 183, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st172[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 184, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st173[60] = {
- 436, 185, 144, 145, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 186, 186, 186, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st174[60] = {
- 436, 174, 174, 174, 174, 174, 175, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
-};
-
-static DfaState st175[60] = {
- 436, 187, 188, 189, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 190, 190, 190, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st176[60] = {
- 436, 174, 174, 174, 174, 174, 175, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 174, 174, 174, 436
-};
-
-static DfaState st177[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 191, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st178[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 192, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st179[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 193, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st180[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st181[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st182[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 194,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st183[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st184[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 50, 50, 50, 50, 50, 50, 50, 436, 436, 436,
- 436, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 436, 50, 436,
- 436, 436, 436, 50, 436, 436, 436, 436, 436, 436,
- 436, 50, 436, 436, 50, 50, 50, 50, 436, 436
-};
-
-static DfaState st185[60] = {
- 436, 185, 144, 145, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 186, 186, 186, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st186[60] = {
- 436, 185, 144, 145, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 186, 186, 186, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 436
-};
-
-static DfaState st187[60] = {
- 436, 187, 188, 189, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 190, 190, 190, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st188[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st189[60] = {
- 436, 436, 195, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st190[60] = {
- 436, 187, 188, 189, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 190, 190, 190, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st191[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st192[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st193[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st194[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 196, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st195[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st196[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 197, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st197[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 198, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st198[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 199, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st199[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 200, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st200[60] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 43, 43, 43, 43, 43, 43, 43, 436, 436, 436,
- 436, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 436, 43, 436,
- 436, 436, 436, 43, 436, 436, 436, 436, 436, 436,
- 436, 43, 436, 436, 43, 43, 43, 43, 436, 436
-};
-
-static DfaState st201[7] = {
- 202, 203, 204, 205, 206, 207, 436
-};
-
-static DfaState st202[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st203[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st204[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st205[7] = {
- 436, 436, 208, 436, 436, 436, 436
-};
-
-static DfaState st206[7] = {
- 436, 209, 210, 211, 209, 209, 436
-};
-
-static DfaState st207[7] = {
- 436, 436, 436, 436, 436, 207, 436
-};
-
-static DfaState st208[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st209[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st210[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st211[7] = {
- 436, 436, 212, 436, 436, 436, 436
-};
-
-static DfaState st212[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st213[7] = {
- 214, 215, 216, 217, 218, 219, 436
-};
-
-static DfaState st214[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st215[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st216[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st217[7] = {
- 436, 436, 220, 436, 436, 436, 436
-};
-
-static DfaState st218[7] = {
- 436, 221, 222, 223, 221, 221, 436
-};
-
-static DfaState st219[7] = {
- 436, 436, 436, 436, 436, 219, 436
-};
-
-static DfaState st220[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st221[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st222[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st223[7] = {
- 436, 436, 224, 436, 436, 436, 436
-};
-
-static DfaState st224[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st225[7] = {
- 226, 227, 228, 229, 230, 231, 436
-};
-
-static DfaState st226[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st227[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st228[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st229[7] = {
- 436, 436, 232, 436, 436, 436, 436
-};
-
-static DfaState st230[7] = {
- 436, 233, 233, 233, 233, 233, 436
-};
-
-static DfaState st231[7] = {
- 436, 436, 436, 436, 436, 231, 436
-};
-
-static DfaState st232[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st233[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st234[7] = {
- 235, 236, 237, 238, 239, 237, 436
-};
-
-static DfaState st235[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st236[7] = {
- 436, 436, 240, 436, 436, 436, 436
-};
-
-static DfaState st237[7] = {
- 436, 436, 237, 436, 436, 237, 436
-};
-
-static DfaState st238[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st239[7] = {
- 436, 436, 436, 241, 436, 436, 436
-};
-
-static DfaState st240[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st241[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st242[7] = {
- 243, 244, 245, 246, 247, 245, 436
-};
-
-static DfaState st243[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st244[7] = {
- 436, 436, 248, 436, 436, 436, 436
-};
-
-static DfaState st245[7] = {
- 436, 436, 245, 436, 436, 245, 436
-};
-
-static DfaState st246[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st247[7] = {
- 436, 436, 436, 249, 436, 436, 436
-};
-
-static DfaState st248[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st249[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st250[5] = {
- 251, 252, 253, 254, 436
-};
-
-static DfaState st251[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st252[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st253[5] = {
- 436, 255, 436, 436, 436
-};
-
-static DfaState st254[5] = {
- 436, 436, 436, 254, 436
-};
-
-static DfaState st255[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st256[5] = {
- 257, 258, 259, 260, 436
-};
-
-static DfaState st257[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st258[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st259[5] = {
- 436, 261, 436, 436, 436
-};
-
-static DfaState st260[5] = {
- 436, 436, 436, 260, 436
-};
-
-static DfaState st261[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st262[5] = {
- 263, 264, 265, 266, 436
-};
-
-static DfaState st263[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st264[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st265[5] = {
- 436, 267, 436, 436, 436
-};
-
-static DfaState st266[5] = {
- 436, 436, 436, 266, 436
-};
-
-static DfaState st267[5] = {
- 436, 436, 436, 436, 436
-};
-
-static DfaState st268[7] = {
- 269, 270, 271, 272, 273, 271, 436
-};
-
-static DfaState st269[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st270[7] = {
- 436, 436, 274, 436, 436, 436, 436
-};
-
-static DfaState st271[7] = {
- 436, 436, 271, 436, 436, 271, 436
-};
-
-static DfaState st272[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st273[7] = {
- 436, 436, 436, 275, 436, 436, 436
-};
-
-static DfaState st274[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st275[7] = {
- 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st276[36] = {
- 277, 278, 279, 280, 281, 279, 279, 279, 279, 279,
- 279, 279, 279, 279, 279, 282, 279, 279, 283, 284,
- 285, 286, 287, 279, 279, 279, 279, 288, 289, 290,
- 291, 292, 293, 279, 279, 436
-};
-
-static DfaState st277[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st278[36] = {
- 436, 294, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st279[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st280[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st281[36] = {
- 436, 436, 279, 436, 279, 295, 279, 279, 279, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st282[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st283[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st284[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st285[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 296,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st286[36] = {
- 436, 436, 436, 436, 297, 297, 297, 297, 297, 297,
- 297, 297, 297, 297, 297, 436, 436, 436, 436, 436,
- 436, 298, 299, 300, 300, 436, 297, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st287[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st288[36] = {
- 436, 436, 436, 436, 301, 301, 301, 301, 301, 301,
- 301, 301, 301, 301, 302, 303, 436, 436, 436, 436,
- 436, 436, 304, 305, 306, 436, 301, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st289[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st290[36] = {
- 436, 307, 308, 309, 308, 308, 308, 308, 308, 308,
- 308, 308, 308, 308, 308, 308, 308, 308, 310, 311,
- 312, 313, 308, 308, 308, 308, 308, 314, 308, 308,
- 308, 308, 308, 308, 308, 436
-};
-
-static DfaState st291[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st292[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 315, 316, 436, 436, 436
-};
-
-static DfaState st293[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 317, 279, 279, 279, 436
-};
-
-static DfaState st294[36] = {
- 436, 436, 318, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st295[36] = {
- 436, 436, 279, 436, 279, 279, 319, 279, 279, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st296[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st297[36] = {
- 436, 436, 436, 436, 320, 320, 320, 320, 320, 320,
- 320, 320, 320, 320, 320, 436, 436, 436, 436, 436,
- 436, 436, 436, 320, 320, 436, 320, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st298[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st299[36] = {
- 436, 436, 436, 321, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st300[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 300, 300, 322, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st301[36] = {
- 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
- 323, 323, 323, 323, 323, 436, 436, 436, 436, 436,
- 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st302[36] = {
- 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
- 323, 323, 323, 324, 323, 436, 436, 436, 436, 436,
- 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st303[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 325, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st304[36] = {
- 436, 436, 436, 326, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st305[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 306, 306, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st306[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 306, 306, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st307[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st308[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st309[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st310[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st311[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st312[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 327,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st313[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st314[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st315[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st316[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st317[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st318[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st319[36] = {
- 436, 436, 279, 436, 279, 279, 279, 328, 279, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st320[36] = {
- 436, 436, 436, 436, 320, 320, 320, 320, 320, 320,
- 320, 320, 320, 320, 320, 436, 436, 436, 436, 436,
- 436, 436, 436, 320, 320, 436, 320, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st321[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st322[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 329, 329, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st323[36] = {
- 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
- 323, 323, 323, 323, 323, 436, 436, 436, 436, 436,
- 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st324[36] = {
- 436, 436, 436, 436, 323, 323, 330, 323, 323, 323,
- 323, 323, 323, 323, 323, 436, 436, 436, 436, 436,
- 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st325[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st326[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st327[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st328[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 331, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st329[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 329, 329, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st330[36] = {
- 436, 436, 436, 436, 323, 323, 323, 323, 323, 323,
- 332, 323, 323, 323, 323, 436, 436, 436, 436, 436,
- 436, 436, 436, 323, 323, 436, 323, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st331[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 333,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st332[36] = {
- 436, 334, 334, 334, 335, 335, 335, 335, 335, 335,
- 335, 335, 335, 335, 335, 334, 336, 334, 334, 337,
- 338, 334, 334, 339, 339, 334, 335, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st333[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 340, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st334[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 334, 334, 334, 337,
- 338, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st335[36] = {
- 436, 334, 334, 334, 335, 335, 335, 335, 335, 335,
- 335, 335, 335, 335, 335, 334, 334, 334, 334, 337,
- 338, 334, 334, 335, 335, 334, 335, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st336[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 336, 334, 334, 337,
- 338, 334, 334, 341, 341, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st337[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st338[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 342,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st339[36] = {
- 436, 334, 334, 334, 335, 335, 335, 335, 335, 335,
- 335, 335, 335, 335, 335, 334, 343, 334, 334, 344,
- 345, 334, 334, 339, 339, 334, 335, 334, 346, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st340[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 347, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st341[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 343, 334, 334, 344,
- 345, 334, 334, 341, 341, 334, 334, 334, 346, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st342[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st343[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 343, 334, 334, 337,
- 338, 334, 334, 334, 334, 334, 334, 334, 346, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st344[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st345[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 348,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st346[36] = {
- 436, 349, 349, 349, 349, 349, 349, 349, 349, 349,
- 349, 349, 349, 349, 349, 349, 349, 349, 349, 350,
- 351, 349, 349, 349, 349, 349, 349, 349, 334, 349,
- 349, 349, 349, 349, 349, 436
-};
-
-static DfaState st347[36] = {
- 436, 436, 279, 436, 279, 279, 352, 279, 279, 279,
- 279, 279, 279, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st348[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st349[36] = {
- 436, 349, 349, 349, 349, 349, 349, 349, 349, 349,
- 349, 349, 349, 349, 349, 349, 349, 349, 349, 350,
- 351, 349, 349, 349, 349, 349, 349, 349, 353, 349,
- 349, 349, 349, 349, 349, 436
-};
-
-static DfaState st350[36] = {
- 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
- 354, 354, 354, 354, 354, 436
-};
-
-static DfaState st351[36] = {
- 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 354, 356,
- 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
- 354, 354, 354, 354, 354, 436
-};
-
-static DfaState st352[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 279, 357, 279, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st353[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 358, 334, 334, 344,
- 345, 334, 334, 359, 359, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st354[36] = {
- 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
- 354, 354, 354, 354, 354, 436
-};
-
-static DfaState st355[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 360, 436, 436, 361,
- 362, 436, 436, 363, 363, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st356[36] = {
- 436, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
- 354, 354, 354, 354, 354, 354, 354, 354, 355, 354,
- 354, 354, 354, 354, 354, 436
-};
-
-static DfaState st357[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 279, 279, 364, 279, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st358[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 358, 334, 334, 344,
- 345, 334, 334, 359, 359, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st359[36] = {
- 436, 334, 334, 334, 334, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 334, 358, 334, 334, 344,
- 345, 334, 334, 359, 359, 334, 334, 334, 334, 334,
- 334, 334, 334, 334, 334, 436
-};
-
-static DfaState st360[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 360, 436, 436, 361,
- 362, 436, 436, 363, 363, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st361[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st362[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 365,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st363[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 360, 436, 436, 361,
- 362, 436, 436, 363, 363, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st364[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 279, 279, 279, 366, 436, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st365[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st366[36] = {
- 436, 436, 279, 436, 279, 279, 279, 279, 279, 279,
- 279, 279, 279, 279, 279, 367, 279, 279, 436, 436,
- 436, 436, 436, 279, 279, 279, 279, 436, 436, 436,
- 436, 436, 279, 279, 279, 436
-};
-
-static DfaState st367[36] = {
- 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 368, 369, 370, 436, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 436
-};
-
-static DfaState st368[36] = {
- 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 371, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 436
-};
-
-static DfaState st369[36] = {
- 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 368, 369, 370, 371, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 436
-};
-
-static DfaState st370[36] = {
- 436, 372, 372, 372, 372, 372, 372, 372, 372, 372,
- 372, 372, 372, 372, 372, 372, 372, 372, 373, 372,
- 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
- 372, 372, 372, 372, 368, 436
-};
-
-static DfaState st371[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st372[36] = {
- 436, 372, 372, 372, 372, 372, 372, 372, 372, 372,
- 372, 372, 372, 372, 372, 372, 372, 372, 373, 372,
- 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
- 372, 372, 372, 372, 374, 436
-};
-
-static DfaState st373[36] = {
- 436, 375, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 376, 436
-};
-
-static DfaState st374[36] = {
- 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 368, 377, 368, 378, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 436
-};
-
-static DfaState st375[36] = {
- 436, 375, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
- 375, 375, 375, 375, 376, 436
-};
-
-static DfaState st376[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 379, 436, 380, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st377[36] = {
- 436, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 368, 377, 368, 378, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 436
-};
-
-static DfaState st378[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st379[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 379, 436, 380, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st380[36] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st381[28] = {
- 382, 383, 384, 385, 386, 436, 387, 388, 388, 388,
- 389, 388, 388, 388, 388, 388, 388, 388, 388, 388,
- 390, 391, 392, 393, 394, 395, 388, 436
-};
-
-static DfaState st382[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st383[28] = {
- 436, 383, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st384[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st385[28] = {
- 436, 436, 396, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st386[28] = {
- 436, 436, 436, 436, 397, 398, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st387[28] = {
- 436, 436, 436, 436, 436, 436, 436, 399, 436, 400,
- 401, 436, 436, 436, 402, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st388[28] = {
- 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 436, 436, 436, 436, 436, 403, 403, 436
-};
-
-static DfaState st389[28] = {
- 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
- 403, 404, 403, 403, 403, 403, 403, 403, 403, 403,
- 436, 436, 436, 436, 436, 403, 403, 436
-};
-
-static DfaState st390[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st391[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st392[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st393[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st394[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st395[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 395, 436, 436
-};
-
-static DfaState st396[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st397[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st398[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st399[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 405, 436,
- 436, 436, 436, 436, 436, 406, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st400[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 407, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st401[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 408, 409, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st402[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 410, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st403[28] = {
- 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 436, 436, 436, 436, 436, 403, 403, 436
-};
-
-static DfaState st404[28] = {
- 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
- 403, 403, 403, 403, 411, 403, 403, 403, 403, 403,
- 436, 436, 436, 436, 436, 403, 403, 436
-};
-
-static DfaState st405[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 412,
- 436, 413, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st406[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 414, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st407[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 415, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st408[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 416,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st409[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 417, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st410[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 418,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st411[28] = {
- 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
- 403, 403, 403, 403, 403, 419, 403, 403, 403, 403,
- 436, 436, 436, 436, 436, 403, 403, 436
-};
-
-static DfaState st412[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 420, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st413[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 421,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st414[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 422, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st415[28] = {
- 436, 436, 436, 436, 436, 436, 436, 423, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st416[28] = {
- 436, 436, 436, 436, 436, 436, 436, 424, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st417[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 425, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st418[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 426, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st419[28] = {
- 436, 436, 436, 436, 436, 436, 436, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 436, 436, 436, 436, 436, 403, 403, 436
-};
-
-static DfaState st420[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 427, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st421[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 428, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st422[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 429, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st423[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 430, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st424[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 431, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st425[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st426[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 432, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st427[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st428[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 433, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st429[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 434,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st430[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 435, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st431[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st432[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st433[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st434[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-static DfaState st435[28] = {
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436
-};
-
-
-DfaState *dfa[436] = {
- st0,
- st1,
- st2,
- st3,
- st4,
- st5,
- st6,
- st7,
- st8,
- st9,
- st10,
- st11,
- st12,
- st13,
- st14,
- st15,
- st16,
- st17,
- st18,
- st19,
- st20,
- st21,
- st22,
- st23,
- st24,
- st25,
- st26,
- st27,
- st28,
- st29,
- st30,
- st31,
- st32,
- st33,
- st34,
- st35,
- st36,
- st37,
- st38,
- st39,
- st40,
- st41,
- st42,
- st43,
- st44,
- st45,
- st46,
- st47,
- st48,
- st49,
- st50,
- st51,
- st52,
- st53,
- st54,
- st55,
- st56,
- st57,
- st58,
- st59,
- st60,
- st61,
- st62,
- st63,
- st64,
- st65,
- st66,
- st67,
- st68,
- st69,
- st70,
- st71,
- st72,
- st73,
- st74,
- st75,
- st76,
- st77,
- st78,
- st79,
- st80,
- st81,
- st82,
- st83,
- st84,
- st85,
- st86,
- st87,
- st88,
- st89,
- st90,
- st91,
- st92,
- st93,
- st94,
- st95,
- st96,
- st97,
- st98,
- st99,
- st100,
- st101,
- st102,
- st103,
- st104,
- st105,
- st106,
- st107,
- st108,
- st109,
- st110,
- st111,
- st112,
- st113,
- st114,
- st115,
- st116,
- st117,
- st118,
- st119,
- st120,
- st121,
- st122,
- st123,
- st124,
- st125,
- st126,
- st127,
- st128,
- st129,
- st130,
- st131,
- st132,
- st133,
- st134,
- st135,
- st136,
- st137,
- st138,
- st139,
- st140,
- st141,
- st142,
- st143,
- st144,
- st145,
- st146,
- st147,
- st148,
- st149,
- st150,
- st151,
- st152,
- st153,
- st154,
- st155,
- st156,
- st157,
- st158,
- st159,
- st160,
- st161,
- st162,
- st163,
- st164,
- st165,
- st166,
- st167,
- st168,
- st169,
- st170,
- st171,
- st172,
- st173,
- st174,
- st175,
- st176,
- st177,
- st178,
- st179,
- st180,
- st181,
- st182,
- st183,
- st184,
- st185,
- st186,
- st187,
- st188,
- st189,
- st190,
- st191,
- st192,
- st193,
- st194,
- st195,
- st196,
- st197,
- st198,
- st199,
- st200,
- st201,
- st202,
- st203,
- st204,
- st205,
- st206,
- st207,
- st208,
- st209,
- st210,
- st211,
- st212,
- st213,
- st214,
- st215,
- st216,
- st217,
- st218,
- st219,
- st220,
- st221,
- st222,
- st223,
- st224,
- st225,
- st226,
- st227,
- st228,
- st229,
- st230,
- st231,
- st232,
- st233,
- st234,
- st235,
- st236,
- st237,
- st238,
- st239,
- st240,
- st241,
- st242,
- st243,
- st244,
- st245,
- st246,
- st247,
- st248,
- st249,
- st250,
- st251,
- st252,
- st253,
- st254,
- st255,
- st256,
- st257,
- st258,
- st259,
- st260,
- st261,
- st262,
- st263,
- st264,
- st265,
- st266,
- st267,
- st268,
- st269,
- st270,
- st271,
- st272,
- st273,
- st274,
- st275,
- st276,
- st277,
- st278,
- st279,
- st280,
- st281,
- st282,
- st283,
- st284,
- st285,
- st286,
- st287,
- st288,
- st289,
- st290,
- st291,
- st292,
- st293,
- st294,
- st295,
- st296,
- st297,
- st298,
- st299,
- st300,
- st301,
- st302,
- st303,
- st304,
- st305,
- st306,
- st307,
- st308,
- st309,
- st310,
- st311,
- st312,
- st313,
- st314,
- st315,
- st316,
- st317,
- st318,
- st319,
- st320,
- st321,
- st322,
- st323,
- st324,
- st325,
- st326,
- st327,
- st328,
- st329,
- st330,
- st331,
- st332,
- st333,
- st334,
- st335,
- st336,
- st337,
- st338,
- st339,
- st340,
- st341,
- st342,
- st343,
- st344,
- st345,
- st346,
- st347,
- st348,
- st349,
- st350,
- st351,
- st352,
- st353,
- st354,
- st355,
- st356,
- st357,
- st358,
- st359,
- st360,
- st361,
- st362,
- st363,
- st364,
- st365,
- st366,
- st367,
- st368,
- st369,
- st370,
- st371,
- st372,
- st373,
- st374,
- st375,
- st376,
- st377,
- st378,
- st379,
- st380,
- st381,
- st382,
- st383,
- st384,
- st385,
- st386,
- st387,
- st388,
- st389,
- st390,
- st391,
- st392,
- st393,
- st394,
- st395,
- st396,
- st397,
- st398,
- st399,
- st400,
- st401,
- st402,
- st403,
- st404,
- st405,
- st406,
- st407,
- st408,
- st409,
- st410,
- st411,
- st412,
- st413,
- st414,
- st415,
- st416,
- st417,
- st418,
- st419,
- st420,
- st421,
- st422,
- st423,
- st424,
- st425,
- st426,
- st427,
- st428,
- st429,
- st430,
- st431,
- st432,
- st433,
- st434,
- st435
-};
-
-
-DfaState accepts[437] = {
- 0, 1, 2, 3, 3, 4, 25, 6, 0, 50,
- 59, 57, 57, 43, 26, 13, 14, 0, 57, 58,
- 57, 21, 57, 23, 24, 27, 28, 44, 0, 35,
- 36, 42, 45, 46, 58, 51, 52, 3, 5, 9,
- 7, 8, 59, 59, 59, 59, 59, 59, 59, 59,
- 57, 57, 12, 40, 59, 57, 58, 57, 57, 57,
- 33, 34, 53, 58, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 57, 59, 57, 57, 57, 57, 0,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 57, 57, 57, 57, 57, 0, 0, 59, 59, 59,
- 59, 59, 59, 32, 59, 59, 59, 59, 59, 59,
- 59, 59, 57, 57, 57, 22, 56, 48, 49, 0,
- 11, 11, 0, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 41, 59, 59, 59, 18, 57, 47,
- 57, 0, 11, 0, 10, 10, 0, 59, 59, 59,
- 59, 59, 15, 19, 59, 59, 59, 17, 57, 55,
- 10, 0, 11, 11, 59, 59, 59, 59, 59, 59,
- 20, 59, 57, 0, 0, 0, 11, 59, 59, 59,
- 37, 38, 59, 39, 54, 0, 0, 0, 10, 10,
- 0, 31, 29, 30, 59, 10, 59, 59, 59, 59,
- 16, 0, 60, 61, 62, 62, 0, 65, 62, 64,
- 63, 63, 63, 0, 66, 67, 68, 68, 0, 71,
- 68, 70, 69, 69, 69, 0, 72, 73, 74, 74,
- 0, 76, 74, 75, 0, 77, 79, 81, 80, 80,
- 78, 80, 0, 82, 84, 86, 85, 85, 83, 85,
- 0, 87, 88, 88, 89, 88, 0, 90, 91, 91,
- 92, 91, 0, 93, 94, 94, 95, 94, 0, 96,
- 98, 100, 99, 99, 97, 99, 0, 101, 108, 143,
- 104, 143, 129, 127, 107, 107, 109, 128, 126, 134,
- 0, 133, 139, 143, 102, 143, 107, 116, 110, 112,
- 113, 123, 123, 125, 124, 117, 120, 132, 138, 130,
- 131, 137, 137, 135, 136, 142, 140, 141, 103, 143,
- 116, 111, 114, 123, 123, 119, 118, 137, 143, 115,
- 123, 143, 123, 143, 0, 123, 0, 122, 122, 123,
- 143, 0, 122, 0, 121, 121, 0, 143, 121, 0,
- 122, 122, 143, 0, 0, 0, 122, 143, 0, 0,
- 0, 121, 121, 0, 143, 121, 143, 0, 0, 0,
- 0, 106, 0, 106, 0, 0, 0, 0, 105, 0,
- 105, 0, 144, 145, 146, 146, 0, 0, 164, 164,
- 158, 159, 160, 161, 162, 163, 146, 147, 148, 0,
- 0, 0, 0, 164, 164, 150, 0, 0, 0, 0,
- 0, 164, 0, 0, 0, 0, 0, 0, 0, 157,
- 0, 0, 0, 0, 0, 152, 0, 149, 0, 0,
- 0, 153, 154, 151, 155, 156, 0
-};
-
-void (*actions[165])() = {
- zzerraction,
- act1,
- act2,
- act3,
- act4,
- act5,
- act6,
- act7,
- act8,
- act9,
- act10,
- act11,
- act12,
- act13,
- act14,
- act15,
- act16,
- act17,
- act18,
- act19,
- act20,
- act21,
- act22,
- act23,
- act24,
- act25,
- act26,
- act27,
- act28,
- act29,
- act30,
- act31,
- act32,
- act33,
- act34,
- act35,
- act36,
- act37,
- act38,
- act39,
- act40,
- act41,
- act42,
- act43,
- act44,
- act45,
- act46,
- act47,
- act48,
- act49,
- act50,
- act51,
- act52,
- act53,
- act54,
- act55,
- act56,
- act57,
- act58,
- act59,
- act60,
- act61,
- act62,
- act63,
- act64,
- act65,
- act66,
- act67,
- act68,
- act69,
- act70,
- act71,
- act72,
- act73,
- act74,
- act75,
- act76,
- act77,
- act78,
- act79,
- act80,
- act81,
- act82,
- act83,
- act84,
- act85,
- act86,
- act87,
- act88,
- act89,
- act90,
- act91,
- act92,
- act93,
- act94,
- act95,
- act96,
- act97,
- act98,
- act99,
- act100,
- act101,
- act102,
- act103,
- act104,
- act105,
- act106,
- act107,
- act108,
- act109,
- act110,
- act111,
- act112,
- act113,
- act114,
- act115,
- act116,
- act117,
- act118,
- act119,
- act120,
- act121,
- act122,
- act123,
- act124,
- act125,
- act126,
- act127,
- act128,
- act129,
- act130,
- act131,
- act132,
- act133,
- act134,
- act135,
- act136,
- act137,
- act138,
- act139,
- act140,
- act141,
- act142,
- act143,
- act144,
- act145,
- act146,
- act147,
- act148,
- act149,
- act150,
- act151,
- act152,
- act153,
- act154,
- act155,
- act156,
- act157,
- act158,
- act159,
- act160,
- act161,
- act162,
- act163,
- act164
-};
-
-static DfaState dfa_base[] = {
- 0,
- 201,
- 213,
- 225,
- 234,
- 242,
- 250,
- 256,
- 262,
- 268,
- 276,
- 381
-};
-
-static unsigned char *b_class_no[] = {
- shift0,
- shift1,
- shift2,
- shift3,
- shift4,
- shift5,
- shift6,
- shift7,
- shift8,
- shift9,
- shift10,
- shift11
-};
-
-
-
-#define ZZSHIFT(c) (b_class_no[zzauto][1+c])
-#define MAX_MODE 12
-#include "dlgauto.h"
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h
deleted file mode 100644
index ccdc21c3c9..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/stdpccts.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef STDPCCTS_H
-#define STDPCCTS_H
-/*
- * stdpccts.h -- P C C T S I n c l u d e
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33MR33
- */
-
-#ifndef ANTLR_VERSION
-#define ANTLR_VERSION 13333
-#endif
-
-#include "pcctscfg.h"
-#include "pccts_stdio.h"
-
-#include "pcctscfg.h"
-#include "set.h"
-#include <ctype.h>
-#include "syn.h"
-#include "hash.h"
-#include "generic.h"
-#define zzcr_attr(attr,tok,t)
-#define zzSET_SIZE 20
-#include "antlr.h"
-#include "tokens.h"
-#include "dlgdef.h"
-#include "mode.h"
-#endif
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h
deleted file mode 100644
index a23d196d77..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/syn.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * syn.h
- *
- * This file includes definitions and macros associated with syntax diagrams
- *
- * SOFTWARE RIGHTS
- *
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
- * Set (PCCTS) -- PCCTS is in the public domain. An individual or
- * company may do whatever they wish with source code distributed with
- * PCCTS or the code generated by PCCTS, including the incorporation of
- * PCCTS, or its output, into commerical software.
- *
- * We encourage users to develop software with PCCTS. However, we do ask
- * that credit is given to us for developing PCCTS. By "credit",
- * we mean that if you incorporate our source code into one of your
- * programs (commercial product, research project, or otherwise) that you
- * acknowledge this fact somewhere in the documentation, research report,
- * etc... If you like PCCTS and have developed a nice tool with the
- * output, please mention that you developed it using PCCTS. In
- * addition, we ask that this header remain intact in our source code.
- * As long as these guidelines are kept, we expect to continue enhancing
- * this system and expect to make other tools available as they are
- * completed.
- *
- * ANTLR 1.33
- * Terence Parr
- * Parr Research Corporation
- * with Purdue University and AHPCRC, University of Minnesota
- * 1989-2001
- */
-
-#include "set.h"
-
-#define NumNodeTypes 4
-#define NumJuncTypes 9
-
-/* List the different node types */
-#define nJunction 1
-#define nRuleRef 2
-#define nToken 3
-#define nAction 4
-
-/* Different types of junctions */
-#define aSubBlk 1
-#define aOptBlk 2
-#define aLoopBlk 3
-#define EndBlk 4
-#define RuleBlk 5
-#define Generic 6 /* just a junction--no unusual characteristics */
-#define EndRule 7
-#define aPlusBlk 8
-#define aLoopBegin 9
-
-typedef int NodeType;
-
-#define TreeBlockAllocSize 500
-#define JunctionBlockAllocSize 200
-#define ActionBlockAllocSize 50
-#define RRefBlockAllocSize 100
-#define TokenBlockAllocSize 100
-
-#ifdef __cplusplus
-class ActionNode;
-class Junction;
-#endif
-
-/* note that 'right' is used by the tree node allocator as a ptr for linked list */
-typedef struct _tree {
- struct _tree *down, *right;
- int token;
- union {
- int rk; /* if token==EpToken, => how many more tokens req'd */
- struct _tree *tref; /* if token==TREE_REF */
- set sref; /* if token==SET */
- } v;
-#ifdef TREE_DEBUG
- int in_use;
- int seq;
-#endif
- } Tree;
-
-
-/* a predicate is defined to be a predicate action and a token tree with
- * context info (if used); later, this struct may include the
- * "hoisting distance" when we hoist past tokens.
- *
- * A tree is used to indicate && vs ||
- *
- * p
- * |
- * q--r
- *
- * indicates p && (q||r).
- *
- * If expr is PRED_AND_LIST or PRED_OR_LIST, then it's an operation node
- * and indicates the start of an && or || list.
- */
-
-typedef struct _Predicate {
- struct _Predicate *down, *right; /* these have to be first */
- struct _Predicate *up, *left; /* doubly-link me */
- char *expr;
- Tree *tcontext; /* used if lookahead depth of > one is needed (tree) */
- int k; /* lookahead depth for this tcontext */
- set scontext[2];/* used if lookahead depth of one is needed (set) */
- /* scontext[0] is not used; only needed so genExprSets()
- routine works (it expects an array)
- */
- set completionTree; /* which lookahead depths are required to complete tcontext? */
- set completionSet; /* MR10 separate completion set for sets and trees */
- struct _PredEntry *predEntry; /* MR11 */
-
-#ifdef __cplusplus
- ActionNode *source; /* where did this predicate come from? */
-#else
- struct _anode *source; /* where did this predicate come from? */
-#endif
-
- char cloned; /* MR10 don't want to free original guard pred */
- char redundant; /* MR10 predicate tree simplification */
- char ampersandStyle; /* MR10 (g)? && <<p>>? */
- char inverted; /* MR11 ! predName */
- char isConst; /* MR11 */
- char constValue; /* MR11 */
- char conflictReported; /* MR11 */
-
- set plainSet; /* MR12b */
-
- /*** remember to change new_predicate() and predicate_dup() when changing this ***/
-
-} Predicate;
-
-typedef struct _ExceptionHandler {
- char *signalname;
- char *action;
- } ExceptionHandler;
-
-typedef struct _ExceptionGroup {
- struct _ListNode *handlers; /* list of ExceptionHandler's */
- char *label; /* label==""; implies not attached to any
- * particular rule ref.
- */
- char *altID; /* which alt did it come from (blk#:alt#) */
-
- struct _ExceptionGroup *pendingLink; /* for alternative EG MR7 */
- struct _ExceptionGroup *outerEG; /* for alternative EG MR7 */
- struct _LabelEntry *labelEntry; /* for alternative EG MR7 */
- int forRule; /* MR7 */
- int used; /* MR7 */
- } ExceptionGroup ;
-
-
-#define TokenString(_i) ((TokenInd!=NULL)?TokenStr[TokenInd[_i]]:TokenStr[_i])
-#define ExprString(_i) ((TokenInd!=NULL)?ExprStr[TokenInd[_i]]:ExprStr[_i])
-
-
- /* M e s s a g e P a s s i n g T o N o d e s */
-
-/*
- * assumes a 'Junction *r' exists. This macro calls a function with
- * the pointer to the node to operate on and a pointer to the rule
- * in which it is enclosed.
- */
-#define TRANS(p) {if ( (p)==NULL ) fatal("TRANS: NULL object"); \
- if ( (p)->ntype == nJunction ) (*(fpJTrans[((Junction *)(p))->jtype]))( p );\
- else (*(fpTrans[(p)->ntype]))( p );}
-
-#define PRINT(p) {if ( (p)==NULL ) fatal("PRINT: NULL object");\
- (*(fpPrint[(p)->ntype]))( p );}
-
-#define REACH(p,k,rk,a) {if ( (p)==NULL ) fatal("REACH: NULL object");\
- (a) = (*(fpReach[(p)->ntype]))( p, k, rk );}
-
-#define TRAV(p,k,rk,a) {if ( (p)==NULL ) {\
- if ( ContextGuardTRAV ) (a)=NULL; \
- else fatal("TRAV: NULL object");\
- } \
- else (a) = (*(fpTraverse[(p)->ntype]))( p, k, rk );}
-
-/**
-*** #define TRAV(p,k,rk,a) {if ( (p)==NULL ) fatal("TRAV: NULL object");\
-*** (a) = (*(fpTraverse[(p)->ntype]))( p, k, rk );}
-**/
-
-/* All syntax diagram nodes derive from Node -- superclass
- */
-#ifdef __cplusplus
-class Node {
-public:
- NodeType ntype;
- char *rname; /* what rule does this element live in? */
- int file; /* index in FileStr */
- int line; /* line number that element occurs on */
- };
-#else
-typedef struct _node {
- NodeType ntype;
- char *rname; /* what rule does this element live in? */
- int file; /* index in FileStr */
- int line; /* line number that element occurs on */
- } Node;
-#endif
-
-#ifdef __cplusplus
-class ActionNode : public Node {
-public:
-#else
-typedef struct _anode {
- NodeType ntype;
- char *rname; /* what rule does this action live in? */
- int file; /* index in FileStr (name of file with action) */
- int line; /* line number that action occurs on */
-#endif
- Node *next;
- char *action;
- int is_predicate; /* true if action is a <<...>>? predicate action */
- int done; /* don't dump if action dumped (used for predicates) */
- int init_action; /* is this the 1st action of 1st prod of block? */
- char *pred_fail; /* what to do/print when predicate fails */
- Predicate *guardpred; /* if '(context)? =>' was present, already done */
- unsigned char frmwarned;/* have we dumped a warning for pred yet? */
- unsigned char ctxwarned;/* have we dumped a warning for pred yet? */
- unsigned char predTooLong; /* MR10 have we dumped warning for pred yet */
- unsigned char noHoist; /* MR12 literally "noHoist" */
- Predicate *ampersandPred; /* MR10 (g)? && <<p>>? expr */
-#ifdef __cplusplus
- Junction *guardNodes; /* MR11 */
-#else
- struct _junct *guardNodes; /* MR11 */
-#endif
- struct _PredEntry *predEntry; /* MR11 */
- int inverted; /* MR11 <<!predSymbol>>? */
-#ifdef __cplusplus
- };
-#else
- } ActionNode;
-#endif
-
-#ifdef __cplusplus
-class TokNode : public Node {
-public:
-#else
-typedef struct _toknode {
- NodeType ntype;
- char *rname; /* name of rule it's in */
- int file; /* index in FileStr (name of file with rule) */
- int line; /* line number that token occurs on */
-#endif
- Node *next;
- int token;
- int astnode; /* leaf/root/excluded (used to build AST's) */
- unsigned char label;/* token label or expression ? */
- unsigned char remapped;
- /* used if token id's are forced to certain positions;
- * a function walks the tree reassigning token numbers */
- int upper_range; /* MR13 - was char */
- /* used only if Token is of type T1..T2; in this case,
- * use token..upper_range as the range; else
- * upper_range must be 0 */
- unsigned char wild_card;
- /* indicates that the token is the "." wild-card;
- * field token is ignored if wild_card is set
- */
- unsigned int elnum; /* element number within the alternative */
-#ifdef __cplusplus
- Junction *altstart; /* pointer to node that starts alt */
-#else
- struct _junct *altstart; /* pointer to node that starts alt */
-#endif
- struct _TCnode *tclass; /* token class if tokclass ref */
- set tset; /* set of tokens represented by meta token */
- char *el_label; /* el_label:toknode */
- unsigned char complement; /* complement the set? */
- ExceptionGroup *ex_group; /* any exception[el_label] attached? */
- unsigned char use_def_MT_handler;
- unsigned char label_used_in_semantic_pred; /* MR10 */
-#ifdef __cplusplus
- };
-#else
- } TokNode;
-#endif
-
-#ifdef __cplusplus
-class RuleRefNode : public Node {
-public:
-#else
-typedef struct _rrnode {
- NodeType ntype;
- char *rname; /* name of rule it's in */
- int file; /* index in FileStr (name of file with rule)
- it's in */
- int line; /* line number that rule ref occurs on */
-#endif
- Node *next;
- char *text; /* reference to which rule */
- char *parms; /* point to parameters of rule invocation
- (if present) */
- char *assign; /* point to left-hand-side of assignment
- (if any) */
- int linked; /* Has a FoLink already been established? */
- int astnode; /* excluded? (used to build AST's) */
- unsigned int elnum; /* element number within the alternative */
-#ifdef __cplusplus
- Junction *altstart;
-#else
- struct _junct *altstart;
-#endif
- char *el_label; /* el_label:rrnode */
- ExceptionGroup *ex_group; /* any exception[el_label] attached? */
-#ifdef __cplusplus
- };
-#else
- } RuleRefNode;
-#endif
-
-#ifdef __cplusplus
-class Junction : public Node {
-public:
-#else
-typedef struct _junct {
- NodeType ntype;
- char *rname; /* name of rule junction is in */
- int file; /* index in FileStr (name of file with rule)
- if blk == RuleBlk */
- int line; /* line number that rule occurs on */
-#endif
- int seq; /* MR10 sequence number */
- char ignore; /* used by FIRST computation to ignore
- empty alt added for the (...)+ blks */
- char visited; /* used by recursive routines to avoid
- infinite recursion */
- char pvisited; /* used by print routines to avoid
- infinite recursion */
- char fvisited; /* used by FoLink() to avoid
- infinite recursion */
- char *lock; /* used by REACH to track infinite recursion */
- char *pred_lock; /* used by find_predicates to track infinite recursion */
- int altnum; /* used in subblocks. altnum==0 means not an
- alt of subrule */
- int jtype; /* annotation for code-gen/FIRST/FOLLOW.
- Junction type */
-#ifdef __cplusplus
- Junction *end; /* pointer to node with EndBlk in it
- if blk == a block type */
-#else
- struct _junct *end; /* pointer to node with EndBlk in it
- if blk == a block type */
-#endif
- Node *p1, *p2;
- char halt; /* never move past a junction with halt==TRUE */ /* MR10 was int */
- char *pdecl; /* point to declaration of parameters on rule
- (if present) */
- char *parm; /* point to parameter of block invocation
- (if present) */
- char predparm; /* indicates that the 'parm' is a predicate
- * to be used in the while loop generated
- * for blocks */ /* MR10 was int */
- char *ret; /* point to return type of rule (if present) */
- char *erraction; /* point to error action (if present) */
- int blockid; /* this is a unique ID */
- char *exception_label; /* goto label for this alt */
- set *fset; /* used for code generation */
- Tree *ftree; /* used for code generation */
- Predicate *predicate;/* predicate that can be used to disambiguate */
- char guess; /* true if (...)? block */
- char alpha_beta_guess_end; /* MR14 1 => end block of guess sub block */
- Node *guess_analysis_point; /* MR14 */
- char approx; /* limit block to use linear approx lookahead? */
- set tokrefs; /* if ith element of alt is tokref then i is member */
- set rulerefs; /* if ith element of alt is rule ref then i is member */
- struct _ListNode *exceptions; /* list of exceptions groups for rule */
- struct _ListNode *el_labels; /* list of element labels for rule */
- ExceptionGroup *outerEG; /* MR7 */
- int curAltNum; /* MR7 */
- char* pFirstSetSymbol; /* #pragma FirstSetSymbol(Foo) MR21 */
-#ifdef __cplusplus
- Junction *pendingLink; /* MR7 */
-#else
- struct _junct *pendingLink; /* MR7 */
-#endif
- char overlap_warning; /* MR10 */
-#ifdef __cplusplus
- };
-#else
- } Junction;
-#endif
-
-typedef struct { Node *left, *right;} Graph;
-
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h b/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h
deleted file mode 100644
index 91a53a8471..0000000000
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/tokens.h
+++ /dev/null
@@ -1,246 +0,0 @@
-#ifndef tokens_h
-#define tokens_h
-/* tokens.h -- List of labelled tokens and stuff
- *
- * Generated from: antlr.g
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
- * Purdue University Electrical Engineering
- * ANTLR Version 1.33MR33
- */
-#define zzEOF_TOKEN 1
-#define Eof 1
-#define QuotedTerm 2
-#define Action 34
-#define Pred 35
-#define PassAction 36
-#define WildCard 87
-#define LABEL 89
-#define Pragma 92
-#define FirstSetSymbol 93
-#define NonTerminal 100
-#define TokenTerm 101
-#define ID 148
-#define INT 150
-
-#ifdef __USE_PROTOS
-void grammar(void);
-#else
-extern void grammar();
-#endif
-
-#ifdef __USE_PROTOS
-void class_def(void);
-#else
-extern void class_def();
-#endif
-
-#ifdef __USE_PROTOS
-void rule(void);
-#else
-extern void rule();
-#endif
-
-#ifdef __USE_PROTOS
-void laction(void);
-#else
-extern void laction();
-#endif
-
-#ifdef __USE_PROTOS
-void lmember(void);
-#else
-extern void lmember();
-#endif
-
-#ifdef __USE_PROTOS
-void lprefix(void);
-#else
-extern void lprefix();
-#endif
-
-#ifdef __USE_PROTOS
-void aPred(void);
-#else
-extern void aPred();
-#endif
-
-#ifdef __USE_PROTOS
-extern Predicate * predOrExpr(void);
-#else
-extern Predicate * predOrExpr();
-#endif
-
-#ifdef __USE_PROTOS
-extern Predicate * predAndExpr(void);
-#else
-extern Predicate * predAndExpr();
-#endif
-
-#ifdef __USE_PROTOS
-extern Predicate * predPrimary(void);
-#else
-extern Predicate * predPrimary();
-#endif
-
-#ifdef __USE_PROTOS
-void aLexclass(void);
-#else
-extern void aLexclass();
-#endif
-
-#ifdef __USE_PROTOS
-void error(void);
-#else
-extern void error();
-#endif
-
-#ifdef __USE_PROTOS
-void tclass(void);
-#else
-extern void tclass();
-#endif
-
-#ifdef __USE_PROTOS
-void token(void);
-#else
-extern void token();
-#endif
-
-#ifdef __USE_PROTOS
-void block(set * toksrefd,set * rulesrefd);
-#else
-extern void block();
-#endif
-
-#ifdef __USE_PROTOS
-void alt(set * toksrefd,set * rulesrefd);
-#else
-extern void alt();
-#endif
-
-#ifdef __USE_PROTOS
-extern LabelEntry * element_label(void);
-#else
-extern LabelEntry * element_label();
-#endif
-
-#ifdef __USE_PROTOS
-extern Node * element(int old_not,int first_on_line,int use_def_MT_handler);
-#else
-extern Node * element();
-#endif
-
-#ifdef __USE_PROTOS
-void default_exception_handler(void);
-#else
-extern void default_exception_handler();
-#endif
-
-#ifdef __USE_PROTOS
-extern ExceptionGroup * exception_group(void);
-#else
-extern ExceptionGroup * exception_group();
-#endif
-
-#ifdef __USE_PROTOS
-extern ExceptionHandler * exception_handler(void);
-#else
-extern ExceptionHandler * exception_handler();
-#endif
-
-#ifdef __USE_PROTOS
-void enum_file(char * fname);
-#else
-extern void enum_file();
-#endif
-
-#ifdef __USE_PROTOS
-void defines(char * fname);
-#else
-extern void defines();
-#endif
-
-#ifdef __USE_PROTOS
-void enum_def(char * fname);
-#else
-extern void enum_def();
-#endif
-
-#endif
-extern SetWordType zzerr1[];
-extern SetWordType zzerr2[];
-extern SetWordType zzerr3[];
-extern SetWordType zzerr4[];
-extern SetWordType setwd1[];
-extern SetWordType zzerr5[];
-extern SetWordType zzerr6[];
-extern SetWordType zzerr7[];
-extern SetWordType zzerr8[];
-extern SetWordType zzerr9[];
-extern SetWordType setwd2[];
-extern SetWordType zzerr10[];
-extern SetWordType zzerr11[];
-extern SetWordType zzerr12[];
-extern SetWordType zzerr13[];
-extern SetWordType setwd3[];
-extern SetWordType zzerr14[];
-extern SetWordType zzerr15[];
-extern SetWordType zzerr16[];
-extern SetWordType zzerr17[];
-extern SetWordType zzerr18[];
-extern SetWordType zzerr19[];
-extern SetWordType zzerr20[];
-extern SetWordType zzerr21[];
-extern SetWordType setwd4[];
-extern SetWordType zzerr22[];
-extern SetWordType zzerr23[];
-extern SetWordType zzerr24[];
-extern SetWordType zzerr25[];
-extern SetWordType zzerr26[];
-extern SetWordType setwd5[];
-extern SetWordType zzerr27[];
-extern SetWordType zzerr28[];
-extern SetWordType zzerr29[];
-extern SetWordType zzerr30[];
-extern SetWordType zzerr31[];
-extern SetWordType zzerr32[];
-extern SetWordType zzerr33[];
-extern SetWordType setwd6[];
-extern SetWordType zzerr34[];
-extern SetWordType zzerr35[];
-extern SetWordType zzerr36[];
-extern SetWordType zzerr37[];
-extern SetWordType zzerr38[];
-extern SetWordType zzerr39[];
-extern SetWordType zzerr40[];
-extern SetWordType zzerr41[];
-extern SetWordType zzerr42[];
-extern SetWordType setwd7[];
-extern SetWordType zzerr43[];
-extern SetWordType zzerr44[];
-extern SetWordType zzerr45[];
-extern SetWordType zzerr46[];
-extern SetWordType zzerr47[];
-extern SetWordType zzerr48[];
-extern SetWordType zzerr49[];
-extern SetWordType zzerr50[];
-extern SetWordType zzerr51[];
-extern SetWordType zzerr52[];
-extern SetWordType zzerr53[];
-extern SetWordType setwd8[];
-extern SetWordType zzerr54[];
-extern SetWordType zzerr55[];
-extern SetWordType zzerr56[];
-extern SetWordType zzerr57[];
-extern SetWordType setwd9[];
-extern SetWordType zzerr58[];
-extern SetWordType zzerr59[];
-extern SetWordType zzerr60[];
-extern SetWordType zzerr61[];
-extern SetWordType zzerr62[];
-extern SetWordType zzerr63[];
-extern SetWordType zzerr64[];
-extern SetWordType zzerr65[];
-extern SetWordType setwd10[];
-extern SetWordType setwd11[];