From afbde3314aee106c835249b2f56c14d68f782899 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Sun, 13 Oct 2019 22:48:18 +0300 Subject: Allow mixed tabs and spaces when indentation does not depend on tab size (hopefully) Closes #30937, fixes #32612 --- modules/gdscript/gdscript_parser.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'modules/gdscript/gdscript_parser.h') diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 04ce9cf4c6..93557d745d 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -552,7 +552,27 @@ private: int pending_newline; - List tab_level; + struct IndentLevel { + int indent; + int tabs; + + bool is_mixed(IndentLevel other) { + return ( + (indent == other.indent && tabs != other.tabs) || + (indent > other.indent && tabs < other.tabs) || + (indent < other.indent && tabs > other.tabs)); + } + + IndentLevel() : + indent(0), + tabs(0) {} + + IndentLevel(int p_indent, int p_tabs) : + indent(p_indent), + tabs(p_tabs) {} + }; + + List indent_level; String base_path; String self_path; -- cgit v1.2.3