Removed unnecessary code

This commit is contained in:
moandji.ezana 2015-01-22 15:11:53 +02:00
parent ac3c0fd230
commit 6ad2743276
4 changed files with 0 additions and 41 deletions

View file

@ -2,7 +2,6 @@ package com.moandjiezana.toml;
import static com.moandjiezana.toml.ValueConverterUtils.INVALID;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -34,7 +33,6 @@ class DateConverter implements ValueConverter {
format += "Z";
if ("Z".equals(zone)) {
s += "+0000";
// s = s.substring(0, 22) + s.substring(23);
} else if (zone.contains(":")) {
s += zone.replace(":", "");
}
@ -48,13 +46,4 @@ class DateConverter implements ValueConverter {
}
private DateConverter() {}
public static void main(String[] args) throws ParseException {
Pattern DATE_REGEX = Pattern.compile("(\\d{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9](?:\\.\\d*)?)(Z|(?:[+\\-]\\d{2}:\\d{2}))(.*)");
Pattern DATE_REGEX2 = Pattern.compile("(\\d{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9])(Z|(?:[+\\-]\\d{2}:\\d{2}))");
System.out.println(DATE_REGEX.matcher("2011-11-11T12:32:00.999-07:00").matches());
System.out.println(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse("1979-05-27T00:32:00+0000"));
}
}

View file

@ -6,25 +6,8 @@ import static com.moandjiezana.toml.ValueConverterUtils.parser;
import java.util.List;
import org.parboiled.errors.ParseError;
import org.parboiled.parserunners.RecoveringParseRunner;
import org.parboiled.support.ParseTreeUtils;
import org.parboiled.support.ParsingResult;
class MultilineLiteralStringConverter implements ValueConverter {
public static void main(String[] args) {
ParsingResult<List<java.lang.String>> parsingResult = new RecoveringParseRunner<List<String>>(ValueConverterUtils.parser().MultilineLiteralString()).run("'''abc''' # comment");
if (parsingResult.hasErrors()) {
for (ParseError parseError : parsingResult.parseErrors) {
System.out.println(parseError.getInputBuffer().extract(0, 1000));
}
}
System.out.println(ParseTreeUtils.printNodeTree(parsingResult));
}
static final MultilineLiteralStringConverter MULTILINE_LITERAL_STRING_CONVERTER = new MultilineLiteralStringConverter();
@Override

View file

@ -6,19 +6,10 @@ import java.util.List;
import org.parboiled.BaseParser;
import org.parboiled.Rule;
import org.parboiled.annotations.BuildParseTree;
import org.parboiled.parserunners.RecoveringParseRunner;
import org.parboiled.support.ParseTreeUtils;
import org.parboiled.support.ParsingResult;
@BuildParseTree
class ValueParser extends BaseParser<List<Object>> {
public static void main(String[] args) {
ParsingResult<Object> parsingResult = new RecoveringParseRunner<Object>(ValueConverterUtils.parser().T()).run("'''abc''' # comment");
System.out.println(ParseTreeUtils.printNodeTree(parsingResult));
}
public Rule T() {
return Sequence("'''", OneOrMore(TestNot("'''"), ANY), "'''", Comment());
}

View file

@ -59,10 +59,6 @@ public class NumberTest {
assertEquals(6.626D * Math.pow(10, -34), toml.getDouble("fractional"), 0.0);
}
public static void main(String[] args) {
System.out.println(1e6);
}
@Test(expected = IllegalStateException.class)
public void should_fail_on_invalid_number() throws Exception {
new Toml().parse("a = 200-");