* is only a comment character if first character.

This commit is contained in:
Kelvin Sherlock 2019-12-16 23:12:53 -05:00
parent 4688dbc5c3
commit 7b059c424b
1 changed files with 7 additions and 10 deletions

View File

@ -13,11 +13,8 @@
#include <stdexcept> #include <stdexcept>
#include <cctype> #include <cctype>
#include <cstdio>
#include <cstdint> #include <cstdint>
#include <err.h>
#include "script.h" #include "script.h"
@ -145,7 +142,7 @@ uint32_t number_operand(const char *YYCURSOR, const std::unordered_map<std::stri
// const char *YYMARKER = nullptr; // const char *YYMARKER = nullptr;
/*!re2c /*!re2c
* { throw std::invalid_argument("bad operand"); } * { throw std::invalid_argument("bad operand"); }
[;*] | eof { [;] | eof {
if (flags & OP_REQUIRED) if (flags & OP_REQUIRED)
throw std::invalid_argument("missing operand"); throw std::invalid_argument("missing operand");
return 0; return 0;
@ -171,7 +168,7 @@ int ovr_operand(const char *YYCURSOR) {
/*!re2c /*!re2c
* { throw std::invalid_argument("bad operand"); } * { throw std::invalid_argument("bad operand"); }
[;*] | eof { [;] | eof {
return OVR_NONE; return OVR_NONE;
} }
'ALL' { 'ALL' {
@ -193,7 +190,7 @@ std::string label_operand(const char *YYCURSOR, int flags) {
// const char *YYMARKER = nullptr; // const char *YYMARKER = nullptr;
/*!re2c /*!re2c
* { throw std::invalid_argument("bad operand"); } * { throw std::invalid_argument("bad operand"); }
[;*] | eof { [;] | eof {
if (flags & OP_REQUIRED) if (flags & OP_REQUIRED)
throw std::invalid_argument("missing operand"); throw std::invalid_argument("missing operand");
return std::string(); return std::string();
@ -212,7 +209,7 @@ std::string path_operand(const char *YYCURSOR, int flags) {
/*!re2c /*!re2c
* { throw std::invalid_argument("bad operand"); } * { throw std::invalid_argument("bad operand"); }
[;*] | eof { [;] | eof {
if (flags & OP_REQUIRED) if (flags & OP_REQUIRED)
throw std::invalid_argument("missing operand"); throw std::invalid_argument("missing operand");
return rv; return rv;
@ -242,7 +239,7 @@ std::string string_operand(const char *YYCURSOR, int flags) {
/*!re2c /*!re2c
* { throw std::invalid_argument("bad operand"); } * { throw std::invalid_argument("bad operand"); }
[;*] | eof { [;] | eof {
if (flags & OP_REQUIRED) if (flags & OP_REQUIRED)
throw std::invalid_argument("missing operand"); throw std::invalid_argument("missing operand");
return std::string(); return std::string();
@ -259,7 +256,7 @@ std::string string_operand(const char *YYCURSOR, int flags) {
void no_operand(const char *YYCURSOR) { void no_operand(const char *YYCURSOR) {
/*!re2c /*!re2c
* { throw std::invalid_argument("bad operand"); } * { throw std::invalid_argument("bad operand"); }
[;*] | eof { return; } [;] | eof { return; }
*/ */
} }
@ -295,7 +292,7 @@ opcode:
/*!re2c /*!re2c
* { throw std::invalid_argument("bad opcode"); } * { throw std::invalid_argument("bad opcode"); }
[;*]|eof { return; } [;]|eof { return; }
'=' / (ws|eof) { opcode = OP_EQ; goto operand; } '=' / (ws|eof) { opcode = OP_EQ; goto operand; }