diff options
author | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2019-10-13 22:48:18 +0300 |
---|---|---|
committer | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2019-10-25 14:54:57 +0300 |
commit | afbde3314aee106c835249b2f56c14d68f782899 (patch) | |
tree | 1e728dffda67be2c39fe57880e16c7bc0899d72e /modules/gdscript/gdscript_parser.h | |
parent | d0628180aef4987d24f91329e4c3378b5a037a34 (diff) | |
download | redot-engine-afbde3314aee106c835249b2f56c14d68f782899.tar.gz |
Allow mixed tabs and spaces when indentation does not depend on tab size
(hopefully) Closes #30937, fixes #32612
Diffstat (limited to 'modules/gdscript/gdscript_parser.h')
-rw-r--r-- | modules/gdscript/gdscript_parser.h | 22 |
1 files changed, 21 insertions, 1 deletions
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<int> 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<IndentLevel> indent_level; String base_path; String self_path; |