return 0;
}
+static inline int is_newline(int c) {
+ return c == '\n';
+}
+
+static inline void skip_comment(FILE *fh) {
+ int c;
+ while ((c = getc(fh)) != EOF)
+ if (is_newline(c))
+ return;
+}
+
int parse_input(FILE *fh, struct program *p) {
int c;
struct ast_item ai;
case '/':
ai.type = AST_ITEM_DIVIDE;
goto add_item;
+ case '#':
+ skip_comment(fh);
+ continue;
}
if (isdigit(c)) {
ai.type = AST_ITEM_INT;