@@ -1248,27 +1248,28 @@ else if (is_end)
1248
1248
}
1249
1249
m_outstream .println ("\t );" );
1250
1250
1251
- m_outstream .print ("\t private $yy_cmap = null;\n " );
1252
- m_outstream .print ("\t private $yy_rmap = null;\n " );
1253
- m_outstream .print ("\t private $yy_nxt = null;\n " );
1251
+ // m_outstream.print("\tstatic $yy_cmap = null;\n");
1252
+ // m_outstream.print("\tstatic $yy_rmap = null;\n");
1253
+ // m_outstream.print("\tprivate $yy_nxt = null;\n");
1254
1254
1255
- m_outstream .print ("\t protected function yy_build_tables() {\n " );
1255
+ // m_outstream.print("\tprotected function yy_build_tables() {\n");
1256
1256
1257
1257
// CSA: modified yy_cmap to use string packing 9-Aug-1999
1258
1258
int [] yy_cmap = new int [m_spec .m_ccls_map .length ];
1259
1259
for (i = 0 ; i < m_spec .m_ccls_map .length ; ++i )
1260
1260
yy_cmap [i ] = m_spec .m_col_map [m_spec .m_ccls_map [i ]];
1261
- m_outstream .print ("\t \t $yy_cmap = $this->unpackFromString( " );
1262
- emit_table_as_string (new int [][] { yy_cmap });
1263
- m_outstream . println ( ");" );
1264
- m_outstream .print ( " \t \t $this->yy_cmap = $yy_cmap[0] ;" );
1261
+ m_outstream .print ("\t \t static $yy_cmap = " );
1262
+ // emit_table_as_string(new int[][] { yy_cmap });
1263
+ emit_table_as_array ( yy_cmap );
1264
+ // m_outstream.println(") ;");
1265
1265
m_outstream .println ();
1266
1266
1267
1267
// CSA: modified yy_rmap to use string packing 9-Aug-1999
1268
- m_outstream .print ("\t \t $yy_rmap = $this->unpackFromString(" );
1269
- emit_table_as_string (new int [][] { m_spec .m_row_map });
1270
- m_outstream .println (");" );
1271
- m_outstream .print ("\t \t $this->yy_rmap = $yy_rmap[0];" );
1268
+ m_outstream .print ("\t \t static $yy_rmap = " );
1269
+ // emit_table_as_string(new int[][] { m_spec.m_row_map });
1270
+ emit_table_as_array (m_spec .m_row_map );
1271
+ // m_outstream.println(");");
1272
+ // m_outstream.print("\t\t$this->yy_rmap = $yy_rmap[0];");
1272
1273
m_outstream .println ();
1273
1274
1274
1275
// 6/24/98 Raimondas Lencevicius
@@ -1282,13 +1283,38 @@ else if (is_end)
1282
1283
yy_nxt [elem ] = dtrans .m_dtrans ;
1283
1284
}
1284
1285
m_outstream .print
1285
- ("\t \t $this->yy_nxt = $this->unpackFromString(" );
1286
- emit_table_as_string (yy_nxt );
1287
- m_outstream .println (");" );
1286
+ ("\t \t static $yy_nxt = " );
1287
+ // emit_table_as_string(yy_nxt);
1288
+ emit_table_as_array_2d (yy_nxt );
1289
+ // m_outstream.println(");");
1288
1290
m_outstream .println ();
1289
- m_outstream .println ("\t }" );
1291
+ // m_outstream.println("\t}");
1290
1292
}
1291
1293
1294
+ private void emit_table_as_array (int [] ia ) {
1295
+ int i ;
1296
+ m_outstream .println ("array(" );
1297
+ for (i = 0 ; i < ia .length ; ++i ) {
1298
+ m_outstream .print (" " + ia [i ] + "," );
1299
+ if (i % 20 == 19 ) m_outstream .println ();
1300
+ }
1301
+ m_outstream .println (");" );
1302
+ }
1303
+ private void emit_table_as_array_2d (int [][] ia ) {
1304
+ int i , j ;
1305
+ m_outstream .println ("array(" );
1306
+ for (j = 0 ; j < ia .length ; ++j ) {
1307
+ m_outstream .println ("array(" );
1308
+ for (i = 0 ; i < ia [j ].length ; ++i ) {
1309
+ m_outstream .print (" " + ia [j ][i ] + "," );
1310
+ if (i % 20 == 19 ) m_outstream .println ();
1311
+ }
1312
+ m_outstream .println ();
1313
+ m_outstream .println (")," );
1314
+ }
1315
+ m_outstream .println (");" );
1316
+ }
1317
+
1292
1318
/***************************************************************
1293
1319
Function: emit_driver
1294
1320
Description: Output an integer table as a string. Written by
@@ -1353,7 +1379,7 @@ private void emit_table_as_string(int[][] ia) {
1353
1379
// CSA: output in 75 character chunks.
1354
1380
if (outstr .length () > 75 ) {
1355
1381
String s = outstr .toString ();
1356
- m_outstream .println ("\" " +s .substring (0 ,75 )+"\" + " );
1382
+ m_outstream .println ("\" " +s .substring (0 ,75 )+"\" . " );
1357
1383
outstr = new StringBuffer (s .substring (75 ));
1358
1384
}
1359
1385
}
@@ -1437,13 +1463,13 @@ else if (m_spec.m_intwrap_type)
1437
1463
m_outstream .println ("\t \t $yy_next_state = self::YY_NO_STATE;" );
1438
1464
/*m_outstream.println("\t\tint yy_prev_stave = YY_NO_STATE;");*/
1439
1465
m_outstream .println ("\t \t $yy_last_accept_state = self::YY_NO_STATE;" );
1440
- m_outstream .println ("\t \t $$ yy_initial = true;" );
1466
+ m_outstream .println ("\t \t $yy_initial = true;" );
1441
1467
// m_outstream.println("\t\t$yy_this_accept;");
1442
1468
m_outstream .println ();
1443
1469
1444
1470
m_outstream .println ("\t \t $this->yy_mark_start();" );
1445
1471
/*m_outstream.println("\t\tyy_this_accept = yy_accept(yy_state);");*/
1446
- m_outstream .println ("\t \t $yy_this_accept = self::$yy_acpt[$this-> yy_state];" );
1472
+ m_outstream .println ("\t \t $yy_this_accept = self::$yy_acpt[$yy_state];" );
1447
1473
m_outstream .println ("\t \t if (self::YY_NOT_ACCEPT != $yy_this_accept) {" );
1448
1474
m_outstream .println ("\t \t \t $yy_last_accept_state = $yy_state;" );
1449
1475
m_outstream .println ("\t \t \t $this->yy_mark_end();" );
@@ -1459,11 +1485,11 @@ else if (m_spec.m_intwrap_type)
1459
1485
m_outstream .println ("\t \t \t if ($yy_initial && $this->yy_at_bol) " +
1460
1486
"$yy_lookahead = self::YY_BOL;" );
1461
1487
m_outstream .println ("\t \t \t else $yy_lookahead = $this->yy_advance();" );
1462
- m_outstream .println ("\t \t \t $this-> yy_next_state = self::YY_F;" );
1488
+ // m_outstream.println("\t\t\t$yy_next_state = self::YY_F;");
1463
1489
/*m_outstream.println("\t\t\t\tyy_next_state = "
1464
1490
+ "yy_next(yy_state,yy_lookahead);");*/
1465
1491
m_outstream .println ("\t \t \t $yy_next_state = "
1466
- + "$this-> yy_nxt[$this-> yy_rmap[$this-> yy_state]][$this-> yy_cmap[$this-> yy_lookahead]];" );
1492
+ + "self::$ yy_nxt[self::$ yy_rmap[$yy_state]][self::$ yy_cmap[$yy_lookahead]];" );
1467
1493
1468
1494
if (NOT_EDBG )
1469
1495
{
@@ -1555,9 +1581,9 @@ else if (null != m_spec.m_eof_value_code)
1555
1581
1556
1582
m_outstream .println ("\t \t \t \t \t switch ($yy_last_accept_state) {" );
1557
1583
1558
- emit_actions ("\t \t \t \t \t " );
1584
+ emit_actions ("\t \t \t \t \t \t " );
1559
1585
1560
- m_outstream .println ("\t \t \t \t \t default:" );
1586
+ m_outstream .println ("\t \t \t \t \t \ t default:" );
1561
1587
m_outstream .println ("\t \t \t \t \t \t $this->yy_error(self::YY_E_INTERNAL,false);" );
1562
1588
/*m_outstream.println("\t\t\t\t\t\treturn null;");*/
1563
1589
m_outstream .println ("\t \t \t \t \t case -1:" );
0 commit comments