File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ class SourceFile {
61
61
return fileInput == null || fileInput .eof ();
62
62
63
63
64
+ function extractCondition (line : String , startToken : String ) {
65
+ var condition = line .substringAfter (startToken );
66
+ if (condition .contains (" #else" )) condition = condition .substringBefore (" #else" );
67
+ if (condition .contains (" /*" )) condition = condition .substringBefore (" /*" );
68
+ if (condition .contains (" //" )) condition = condition .substringBefore (" //" );
69
+ return condition .trim ();
70
+ }
71
+
72
+
64
73
public function nextLine (): Bool {
65
74
while (! isLastLine ()) {
66
75
var line : String ;
@@ -81,17 +90,17 @@ class SourceFile {
81
90
}
82
91
83
92
if (lineTrimmed .startsWith (" #if " )) {
84
- currentLine = CompilerConditionStart (lineTrimmed . substringAfter ( " #if " ). trim ( ));
93
+ currentLine = CompilerConditionStart (extractCondition ( lineTrimmed , " #if " ));
85
94
return true ;
86
95
}
87
96
88
97
if (lineTrimmed .startsWith (" #elseif " )) {
89
- currentLine = CompilerConditionElseIf (lineTrimmed . substringAfter ( " #elseif " ). trim ( ));
98
+ currentLine = CompilerConditionElseIf (extractCondition ( lineTrimmed , " #elseif " ));
90
99
return true ;
91
100
}
92
101
93
102
if (lineTrimmed .startsWith (" #else if " )) {
94
- currentLine = CompilerConditionElseIf (lineTrimmed . substringAfter ( " #else if " ). trim ( ));
103
+ currentLine = CompilerConditionElseIf (extractCondition ( lineTrimmed , " #else if " ));
95
104
return true ;
96
105
}
97
106
You can’t perform that action at this time.
0 commit comments