Skip to content

Commit 96fb4a4

Browse files
committed
✨ support for case insensitive variable usage
1 parent 691ccfd commit 96fb4a4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

PascalInterpreter/PascalInterpreter/FatalError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import Foundation
1111
/**
1212
Taken from https://medium.com/@marcosantadev/how-to-test-fatalerror-in-swift-e1be9ff11a29
1313
*/
14-
/*func fatalError(_ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) -> Never {
14+
func fatalError(_ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) -> Never {
1515
FatalErrorUtil.fatalErrorClosure(message(), file, line)
16-
}*/
16+
}
1717

1818
struct FatalErrorUtil {
1919

PascalInterpreter/PascalInterpreter/Semantic analyzer/SymbolTable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public class ScopedSymbolTable {
2626
}
2727

2828
func insert(_ symbol: Symbol) {
29-
symbols[symbol.name] = symbol
29+
symbols[symbol.name.lowercased()] = symbol
3030
}
3131

3232
func lookup(_ name: String, currentScopeOnly: Bool = false) -> Symbol? {
33-
if let symbol = symbols[name] {
33+
if let symbol = symbols[name.lowercased()] {
3434
return symbol
3535
}
3636

PascalInterpreter/PascalInterpreterTests/SemanticAnalyzerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class SemanticAnalyzerTests: XCTestCase {
333333
function Alpha(a : integer): Integer;
334334
var y : integer;
335335
begin
336-
Alpha := a + x;
336+
Alpha := a + X;
337337
end;
338338
339339
begin { Main }

0 commit comments

Comments
 (0)