From 838fb9e23a510f80c1f71abecb6fa29b09f5a39f Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Sun, 8 Nov 1998 17:06:13 +0000
Subject: [PATCH] [project @ 1998-11-08 17:06:13 by sof] front end support for
 'foreign label's

---
 ghc/compiler/parser/hslexer.flex | 1 +
 ghc/compiler/parser/hsparser.y   | 4 +++-
 ghc/compiler/parser/utils.h      | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ghc/compiler/parser/hslexer.flex b/ghc/compiler/parser/hslexer.flex
index a5adef34eadc..fc1b66b5ca7f 100644
--- a/ghc/compiler/parser/hslexer.flex
+++ b/ghc/compiler/parser/hslexer.flex
@@ -401,6 +401,7 @@ NL  	    	    	[\n\r]
 <GlaExt>"_casm_GC_"		{ RETURN(CASM_GC); }
 <GlaExt>"foreign"		{ RETURN(FOREIGN); }
 <GlaExt>"export"		{ RETURN(EXPORT); }
+<GlaExt>"label"			{ RETURN(LABEL); }
 <GlaExt>"unsafe"		{ RETURN(UNSAFE); }
 <GlaExt>"_stdcall"		{ RETURN(STDCALL); }
 <GlaExt>"_ccall"		{ RETURN(C_CALL); }
diff --git a/ghc/compiler/parser/hsparser.y b/ghc/compiler/parser/hsparser.y
index 59d6f9d9ad64..8a691fdcaf37 100644
--- a/ghc/compiler/parser/hsparser.y
+++ b/ghc/compiler/parser/hsparser.y
@@ -161,7 +161,7 @@ BOOLEAN pat_check=TRUE;
 
 %token  SCC
 %token	CCALL		CCALL_GC	CASM		CASM_GC
-%token  EXPORT          UNSAFE          STDCALL		C_CALL  
+%token  EXPORT          UNSAFE          STDCALL		C_CALL   LABEL
 %token  PASCAL		FASTCALL	FOREIGN         DYNAMIC
 
 /**********************************************************************
@@ -548,6 +548,8 @@ defaultd:  defaultkey OPAREN types CPAREN       { $$ = mkdbind($3,startlineno);
 foreignd:  foreignkey IMPORT callconv ext_name unsafe_flag qvarid DCOLON sigtype { $$ = mkfobind($6,$8,$4,$5,$3,FOREIGN_IMPORT,startlineno); }
         |  foreignkey EXPORT callconv ext_name qvarid DCOLON sigtype             { $$ = mkfobind($5,$7,$4,0,$3,FOREIGN_EXPORT,startlineno); }
 	;
+        |  foreignkey LABEL ext_name qvarid DCOLON sigtype                       { $$ = mkfobind($4,$6,$3,0,-1,FOREIGN_LABEL,startlineno); }
+	;
 
 callconv: STDCALL 	{ $$ = CALLCONV_STDCALL;  }
 	| C_CALL        { $$ = CALLCONV_CCALL;    }
diff --git a/ghc/compiler/parser/utils.h b/ghc/compiler/parser/utils.h
index 8124440038e4..4ebf921a538e 100644
--- a/ghc/compiler/parser/utils.h
+++ b/ghc/compiler/parser/utils.h
@@ -122,6 +122,7 @@ void	checkprec PROTO((tree, qid, BOOLEAN));
 
 #define FOREIGN_IMPORT    0
 #define FOREIGN_EXPORT    1
+#define FOREIGN_LABEL     2
 
 BOOLEAN	isconstr PROTO((char *));
 void	setstartlineno PROTO((void));
-- 
GitLab