ParserFunctions: Comment out unused variables [#661]

staging
gnosygnu 4 years ago
parent bfce37f0ba
commit da87b17902

@ -151,6 +151,11 @@ public class DateAdp implements CompareAble, Gfo_invk {
this.under = new GregorianCalendar(year, month - Month_base0adj, day, hour, minute, second);
under.set(Calendar.MILLISECOND, frac);
}
protected DateAdp(int year, int month, int day, int hour, int minute, int second, int frac, TimeZone timeZone) {
this.under = new GregorianCalendar(timeZone);
under.set(year, month - Month_base0adj, day, hour, minute, second);
under.set(Calendar.MILLISECOND, frac);
}
public void SetTzOffset(int offset) {
java.util.Date date = under.getTime();
long msFromEpochGmt = date.getTime();

@ -116,6 +116,11 @@ public class DateAdp_ implements Gfo_invk {
c.setTimeInMillis(v);
return new DateAdp(c);
}
public static DateAdp New_w_tz(int y, int m, int d, int h, int i, int s, int us, String tz_id) {
TimeZone tz = String_.Eq(tz_id, "UTC") ? TIME_ZONE__UTC : TimeZone.getTimeZone(tz_id);
return new DateAdp(y, m, d, h, i, s, us/1000, tz);
}
private static TimeZone TIME_ZONE__UTC = TimeZone.getTimeZone("UTC");
public static final int
SegIdx_year = 0, SegIdx_month = 1, SegIdx_day = 2, SegIdx_hour = 3, SegIdx_minute = 4, SegIdx_second = 5
, SegIdx_frac = 6, SegIdx_dayOfWeek = 7, SegIdx_weekOfYear = 8, SegIdx_dayOfYear = 9, SegIdx_tz = 10, SegIdx__max = 11;

@ -557,8 +557,8 @@ public class Dbx_scan_support {
retval = -1 * timelib_parse_tz_cor(s);
} else {
int found = 0;
int offset = 0;
// int found = 0;
// int offset = 0;
//char *tz_abbr;
t.is_localtime = true;

@ -325,7 +325,7 @@ public class Dbx_strtotime {
break;
case 18: //line 1719 "parse_date.re"
{
int tz_not_found;
// int tz_not_found;
// DEBUG_OUTPUT("tzcorrection | tz");
s.cur = s.cursor;
s.ptr = s.tok;
@ -974,7 +974,7 @@ public class Dbx_strtotime {
break;
case 209: //line 1224 "parse_date.re"
{
int tz_not_found;
// int tz_not_found;
// DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
s.cur = s.cursor;
s.ptr = s.tok;
@ -1014,7 +1014,7 @@ public class Dbx_strtotime {
break;
case 214: //line 1316 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("americanshort | american");
s.cur = s.cursor;
s.ptr = s.tok;
@ -1111,7 +1111,7 @@ public class Dbx_strtotime {
break;
case 241: //line 1386 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("datefull");
s.cur = s.cursor;
s.ptr = s.tok;
@ -1397,7 +1397,7 @@ public class Dbx_strtotime {
break;
case 310: //line 1455 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("datetextual | datenoyear");
s.cur = s.cursor;
s.ptr = s.tok;
@ -2196,7 +2196,7 @@ public class Dbx_strtotime {
break;
case 545: //line 1372 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("gnudateshort");
s.cur = s.cursor;
s.ptr = s.tok;
@ -2309,7 +2309,7 @@ public class Dbx_strtotime {
break;
case 577: //line 1441 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("datenodayrev");
s.cur = s.cursor;
s.ptr = s.tok;
@ -2612,7 +2612,7 @@ public class Dbx_strtotime {
++s.cursor;
//line 1427 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("datenoday");
s.cur = s.cursor;
s.ptr = s.tok;
@ -2752,7 +2752,7 @@ public class Dbx_strtotime {
break;
case 711: //line 1413 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("pointed date YY");
s.cur = s.cursor;
s.ptr = s.tok;
@ -2808,7 +2808,7 @@ public class Dbx_strtotime {
break;
case 724: //line 1358 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("gnudateshorter");
s.cur = s.cursor;
s.ptr = s.tok;
@ -2890,7 +2890,7 @@ public class Dbx_strtotime {
break;
case 747: //line 1296 "parse_date.re"
{
int tz_not_found;
// int tz_not_found;
// DEBUG_OUTPUT("iso8601nocolon");
s.cur = s.cursor;
s.ptr = s.tok;
@ -3118,7 +3118,7 @@ public class Dbx_strtotime {
break;
case 814: //line 1757 "parse_date.re"
{
int tz_not_found;
// int tz_not_found;
// DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
s.cur = s.cursor;
s.ptr = s.tok;
@ -3366,7 +3366,7 @@ public class Dbx_strtotime {
break;
case 886: //line 1519 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("pgydotd");
s.cur = s.cursor;
s.ptr = s.tok;
@ -3551,7 +3551,7 @@ public class Dbx_strtotime {
case 935: //line 1692 "parse_date.re"
{
int i;
int behavior = 0;
// int behavior = 0;
// DEBUG_OUTPUT("relativetext");
s.cur = s.cursor;
s.ptr = s.tok;
@ -3696,7 +3696,7 @@ public class Dbx_strtotime {
break;
case 973: //line 1344 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("iso8601date2");
s.cur = s.cursor;
s.ptr = s.tok;
@ -3882,7 +3882,7 @@ public class Dbx_strtotime {
break;
case 1017: //line 1571 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("pgtextshort");
s.cur = s.cursor;
s.ptr = s.tok;
@ -4102,7 +4102,7 @@ public class Dbx_strtotime {
++s.cursor;
//line 1585 "parse_date.re"
{
int length = 0;
// int length = 0;
// DEBUG_OUTPUT("pgtextreverse");
s.cur = s.cursor;
s.ptr = s.tok;
@ -4251,7 +4251,7 @@ public class Dbx_strtotime {
case 1108: //line 1668 "parse_date.re"
{
int i;
int behavior = 0;
// int behavior = 0;
// DEBUG_OUTPUT("relativetextweek");
s.cur = s.cursor;
s.ptr = s.tok;
@ -4543,7 +4543,7 @@ public class Dbx_strtotime {
//line 1165 "parse_date.re"
{
int i;
int behavior = 0;
// int behavior = 0;
// DEBUG_OUTPUT("weekdayof");
s.cur = s.cursor;
s.ptr = s.tok;
@ -4738,7 +4738,7 @@ public class Dbx_strtotime {
break;
case 1228: //line 1493 "parse_date.re"
{
int tz_not_found;
// int tz_not_found;
// DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
s.cur = s.cursor;
s.ptr = s.tok;
@ -4859,7 +4859,7 @@ public class Dbx_strtotime {
break;
case 1258: //line 1599 "parse_date.re"
{
int tz_not_found;
// int tz_not_found;
// DEBUG_OUTPUT("clf");
s.cur = s.cursor;
s.ptr = s.tok;

@ -13,22 +13,70 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.xtns.pfuncs.times; import org.junit.After;
package gplx.xowa.xtns.pfuncs.times; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import gplx.core.tests.*;
import gplx.core.btries.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class Dbx_strtotime_tst {
private final Dbx_strtotime_fxt fxt = new Dbx_strtotime_fxt();
// private final Dbx_strtotime_fxt fxt = new Dbx_strtotime_fxt();
@Before public void setup() {
Datetime_now.Manual_(DateAdp_.new_(2012, 1, 2, 3, 4, 5, 6));
}
@After public void teardown() {
Datetime_now.Manual_n_();
}
// REF.PHP:https://github.com/php/php-src/blob/master/ext/date/tests/strtotime.phpt
@Test public void strtotime() {
// fxt.Init__format();
// fxt.Test__strtotime("2005-07-14 22:30:41" , "2005-07-14T22:30:41+0200");
// fxt.Test__strtotime("2005-07-14 22:30:41 GMT", "2005-07-15T00:30:41+0200");
// fxt.Test__strtotime("@1121373041" , "2005-07-14T22:30:41+0200");
// fxt.Test__strtotime("@1121373041 CEST" , "2005-07-14T22:30:41+0200");
// long x = DateAdp_.parse_iso8561("2005-07-14T22:30:41+0200").Timestamp_unix();
}
// REF.PHP:https://github.com/php/php-src/blob/master/ext/date/tests/strtotime_basic.phpt
@Test public void strtotime_basic() {
// fxt.Init__format("yyyy-MM-dd");
// fxt.Test__strtotime("1 Monday December 2008" , "2008-12-01");
// fxt.Test__strtotime("2 Monday December 2008" , "2008-12-08");
// fxt.Test__strtotime("3 Monday December 2008" , "2008-12-15");
// fxt.Test__strtotime("first Monday December 2008" , "2008-12-08");
// fxt.Test__strtotime("second Monday December 2008" , "2008-12-15");
// fxt.Test__strtotime("third Monday December 2008" , "2008-12-22");
}
// REF.PHP:https://github.com/php/php-src/blob/master/ext/date/tests/date_default_timezone_set-1.phpt
// REF.PHP:https://github.com/php/php-src/blob/master/ext/date/tests/timezone-configuration.phpt
// REF.PHP:https://github.com/php/php-src/blob/master/ext/intl/tests/calendar_isWeekend_basic.phpt
// REF.PHP:https://github.com/php/php-src/blob/master/ext/intl/tests/calendar_fromDateTime_basic.phpt
// REF.PHP:https://github.com/php/php-src/blob/master/ext/date/tests/strtotime_basic2.phpt
// REF.PHP:https://github.com/php/php-src/blob/master/ext/date/tests/002.phpt
/*
var_dump(date('Y-m-d', strtotime('1 Monday December 2008')));
var_dump(date('Y-m-d', strtotime('2 Monday December 2008')));
var_dump(date('Y-m-d', strtotime('3 Monday December 2008')));
var_dump(date('Y-m-d', strtotime('first Monday December 2008')));
var_dump(date('Y-m-d', strtotime('second Monday December 2008')));
var_dump(date('Y-m-d', strtotime('third Monday December 2008')));
?>
--EXPECT--
string(10) "2008-12-01"
string(10) "2008-12-08"
string(10) "2008-12-15"
string(10) "2008-12-08"
string(10) "2008-12-15"
string(10) "2008-12-22"
*/
@Test public void Basic() {
// "{{#time:r|n.d.}}", "Sat, 08 Feb 2020 22:57:12 +0000");
// fxt.Test__date("n.d.", "Sat, 08 Feb 2020 22:57:12 +0000");
@ -38,12 +86,51 @@ public class Dbx_strtotime_tst {
}
class Dbx_strtotime_fxt {
public Dbx_strtotime_fxt() {
Btrie_slim_mgr trie = Pxd_parser_.Trie();
Dbx_scan_support.Init(trie);
}
public void Test__date(String raw, String expd) {
DateAdp date = Dbx_scan_support.Parse(Bry_.new_u8(raw));
Gftest.Eq__str(expd, date.XtoStr_fmt_iso_8561());
}
// private SimpleDateFormat sdf;
// private String fmt, tz;
// public Dbx_strtotime_fxt() {
// Btrie_slim_mgr trie = Pxd_parser_.Trie();
// Dbx_scan_support.Init(trie);
// }
// public Dbx_strtotime_fxt Init__format() {return Init__format("yyyy-MM-dd'T'HH:mm:ssZ", "CET");}
// public Dbx_strtotime_fxt Init__format(String fmt) {return Init__format(fmt, "UTC");}
// public Dbx_strtotime_fxt Init__format(String fmt, String tz) {
// this.sdf = new SimpleDateFormat(fmt);
// sdf.setTimeZone(TimeZone.getTimeZone(tz));
// this.fmt = fmt;
// this.tz = tz;
// return this;
// }
// public void Test__date(String raw, String expd) {
// DateAdp date = Dbx_scan_support.Parse(Bry_.new_u8(raw));
// Gftest.Eq__str(expd, date.XtoStr_fmt_iso_8561());
// }
// public void Test__strtotime__ary(String[] raw, String[] expd) {
// int len = raw.length;
// String[] actl = new String[len];
// for (int i = 0; i < len; i++) {
// DateAdp date = Dbx_scan_support.Parse(Bry_.new_u8(raw[i]));
// actl[i] = To_str(date, sdf);
// }
// Gftest.Eq__ary(expd, actl);
// }
// public void Test__strtotime(String orig, String expd) {
// DateAdp date = Dbx_scan_support.Parse(Bry_.new_u8(orig));
// String actl = To_str(date, sdf);
// Gftest.Eq__str(expd, actl);
// }
// private String To_str(DateAdp date, SimpleDateFormat sdf) {
// Calendar calendar = date.UnderDateTime();
//
// // change TZ to same as sdf
//// calendar.setTimeZone(TimeZone.getTimeZone(sdf.getTimeZone().getID()));
// return sdf.format(calendar.getTime());
///*
// Instant instant = calendar.toInstant();
// ZoneId zoneId = ZoneId.of(tz);
// ZonedDateTime zdt = instant.atZone( zoneId );
// DateTimeFormatter dtf = new DateTimeFormatterBuilder().appendPattern(fmt).toFormatter();
// return zdt.format(dtf);
//*/
// }
}

Loading…
Cancel
Save