浏览代码

Added support for SHORT and LONG on unsigned expressions

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7913 8c9fc860-2736-0410-a75d-ab315db34111
eth.negelef 7 年之前
父节点
当前提交
881bebbdc0
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      source/FoxSemanticChecker.Mod

+ 18 - 0
source/FoxSemanticChecker.Mod

@@ -5791,6 +5791,15 @@ TYPE
 								|64: type := Global.Integer32
 							END;
 						END;
+					ELSIF IsUnsignedIntegerType(type) THEN
+						IF (type.sizeInBits = 8) OR (type = Global.Unsigned8) THEN Error(parameter0.position,"short not applicable")
+						ELSE
+							CASE type.sizeInBits OF
+								16: type := Global.Unsigned8
+								|32: type := Global.Unsigned16
+								|64: type := Global.Unsigned32
+							END;
+						END;
 					ELSIF type IS SyntaxTree.FloatType THEN
 						IF (type.sizeInBits = 32) OR (type = system.realType) THEN Error(parameter0.position,"short not applicable")
 						ELSIF type = system.longrealType THEN type := system.realType
@@ -5825,6 +5834,15 @@ TYPE
 							|32: type := Global.Integer64
 							END;
 						END;
+					ELSIF IsUnsignedIntegerType(type) THEN
+						IF (type.sizeInBits = 64) OR (type = Global.Unsigned64) THEN Error(parameter0.position,"long not applicable")
+						ELSE
+							CASE type.sizeInBits OF
+							8: type := Global.Unsigned16
+							|16: type := Global.Unsigned32
+							|32: type := Global.Unsigned64
+							END;
+						END;
 					ELSIF type IS SyntaxTree.FloatType THEN
 						IF (type.sizeInBits = 64) OR (type = system.longrealType) THEN Error(parameter0.position,"long not applicable")
 						ELSIF type= system.realType THEN  type := system.longrealType