11 #ifndef AISC_LOCATION_H
70 str(nulldup(other.str)),
72 command(other.command),
108 const char *last_line_start;
114 void get_byte(
const char *& io) {
116 if (
is_LF(lastchar)) {
117 last_line_start = io;
122 const char *currentLocation(
const char *io);
124 void p_err(
const char *io,
const char *
error);
127 void p_err_empty_braces(
const char *io) { p_err(io,
"{} found, missing contents"); }
128 void p_err_exp_line_terminator(
const char *io) { p_err(io,
"missing ',' or ';' or 'newline'"); }
129 void p_err_ill_atWord(
const char *io) { p_err(io,
"only header definitions may start with '@'"); }
130 void p_err_exp_atWord(
const char *io) { p_err(io,
"all words in header-definitions have to start with '@'"); }
132 void p_err_expected(
const char *io,
const char *expect) { p_errf(io,
"Expected to see %s", expect); }
133 void p_err_exp_but_saw(
const char *io,
const char *expect,
const char *saw) { p_errf(io,
"Expected to see %s, but saw %s", expect, saw); }
135 void p_err_exp_string_but_saw(
const char *io,
const char *saw) { p_err_exp_but_saw(io,
"string", saw); }
136 void p_err_exp_but_saw_EOF(
const char *io,
const char *expect) { p_err_exp_but_saw(io, expect,
"end of file"); }
138 inline void expect_line_terminator(
const char *in) {
142 void expect_and_skip_closing_brace(
const char *& in,
const char *openingBraceLocation) {
143 if (lastchar !=
'}') {
144 p_err_expected(in,
"'}'");
145 fprintf(stderr,
"%s: opening brace was here\n", openingBraceLocation);
149 void expect_and_skip(
const char *& in,
char expect) {
150 if (lastchar != expect) {
153 p_err_expected(in, buf);
158 void skip_over_spaces(
const char *& in) {
while (
is_SPACE(lastchar)) get_byte(in); }
159 void skip_over_spaces_and_comments(
const char *& in) {
160 skip_over_spaces(in);
161 if (lastchar ==
'#') {
162 while (!
is_LF_EOS(lastchar)) get_byte(in);
165 void skip_over_spaces_and_comments_multiple_lines(
const char *& in) {
167 skip_over_spaces_and_comments(in);
168 if (!
is_LF(lastchar))
break;
173 void copyWordTo(
const char*& in,
char*& out) {
180 void copyTillQuotesTo(
const char*& in,
char*& out);
181 char *readWord(
const char *& in);
183 char *SETSOURCE(
const char *& in,
enum TOKEN& foundTokenType);
184 char *parse_token(
const char *& in,
enum TOKEN& foundTokenType);
186 Token *parseBrace(
const char *& in,
const char *key);
192 last_line_start =
NULp;
209 last_line_start = start-offset_in_line;
219 #error aisc_parser.h included twice
220 #endif // AISC_PARSER_H
void set_source(const char *path, int linenumber)
const char * get_path() const
int get_sourceline() const
CONSTEXPR_INLINE bool is_LF(char c)
void set_command(CommandType command_, const char *args)
DECLARE_ASSIGNMENT_OPERATOR(Code)
CONSTEXPR_INLINE bool is_SEP_LF_EOS(char c)
void print_warning_internal(const char *msg, const char *launcher_file, int launcher_line) const
const Location & get_location() const
static HelixNrInfo * start
#define __ATTR__FORMAT_MEMBER(pos)
void print_error_internal(const char *err, const char *launcher_file, int launcher_line) const
static void error(const char *msg)
CONSTEXPR_INLINE bool is_SPACE_SEP_LF_EOS(char c)
class Code * parse_program(const char *in, const char *filename)
const char * get_sourcename() const
void print_warning_internal(const char *warn, const char *launcher_file, int launcher_line) const
TokenListBlock * parseTokenListBlock(const char *&in)
void set_source(const Location &other)
void set_line_start(const char *start, int offset_in_line)
CONSTEXPR_INLINE bool is_LF_EOS(char c)
CONSTEXPR_INLINE bool is_SPACE(char c)
#define aisc_assert(cond)
void print_error_internal(const char *err, const char *launcher_file, int launcher_line) const
void SKIP_SPACE_LF(const char *&var)