2
0
Эх сурвалжийг харах

Removed Abs and Sgn keywords.

woollybah 6 жил өмнө
parent
commit
9c7f93c7af
5 өөрчлөгдсөн 0 нэмэгдсэн , 163 устгасан
  1. 0 1
      config.bmx
  2. 0 37
      ctranslator.bmx
  3. 0 95
      expr.bmx
  4. 0 22
      parser.bmx
  5. 0 8
      translator.bmx

+ 0 - 1
config.bmx

@@ -301,7 +301,6 @@ Function MakeKeywords:String()
 	
 	keywords :+ "import brl.classes~n"
 	keywords :+ "Asc%(v$)=~qbrl_blitz_keywords_asc~q~n"
-	keywords :+ "Sgn#(v#)=~qbrl_blitz_keywords_sgn~q~n"
 	keywords :+ "Chr$(v%)=~qbrl_blitz_keywords_chr~q~n"
 	keywords :+ "Len%(v:Object)=~qbrl_blitz_keywords_len~q~n"
 	keywords :+ "IncbinPtr@*(v$)=~qbbIncbinPtr~q~n"

+ 0 - 37
ctranslator.bmx

@@ -1391,43 +1391,6 @@ t:+"NULLNULLNULL"
 		Return "bbStringFromChar" + Bra(expr.expr.Trans())
 	End Method
 
-	Method TransSgnExpr:String(expr:TSgnExpr)
-		Local s:String
-		If TFloatType(expr.expr.exprType) Or TDoubleType(expr.expr.exprType)
-			'decl.ident contains "sgn", same like "bbFloatSng"
-			s = "bbFloatSgn"
-		Else If TLongType(expr.expr.exprType) Then
-			s = "bbLongSgn"
-		Else If TSizeTType(expr.expr.exprType) Then
-			s = "bbSizetSgn"
-		Else If TUIntType(expr.expr.exprType) Then
-			s = "bbUIntSgn"
-		Else If TULongType(expr.expr.exprType) Then
-			s = "bbULongSgn"
-		Else
-			s = "bbIntSgn"
-		End If
-		Return s + Bra(expr.expr.Trans())
-	End Method
-
-	Method TransAbsExpr:String(expr:TAbsExpr)
-		Local s:String
-		If TDecimalType(expr.exprType) Then
-			s = "bbFloatAbs"
-		Else If TLongType(expr.exprType)
-			s = "bbLongAbs"
-		Else If TSizeTType(expr.exprType)
-			s = "bbSizetAbs"
-		Else If TUIntType(expr.exprType)
-			s = "bbUIntAbs"
-		Else If TULongType(expr.exprType)
-			s = "bbULongAbs"
-		Else
-			s = "bbIntAbs"
-		End If
-		Return s + Bra(expr.expr.Trans())
-	End Method
-
 	Method TransLenExpr:String(expr:TLenExpr)
 		'constant strings do not have "->length", so we use the
 		'precalculated value

+ 0 - 95
expr.bmx

@@ -2935,49 +2935,6 @@ Type TLenExpr Extends TBuiltinExpr
 
 End Type
 
-Type TAbsExpr Extends TBuiltinExpr
-
-	Method Create:TAbsExpr( expr:TExpr )
-		Self.id="abs"
-		Self.expr=expr
-		Return Self
-	End Method
-
-	Method Semant:TExpr()
-
-		If exprType Return Self
-
-		expr=expr.Semant()
-
-		If TNumericType(expr.exprType) Or TBoolType(expr.exprType) Then
-
-			If TInt128Type(expr.exprType) Err "'Abs' does not support Int128 type. Use specific intrinsic function instead."
-			If TFloat64Type(expr.exprType) Err "'Abs' does not support Float64 type. Use specific intrinsic function instead."
-			If TFloat128Type(expr.exprType) Err "'Abs' does not support Float128 type. Use specific intrinsic function instead."
-			If TDouble128Type(expr.exprType) Err "'Abs' does not support Double128 type. Use specific intrinsic function instead."
-
-			If TIntType(expr.exprType) Or TByteType(expr.exprType) Or TShortType(expr.exprType) Then
-				exprType=New TIntType
-			Else
-				exprType=expr.exprType
-			End If
-		Else
-			Err "Subexpression for 'Abs' must be of numeric type"
-		End If
-
-		Return Self
-	End Method
-
-	Method Copy:TExpr()
-		Return New TAbsExpr.Create( CopyExpr(expr) )
-	End Method
-
-	Method ToString$()
-		Return "TAbsExpr("+expr.ToString()+")"
-	End Method
-
-End Type
-
 Type TAscExpr Extends TBuiltinExpr
 
 	Method Create:TAscExpr( expr:TExpr )
@@ -3011,58 +2968,6 @@ Type TAscExpr Extends TBuiltinExpr
 
 End Type
 
-Type TSgnExpr Extends TBuiltinExpr
-
-	Method Create:TSgnExpr( expr:TExpr )
-		Self.id="sgn"
-		Self.expr=expr
-		Return Self
-	End Method
-
-	Method Semant:TExpr()
-		If exprType Return Self
-
-		If TConstExpr(expr) Then
-			'use different calls to only return a "float sgn"
-			'when param is a float
-			Local val:String = TConstExpr(expr).value
-			Local cexpr:TExpr
-			If String(Int(val)) = val
-				cexpr = New TConstExpr.Create(New TIntType, Sgn(Int(TConstExpr(expr).value)))
-			Else
-				cexpr = New TConstExpr.Create(New TFloatType, Sgn(Float(TConstExpr(expr).value)))
-			End If
-			
-			_appInstance.removeStringConst(TConstExpr(expr).value)
-			cexpr.Semant()
-			Return cexpr
-		End If
-		
-		expr = expr.Semant()
-		
-		If Not TNumericType(expr.exprType) Then
-			Err "Subexpression for 'Sgn' must be of numeric type"
-		End If
-
-		If TInt128Type(expr.exprType) Err "'Sgn' does not support Int128 type. Use specific intrinsic function instead."
-		If TFloat64Type(expr.exprType) Err "'Sgn' does not support Float64 type. Use specific intrinsic function instead."
-		If TFloat128Type(expr.exprType) Err "'Sgn' does not support Float128 type. Use specific intrinsic function instead."
-		If TDouble128Type(expr.exprType) Err "'Sgn' does not support Double128 type. Use specific intrinsic function instead."
-		
-		exprType=expr.exprType
-		Return Self
-	End Method
-
-	Method Copy:TExpr()
-		Return New TSgnExpr.Create( CopyExpr(expr) )
-	End Method
-
-	Method ToString$()
-		Return "TSgnExpr("+expr.ToString()+")"
-	End Method
-
-End Type
-
 Type TSizeOfExpr Extends TBuiltinExpr
 
 	Method Create:TSizeOfExpr( expr:TExpr )

+ 0 - 22
parser.bmx

@@ -1270,17 +1270,6 @@ Type TParser Extends TGenProcessor
 				expr=ParseExpr()
 				expr=New TLenExpr.Create( expr )
 			EndIf
-		Case "abs"
-			NextToke
-			' optional brackets
-			If CParse( "(" )
-				expr=ParseExpr()
-				Parse ")"
-				expr=New TAbsExpr.Create( expr )
-			Else
-				expr=ParseExpr()
-				expr=New TAbsExpr.Create( expr )
-			EndIf
 		Case "asc"
 			NextToke
 
@@ -1319,17 +1308,6 @@ Type TParser Extends TGenProcessor
 				expr=ParseExpr()
 				expr=New TChrExpr.Create( expr )
 			EndIf
-		Case "sgn"
-			NextToke
-			' optional brackets
-			If CParse( "(" )
-				expr=ParseExpr()
-				Parse ")"
-				expr=New TSgnExpr.Create( expr )
-			Else
-				expr=ParseExpr()
-				expr=New TSgnExpr.Create( expr )
-			EndIf
 		Case "varptr"
 			NextToke
 			expr=ParseExpr()

+ 0 - 8
translator.bmx

@@ -1312,27 +1312,19 @@ End Rem
 	End Method
 
 	Method TransBuiltinExpr$( expr:TBuiltinExpr )
-		If TAbsExpr(expr) Return TransAbsExpr(TAbsExpr(expr))
 		If TAscExpr(expr) Return TransAscExpr(TAscExpr(expr))
 		If TChrExpr(expr) Return TransChrExpr(TChrExpr(expr))
-		If TSgnExpr(expr) Return TransSgnExpr(TSgnExpr(expr))
 		If TLenExpr(expr) Return TransLenExpr(TLenExpr(expr))
 		If TSizeOfExpr(expr) Return TransSizeOfExpr(TSizeOfExpr(expr))
 		Err "TODO : TransBuiltinExpr()"
 	End Method
 	
-	Method TransAbsExpr:String(expr:TAbsExpr)
-	End Method
-
 	Method TransAscExpr:String(expr:TAscExpr)
 	End Method
 
 	Method TransChrExpr:String(expr:TChrExpr)
 	End Method
 
-	Method TransSgnExpr:String(expr:TSgnExpr)
-	End Method
-
 	Method TransLenExpr:String(expr:TLenExpr)
 	End Method