From 64034bc2613afefb289d1450411e69a0de4bce4e Mon Sep 17 00:00:00 2001 From: George Lebl Date: Sun, 5 Sep 1999 02:38:00 -0800 Subject: [PATCH] Release 0.90.1 --- ChangeLog | 9 + NEWS | 4 + configure | 2 +- configure.in | 2 +- doc/gob.1 | 2 +- gob.spec | 2 +- src/lexer.c | 713 +++++++++++++++++++++++++++------------------------ src/lexer.l | 5 + src/main.c | 31 ++- src/parse.c | 697 +++++++++++++++++++++++++------------------------ src/parse.y | 61 +++-- src/test.gob | 4 + src/tree.c | 3 +- src/tree.h | 3 +- 14 files changed, 847 insertions(+), 691 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88451c1..bb458d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Sep 04 17:18:22 1999 George Lebl + + * src/lexer.l,src/parse.y,src/main.c,src/tree.[ch]: support + variable arguments for public and private methods + +Sat Sep 04 16:51:11 1999 George Lebl + + * lexer.l,parse.y: accept const in parameter lists + Sun Aug 29 13:46:33 1999 George Lebl * Release 0.90.0 diff --git a/NEWS b/NEWS index 8453dbd..28d8895 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +0.90.1 + * accept 'const' in argument lists + * accept '...' in public and private method argument lists + 0.90.0 * changed "this" to "self" but recognize "this" as well * warn if "new" is not public diff --git a/configure b/configure index 0deb730..2d83de5 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=0.90.0 +VERSION=0.90.1 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } diff --git a/configure.in b/configure.in index cda5ea7..4d7b6fd 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) AC_INIT(src/tree.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,0.90.0) +AM_INIT_AUTOMAKE(gob,0.90.1) dnl Checks for programs. AC_PROG_CC diff --git a/doc/gob.1 b/doc/gob.1 index 089cdd3..c7bc0f8 100644 --- a/doc/gob.1 +++ b/doc/gob.1 @@ -5,7 +5,7 @@ .\" This manual page is covered by the terms of the GNU General .\" Public License. .\" -.TH GOB 1 "GOB 0.90.0" +.TH GOB 1 "GOB 0.90.1" .SH NAME GOB \- The GTK+ Object Builder .SH SYNOPSIS diff --git a/gob.spec b/gob.spec index 7c9cfa9..b05743b 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 0.90.0 +%define ver 0.90.1 %define rel 1 %define prefix /usr diff --git a/src/lexer.c b/src/lexer.c index 1e4dccb..95f6964 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -284,65 +284,74 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 58 -#define YY_END_OF_BUFFER 59 -static yyconst short int yy_acclist[269] = +#define YY_NUM_RULES 61 +#define YY_END_OF_BUFFER 62 +static yyconst short int yy_acclist[302] = { 0, - 59, 57, 58, 56, 57, 58, 1, 56, 58, 57, - 58, 57, 58, 57, 58, 11, 57, 58, 1, 12, - 58, 11, 57, 58, 27, 57, 58, 1, 28, 58, - 21, 27, 57, 58, 27, 57, 58, 27, 57, 58, - 27, 57, 58, 25, 27, 57, 58, 26, 27, 57, - 58, 27, 57, 58, 24, 57, 58, 1, 58, 23, - 24, 57, 58, 24, 57, 58, 57, 58, 57, 58, - 52, 57, 58, 52, 57, 58, 53, 57, 58, 57, - 58, 57, 58, 50, 57, 58, 50, 57, 58, 52, - 57, 58, 52, 57, 58, 52, 57, 58, 52, 57, - - 58, 52, 57, 58, 52, 57, 58, 52, 57, 58, - 52, 57, 58, 52, 57, 58, 52, 57, 58, 52, - 57, 58, 52, 57, 58, 54, 57, 58, 55, 57, - 58, 6, 14, 10, 7, 20, 15, 22, 8, 52, - 51, 52, 50, 9, 50, 50, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 2, 13, 16, 18, 3, 4, 51, - 52, 50, 5, 50, 50, 52, 52, 52, 52, 52, - 39, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 17, 19, 30, 52, 52, 42, - - 52, 52, 34, 52, 52, 37, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 31, 52, 29, - 52, 52, 40, 52, 52, 52, 52, 52, 38, 52, - 52, 52, 52, 33, 52, 52, 52, 52, 41, 52, - 52, 52, 52, 43, 52, 47, 52, 35, 52, 32, - 52, 52, 52, 52, 49, 52, 52, 44, 52, 52, - 46, 52, 45, 52, 48, 52, 36, 52 + 62, 60, 61, 59, 60, 61, 1, 59, 61, 60, + 61, 60, 61, 60, 61, 60, 61, 12, 60, 61, + 1, 13, 61, 12, 60, 61, 12, 60, 61, 28, + 60, 61, 1, 29, 61, 22, 28, 60, 61, 28, + 60, 61, 28, 60, 61, 28, 60, 61, 28, 60, + 61, 26, 28, 60, 61, 27, 28, 60, 61, 28, + 60, 61, 25, 60, 61, 1, 61, 24, 25, 60, + 61, 25, 60, 61, 25, 60, 61, 60, 61, 60, + 61, 55, 60, 61, 55, 60, 61, 55, 60, 61, + 56, 60, 61, 60, 61, 60, 61, 53, 60, 61, + + 53, 60, 61, 55, 60, 61, 55, 60, 61, 55, + 60, 61, 55, 60, 61, 55, 60, 61, 55, 60, + 61, 55, 60, 61, 55, 60, 61, 55, 60, 61, + 55, 60, 61, 55, 60, 61, 55, 60, 61, 57, + 60, 61, 58, 60, 61, 7, 15, 11, 8, 21, + 16, 23, 9, 55, 54, 55, 55, 53, 10, 53, + 53, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 3, + 14, 17, 19, 4, 5, 54, 55, 55, 45, 53, + 6, 53, 53, 55, 55, 55, 55, 55, 55, 40, + + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 18, 20, 55, 31, 55, 55, 43, + 55, 55, 55, 35, 55, 55, 38, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 32, 55, + 30, 55, 55, 44, 55, 55, 41, 55, 55, 55, + 55, 55, 39, 55, 55, 55, 55, 34, 55, 55, + 55, 55, 55, 42, 55, 55, 55, 55, 46, 55, + 50, 55, 36, 55, 33, 55, 55, 55, 55, 55, + 52, 55, 55, 47, 55, 55, 49, 55, 55, 48, + 55, 51, 55, 37, 55, 55, 55, 55, 2, 2, + + 55 } ; -static yyconst short int yy_accept[200] = +static yyconst short int yy_accept[233] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 7, 10, 12, 14, 16, - 19, 22, 25, 28, 31, 35, 38, 41, 44, 48, - 52, 55, 58, 60, 64, 67, 69, 71, 74, 77, - 80, 82, 84, 87, 90, 93, 96, 99, 102, 105, - 108, 111, 114, 117, 120, 123, 126, 129, 132, 133, - 133, 133, 133, 134, 135, 135, 135, 135, 136, 136, - 137, 138, 139, 140, 140, 140, 141, 142, 143, 144, - 145, 145, 145, 146, 146, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - - 161, 162, 163, 164, 164, 165, 165, 166, 166, 166, - 167, 168, 168, 169, 169, 170, 170, 171, 172, 173, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 195, 196, 197, 199, 200, 202, 203, 205, - 206, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 220, 221, 222, 223, 225, 226, 227, 228, - 229, 231, 232, 233, 234, 236, 237, 238, 239, 241, - 242, 243, 244, 246, 248, 250, 252, 253, 254, 255, - 257, 258, 260, 261, 263, 265, 267, 269, 269 - + 18, 21, 24, 27, 30, 33, 36, 40, 43, 46, + 49, 52, 56, 60, 63, 66, 68, 72, 75, 78, + 80, 82, 85, 88, 91, 94, 96, 98, 101, 104, + 107, 110, 113, 116, 119, 122, 125, 128, 131, 134, + 137, 140, 143, 146, 147, 147, 147, 147, 147, 148, + 149, 149, 149, 149, 150, 150, 151, 152, 153, 154, + 154, 154, 155, 156, 157, 158, 158, 159, 160, 160, + 160, 161, 161, 161, 162, 163, 164, 165, 166, 167, + + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 180, 181, 181, 181, 182, 182, 182, + 183, 184, 184, 185, 185, 186, 186, 187, 188, 189, + 190, 191, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 214, 214, 215, 216, 217, + 219, 220, 222, 223, 224, 226, 227, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 241, 241, + 242, 243, 244, 246, 247, 249, 250, 251, 252, 253, + 255, 256, 257, 258, 260, 261, 262, 262, 263, 264, + + 266, 267, 268, 269, 271, 273, 275, 277, 278, 279, + 279, 280, 281, 283, 284, 286, 287, 289, 289, 290, + 292, 294, 296, 296, 297, 297, 298, 298, 299, 300, + 302, 302 } ; static yyconst int yy_ec[256] = @@ -353,14 +362,14 @@ static yyconst int yy_ec[256] = 1, 2, 1, 4, 1, 1, 5, 1, 6, 1, 1, 7, 1, 1, 1, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 13, 1, 1, - 1, 1, 1, 1, 14, 14, 14, 14, 14, 14, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 1, 16, 1, 1, 15, 1, 17, 18, 19, 20, - - 21, 22, 23, 24, 25, 15, 15, 26, 27, 28, - 29, 30, 15, 31, 32, 33, 34, 35, 15, 36, - 15, 15, 37, 1, 38, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 14, 14, 15, 14, 16, 17, + 18, 19, 18, 18, 20, 18, 21, 18, 22, 18, + 18, 23, 18, 24, 25, 18, 18, 18, 18, 18, + 1, 26, 1, 1, 18, 1, 27, 28, 29, 30, + + 31, 32, 33, 34, 35, 18, 18, 36, 37, 38, + 39, 40, 18, 41, 42, 43, 44, 45, 18, 46, + 18, 18, 47, 1, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -377,180 +386,203 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[39] = +static yyconst int yy_meta[49] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, - 3, 3, 4, 5, 6, 1, 5, 5, 5, 5, + 3, 3, 4, 5, 5, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 1, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1 } ; -static yyconst short int yy_base[214] = +static yyconst short int yy_base[248] = { 0, - 0, 2, 3, 5, 19, 55, 10, 13, 93, 0, - 124, 0, 434, 435, 435, 435, 11, 407, 0, 435, - 435, 423, 435, 435, 435, 11, 23, 0, 435, 435, - 393, 435, 435, 435, 0, 24, 0, 417, 21, 435, - 28, 34, 34, 43, 34, 49, 37, 50, 54, 55, - 56, 129, 134, 127, 59, 61, 435, 435, 435, 426, - 411, 390, 435, 435, 38, 420, 419, 435, 421, 435, - 435, 435, 435, 420, 409, 408, 407, 126, 159, 435, - 416, 162, 167, 172, 0, 177, 66, 64, 2, 163, - 173, 168, 135, 177, 178, 179, 182, 180, 183, 181, - - 190, 192, 194, 415, 435, 385, 435, 410, 409, 435, - 435, 411, 435, 410, 435, 399, 398, 197, 206, 407, - 435, 215, 0, 195, 200, 215, 207, 71, 395, 198, - 201, 217, 222, 223, 224, 225, 226, 227, 229, 228, - 230, 332, 435, 435, 345, 231, 318, 233, 317, 232, - 316, 238, 239, 249, 250, 234, 251, 258, 260, 261, - 263, 315, 435, 265, 266, 314, 267, 268, 269, 270, - 313, 272, 279, 277, 312, 278, 287, 281, 311, 282, - 288, 290, 308, 307, 306, 304, 294, 292, 299, 154, - 301, 153, 303, 125, 124, 78, 69, 435, 332, 338, - - 344, 350, 356, 362, 364, 368, 374, 380, 386, 390, - 394, 400, 404 + 0, 2, 3, 5, 29, 75, 13, 15, 123, 171, + 212, 0, 493, 494, 494, 494, 6, 470, 455, 6, + 494, 494, 481, 467, 494, 494, 494, 1, 13, 466, + 0, 494, 494, 439, 494, 494, 494, 464, 0, 21, + 0, 472, 24, 1, 494, 46, 36, 51, 56, 31, + 52, 12, 47, 34, 56, 60, 62, 61, 69, 70, + 74, 494, 494, 494, 481, 459, 455, 434, 494, 494, + 41, 474, 473, 494, 475, 494, 494, 494, 494, 474, + 463, 462, 461, 82, 77, 465, 107, 494, 469, 127, + 135, 140, 0, 146, 107, 140, 128, 98, 146, 147, + + 148, 149, 79, 175, 58, 172, 150, 180, 155, 191, + 186, 181, 468, 494, 451, 427, 494, 462, 461, 494, + 494, 463, 494, 462, 494, 451, 450, 102, 188, 494, + 197, 459, 494, 200, 0, 151, 189, 156, 201, 218, + 219, 448, 202, 204, 221, 192, 225, 223, 215, 227, + 236, 237, 245, 250, 444, 417, 494, 494, 252, 445, + 253, 444, 254, 256, 443, 257, 442, 260, 261, 264, + 263, 265, 268, 85, 266, 270, 269, 441, 430, 494, + 271, 274, 439, 276, 438, 272, 280, 273, 283, 437, + 293, 296, 297, 436, 301, 304, 431, 305, 306, 434, + + 307, 308, 310, 433, 432, 431, 430, 311, 314, 417, + 312, 315, 427, 320, 383, 317, 377, 342, 319, 343, + 342, 341, 333, 323, 336, 333, 142, 322, 494, 39, + 494, 358, 364, 370, 376, 382, 388, 394, 396, 400, + 406, 412, 418, 422, 426, 432, 436 } ; -static yyconst short int yy_def[214] = +static yyconst short int yy_def[248] = { 0, - 199, 199, 200, 200, 201, 201, 202, 202, 198, 9, - 9, 11, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 203, 198, 198, - 198, 198, 198, 198, 204, 198, 205, 206, 206, 198, - 198, 198, 198, 198, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 198, 198, 198, 207, - 198, 198, 198, 198, 198, 198, 198, 198, 208, 198, - 198, 198, 198, 209, 210, 206, 211, 206, 198, 198, - 212, 198, 198, 198, 213, 198, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - - 206, 206, 206, 207, 198, 198, 198, 198, 198, 198, - 198, 208, 198, 209, 198, 210, 211, 206, 198, 212, - 198, 198, 213, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 198, 198, 198, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 198, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 0, 198, 198, - - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198 + 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, + 10, 11, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 237, 231, 231, 231, 231, 231, 231, 231, 238, 231, + 239, 240, 240, 240, 231, 231, 231, 231, 231, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 231, 231, 231, 241, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 242, 231, 231, 231, 231, 243, + 244, 240, 245, 240, 240, 231, 231, 231, 246, 231, + 231, 231, 247, 231, 240, 240, 240, 240, 240, 240, + + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 241, 231, 231, 231, 231, 231, 231, 231, + 231, 242, 231, 243, 231, 244, 245, 240, 240, 231, + 231, 246, 231, 231, 247, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 231, 231, 231, 231, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 231, 231, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 231, 240, 240, 240, + + 240, 240, 240, 240, 240, 240, 240, 240, 240, 231, + 240, 240, 240, 240, 240, 240, 240, 231, 240, 240, + 240, 240, 231, 240, 231, 240, 231, 240, 231, 240, + 0, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231 } ; -static yyconst short int yy_nxt[474] = +static yyconst short int yy_nxt[543] = { 0, - 198, 15, 16, 15, 16, 21, 19, 21, 17, 22, - 17, 22, 33, 34, 77, 33, 34, 59, 18, 60, - 18, 24, 25, 62, 26, 35, 65, 27, 35, 68, - 73, 69, 74, 77, 28, 126, 63, 79, 79, 79, - 80, 82, 81, 83, 83, 84, 77, 66, 67, 77, - 82, 78, 86, 86, 86, 29, 30, 24, 25, 31, - 26, 77, 77, 27, 87, 89, 77, 77, 77, 85, - 28, 77, 88, 77, 108, 109, 77, 90, 77, 91, - 125, 77, 92, 77, 93, 102, 101, 150, 124, 103, - 77, 29, 30, 14, 15, 16, 14, 14, 14, 14, - - 14, 36, 14, 14, 14, 37, 38, 38, 14, 38, - 38, 38, 38, 38, 39, 38, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 40, - 14, 41, 42, 43, 44, 44, 77, 77, 77, 77, - 45, 77, 46, 47, 48, 49, 77, 77, 50, 51, - 98, 99, 52, 53, 118, 54, 94, 55, 56, 100, - 57, 58, 130, 95, 96, 77, 77, 97, 119, 119, - 119, 122, 122, 122, 82, 77, 83, 83, 84, 82, - 77, 84, 84, 84, 82, 77, 86, 86, 86, 77, - 77, 77, 77, 77, 77, 77, 127, 131, 132, 134, - - 129, 128, 77, 133, 77, 136, 77, 77, 135, 77, - 77, 137, 77, 77, 138, 119, 119, 119, 141, 77, - 151, 139, 140, 145, 122, 122, 122, 77, 146, 77, - 147, 152, 148, 149, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 153, 155, 162, - 77, 77, 157, 160, 156, 159, 154, 164, 165, 158, - 161, 77, 77, 77, 166, 169, 171, 172, 167, 168, - 77, 173, 77, 77, 170, 77, 174, 77, 77, 77, - 77, 77, 77, 176, 77, 178, 179, 175, 183, 77, - 77, 77, 181, 77, 77, 180, 177, 184, 185, 77, - - 77, 182, 77, 188, 77, 187, 77, 191, 189, 186, - 192, 77, 190, 77, 193, 77, 77, 194, 77, 77, - 77, 196, 197, 77, 77, 77, 77, 77, 77, 77, - 77, 195, 14, 14, 14, 14, 14, 14, 20, 20, - 20, 20, 20, 20, 23, 23, 23, 23, 23, 23, - 32, 32, 32, 32, 32, 32, 70, 77, 70, 70, - 70, 70, 72, 163, 72, 72, 72, 72, 75, 75, - 76, 76, 76, 76, 104, 104, 104, 104, 104, 104, - 112, 112, 112, 112, 112, 112, 114, 114, 114, 114, - 114, 114, 116, 116, 116, 116, 117, 117, 117, 117, - - 120, 120, 120, 120, 120, 120, 123, 77, 123, 121, - 77, 77, 115, 113, 144, 143, 142, 105, 121, 77, - 77, 77, 115, 113, 111, 110, 107, 106, 105, 77, - 71, 64, 61, 198, 13, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198 + 231, 15, 16, 15, 16, 22, 20, 22, 17, 23, + 17, 23, 64, 83, 65, 36, 37, 36, 37, 74, + 18, 75, 18, 24, 83, 24, 71, 79, 19, 80, + 19, 26, 27, 38, 28, 38, 83, 29, 39, 68, + 39, 85, 88, 83, 89, 84, 83, 72, 73, 30, + 98, 83, 69, 86, 31, 87, 87, 87, 90, 83, + 91, 91, 92, 90, 83, 94, 94, 94, 83, 100, + 83, 95, 83, 83, 83, 32, 33, 26, 27, 34, + 28, 83, 83, 29, 99, 96, 83, 118, 119, 83, + 97, 83, 146, 101, 83, 30, 93, 83, 102, 103, + + 31, 105, 107, 108, 106, 128, 104, 110, 111, 144, + 83, 109, 112, 193, 83, 129, 131, 131, 131, 83, + 159, 32, 33, 14, 15, 16, 14, 14, 14, 14, + 14, 40, 14, 14, 14, 41, 134, 134, 134, 136, + 83, 139, 90, 43, 91, 91, 92, 90, 14, 92, + 92, 92, 83, 90, 44, 94, 94, 94, 83, 83, + 83, 83, 83, 83, 229, 138, 137, 83, 83, 45, + 14, 14, 15, 16, 14, 14, 14, 14, 14, 40, + 14, 14, 14, 41, 83, 141, 143, 83, 148, 140, + 142, 43, 83, 83, 161, 150, 14, 163, 83, 147, + + 83, 83, 44, 83, 83, 145, 131, 131, 131, 134, + 134, 134, 149, 83, 83, 154, 83, 45, 14, 46, + 47, 48, 49, 49, 160, 151, 153, 83, 164, 162, + 83, 83, 152, 83, 167, 83, 170, 83, 50, 83, + 51, 52, 53, 54, 168, 166, 55, 56, 83, 83, + 57, 58, 173, 59, 165, 60, 61, 83, 62, 63, + 171, 169, 83, 172, 83, 83, 83, 181, 83, 83, + 174, 176, 83, 83, 175, 83, 83, 83, 83, 178, + 83, 83, 83, 83, 83, 83, 83, 177, 83, 182, + 188, 184, 83, 198, 191, 83, 183, 189, 192, 185, + + 186, 187, 195, 194, 199, 83, 200, 190, 83, 83, + 201, 204, 196, 83, 202, 203, 83, 83, 83, 83, + 83, 211, 83, 83, 83, 206, 83, 83, 205, 83, + 209, 83, 83, 224, 83, 83, 219, 214, 208, 207, + 215, 216, 226, 212, 230, 83, 222, 213, 228, 217, + 221, 227, 225, 83, 83, 83, 223, 220, 14, 14, + 14, 14, 14, 14, 21, 21, 21, 21, 21, 21, + 25, 25, 25, 25, 25, 25, 35, 35, 35, 35, + 35, 35, 42, 42, 42, 42, 42, 42, 76, 83, + 76, 76, 76, 76, 78, 83, 78, 78, 78, 78, + + 81, 81, 82, 82, 82, 82, 113, 113, 113, 113, + 113, 113, 122, 122, 122, 122, 122, 122, 124, 124, + 124, 124, 124, 124, 126, 126, 126, 126, 127, 127, + 127, 127, 132, 132, 132, 132, 132, 132, 135, 83, + 135, 218, 83, 83, 83, 83, 83, 210, 83, 83, + 83, 83, 197, 83, 83, 83, 83, 83, 180, 179, + 83, 133, 83, 83, 125, 123, 158, 157, 156, 155, + 114, 133, 130, 83, 83, 83, 125, 123, 121, 120, + 117, 116, 115, 114, 83, 66, 77, 66, 66, 70, + 67, 66, 231, 13, 231, 231, 231, 231, 231, 231, + + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231 } ; -static yyconst short int yy_chk[474] = +static yyconst short int yy_chk[543] = { 0, 0, 1, 1, 2, 2, 3, 2, 4, 1, 3, - 2, 4, 7, 7, 89, 8, 8, 17, 1, 17, - 2, 5, 5, 19, 5, 7, 26, 5, 8, 27, - 36, 27, 36, 39, 5, 89, 19, 41, 41, 41, - 42, 43, 42, 43, 43, 43, 45, 26, 26, 47, - 44, 39, 44, 44, 44, 5, 5, 6, 6, 6, - 6, 46, 48, 6, 45, 47, 49, 50, 51, 43, - 6, 55, 46, 56, 65, 65, 88, 48, 87, 49, - 88, 197, 50, 128, 51, 56, 55, 128, 87, 56, - 196, 6, 6, 9, 9, 9, 9, 9, 9, 9, - - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 11, 11, 11, 11, 11, 195, 194, 78, 54, - 11, 52, 11, 11, 11, 11, 53, 93, 11, 11, - 54, 54, 11, 11, 78, 11, 52, 11, 11, 54, - 11, 11, 93, 52, 53, 192, 190, 53, 79, 79, - 79, 82, 82, 82, 83, 90, 83, 83, 83, 84, - 92, 84, 84, 84, 86, 91, 86, 86, 86, 94, - 95, 96, 98, 100, 97, 99, 90, 94, 95, 97, - - 92, 91, 101, 96, 102, 99, 103, 124, 98, 118, - 130, 100, 125, 131, 101, 119, 119, 119, 103, 127, - 130, 101, 102, 118, 122, 122, 122, 126, 124, 132, - 125, 131, 126, 127, 133, 134, 135, 136, 137, 138, - 140, 139, 141, 146, 150, 148, 156, 132, 134, 141, - 152, 153, 136, 139, 135, 138, 133, 146, 148, 137, - 140, 154, 155, 157, 150, 154, 156, 157, 152, 153, - 158, 157, 159, 160, 155, 161, 158, 164, 165, 167, - 168, 169, 170, 160, 172, 164, 165, 159, 170, 174, - 176, 173, 168, 178, 180, 167, 161, 172, 173, 177, - - 181, 169, 182, 177, 188, 176, 187, 181, 178, 174, - 182, 189, 180, 191, 187, 193, 186, 188, 185, 184, - 183, 191, 193, 179, 175, 171, 166, 162, 151, 149, - 147, 189, 199, 199, 199, 199, 199, 199, 200, 200, - 200, 200, 200, 200, 201, 201, 201, 201, 201, 201, - 202, 202, 202, 202, 202, 202, 203, 145, 203, 203, - 203, 203, 204, 142, 204, 204, 204, 204, 205, 205, - 206, 206, 206, 206, 207, 207, 207, 207, 207, 207, - 208, 208, 208, 208, 208, 208, 209, 209, 209, 209, - 209, 209, 210, 210, 210, 210, 211, 211, 211, 211, - - 212, 212, 212, 212, 212, 212, 213, 129, 213, 120, - 117, 116, 114, 112, 109, 108, 106, 104, 81, 77, - 76, 75, 74, 69, 67, 66, 62, 61, 60, 38, - 31, 22, 18, 13, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198 + 2, 4, 17, 44, 17, 7, 7, 8, 8, 29, + 1, 29, 2, 3, 52, 4, 28, 40, 1, 40, + 2, 5, 5, 7, 5, 8, 43, 5, 7, 20, + 8, 44, 47, 50, 47, 43, 54, 28, 28, 5, + 52, 230, 20, 46, 5, 46, 46, 46, 48, 53, + 48, 48, 48, 49, 51, 49, 49, 49, 55, 54, + 105, 50, 56, 58, 57, 5, 5, 6, 6, 6, + 6, 59, 60, 6, 53, 51, 61, 71, 71, 85, + 51, 103, 105, 55, 84, 6, 48, 174, 56, 57, + + 6, 58, 59, 59, 58, 84, 57, 60, 61, 103, + 98, 59, 61, 174, 128, 85, 87, 87, 87, 95, + 128, 6, 6, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 90, 90, 90, 95, + 97, 98, 91, 9, 91, 91, 91, 92, 9, 92, + 92, 92, 96, 94, 9, 94, 94, 94, 99, 100, + 101, 102, 107, 136, 227, 97, 96, 109, 138, 9, + 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 106, 100, 102, 104, 107, 99, + 101, 10, 108, 112, 136, 109, 10, 138, 111, 106, + + 129, 137, 10, 110, 146, 104, 131, 131, 131, 134, + 134, 134, 108, 139, 143, 112, 144, 10, 10, 11, + 11, 11, 11, 11, 129, 110, 111, 149, 139, 137, + 140, 141, 110, 145, 143, 148, 146, 147, 11, 150, + 11, 11, 11, 11, 144, 141, 11, 11, 151, 152, + 11, 11, 149, 11, 140, 11, 11, 153, 11, 11, + 147, 145, 154, 148, 159, 161, 163, 159, 164, 166, + 150, 152, 168, 169, 151, 171, 170, 172, 175, 154, + 173, 177, 176, 181, 186, 188, 182, 153, 184, 161, + 170, 164, 187, 181, 173, 189, 163, 171, 173, 166, + + 168, 169, 176, 175, 182, 191, 184, 172, 192, 193, + 186, 189, 177, 195, 187, 188, 196, 198, 199, 201, + 202, 198, 203, 208, 211, 192, 209, 212, 191, 216, + 196, 219, 214, 219, 228, 224, 211, 202, 195, 193, + 203, 208, 224, 199, 228, 226, 216, 201, 226, 209, + 214, 225, 223, 222, 221, 220, 218, 212, 232, 232, + 232, 232, 232, 232, 233, 233, 233, 233, 233, 233, + 234, 234, 234, 234, 234, 234, 235, 235, 235, 235, + 235, 235, 236, 236, 236, 236, 236, 236, 237, 217, + 237, 237, 237, 237, 238, 215, 238, 238, 238, 238, + + 239, 239, 240, 240, 240, 240, 241, 241, 241, 241, + 241, 241, 242, 242, 242, 242, 242, 242, 243, 243, + 243, 243, 243, 243, 244, 244, 244, 244, 245, 245, + 245, 245, 246, 246, 246, 246, 246, 246, 247, 213, + 247, 210, 207, 206, 205, 204, 200, 197, 194, 190, + 185, 183, 179, 178, 167, 165, 162, 160, 156, 155, + 142, 132, 127, 126, 124, 122, 119, 118, 116, 115, + 113, 89, 86, 83, 82, 81, 80, 75, 73, 72, + 68, 67, 66, 65, 42, 38, 34, 30, 24, 23, + 19, 18, 13, 231, 231, 231, 231, 231, 231, 231, + + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -636,7 +668,7 @@ add_to_cbuf(char *s) #define CLASS_CODE_I 5 -#line 640 "lex.yy.c" +#line 672 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -793,7 +825,7 @@ YY_DECL #line 66 "lexer.l" -#line 797 "lex.yy.c" +#line 829 "lex.yy.c" if ( yy_init ) { @@ -842,14 +874,14 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 199 ) + if ( yy_current_state >= 232 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 435 ); + while ( yy_base[yy_current_state] != 494 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -884,19 +916,16 @@ YY_RULE_SETUP { line_no++; REJECT; } YY_BREAK case 2: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 70 "lexer.l" -{ ; /*comment, ignore*/ } +{ fprintf(stderr,"You are a bad bad person!\n"); REJECT; } YY_BREAK case 3: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 71 "lexer.l" +#line 72 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 4: @@ -904,7 +933,7 @@ case 4: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 72 "lexer.l" +#line 73 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 5: @@ -912,47 +941,55 @@ case 5: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 73 "lexer.l" +#line 74 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 6: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 74 "lexer.l" -{BEGIN(COMMENT); before_comment = INITIAL; } +#line 75 "lexer.l" +{ ; /*comment, ignore*/ } YY_BREAK case 7: YY_RULE_SETUP -#line 75 "lexer.l" -{BEGIN(COMMENT); before_comment = C_CODE; } +#line 76 "lexer.l" +{BEGIN(COMMENT); before_comment = INITIAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 76 "lexer.l" -{BEGIN(COMMENT); before_comment = CLASS_CODE; } +#line 77 "lexer.l" +{BEGIN(COMMENT); before_comment = C_CODE; } YY_BREAK case 9: YY_RULE_SETUP -#line 77 "lexer.l" -{BEGIN(COMMENT); before_comment = CLASS_CODE_I; } +#line 78 "lexer.l" +{BEGIN(COMMENT); before_comment = CLASS_CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 78 "lexer.l" -{BEGIN(before_comment);} +#line 79 "lexer.l" +{BEGIN(COMMENT); before_comment = CLASS_CODE_I; } YY_BREAK case 11: YY_RULE_SETUP -#line 79 "lexer.l" -{ ; /* comment, ignore */ } +#line 80 "lexer.l" +{BEGIN(before_comment);} YY_BREAK case 12: YY_RULE_SETUP -#line 80 "lexer.l" +#line 81 "lexer.l" { ; /* comment, ignore */ } YY_BREAK case 13: YY_RULE_SETUP #line 82 "lexer.l" +{ ; /* comment, ignore */ } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 84 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -962,9 +999,9 @@ YY_RULE_SETUP ccode_line = line_no; } YY_BREAK -case 14: +case 15: YY_RULE_SETUP -#line 90 "lexer.l" +#line 92 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -974,9 +1011,9 @@ YY_RULE_SETUP ccode_line = line_no; } YY_BREAK -case 15: +case 16: YY_RULE_SETUP -#line 98 "lexer.l" +#line 100 "lexer.l" { BEGIN(INITIAL); yylval.cbuf = cbuf; @@ -987,24 +1024,19 @@ YY_RULE_SETUP return CCODE; } YY_BREAK -case 16: -YY_RULE_SETUP -#line 108 "lexer.l" -{ add_to_cbuf(yytext); } - YY_BREAK case 17: YY_RULE_SETUP -#line 109 "lexer.l" +#line 110 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 18: YY_RULE_SETUP -#line 110 "lexer.l" +#line 111 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 19: YY_RULE_SETUP -#line 111 "lexer.l" +#line 112 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 20: @@ -1014,45 +1046,50 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 114 "lexer.l" +#line 115 "lexer.l" +{ add_to_cbuf(yytext); } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 116 "lexer.l" { BEGIN(C_CODE_STRING); add_to_cbuf(yytext); } YY_BREAK -case 22: +case 23: YY_RULE_SETUP -#line 118 "lexer.l" +#line 120 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 23: +case 24: YY_RULE_SETUP -#line 121 "lexer.l" +#line 123 "lexer.l" { BEGIN(C_CODE); add_to_cbuf(yytext); } YY_BREAK -case 24: +case 25: YY_RULE_SETUP -#line 125 "lexer.l" +#line 127 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 25: +case 26: YY_RULE_SETUP -#line 129 "lexer.l" +#line 131 "lexer.l" { parenth_depth++; add_to_cbuf(yytext); } YY_BREAK -case 26: +case 27: YY_RULE_SETUP -#line 133 "lexer.l" +#line 135 "lexer.l" { parenth_depth--; if(parenth_depth<0) { @@ -1066,159 +1103,169 @@ YY_RULE_SETUP add_to_cbuf(yytext); } YY_BREAK -case 27: -YY_RULE_SETUP -#line 146 "lexer.l" -{ add_to_cbuf(yytext); } - YY_BREAK case 28: YY_RULE_SETUP -#line 147 "lexer.l" +#line 148 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 29: YY_RULE_SETUP #line 149 "lexer.l" +{ add_to_cbuf(yytext); } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 151 "lexer.l" { BEGIN(CLASS_CODE); return CLASS; } YY_BREAK -case 30: -YY_RULE_SETUP -#line 154 "lexer.l" -{return FROM;} - YY_BREAK case 31: YY_RULE_SETUP #line 156 "lexer.l" -{return VOID;} +{return FROM;} YY_BREAK case 32: YY_RULE_SETUP -#line 157 "lexer.l" -{return STRUCT;} +#line 158 "lexer.l" +{return VOID;} YY_BREAK case 33: YY_RULE_SETUP -#line 158 "lexer.l" -{return UNION;} +#line 159 "lexer.l" +{return STRUCT;} YY_BREAK case 34: YY_RULE_SETUP -#line 159 "lexer.l" -{return ENUM;} +#line 160 "lexer.l" +{return UNION;} YY_BREAK case 35: YY_RULE_SETUP -#line 160 "lexer.l" -{return SIGNED;} +#line 161 "lexer.l" +{return ENUM;} YY_BREAK case 36: YY_RULE_SETUP -#line 161 "lexer.l" -{return UNSIGNED;} +#line 162 "lexer.l" +{return SIGNED;} YY_BREAK case 37: YY_RULE_SETUP -#line 162 "lexer.l" -{return LONG;} +#line 163 "lexer.l" +{return UNSIGNED;} YY_BREAK case 38: YY_RULE_SETUP -#line 163 "lexer.l" -{return SHORT;} +#line 164 "lexer.l" +{return LONG;} YY_BREAK case 39: YY_RULE_SETUP -#line 164 "lexer.l" -{return INT;} +#line 165 "lexer.l" +{return SHORT;} YY_BREAK case 40: YY_RULE_SETUP -#line 165 "lexer.l" -{return FLOAT;} +#line 166 "lexer.l" +{return INT;} YY_BREAK case 41: YY_RULE_SETUP -#line 166 "lexer.l" -{return DOUBLE;} +#line 167 "lexer.l" +{return FLOAT;} YY_BREAK case 42: YY_RULE_SETUP -#line 167 "lexer.l" -{return CHAR;} +#line 168 "lexer.l" +{return DOUBLE;} YY_BREAK case 43: YY_RULE_SETUP #line 169 "lexer.l" -{yylval.line = line_no; return PUBLIC;} +{return CHAR;} YY_BREAK case 44: YY_RULE_SETUP #line 170 "lexer.l" -{yylval.line = line_no; return PRIVATE;} +{return CONST;} YY_BREAK case 45: YY_RULE_SETUP -#line 171 "lexer.l" -{yylval.line = line_no; return ARGUMENT;} +#line 172 "lexer.l" +{return THREEDOTS;} YY_BREAK case 46: YY_RULE_SETUP -#line 172 "lexer.l" -{yylval.line = line_no; return VIRTUAL;} +#line 174 "lexer.l" +{yylval.line = line_no; return PUBLIC;} YY_BREAK case 47: YY_RULE_SETUP -#line 173 "lexer.l" -{yylval.line = line_no; return SIGNAL;} +#line 175 "lexer.l" +{yylval.line = line_no; return PRIVATE;} YY_BREAK case 48: YY_RULE_SETUP -#line 174 "lexer.l" -{yylval.line = line_no; return OVERRIDE;} +#line 176 "lexer.l" +{yylval.line = line_no; return ARGUMENT;} YY_BREAK case 49: YY_RULE_SETUP -#line 175 "lexer.l" -{return ONERROR;} +#line 177 "lexer.l" +{yylval.line = line_no; return VIRTUAL;} YY_BREAK case 50: YY_RULE_SETUP -#line 176 "lexer.l" +#line 178 "lexer.l" +{yylval.line = line_no; return SIGNAL;} + YY_BREAK +case 51: +YY_RULE_SETUP +#line 179 "lexer.l" +{yylval.line = line_no; return OVERRIDE;} + YY_BREAK +case 52: +YY_RULE_SETUP +#line 180 "lexer.l" +{return ONERROR;} + YY_BREAK +case 53: +YY_RULE_SETUP +#line 181 "lexer.l" { yylval.id = g_strdup(yytext); return NUMBER; } YY_BREAK -case 51: +case 54: YY_RULE_SETUP -#line 180 "lexer.l" +#line 185 "lexer.l" { yylval.id = g_strdup(yytext); return TYPETOKEN; } YY_BREAK -case 52: +case 55: YY_RULE_SETUP -#line 184 "lexer.l" +#line 189 "lexer.l" { yylval.id = g_strdup(yytext); return TOKEN; } YY_BREAK -case 53: +case 56: YY_RULE_SETUP -#line 189 "lexer.l" +#line 194 "lexer.l" { BEGIN(CLASS_CODE_I); return '{'; } YY_BREAK -case 54: +case 57: YY_RULE_SETUP -#line 193 "lexer.l" +#line 198 "lexer.l" { BEGIN(C_CODE); parenth_depth=1; @@ -1228,33 +1275,33 @@ YY_RULE_SETUP return '{'; } YY_BREAK -case 55: +case 58: YY_RULE_SETUP -#line 201 "lexer.l" +#line 206 "lexer.l" { BEGIN(INITIAL); return '}'; } YY_BREAK -case 56: +case 59: YY_RULE_SETUP -#line 206 "lexer.l" +#line 211 "lexer.l" ; /*ignore*/ YY_BREAK -case 57: +case 60: YY_RULE_SETUP -#line 208 "lexer.l" +#line 213 "lexer.l" { yylval.line = line_no; return yytext[0]; } YY_BREAK -case 58: +case 61: YY_RULE_SETUP -#line 212 "lexer.l" +#line 217 "lexer.l" ECHO; YY_BREAK -#line 1258 "lex.yy.c" +#line 1305 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(C_CODE): @@ -1549,7 +1596,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 199 ) + if ( yy_current_state >= 232 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1579,11 +1626,11 @@ yy_state_type yy_current_state; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 199 ) + if ( yy_current_state >= 232 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 198); + yy_is_jam = (yy_current_state == 231); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2141,4 +2188,4 @@ int main() return 0; } #endif -#line 212 "lexer.l" +#line 217 "lexer.l" diff --git a/src/lexer.l b/src/lexer.l index 5f9f742..cabafca 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -67,6 +67,8 @@ add_to_cbuf(char *s) <*>\n { line_no++; REJECT; } +<*>MOTHERFUCKER { fprintf(stderr,"You are a bad bad person!\n"); REJECT; } + \/\/.*$ { ; /*comment, ignore*/ } \/\/.*$ { ; /*comment, ignore*/ } \/\/.*$ { ; /*comment, ignore*/ } @@ -165,6 +167,9 @@ class { float {return FLOAT;} double {return DOUBLE;} char {return CHAR;} +const {return CONST;} + +\.\.\. {return THREEDOTS;} public {yylval.line = line_no; return PUBLIC;} private {yylval.line = line_no; return PRIVATE;} diff --git a/src/main.c b/src/main.c index 54293fc..0ed34ee 100644 --- a/src/main.c +++ b/src/main.c @@ -257,6 +257,8 @@ print_method(FILE *fp, char *typeprefix, char *nameprefix, out_printf(fp,"%s",arg->name); } + if(m->vararg) + out_printf(fp,", ..."); } else { out_printf(fp,"void"); } @@ -347,7 +349,7 @@ make_inits(Class *cl) (Type *)new_type(0,g_strdup("void")), NULL,NULL,g_strdup("class_init"), make_init_args(cl,g_strdup("c"),TRUE), - NULL, NULL,0,0); + NULL, NULL,0,0,FALSE); cl->nodes = g_list_prepend(cl->nodes,node); } if(!got_init) { @@ -355,7 +357,7 @@ make_inits(Class *cl) (Type *)new_type(0,g_strdup("void")), NULL,NULL,g_strdup("init"), make_init_args(cl,g_strdup("o"),FALSE), - NULL, NULL,0,0); + NULL, NULL,0,0,FALSE); cl->nodes = g_list_prepend(cl->nodes,node); } } @@ -1105,6 +1107,30 @@ check_public_new(Class *c) } } +static void +check_vararg(Class *c) +{ + GList *l; + for(l=c->nodes;l;l=g_list_next(l)) { + Node *n = l->data; + if(n->type == METHOD_NODE) { + Method *m = (Method *)n; + if(!m->vararg) + continue; + if(m->scope == OVERRIDE_METHOD || + m->scope == SIGNAL_LAST_METHOD || + m->scope == SIGNAL_FIRST_METHOD || + m->scope == VIRTUAL_METHOD) { + print_error(FALSE, + "signals, overrides and virtuals, " + "can't have variable argument " + "lists", + m->line_no); + } + } + } +} + static int count_signals(Class *c) { @@ -1384,6 +1410,7 @@ main(int argc, char *argv[]) check_duplicate_symbols((Class *)class); check_duplicate_signals_args((Class *)class); check_public_new((Class *)class); + check_vararg((Class *)class); exit_on_error = TRUE; if(got_error) diff --git a/src/parse.c b/src/parse.c index e50c96b..83fc42c 100644 --- a/src/parse.c +++ b/src/parse.c @@ -7,20 +7,20 @@ #define CLASS 258 #define FROM 259 -#define VOID 260 -#define STRUCT 261 -#define UNION 262 -#define ENUM 263 -#define SIGNED 264 -#define UNSIGNED 265 -#define LONG 266 -#define SHORT 267 -#define INT 268 -#define FLOAT 269 -#define DOUBLE 270 -#define CHAR 271 -#define FIRST 272 -#define LAST 273 +#define CONST 260 +#define VOID 261 +#define STRUCT 262 +#define UNION 263 +#define ENUM 264 +#define THREEDOTS 265 +#define SIGNED 266 +#define UNSIGNED 267 +#define LONG 268 +#define SHORT 269 +#define INT 270 +#define FLOAT 271 +#define DOUBLE 272 +#define CHAR 273 #define ONERROR 274 #define TOKEN 275 #define NUMBER 276 @@ -59,6 +59,7 @@ static int stars = 0; static GList *funcargs = NULL; static GList *checks = NULL; static int has_self = FALSE; +static int vararg = FALSE; static GList *gtktypes = NULL; @@ -108,7 +109,7 @@ push_variable(char *name, int scope, int line_no) static void push_function(int scope, char *oid, char *id, char *onerror, - GString *cbuf,int line_no, int ccode_line) + GString *cbuf,int line_no, int ccode_line, int vararg) { Node *node; Type *type; @@ -121,7 +122,7 @@ push_function(int scope, char *oid, char *id, char *onerror, } node = new_method(scope,type,oid,gtktypes,id,funcargs, - onerror,cbuf,line_no,ccode_line); + onerror,cbuf,line_no,ccode_line,vararg); gtktypes = NULL; funcargs = NULL; @@ -172,7 +173,7 @@ push_self(char *id) } -#line 159 "parse.y" +#line 160 "parse.y" typedef union { char *id; GString *cbuf; @@ -193,11 +194,11 @@ typedef union { -#define YYFINAL 187 +#define YYFINAL 192 #define YYFLAG -32768 #define YYNTBASE 45 -#define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 70) +#define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 72) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -235,62 +236,64 @@ static const char yytranslate[] = { 0, static const short yyprhs[] = { 0, 0, 4, 7, 10, 12, 15, 18, 20, 22, 27, 32, 35, 38, 41, 43, 45, 47, 52, 57, 69, - 78, 82, 83, 87, 89, 91, 94, 97, 100, 102, - 105, 108, 110, 112, 114, 116, 119, 121, 123, 126, - 128, 131, 133, 135, 137, 139, 141, 144, 146, 151, - 155, 157, 160, 162, 173, 183, 192, 205, 215, 225, - 231, 238, 241, 245, 248, 249, 251, 253, 257, 259, - 263, 265, 268, 275, 278, 280, 282, 285, 288, 292, - 296, 300, 304, 306, 309 + 78, 82, 83, 87, 89, 91, 94, 96, 99, 102, + 105, 107, 110, 113, 115, 117, 119, 121, 124, 126, + 128, 131, 133, 136, 138, 140, 142, 144, 146, 149, + 151, 156, 160, 162, 165, 167, 178, 188, 197, 210, + 220, 230, 236, 243, 246, 250, 253, 254, 256, 258, + 262, 264, 268, 270, 274, 276, 279, 286, 289, 291, + 293, 296, 299, 303, 307, 311, 315, 317, 320 }; static const short yyrhs[] = { 46, 47, 46, 0, 47, 46, 0, 46, 47, 0, 47, 0, 46, 23, 0, 46, 24, 0, 23, 0, 24, 0, 48, 31, 49, 32, 0, 3, 22, 4, 22, - 0, 49, 62, 0, 49, 50, 0, 49, 51, 0, - 62, 0, 50, 0, 51, 0, 25, 54, 20, 33, + 0, 49, 63, 0, 49, 50, 0, 49, 51, 0, + 63, 0, 50, 0, 51, 0, 25, 54, 20, 33, 0, 26, 54, 20, 33, 0, 27, 52, 20, 20, 20, 31, 23, 20, 31, 23, 33, 0, 27, 52, 20, 20, 20, 31, 23, 33, 0, 34, 53, 35, 0, 0, 20, 36, 53, 0, 20, 0, 55, 0, - 55, 58, 0, 10, 56, 0, 9, 56, 0, 56, - 0, 10, 16, 0, 9, 16, 0, 16, 0, 15, - 0, 14, 0, 20, 0, 57, 20, 0, 22, 0, - 5, 0, 11, 13, 0, 11, 0, 12, 13, 0, - 12, 0, 13, 0, 8, 0, 7, 0, 6, 0, - 37, 58, 0, 37, 0, 20, 34, 60, 35, 0, - 60, 38, 20, 0, 20, 0, 31, 23, 0, 33, - 0, 29, 20, 59, 54, 20, 34, 64, 35, 63, - 61, 0, 29, 59, 54, 20, 34, 64, 35, 63, - 61, 0, 28, 54, 20, 34, 64, 35, 63, 61, - 0, 30, 34, 22, 35, 54, 20, 34, 64, 35, - 63, 31, 23, 0, 25, 54, 20, 34, 64, 35, - 63, 31, 23, 0, 26, 54, 20, 34, 64, 35, - 63, 31, 23, 0, 20, 34, 20, 35, 33, 0, - 20, 34, 20, 35, 31, 23, 0, 19, 69, 0, - 19, 31, 23, 0, 39, 40, 0, 0, 5, 0, - 20, 0, 20, 38, 65, 0, 65, 0, 65, 38, - 66, 0, 66, 0, 54, 20, 0, 54, 20, 34, - 20, 67, 35, 0, 67, 68, 0, 68, 0, 20, - 0, 41, 69, 0, 42, 69, 0, 41, 39, 69, - 0, 42, 39, 69, 0, 39, 39, 69, 0, 43, - 39, 69, 0, 21, 0, 44, 21, 0, 20, 0 + 5, 55, 0, 56, 0, 56, 59, 0, 12, 57, + 0, 11, 57, 0, 57, 0, 12, 18, 0, 11, + 18, 0, 18, 0, 17, 0, 16, 0, 20, 0, + 58, 20, 0, 22, 0, 6, 0, 13, 15, 0, + 13, 0, 14, 15, 0, 14, 0, 15, 0, 9, + 0, 8, 0, 7, 0, 37, 59, 0, 37, 0, + 20, 34, 61, 35, 0, 61, 38, 20, 0, 20, + 0, 31, 23, 0, 33, 0, 29, 20, 60, 54, + 20, 34, 65, 35, 64, 62, 0, 29, 60, 54, + 20, 34, 65, 35, 64, 62, 0, 28, 54, 20, + 34, 65, 35, 64, 62, 0, 30, 34, 22, 35, + 54, 20, 34, 65, 35, 64, 31, 23, 0, 25, + 54, 20, 34, 65, 35, 64, 31, 23, 0, 26, + 54, 20, 34, 65, 35, 64, 31, 23, 0, 20, + 34, 20, 35, 33, 0, 20, 34, 20, 35, 31, + 23, 0, 19, 71, 0, 19, 31, 23, 0, 39, + 40, 0, 0, 6, 0, 20, 0, 20, 38, 66, + 0, 66, 0, 67, 38, 10, 0, 67, 0, 67, + 38, 68, 0, 68, 0, 54, 20, 0, 54, 20, + 34, 20, 69, 35, 0, 69, 70, 0, 70, 0, + 20, 0, 41, 71, 0, 42, 71, 0, 41, 39, + 71, 0, 42, 39, 71, 0, 39, 39, 71, 0, + 43, 39, 71, 0, 21, 0, 44, 21, 0, 20, + 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 177, 178, 179, 180, 183, 187, 191, 195, 201, 208, - 213, 214, 215, 216, 217, 218, 221, 224, 228, 257, - 283, 284, 287, 290, 296, 300, 307, 310, 313, 316, - 319, 322, 325, 328, 331, 334, 338, 341, 346, 349, - 352, 355, 358, 363, 366, 369, 374, 375, 378, 383, - 386, 391, 392, 396, 417, 426, 435, 439, 443, 447, - 463, 484, 485, 489, 490, 495, 496, 511, 526, 529, - 530, 533, 536, 546, 547, 550, 563, 567, 571, 575, - 579, 583, 589, 590, 594 + 178, 179, 180, 181, 184, 188, 192, 196, 202, 209, + 214, 215, 216, 217, 218, 219, 222, 225, 229, 258, + 284, 285, 288, 291, 297, 298, 306, 310, 317, 320, + 323, 326, 329, 332, 335, 338, 341, 344, 348, 351, + 356, 359, 362, 365, 368, 373, 376, 379, 384, 385, + 388, 393, 396, 401, 402, 406, 428, 438, 448, 454, + 459, 464, 482, 503, 504, 508, 509, 512, 513, 528, + 543, 546, 547, 550, 551, 554, 557, 567, 568, 571, + 584, 588, 592, 596, 600, 604, 610, 611, 615 }; #endif @@ -298,153 +301,157 @@ static const short yyrline[] = { 0, #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","CLASS", -"FROM","VOID","STRUCT","UNION","ENUM","SIGNED","UNSIGNED","LONG","SHORT","INT", -"FLOAT","DOUBLE","CHAR","FIRST","LAST","ONERROR","TOKEN","NUMBER","TYPETOKEN", +"FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED", +"LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","ONERROR","TOKEN","NUMBER","TYPETOKEN", "CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE", "'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'","'>'","'<'","'!'", "'-'","prog","ccodes","class","classdec","classcode","variable","argument","argflags", -"flaglist","type","type1","integer","tspecifier","stars","sigtype","tokenlist", -"codenocode","method","onerror","funcargs","arglist","arg","checklist","check", -"numtok", NULL +"flaglist","type","type1","type2","integer","tspecifier","stars","sigtype","tokenlist", +"codenocode","method","onerror","funcargs","arglist","arglist1","arg","checklist", +"check","numtok", NULL }; #endif static const short yyr1[] = { 0, 45, 45, 45, 45, 46, 46, 46, 46, 47, 48, 49, 49, 49, 49, 49, 49, 50, 50, 51, 51, - 52, 52, 53, 53, 54, 54, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, - 56, 56, 56, 57, 57, 57, 58, 58, 59, 60, - 60, 61, 61, 62, 62, 62, 62, 62, 62, 62, - 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, - 65, 66, 66, 67, 67, 68, 68, 68, 68, 68, - 68, 68, 69, 69, 69 + 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 57, 57, 57, 57, 57, 58, 58, 58, 59, 59, + 60, 61, 61, 62, 62, 63, 63, 63, 63, 63, + 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, + 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, + 70, 70, 70, 70, 70, 70, 71, 71, 71 }; static const short yyr2[] = { 0, 3, 2, 2, 1, 2, 2, 1, 1, 4, 4, 2, 2, 2, 1, 1, 1, 4, 4, 11, 8, - 3, 0, 3, 1, 1, 2, 2, 2, 1, 2, - 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, - 2, 1, 1, 1, 1, 1, 2, 1, 4, 3, - 1, 2, 1, 10, 9, 8, 12, 9, 9, 5, - 6, 2, 3, 2, 0, 1, 1, 3, 1, 3, - 1, 2, 6, 2, 1, 1, 2, 2, 3, 3, - 3, 3, 1, 2, 1 + 3, 0, 3, 1, 1, 2, 1, 2, 2, 2, + 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, + 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, + 4, 3, 1, 2, 1, 10, 9, 8, 12, 9, + 9, 5, 6, 2, 3, 2, 0, 1, 1, 3, + 1, 3, 1, 3, 1, 2, 6, 2, 1, 1, + 2, 2, 3, 3, 3, 3, 1, 2, 1 }; static const short yydefact[] = { 0, 0, 7, 8, 0, 4, 0, 0, 5, 6, 3, 2, 0, 0, 1, 0, 0, 0, 22, 0, 0, - 0, 0, 15, 16, 14, 10, 0, 38, 46, 45, - 44, 0, 0, 40, 42, 43, 34, 33, 32, 35, - 37, 0, 25, 29, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 12, 13, 11, 0, 31, 28, 30, - 27, 39, 41, 0, 48, 26, 36, 0, 24, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, - 47, 18, 0, 0, 21, 0, 0, 51, 0, 0, - 0, 0, 0, 60, 38, 35, 0, 0, 69, 71, - 0, 23, 0, 0, 49, 0, 0, 0, 0, 61, - 0, 72, 65, 0, 65, 0, 65, 50, 0, 0, - 0, 68, 0, 0, 0, 0, 70, 0, 0, 0, - 0, 65, 0, 0, 85, 83, 0, 0, 62, 64, - 0, 0, 0, 20, 0, 53, 56, 65, 0, 0, - 76, 0, 0, 0, 0, 0, 75, 63, 84, 58, - 59, 0, 52, 0, 55, 65, 0, 0, 77, 0, - 78, 0, 73, 74, 0, 54, 0, 81, 79, 80, - 82, 19, 0, 57, 0, 0, 0 + 0, 0, 15, 16, 14, 10, 0, 0, 40, 48, + 47, 46, 0, 0, 42, 44, 45, 36, 35, 34, + 37, 39, 0, 25, 27, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 9, 12, 13, 11, 0, 26, + 33, 30, 32, 29, 41, 43, 0, 50, 28, 38, + 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 17, 0, 49, 18, 0, 0, 21, 0, 0, + 53, 0, 0, 0, 0, 0, 62, 40, 37, 0, + 0, 71, 73, 75, 0, 23, 0, 0, 51, 0, + 0, 0, 0, 63, 0, 76, 67, 0, 67, 0, + 67, 52, 0, 0, 0, 70, 0, 0, 0, 0, + 72, 74, 0, 0, 0, 0, 67, 0, 0, 89, + 87, 0, 0, 64, 66, 0, 0, 0, 20, 0, + 55, 58, 67, 0, 0, 80, 0, 0, 0, 0, + 0, 79, 65, 88, 60, 61, 0, 54, 0, 57, + 67, 0, 0, 81, 0, 82, 0, 77, 78, 0, + 56, 0, 85, 83, 84, 86, 19, 0, 59, 0, + 0, 0 }; -static const short yydefgoto[] = { 185, - 4, 5, 6, 22, 23, 24, 48, 70, 97, 43, - 44, 45, 66, 51, 89, 147, 25, 126, 98, 99, - 100, 156, 157, 139 +static const short yydefgoto[] = { 190, + 4, 5, 6, 22, 23, 24, 50, 73, 100, 44, + 45, 46, 47, 69, 53, 92, 152, 25, 130, 101, + 102, 103, 104, 161, 162, 144 }; -static const short yypact[] = { 26, - -14,-32768,-32768, 37, 51, -6, 43,-32768,-32768, 51, - 98, 99, 8, 98, 20, 72, 72, 24, 72, 52, - 57, 88,-32768,-32768,-32768,-32768, 69,-32768,-32768,-32768, --32768, 119, 125, 94, 96,-32768,-32768,-32768,-32768,-32768, --32768, 91, 86,-32768, 120, 127, 128, 129, 130, 33, - 72, 131,-32768,-32768,-32768,-32768, 116,-32768,-32768,-32768, --32768,-32768,-32768, 100, 86,-32768,-32768, 110, 118, 117, - 135, 122, 123, 138, 72, 139, 126, 31,-32768, 90, --32768,-32768, 90, 128,-32768, 140, 90,-32768, 55, 142, - 132, 72, 141,-32768, 133, 104, 143, 134, 136,-32768, - 137,-32768, 144, 145,-32768, 147, 148, 90, 150,-32768, - 72, 149, -17, 72, -17, 153, -17,-32768, 90, 146, - 151, 136, 157, -11, 152, 155,-32768, 156, 36, 40, - 154, -17, 90, -15,-32768,-32768, 161, 158,-32768,-32768, - 165, 167, 160,-32768, 170,-32768,-32768, -17, 40, 159, --32768, 162, -8, -5, 163, 3,-32768,-32768,-32768,-32768, --32768, 172,-32768, 40,-32768, -17, -3, -3,-32768, -3, --32768, -3,-32768,-32768, 164,-32768, 168,-32768,-32768,-32768, --32768,-32768, 173,-32768, 171, 178,-32768 +static const short yypact[] = { 32, + 81,-32768,-32768, 36, 53, -15, 108,-32768,-32768, 53, + 137, 138, 92, 137, 87, 93, 93, 96, 93, 3, + 98, 127,-32768,-32768,-32768,-32768, 118, 128,-32768,-32768, +-32768,-32768, 60, 156, 134, 136,-32768,-32768,-32768,-32768, +-32768,-32768, 157,-32768, 125,-32768, 158, 159, 160, 161, + 162, -2, 93, 163,-32768,-32768,-32768,-32768, 148,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 19, 125,-32768,-32768, + 139, 150, 149, 167, 154, 155, 170, 93, 171, 164, + 10,-32768, 111,-32768,-32768, 111, 160,-32768, 172, 111, +-32768, 23, 173, 166, 93, 174,-32768, 168, 28, 175, + 169,-32768, 176,-32768, 177,-32768, 165, 178,-32768, 181, + 182, 111, 185,-32768, 93, 183, -11, 75, -11, 179, + -11,-32768, 111, 180, 184,-32768, 186, -14, 187, 188, +-32768,-32768, 189, -7, 63, 190, -11, 111, 29,-32768, +-32768, 198, 201,-32768,-32768, 200, 203, 193,-32768, 205, +-32768,-32768, -11, 63, 194,-32768, 191, -10, -6, 192, + 5,-32768,-32768,-32768,-32768,-32768, 209,-32768, 63,-32768, + -11, 1, 1,-32768, 1,-32768, 1,-32768,-32768, 202, +-32768, 206,-32768,-32768,-32768,-32768,-32768, 210,-32768, 207, + 208,-32768 }; static const short yypgoto[] = {-32768, - 9, 169,-32768,-32768, 176, 181,-32768, 81, -16,-32768, - 113,-32768, 166, 174,-32768, -101, 182, -111, -76, 89, - 92,-32768, 49, -102 + 14, 230,-32768,-32768, 214, 216,-32768, 107, -16, 211, +-32768, 142,-32768, 130, 195,-32768, -142, 218, -117, -81, + 94,-32768, 123,-32768, 49, -108 }; -#define YYLAST 231 - - -static const short yytable[] = { 42, - 46, 124, 49, 128, 151, 130, 101, 7, 135, 136, - 104, 135, 136, 11, 135, 136, 135, 136, 14, 137, - 149, 125, 151, 152, 12, 153, 154, 155, 1, 26, - 168, 120, 138, 170, 76, 138, 164, 173, 138, 1, - 138, 152, 131, 153, 154, 155, 13, 165, 2, 3, - 169, 171, 73, 27, 177, 143, 150, 47, 90, 8, - 9, 93, 176, 94, 178, 179, 74, 180, 144, 181, - 145, 50, 146, 2, 3, 109, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 57, 105, - 52, 40, 106, 41, 95, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 62, 15, 63, 96, - 64, 41, 16, 17, 18, 19, 20, 21, 15, 53, - 8, 9, 65, 16, 17, 18, 19, 20, 21, 34, - 35, 36, 79, 80, 58, 34, 35, 36, -67, 67, - 60, 111, 82, 83, 59, 61, 68, 69, 71, 72, - 78, 85, 77, 84, 86, 87, 74, 88, 91, 103, - 92, 107, 112, 110, 102, 108, 118, -66, 113, 121, - 186, 115, 10, 114, 116, 129, 134, 187, 159, 117, - 132, 119, 123, 158, 133, 141, 142, 160, 148, 161, - 162, 140, 163, 166, 175, 184, 182, 54, 183, 122, - 167, 172, 55, 56, 174, 127, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, - 81 +#define YYLAST 247 + + +static const short yytable[] = { 43, + 48, 133, 51, 135, 105, 140, 141, 128, 108, 140, + 141, 170, 148, 140, 141, 12, 142, 76, 11, 154, + 140, 141, 52, 14, 156, 149, 181, 129, 173, 143, + 124, 77, 175, 143, 1, 169, 79, 143, 1, 178, + 96, 136, 97, 157, 143, 158, 159, 160, 156, 174, + 176, 82, 83, 182, 2, 3, 155, 109, 8, 9, + 110, 93, -69, 183, 184, 115, 185, 157, 186, 158, + 159, 160, 35, 36, 37, 2, 3, 61, 113, 28, + 29, 30, 31, 32, 131, 33, 34, 35, 36, 37, + 38, 39, 40, 150, 41, 151, 42, 28, 29, 30, + 31, 32, 7, 33, 34, 35, 36, 37, 38, 39, + 40, 13, 41, 26, 42, 28, 98, 30, 31, 32, + 27, 33, 34, 35, 36, 37, 38, 39, 40, 49, + 99, 54, 42, 29, 30, 31, 32, 59, 33, 34, + 35, 36, 37, 38, 39, 40, 15, 41, 65, 42, + 66, 16, 17, 18, 19, 20, 21, 15, 55, 8, + 9, 68, 16, 17, 18, 19, 20, 21, 35, 36, + 37, 85, 86, 63, 62, 64, 67, 70, 71, 72, + 74, 75, 81, 88, 80, 87, 89, 90, 77, 91, + 94, 107, 111, 106, 116, 120, 114, 84, 95, 112, + 122, 134, -68, 117, 125, 139, 191, 192, 126, 179, + 0, 119, 121, 118, 137, 123, 127, 138, 146, 147, + 163, 164, 165, 167, 153, 166, 145, 168, 171, 172, + 177, 180, 189, 10, 187, 56, 188, 57, 60, 58, + 132, 0, 0, 0, 0, 0, 78 }; static const short yycheck[] = { 16, - 17, 19, 19, 115, 20, 117, 83, 22, 20, 21, - 87, 20, 21, 5, 20, 21, 20, 21, 10, 31, - 132, 39, 20, 39, 31, 41, 42, 43, 3, 22, - 39, 108, 44, 39, 51, 44, 148, 35, 44, 3, - 44, 39, 119, 41, 42, 43, 4, 149, 23, 24, - 153, 154, 20, 34, 166, 20, 133, 34, 75, 23, - 24, 31, 164, 33, 167, 168, 34, 170, 33, 172, - 31, 20, 33, 23, 24, 92, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 20, 35, - 34, 20, 38, 22, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 13, 20, 13, 20, - 20, 22, 25, 26, 27, 28, 29, 30, 20, 32, - 23, 24, 37, 25, 26, 27, 28, 29, 30, 11, - 12, 13, 33, 34, 16, 11, 12, 13, 35, 20, - 16, 38, 33, 34, 32, 33, 20, 20, 20, 20, - 35, 35, 22, 36, 20, 34, 34, 20, 20, 20, - 35, 20, 20, 23, 84, 34, 20, 35, 35, 20, - 0, 35, 4, 38, 31, 23, 20, 0, 21, 35, - 35, 34, 34, 23, 34, 31, 31, 23, 35, 23, - 31, 40, 23, 35, 23, 23, 33, 22, 31, 111, - 39, 39, 22, 22, 156, 114, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, - 65 + 17, 119, 19, 121, 86, 20, 21, 19, 90, 20, + 21, 154, 20, 20, 21, 31, 31, 20, 5, 137, + 20, 21, 20, 10, 20, 33, 169, 39, 39, 44, + 112, 34, 39, 44, 3, 153, 53, 44, 3, 35, + 31, 123, 33, 39, 44, 41, 42, 43, 20, 158, + 159, 33, 34, 171, 23, 24, 138, 35, 23, 24, + 38, 78, 35, 172, 173, 38, 175, 39, 177, 41, + 42, 43, 13, 14, 15, 23, 24, 18, 95, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 31, 20, 33, 22, 5, 6, 7, + 8, 9, 22, 11, 12, 13, 14, 15, 16, 17, + 18, 4, 20, 22, 22, 5, 6, 7, 8, 9, + 34, 11, 12, 13, 14, 15, 16, 17, 18, 34, + 20, 34, 22, 6, 7, 8, 9, 20, 11, 12, + 13, 14, 15, 16, 17, 18, 20, 20, 15, 22, + 15, 25, 26, 27, 28, 29, 30, 20, 32, 23, + 24, 37, 25, 26, 27, 28, 29, 30, 13, 14, + 15, 33, 34, 18, 33, 34, 20, 20, 20, 20, + 20, 20, 35, 35, 22, 36, 20, 34, 34, 20, + 20, 20, 20, 87, 20, 31, 23, 68, 35, 34, + 20, 23, 35, 35, 20, 20, 0, 0, 115, 161, + -1, 35, 35, 38, 35, 34, 34, 34, 31, 31, + 23, 21, 23, 31, 35, 23, 40, 23, 35, 39, + 39, 23, 23, 4, 33, 22, 31, 22, 28, 22, + 118, -1, -1, -1, -1, -1, 52 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -945,51 +952,51 @@ yyreduce: switch (yyn) { case 1: -#line 177 "parse.y" +#line 178 "parse.y" { ; ; break;} case 2: -#line 178 "parse.y" +#line 179 "parse.y" { ; ; break;} case 3: -#line 179 "parse.y" +#line 180 "parse.y" { ; ; break;} case 4: -#line 180 "parse.y" +#line 181 "parse.y" { ; ; break;} case 5: -#line 183 "parse.y" +#line 184 "parse.y" { Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 6: -#line 187 "parse.y" +#line 188 "parse.y" { Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 7: -#line 191 "parse.y" +#line 192 "parse.y" { Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 8: -#line 195 "parse.y" +#line 196 "parse.y" { Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 9: -#line 201 "parse.y" +#line 202 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -997,49 +1004,49 @@ case 9: ; break;} case 10: -#line 208 "parse.y" +#line 209 "parse.y" { class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL); ; break;} case 11: -#line 213 "parse.y" +#line 214 "parse.y" { ; ; break;} case 12: -#line 214 "parse.y" +#line 215 "parse.y" { ; ; break;} case 13: -#line 215 "parse.y" +#line 216 "parse.y" { ; ; break;} case 14: -#line 216 "parse.y" +#line 217 "parse.y" { ; ; break;} case 15: -#line 217 "parse.y" +#line 218 "parse.y" { ; ; break;} case 16: -#line 218 "parse.y" +#line 219 "parse.y" { ; ; break;} case 17: -#line 221 "parse.y" +#line 222 "parse.y" { push_variable(yyvsp[-1].id,PUBLIC_SCOPE,yyvsp[-3].line); ; break;} case 18: -#line 224 "parse.y" +#line 225 "parse.y" { push_variable(yyvsp[-1].id,PRIVATE_SCOPE,yyvsp[-3].line); ; break;} case 19: -#line 228 "parse.y" +#line 229 "parse.y" { if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { @@ -1071,7 +1078,7 @@ case 19: ; break;} case 20: -#line 257 "parse.y" +#line 258 "parse.y" { if(strcmp(yyvsp[-3].id,"get")==0) { Node *node; @@ -1098,197 +1105,210 @@ case 20: ; break;} case 21: -#line 283 "parse.y" +#line 284 "parse.y" { yyval.list = yyvsp[-1].list; ; break;} case 22: -#line 284 "parse.y" +#line 285 "parse.y" { yyval.list = NULL; ; break;} case 23: -#line 287 "parse.y" +#line 288 "parse.y" { yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} case 24: -#line 290 "parse.y" +#line 291 "parse.y" { yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} case 25: -#line 296 "parse.y" +#line 297 "parse.y" +{ ; ; + break;} +case 26: +#line 298 "parse.y" +{ + Type *type = typestack->data; + char *oldname = type->name; + type->name = g_strconcat("const ",oldname,NULL); + g_free(oldname); + ; + break;} +case 27: +#line 306 "parse.y" { Node *node = new_type(0,yyvsp[0].id); typestack = g_list_prepend(typestack,node); ; break;} -case 26: -#line 300 "parse.y" +case 28: +#line 310 "parse.y" { Node *node = new_type(stars,yyvsp[-1].id); stars = 0; typestack = g_list_prepend(typestack,node); ; break;} -case 27: -#line 307 "parse.y" +case 29: +#line 317 "parse.y" { yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL); ; break;} -case 28: -#line 310 "parse.y" +case 30: +#line 320 "parse.y" { yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL); ; break;} -case 29: -#line 313 "parse.y" +case 31: +#line 323 "parse.y" { yyval.id = g_strdup(yyvsp[0].id); ; break;} -case 30: -#line 316 "parse.y" +case 32: +#line 326 "parse.y" { yyval.id = g_strdup("unsigned char"); ; break;} -case 31: -#line 319 "parse.y" +case 33: +#line 329 "parse.y" { yyval.id = g_strdup("signed char"); ; break;} -case 32: -#line 322 "parse.y" +case 34: +#line 332 "parse.y" { yyval.id = g_strdup("char"); ; break;} -case 33: -#line 325 "parse.y" +case 35: +#line 335 "parse.y" { yyval.id = g_strdup("double"); ; break;} -case 34: -#line 328 "parse.y" +case 36: +#line 338 "parse.y" { yyval.id = g_strdup("float"); ; break;} -case 35: -#line 331 "parse.y" +case 37: +#line 341 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 36: -#line 334 "parse.y" +case 38: +#line 344 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 37: -#line 338 "parse.y" +case 39: +#line 348 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 38: -#line 341 "parse.y" +case 40: +#line 351 "parse.y" { yyval.id = g_strdup("void"); ; break;} -case 39: -#line 346 "parse.y" +case 41: +#line 356 "parse.y" { yyval.id = "long int"; ; break;} -case 40: -#line 349 "parse.y" +case 42: +#line 359 "parse.y" { yyval.id = "long"; ; break;} -case 41: -#line 352 "parse.y" +case 43: +#line 362 "parse.y" { yyval.id = "short int"; ; break;} -case 42: -#line 355 "parse.y" +case 44: +#line 365 "parse.y" { yyval.id = "short"; ; break;} -case 43: -#line 358 "parse.y" +case 45: +#line 368 "parse.y" { yyval.id = "int"; ; break;} -case 44: -#line 363 "parse.y" +case 46: +#line 373 "parse.y" { yyval.id = "enum "; ; break;} -case 45: -#line 366 "parse.y" +case 47: +#line 376 "parse.y" { yyval.id = "union "; ; break;} -case 46: -#line 369 "parse.y" +case 48: +#line 379 "parse.y" { yyval.id = "struct "; ; break;} -case 47: -#line 374 "parse.y" +case 49: +#line 384 "parse.y" { stars++; ; break;} -case 48: -#line 375 "parse.y" +case 50: +#line 385 "parse.y" { stars++; ; break;} -case 49: -#line 378 "parse.y" +case 51: +#line 388 "parse.y" { gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id); ; break;} -case 50: -#line 383 "parse.y" +case 52: +#line 393 "parse.y" { gtktypes = g_list_append(gtktypes,yyvsp[0].id); ; break;} -case 51: -#line 386 "parse.y" +case 53: +#line 396 "parse.y" { gtktypes = g_list_append(gtktypes,yyvsp[0].id); ; break;} -case 52: -#line 391 "parse.y" +case 54: +#line 401 "parse.y" { yyval.cbuf=yyvsp[0].cbuf; ; break;} -case 53: -#line 392 "parse.y" +case 55: +#line 402 "parse.y" { yyval.cbuf = NULL; ; break;} -case 54: -#line 396 "parse.y" +case 56: +#line 406 "parse.y" { int sigtype = SIGNAL_LAST_METHOD; if(strcmp(yyvsp[-8].id,"first")==0) @@ -1308,11 +1328,12 @@ case 54: YYERROR; } push_function(sigtype,NULL, - yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-9].line,ccode_line); + yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-9].line, + ccode_line,vararg); ; break;} -case 55: -#line 417 "parse.y" +case 57: +#line 428 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1320,11 +1341,12 @@ case 55: YYERROR; } push_function(SIGNAL_LAST_METHOD, NULL, - yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line,ccode_line); + yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line, + ccode_line,vararg); ; break;} -case 56: -#line 426 "parse.y" +case 58: +#line 438 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1332,41 +1354,48 @@ case 56: YYERROR; } push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id, - yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line,ccode_line); + yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line, + ccode_line,vararg); ; break;} -case 57: -#line 435 "parse.y" +case 59: +#line 448 "parse.y" { push_function(OVERRIDE_METHOD, yyvsp[-9].id, - yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line,yyvsp[-1].line); + yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf, + yyvsp[-11].line,yyvsp[-1].line, + vararg); ; break;} -case 58: -#line 439 "parse.y" +case 60: +#line 454 "parse.y" { push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id, - yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line); + yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line, + vararg); ; break;} -case 59: -#line 443 "parse.y" +case 61: +#line 459 "parse.y" { push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id, - yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line); + yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line, + vararg); ; break;} -case 60: -#line 447 "parse.y" +case 62: +#line 464 "parse.y" { if(strcmp(yyvsp[-4].id,"init")==0) { push_init_arg(yyvsp[-2].id,FALSE); push_function(INIT_METHOD, NULL, yyvsp[-4].id, - NULL, NULL,yyvsp[-3].line,0); + NULL, NULL,yyvsp[-3].line,0, + FALSE); } else if(strcmp(yyvsp[-4].id,"class_init")==0) { push_init_arg(yyvsp[-2].id,TRUE); push_function(CLASS_INIT_METHOD, NULL, - yyvsp[-4].id, NULL, NULL,yyvsp[-3].line,0); + yyvsp[-4].id, NULL, NULL,yyvsp[-3].line,0, + FALSE); } else { g_free(yyvsp[-4].id); g_free(yyvsp[-2].id); @@ -1375,19 +1404,19 @@ case 60: } ; break;} -case 61: -#line 463 "parse.y" +case 63: +#line 482 "parse.y" { if(strcmp(yyvsp[-5].id,"init")==0) { push_init_arg(yyvsp[-3].id,FALSE); push_function(INIT_METHOD, NULL, yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line, - yyvsp[-1].line); + yyvsp[-1].line,FALSE); } else if(strcmp(yyvsp[-5].id,"class_init")==0) { push_init_arg(yyvsp[-3].id,TRUE); push_function(CLASS_INIT_METHOD, NULL, yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line, - yyvsp[-1].line); + yyvsp[-1].line,FALSE); } else { g_free(yyvsp[-5].id); g_free(yyvsp[-3].id); @@ -1397,31 +1426,31 @@ case 61: } ; break;} -case 62: -#line 484 "parse.y" +case 64: +#line 503 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 63: -#line 485 "parse.y" +case 65: +#line 504 "parse.y" { yyval.id = (yyvsp[0].cbuf)->str; g_string_free(yyvsp[0].cbuf,FALSE); ; break;} -case 64: -#line 489 "parse.y" +case 66: +#line 508 "parse.y" { ; ; break;} -case 65: -#line 490 "parse.y" +case 67: +#line 509 "parse.y" { yyval.id = NULL; ; break;} -case 66: -#line 495 "parse.y" +case 68: +#line 512 "parse.y" { has_self = FALSE; ; break;} -case 67: -#line 496 "parse.y" +case 69: +#line 513 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[0].id,"this")==0) { @@ -1438,8 +1467,8 @@ case 67: } ; break;} -case 68: -#line 511 "parse.y" +case 70: +#line 528 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"this")==0) { @@ -1456,26 +1485,34 @@ case 68: } ; break;} -case 69: -#line 526 "parse.y" +case 71: +#line 543 "parse.y" { has_self = FALSE; ; break;} -case 70: -#line 529 "parse.y" +case 72: +#line 546 "parse.y" +{ vararg = TRUE; ; + break;} +case 73: +#line 547 "parse.y" +{ vararg = FALSE; ; + break;} +case 74: +#line 550 "parse.y" { ; ; break;} -case 71: -#line 530 "parse.y" +case 75: +#line 551 "parse.y" { ; ; break;} -case 72: -#line 533 "parse.y" +case 76: +#line 554 "parse.y" { push_funcarg(yyvsp[0].id); ; break;} -case 73: -#line 536 "parse.y" +case 77: +#line 557 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -1485,16 +1522,16 @@ case 73: push_funcarg(yyvsp[-4].id); ; break;} -case 74: -#line 546 "parse.y" +case 78: +#line 567 "parse.y" { ; ; break;} -case 75: -#line 547 "parse.y" +case 79: +#line 568 "parse.y" { ; ; break;} -case 76: -#line 550 "parse.y" +case 80: +#line 571 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { Node *node = new_check(TYPE_CHECK,NULL); @@ -1509,61 +1546,61 @@ case 76: g_free(yyvsp[0].id); ; break;} -case 77: -#line 563 "parse.y" +case 81: +#line 584 "parse.y" { Node *node = new_check(GT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 78: -#line 567 "parse.y" +case 82: +#line 588 "parse.y" { Node *node = new_check(LT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 79: -#line 571 "parse.y" +case 83: +#line 592 "parse.y" { Node *node = new_check(GE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 80: -#line 575 "parse.y" +case 84: +#line 596 "parse.y" { Node *node = new_check(LE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 81: -#line 579 "parse.y" +case 85: +#line 600 "parse.y" { Node *node = new_check(EQ_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 82: -#line 583 "parse.y" +case 86: +#line 604 "parse.y" { Node *node = new_check(NE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 83: -#line 589 "parse.y" +case 87: +#line 610 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 84: -#line 590 "parse.y" +case 88: +#line 611 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 85: -#line 594 "parse.y" +case 89: +#line 615 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -1764,5 +1801,5 @@ yyerrhandle: yystate = yyn; goto yynewstate; } -#line 597 "parse.y" +#line 618 "parse.y" diff --git a/src/parse.y b/src/parse.y index 6e17c96..449ef3c 100644 --- a/src/parse.y +++ b/src/parse.y @@ -42,6 +42,7 @@ static int stars = 0; static GList *funcargs = NULL; static GList *checks = NULL; static int has_self = FALSE; +static int vararg = FALSE; static GList *gtktypes = NULL; @@ -91,7 +92,7 @@ push_variable(char *name, int scope, int line_no) static void push_function(int scope, char *oid, char *id, char *onerror, - GString *cbuf,int line_no, int ccode_line) + GString *cbuf,int line_no, int ccode_line, int vararg) { Node *node; Type *type; @@ -104,7 +105,7 @@ push_function(int scope, char *oid, char *id, char *onerror, } node = new_method(scope,type,oid,gtktypes,id,funcargs, - onerror,cbuf,line_no,ccode_line); + onerror,cbuf,line_no,ccode_line,vararg); gtktypes = NULL; funcargs = NULL; @@ -164,8 +165,8 @@ push_self(char *id) } %token CLASS FROM -%token VOID STRUCT UNION ENUM SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR -%token FIRST LAST +%token CONST VOID STRUCT UNION ENUM THREEDOTS +%token SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR %token ONERROR %token TOKEN NUMBER TYPETOKEN @@ -293,18 +294,27 @@ flaglist: TOKEN '|' flaglist { ; -type: type1 { +type: type1 { ; } + | CONST type1 { + Type *type = typestack->data; + char *oldname = type->name; + type->name = g_strconcat("const ",oldname,NULL); + g_free(oldname); + } + ; + +type1: type2 { Node *node = new_type(0,$1); typestack = g_list_prepend(typestack,node); } - | type1 stars { + | type2 stars { Node *node = new_type(stars,$1); stars = 0; typestack = g_list_prepend(typestack,node); } ; -type1: UNSIGNED integer { +type2: UNSIGNED integer { $$ = g_strconcat("unsigned ",$2,NULL); } | SIGNED integer { @@ -412,7 +422,8 @@ method: SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror codenocode { YYERROR; } push_function(sigtype,NULL, - $5, $9, $10,$1,ccode_line); + $5, $9, $10,$1, + ccode_line,vararg); } | SIGNAL sigtype type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { @@ -421,7 +432,8 @@ method: SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror codenocode { YYERROR; } push_function(SIGNAL_LAST_METHOD, NULL, - $4, $8, $9,$1,ccode_line); + $4, $8, $9,$1, + ccode_line,vararg); } | VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode { if(!has_self) { @@ -430,29 +442,36 @@ method: SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror codenocode { YYERROR; } push_function(VIRTUAL_METHOD, NULL, $3, - $7, $8,$1,ccode_line); + $7, $8,$1, + ccode_line,vararg); } | OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' onerror '{' CCODE { push_function(OVERRIDE_METHOD, $3, - $6, $10, $12,$1,$11); + $6, $10, $12, + $1,$11, + vararg); } | PUBLIC type TOKEN '(' funcargs ')' onerror '{' CCODE { push_function(PUBLIC_SCOPE, NULL, $3, - $7, $9,$1,$8); + $7, $9,$1,$8, + vararg); } | PRIVATE type TOKEN '(' funcargs ')' onerror '{' CCODE { push_function(PRIVATE_SCOPE, NULL, $3, - $7, $9,$1,$8); + $7, $9,$1,$8, + vararg); } | TOKEN '(' TOKEN ')' ';' { if(strcmp($1,"init")==0) { push_init_arg($3,FALSE); push_function(INIT_METHOD, NULL, $1, - NULL, NULL,$2,0); + NULL, NULL,$2,0, + FALSE); } else if(strcmp($1,"class_init")==0) { push_init_arg($3,TRUE); push_function(CLASS_INIT_METHOD, NULL, - $1, NULL, NULL,$2,0); + $1, NULL, NULL,$2,0, + FALSE); } else { g_free($1); g_free($3); @@ -465,12 +484,12 @@ method: SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror codenocode { push_init_arg($3,FALSE); push_function(INIT_METHOD, NULL, $1, NULL, $6,$2, - $5); + $5,FALSE); } else if(strcmp($1,"class_init")==0) { push_init_arg($3,TRUE); push_function(CLASS_INIT_METHOD, NULL, $1, NULL, $6,$2, - $5); + $5,FALSE); } else { g_free($1); g_free($3); @@ -490,8 +509,6 @@ onerror: ONERROR numtok { $$ = $2; } | { $$ = NULL; } ; - - funcargs: VOID { has_self = FALSE; } | TOKEN { has_self = TRUE; @@ -525,8 +542,12 @@ funcargs: VOID { has_self = FALSE; } } | arglist { has_self = FALSE; } ; + +arglist: arglist1 ',' THREEDOTS { vararg = TRUE; } + | arglist1 { vararg = FALSE; } + ; -arglist: arglist ',' arg { ; } +arglist1: arglist1 ',' arg { ; } | arg { ; } ; diff --git a/src/test.gob b/src/test.gob index 42adca4..bac330a 100644 --- a/src/test.gob +++ b/src/test.gob @@ -49,6 +49,10 @@ class Gtk:Weird:Button from Gtk:Button { if (GTK_CONTAINER_CLASS (parent_class)->add) (* GTK_CONTAINER_CLASS (parent_class)->add) (self,wid); } + public int consttest(self, const gchar *text, ...) + { + return 25; + } } %{ diff --git a/src/tree.c b/src/tree.c index 279180a..ab06d4f 100644 --- a/src/tree.c +++ b/src/tree.c @@ -77,7 +77,7 @@ new_funcarg(Type *atype, char *name, GList *checks) } Node * -new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf, int line_no,int ccode_line) +new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf, int line_no,int ccode_line, int vararg) { Method *node = (Method *)g_new(Node,1); node->type = METHOD_NODE; @@ -91,6 +91,7 @@ new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList node->cbuf = cbuf; node->line_no = line_no; node->ccode_line = ccode_line; + node->vararg = vararg; return (Node *)node; } diff --git a/src/tree.h b/src/tree.h index caef602..5df83d9 100644 --- a/src/tree.h +++ b/src/tree.h @@ -124,6 +124,7 @@ struct _Method { GString *cbuf; int line_no; int ccode_line; + int vararg; }; typedef struct _Variable Variable; @@ -151,7 +152,7 @@ Node *new_class(char *otype, char *ptype, GList *nodes); Node *new_type(int stars, char *name); Node *new_check(int chtype, char *number); Node *new_funcarg(Type *atype, char *name, GList *checks); -Node *new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf,int line_no,int ccode_line); +Node *new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf,int line_no,int ccode_line, int vararg); Node *new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line, int line_no); Node *new_variable(int scope, Type *vtype, char *id,int line_no); -- 2.43.0