diff --git a/src/main/java/com/moandjiezana/toml/DateConverter.java b/src/main/java/com/moandjiezana/toml/DateConverter.java index d838824..c45d947 100644 --- a/src/main/java/com/moandjiezana/toml/DateConverter.java +++ b/src/main/java/com/moandjiezana/toml/DateConverter.java @@ -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")); - } } diff --git a/src/main/java/com/moandjiezana/toml/MultilineLiteralStringConverter.java b/src/main/java/com/moandjiezana/toml/MultilineLiteralStringConverter.java index fb7823e..f198eef 100644 --- a/src/main/java/com/moandjiezana/toml/MultilineLiteralStringConverter.java +++ b/src/main/java/com/moandjiezana/toml/MultilineLiteralStringConverter.java @@ -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> parsingResult = new RecoveringParseRunner>(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 diff --git a/src/main/java/com/moandjiezana/toml/ValueParser.java b/src/main/java/com/moandjiezana/toml/ValueParser.java index 8ab4017..f6fdebf 100644 --- a/src/main/java/com/moandjiezana/toml/ValueParser.java +++ b/src/main/java/com/moandjiezana/toml/ValueParser.java @@ -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> { - public static void main(String[] args) { - ParsingResult parsingResult = new RecoveringParseRunner(ValueConverterUtils.parser().T()).run("'''abc''' # comment"); - - System.out.println(ParseTreeUtils.printNodeTree(parsingResult)); - } - public Rule T() { return Sequence("'''", OneOrMore(TestNot("'''"), ANY), "'''", Comment()); } diff --git a/src/test/java/com/moandjiezana/toml/NumberTest.java b/src/test/java/com/moandjiezana/toml/NumberTest.java index 1d0308a..16b2009 100644 --- a/src/test/java/com/moandjiezana/toml/NumberTest.java +++ b/src/test/java/com/moandjiezana/toml/NumberTest.java @@ -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-");