8#ifndef SIMPLE_PARSER_HPP_
9#define SIMPLE_PARSER_HPP_
42 if (
match(
"&description")) {
50 if (
match(
"¶meter")) {
52 }
else if (
match(
"&column")) {
54 }
else if (
match(
"&associate")) {
56 }
else if (
match(
"&array")) {
58 }
else if (
match(
"&include")) {
60 }
else if (
match(
"&data")) {
78 if (std::isspace(
static_cast<unsigned char>(
input_[
pos_]))) {
91 bool match(
const std::string& str) {
93 if (
input_.compare(
pos_, str.length(), str) == 0) {
111 throw std::runtime_error(
"Expected: " + str);
117 throw std::runtime_error(std::string(
"Expected: ") + c);
147 if (std::isalnum(
static_cast<unsigned char>(c)) || c ==
'@' || c ==
'#'
148 || c ==
':' || c ==
'+' || c ==
'-' || c ==
'%' || c ==
'.' || c ==
'_'
149 || c ==
'$' || c ==
'&' || c ==
'/') {
173 && std::isdigit(
static_cast<unsigned char>(
input_[
pos_]))) {
177 if (numStr.empty()) {
178 throw std::runtime_error(
"Expected version number");
195 }
else if (
match(
"contents")) {
219 }
else if (
match(
"type")) {
222 if (typeStr ==
"float")
224 else if (typeStr ==
"double")
226 else if (typeStr ==
"short")
228 else if (typeStr ==
"long")
230 else if (typeStr ==
"character")
232 else if (typeStr ==
"string")
236 }
else if (
match(
"units")) {
241 }
else if (
match(
"description")) {
268 }
else if (
match(
"type")) {
271 if (typeStr ==
"float")
273 else if (typeStr ==
"double")
275 else if (typeStr ==
"short")
277 else if (typeStr ==
"long")
279 else if (typeStr ==
"character")
281 else if (typeStr ==
"string")
285 }
else if (
match(
"units")) {
290 }
else if (
match(
"description")) {
355 if (modeStr ==
"ascii")
357 else if (modeStr ==
"binary")
362 if (
match(
"no_row_counts")) {
std::string parseString()
associate parseAssociate()
bool match(const std::string &str)
SimpleParser(const std::string &input)
description parseDescription()
parameter parseParameter()
void expect(const std::string &str)
std::string parseIdentifier()
std::string parseQuotedString()
std::optional< std::string > content_m
std::optional< std::string > text_m
std::optional< std::string > name_m
std::optional< ast::datatype > type_m
std::optional< std::string > units_m
std::optional< std::string > description_m
std::optional< description > sddsDescription_m
includeList sddsIncludes_m
parameterList sddsParameters_m
associateList sddsAssociates_m
std::optional< std::string > name_m
std::optional< std::string > description_m
std::optional< std::string > units_m
std::optional< ast::datatype > type_m