mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-02-08 14:50:05 +01:00
Fix scope parsing of the converter plugin, and make printing parsed data better.
This commit is contained in:
parent
d803ecf2cd
commit
aaf2ca9c2e
@ -51,24 +51,25 @@ class GDSScope:
|
|||||||
scope_lines.append(cl)
|
scope_lines.append(cl)
|
||||||
current_index += 1
|
current_index += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
var curr_line_indent : int = get_indent_count(cl)
|
var curr_line_indent : int = get_indent_count(cl)
|
||||||
|
var clstripped : String = cl.strip_edges(true, false)
|
||||||
|
|
||||||
if curr_line_indent < current_indent:
|
if curr_line_indent < current_indent:
|
||||||
return current_index
|
return current_index
|
||||||
|
|
||||||
if cl.ends_with(":"):
|
if cl.ends_with(":"):
|
||||||
var scope : GDSScope = GDSScope.new()
|
var scope : GDSScope = GDSScope.new()
|
||||||
scope.parse_scope_data(cl)
|
scope.parse_scope_data(clstripped)
|
||||||
current_index += 1
|
current_index += 1
|
||||||
current_index = scope.parse(contents, current_index, curr_line_indent)
|
current_index = scope.parse(contents, current_index, curr_line_indent + 1)
|
||||||
subscopes.append(scope)
|
subscopes.append(scope)
|
||||||
|
|
||||||
#don't
|
#don't
|
||||||
#current_index += 1
|
#current_index += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
scope_lines.append(cl)
|
scope_lines.append(clstripped)
|
||||||
current_index += 1
|
current_index += 1
|
||||||
|
|
||||||
return current_index
|
return current_index
|
||||||
@ -88,23 +89,32 @@ class GDSScope:
|
|||||||
break
|
break
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
func convert_to_string(current_scope_level : int = 0) -> String:
|
||||||
|
var indents : String = ""
|
||||||
|
|
||||||
func _to_string():
|
for i in range(current_scope_level):
|
||||||
var s : String = "---GDSScope---\n"
|
indents += " "
|
||||||
|
|
||||||
|
var s : String = indents + "---GDSScope---\n"
|
||||||
|
|
||||||
|
s += indents + raw_scope_data + "\n"
|
||||||
|
|
||||||
s += raw_scope_data + "\n"
|
indents += " "
|
||||||
|
|
||||||
for l in scope_lines:
|
for l in scope_lines:
|
||||||
s += l + "\n"
|
s += indents + l + "\n"
|
||||||
|
|
||||||
for subs in subscopes:
|
for subs in subscopes:
|
||||||
s += "\n"
|
s += "\n"
|
||||||
s += str(subs)
|
s += subs.convert_to_string(current_scope_level + 1)
|
||||||
s += "\n"
|
|
||||||
|
|
||||||
s += "\n"
|
s += "\n"
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
func _to_string():
|
||||||
|
return convert_to_string()
|
||||||
|
|
||||||
class GDSParser:
|
class GDSParser:
|
||||||
var root : GDSScope
|
var root : GDSScope
|
||||||
|
Loading…
Reference in New Issue
Block a user