it parses. For yacc-based parsers, this translates to setting
yydebug. */
PARSER_DEBUG = (1 << 2),
+
+ /* Normally the expression-parsing functions like parse_exp_1 will
+ attempt to find a context block if one is not passed in. If set,
+ this flag suppresses this search and uses a null context for the
+ parse. */
+ PARSER_LEAVE_BLOCK_ALONE = (1 << 3),
};
DEF_ENUM_FLAGS_TYPE (enum parser_flag, parser_flags);
if (tracker == nullptr)
tracker = &local_tracker;
- /* If no context specified, try using the current frame, if any. */
- if (!expression_context_block)
- expression_context_block = get_selected_block (&expression_context_pc);
- else if (pc == 0)
- expression_context_pc = expression_context_block->entry_pc ();
- else
- expression_context_pc = pc;
+ if ((flags & PARSER_LEAVE_BLOCK_ALONE) == 0)
+ {
+ /* If no context specified, try using the current frame, if any. */
+ if (!expression_context_block)
+ expression_context_block
+ = get_selected_block (&expression_context_pc);
+ else if (pc == 0)
+ expression_context_pc = expression_context_block->entry_pc ();
+ else
+ expression_context_pc = pc;
- /* Fall back to using the current source static context, if any. */
+ /* Fall back to using the current source static context, if any. */
- if (!expression_context_block)
- {
- struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ if (!expression_context_block)
+ {
+ struct symtab_and_line cursal
+ = get_current_source_symtab_and_line ();
- if (cursal.symtab)
- expression_context_block
- = cursal.symtab->compunit ()->blockvector ()->static_block ();
+ if (cursal.symtab)
+ expression_context_block
+ = cursal.symtab->compunit ()->blockvector ()->static_block ();
- if (expression_context_block)
- expression_context_pc = expression_context_block->entry_pc ();
+ if (expression_context_block)
+ expression_context_pc = expression_context_block->entry_pc ();
+ }
}
if (language_mode == language_mode_auto && block != NULL)