1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
Author: Barry deFreese <bdefreese@debian.org>
Description: Declare the tokens before the code. Fixes FTBFS with newer Bison.
Last-Update: 2009-05-06
--- a/src/sdlBasic/src/sdlBrt/sdlBrt_tab.y
+++ b/src/sdlBasic/src/sdlBrt/sdlBrt_tab.y
@@ -1,53 +1,3 @@
-%{
-
-/* comma: return a sequence of items to execute */
-Node *comma( Node *node1, Node *node2 )
-{
- return opNode( OpComma, node1, node2 );
-}
-
-/* blockName: returns name of block */
-char *blockName( int klass )
-{
- switch(klass) {
- case -1: return eCopyString( "end-of-file" );
- case For: return eCopyString( "End For/Next" );
- case Function: return eCopyString( "End Function" );
- case If: return eCopyString( "End If" );
- case While: return eCopyString( "End While" );
- case Do: return eCopyString( "Loop" );
- case Select: return eCopyString( "End Select" );
- case Sub: return eCopyString( "End Sub" );
- default: return eCopyString("block");
- }
-}
-
-/* checkBlockEnd: make sure the block ends correctly */
-void checkBlockEnd(int got)
-{
- int wanted;
- //char *wantedName, *gotName;
-
- if (isEmptyStack(blockStack)) {
- switch (got) {
- case For: ePrintf( Syntax, "End For without For");break;
- case Function: ePrintf( Syntax, "End Function without Function");break;
- case If: ePrintf( Syntax, "End If without If");break;
- case While: ePrintf( Syntax, "End While without While");break;
- case Do: ePrintf( Syntax, "Loop without Do");break;
- case Select: ePrintf( Syntax, "End Select without Select");break;
- case Sub: ePrintf( Syntax, "End Sub without Sub");break;
- }
- }
-
- wanted = peekStack(blockStack);
- if (got != wanted){
- ePrintf( Syntax, "expected %s, not %s", blockName(wanted), blockName(got));
- }
-}
-
-%}
-
/* %no_lines */
%union {
int iValue; /* integer value */
@@ -184,6 +134,56 @@
%left '*' '/' '\\' '%' Shl Shr
%left '^'
+%{
+
+/* comma: return a sequence of items to execute */
+Node *comma( Node *node1, Node *node2 )
+{
+ return opNode( OpComma, node1, node2 );
+}
+
+/* blockName: returns name of block */
+char *blockName( int klass )
+{
+ switch(klass) {
+ case -1: return eCopyString( "end-of-file" );
+ case For: return eCopyString( "End For/Next" );
+ case Function: return eCopyString( "End Function" );
+ case If: return eCopyString( "End If" );
+ case While: return eCopyString( "End While" );
+ case Do: return eCopyString( "Loop" );
+ case Select: return eCopyString( "End Select" );
+ case Sub: return eCopyString( "End Sub" );
+ default: return eCopyString("block");
+ }
+}
+
+/* checkBlockEnd: make sure the block ends correctly */
+void checkBlockEnd(int got)
+{
+ int wanted;
+ //char *wantedName, *gotName;
+
+ if (isEmptyStack(blockStack)) {
+ switch (got) {
+ case For: ePrintf( Syntax, "End For without For");break;
+ case Function: ePrintf( Syntax, "End Function without Function");break;
+ case If: ePrintf( Syntax, "End If without If");break;
+ case While: ePrintf( Syntax, "End While without While");break;
+ case Do: ePrintf( Syntax, "Loop without Do");break;
+ case Select: ePrintf( Syntax, "End Select without Select");break;
+ case Sub: ePrintf( Syntax, "End Sub without Sub");break;
+ }
+ }
+
+ wanted = peekStack(blockStack);
+ if (got != wanted){
+ ePrintf( Syntax, "expected %s, not %s", blockName(wanted), blockName(got));
+ }
+}
+
+%}
+
%%
program:
|