AOS json tokenizer allows C++ style comments
More options for developers.
Change-Id: I8267b5d0b78c3614d2f9af259c370e828d0433c9
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/json_tokenizer.cc b/aos/json_tokenizer.cc
index b3c6620..eab7fcc 100644
--- a/aos/json_tokenizer.cc
+++ b/aos/json_tokenizer.cc
@@ -23,6 +23,19 @@
}
ConsumeChar();
}
+ } else if (Consume("//")) {
+ // C++ style comment. Keep consuming chars until newline, or until the
+ // end of the file if this is the last line (no newline at end of file).
+ while (true) {
+ ConsumeChar();
+ if (AtEnd()) {
+ return;
+ }
+ if (Char() == '\n') {
+ ++linenumber_;
+ break;
+ }
+ }
} else {
// There is no fail. Once we are out of whitespace (including 0 of it),
// declare success.