/* ------------------------------------------------------------------------- */
/* "syntax" : Syntax analyser and compiler */
/* */
-/* Copyright (c) Graham Nelson 1993 - 2018 */
-/* */
-/* This file is part of Inform. */
+/* Part of Inform 6.35 */
+/* copyright (c) Graham Nelson 1993 - 2020 */
/* */
/* Inform is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with Inform. If not, see https://gnu.org/licenses/ */
+/* along with Inform. If not, see https://gnu.org/licenses/ *
/* */
/* ------------------------------------------------------------------------- */
This is called while parsing a long construct, such as Class or
Object, where we want to support internal #ifdefs. (Although
- function-parsing predates this and doesn't make use of it.)
-
- (Technically this permits *any* #-directive, which means you
- can define global variables or properties or what-have-you in
- the middle of an object. You can do that in the middle of an
- object, too. Don't. It's about as well-supported as Wile E.
- Coyote one beat before the plummet-lines kick in.) */
+ function-parsing predates this and doesn't make use of it.) */
int directives_save, segment_markers_save, statements_save;
TRUE if encountered with a # prefix inside a routine or object
definition.
+ (Only directives like #ifdef are permitted inside a definition.)
+
Returns: TRUE if program continues, FALSE if end of file reached. */
int routine_symbol, rep_symbol;
df_dont_note_global_symbols = TRUE;
get_next_token();
df_dont_note_global_symbols = FALSE;
- if ((token_type != SYMBOL_TT)
- || ((!(sflags[token_value] & UNKNOWN_SFLAG))
- && (!(sflags[token_value] & REPLACE_SFLAG))))
+ if (token_type != SYMBOL_TT)
{ ebf_error("routine name", token_text);
return(FALSE);
}
+ if ((!(sflags[token_value] & UNKNOWN_SFLAG))
+ && (!(sflags[token_value] & REPLACE_SFLAG)))
+ { ebf_symbol_error("routine name", token_text, typename(stypes[token_value]), slines[token_value]);
+ return(FALSE);
+ }
routine_symbol = token_value;
{ do
{ begin_syntax_line(TRUE);
get_next_token();
+
+ if ((token_type == SEP_TT) && (token_value == HASH_SEP))
+ { parse_directive(TRUE);
+ continue;
+ }
if (token_type == SEP_TT && token_value == CLOSE_BRACE_SEP)
{ if (switch_clause_made && (!default_clause_made))
assemble_label_no(switch_label);