Fix issue 610: handle correctly end_record and end_unordered_list tokens in adm format.
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
index b8c8659..7e51ae6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
@@ -635,11 +635,16 @@
boolean first = true;
do {
token = nextToken();
- if (token == AdmLexer.TOKEN_END_UNORDERED_LIST) {
- if (expectingListItem) {
- throw new AsterixException("Found END_COLLECTION while expecting a list item.");
+ if (token == AdmLexer.TOKEN_END_RECORD) {
+ if (nextToken() == AdmLexer.TOKEN_END_RECORD) {
+ if (expectingListItem) {
+ throw new AsterixException("Found END_COLLECTION while expecting a list item.");
+ } else {
+ inList = false;
+ }
+ } else {
+ throw new AsterixException("Found END_RECORD while expecting a list item.");
}
- inList = false;
} else if (token == AdmLexer.TOKEN_COMMA) {
if (first) {
throw new AsterixException("Found COMMA before any list item.");
diff --git a/asterix-runtime/src/main/resources/adm.grammar b/asterix-runtime/src/main/resources/adm.grammar
index 80e2cd4..06614d0 100644
--- a/asterix-runtime/src/main/resources/adm.grammar
+++ b/asterix-runtime/src/main/resources/adm.grammar
@@ -45,7 +45,7 @@
START_ORDERED_LIST = char([)
END_ORDERED_LIST = char(])
START_UNORDERED_LIST = string({{)
-END_UNORDERED_LIST = string(}})
+# END_UNORDERED_LIST = }} is recognized as a double END_RECORD token
STRING_LITERAL = char("), anythingUntil(")