560 classstack[index][0]._addattribute(attr) |
565 classstack[index][0]._addattribute(attr) |
561 break |
566 break |
562 else: |
567 else: |
563 index -= 1 |
568 index -= 1 |
564 |
569 |
|
570 elif m.start("Main") >= 0: |
|
571 # 'main' part of the script, reset class stack |
|
572 lineno = lineno + src.count('\n', last_lineno_pos, start) |
|
573 last_lineno_pos = start |
|
574 classstack = [] |
|
575 |
565 elif m.start("Variable") >= 0: |
576 elif m.start("Variable") >= 0: |
566 thisindent = _indent(m.group("VariableIndent")) |
577 thisindent = _indent(m.group("VariableIndent")) |
567 variable_name = m.group("VariableName") |
578 variable_name = m.group("VariableName") |
568 lineno = lineno + src.count('\n', last_lineno_pos, start) |
579 lineno = lineno + src.count('\n', last_lineno_pos, start) |
569 last_lineno_pos = start |
580 last_lineno_pos = start |
570 if thisindent == 0: |
581 if thisindent == 0 or not classstack: |
571 # global variable |
582 # global variable, reset class stack first |
|
583 classstack = [] |
|
584 |
572 if "@@Globals@@" not in dictionary: |
585 if "@@Globals@@" not in dictionary: |
573 dictionary["@@Globals@@"] = ClbrBaseClasses.ClbrBase( |
586 dictionary["@@Globals@@"] = ClbrBaseClasses.ClbrBase( |
574 module, "Globals", file, lineno) |
587 module, "Globals", file, lineno) |
575 dictionary["@@Globals@@"]._addglobal( |
588 dictionary["@@Globals@@"]._addglobal( |
576 Attribute(module, variable_name, file, lineno)) |
589 Attribute(module, variable_name, file, lineno)) |