mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-16 13:12:22 +00:00
Fixing uses of reserved word operator.
This commit is contained in:
@@ -114,7 +114,7 @@
|
|||||||
// Proc: get_cyborgs()
|
// Proc: get_cyborgs()
|
||||||
// Parameters: 1 (operator - mob which is operating the console.)
|
// Parameters: 1 (operator - mob which is operating the console.)
|
||||||
// Description: Returns NanoUI-friendly list of accessible cyborgs.
|
// Description: Returns NanoUI-friendly list of accessible cyborgs.
|
||||||
/obj/machinery/computer/robotics/proc/get_cyborgs(var/mob/operator)
|
/obj/machinery/computer/robotics/proc/get_cyborgs(var/mob/operator_mob)
|
||||||
var/list/robots = list()
|
var/list/robots = list()
|
||||||
|
|
||||||
for(var/mob/living/silicon/robot/R in mob_list)
|
for(var/mob/living/silicon/robot/R in mob_list)
|
||||||
@@ -146,11 +146,11 @@
|
|||||||
robot["master_ai"] = R.connected_ai ? R.connected_ai.name : "None"
|
robot["master_ai"] = R.connected_ai ? R.connected_ai.name : "None"
|
||||||
robot["hackable"] = 0
|
robot["hackable"] = 0
|
||||||
//Antag synths should be able to hack themselves and see their hacked status.
|
//Antag synths should be able to hack themselves and see their hacked status.
|
||||||
if(operator && isrobot(operator) && (operator.mind.special_role && operator.mind.original == operator) && (operator == R))
|
if(operator_mob && isrobot(operator_mob) && (operator_mob.mind.special_role && operator_mob.mind.original == operator_mob) && (operator_mob == R))
|
||||||
robot["hacked"] = R.emagged ? 1 : 0
|
robot["hacked"] = R.emagged ? 1 : 0
|
||||||
robot["hackable"] = R.emagged? 0 : 1
|
robot["hackable"] = R.emagged? 0 : 1
|
||||||
// Antag AIs know whether linked cyborgs are hacked or not.
|
// Antag AIs know whether linked cyborgs are hacked or not.
|
||||||
if(operator && isAI(operator) && (R.connected_ai == operator) && (operator.mind.special_role && operator.mind.original == operator))
|
if(operator_mob && isAI(operator_mob) && (R.connected_ai == operator_mob) && (operator_mob.mind.special_role && operator_mob.mind.original == operator_mob))
|
||||||
robot["hacked"] = R.emagged ? 1 : 0
|
robot["hacked"] = R.emagged ? 1 : 0
|
||||||
robot["hackable"] = R.emagged? 0 : 1
|
robot["hackable"] = R.emagged? 0 : 1
|
||||||
robots.Add(list(robot))
|
robots.Add(list(robot))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ var/global/ntnrc_uid = 0
|
|||||||
/datum/ntnet_conversation/
|
/datum/ntnet_conversation/
|
||||||
var/id = null
|
var/id = null
|
||||||
var/title = "Untitled Conversation"
|
var/title = "Untitled Conversation"
|
||||||
var/datum/computer_file/program/chatclient/operator // "Administrator" of this channel. Creator starts as channel's operator,
|
var/datum/computer_file/program/chatclient/operator_admin // "Administrator" of this channel. Creator starts as channel's operator,
|
||||||
var/list/messages = list()
|
var/list/messages = list()
|
||||||
var/list/clients = list()
|
var/list/clients = list()
|
||||||
var/password
|
var/password
|
||||||
@@ -35,7 +35,7 @@ var/global/ntnrc_uid = 0
|
|||||||
clients.Add(C)
|
clients.Add(C)
|
||||||
add_status_message("[C.username] has joined the channel.")
|
add_status_message("[C.username] has joined the channel.")
|
||||||
// No operator, so we assume the channel was empty. Assign this user as operator.
|
// No operator, so we assume the channel was empty. Assign this user as operator.
|
||||||
if(!operator)
|
if(!operator_admin)
|
||||||
changeop(C)
|
changeop(C)
|
||||||
|
|
||||||
/datum/ntnet_conversation/proc/remove_client(var/datum/computer_file/program/chatclient/C)
|
/datum/ntnet_conversation/proc/remove_client(var/datum/computer_file/program/chatclient/C)
|
||||||
@@ -45,8 +45,8 @@ var/global/ntnrc_uid = 0
|
|||||||
add_status_message("[C.username] has left the channel.")
|
add_status_message("[C.username] has left the channel.")
|
||||||
|
|
||||||
// Channel operator left, pick new operator
|
// Channel operator left, pick new operator
|
||||||
if(C == operator)
|
if(C == operator_admin)
|
||||||
operator = null
|
operator_admin = null
|
||||||
if(clients.len)
|
if(clients.len)
|
||||||
var/datum/computer_file/program/chatclient/newop = pick(clients)
|
var/datum/computer_file/program/chatclient/newop = pick(clients)
|
||||||
changeop(newop)
|
changeop(newop)
|
||||||
@@ -54,11 +54,11 @@ var/global/ntnrc_uid = 0
|
|||||||
|
|
||||||
/datum/ntnet_conversation/proc/changeop(var/datum/computer_file/program/chatclient/newop)
|
/datum/ntnet_conversation/proc/changeop(var/datum/computer_file/program/chatclient/newop)
|
||||||
if(istype(newop))
|
if(istype(newop))
|
||||||
operator = newop
|
operator_admin = newop
|
||||||
add_status_message("Channel operator status transferred to [newop.username].")
|
add_status_message("Channel operator status transferred to [newop.username].")
|
||||||
|
|
||||||
/datum/ntnet_conversation/proc/change_title(var/newtitle, var/datum/computer_file/program/chatclient/client)
|
/datum/ntnet_conversation/proc/change_title(var/newtitle, var/datum/computer_file/program/chatclient/client)
|
||||||
if(operator != client)
|
if(operator_admin != client)
|
||||||
return 0 // Not Authorised
|
return 0 // Not Authorised
|
||||||
|
|
||||||
add_status_message("[client.username] has changed channel title from [title] to [newtitle]")
|
add_status_message("[client.username] has changed channel title from [title] to [newtitle]")
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
var/datum/ntnet_conversation/channel = ntnet_global.get_chat_channel_by_id(active_channel)
|
var/datum/ntnet_conversation/channel = ntnet_global.get_chat_channel_by_id(active_channel)
|
||||||
var/authed = FALSE
|
var/authed = FALSE
|
||||||
if(channel && ((channel.operator == src) || netadmin_mode))
|
if(channel && ((channel.operator_admin == src) || netadmin_mode))
|
||||||
authed = TRUE
|
authed = TRUE
|
||||||
switch(action)
|
switch(action)
|
||||||
if("PRG_speak")
|
if("PRG_speak")
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
return
|
return
|
||||||
var/datum/ntnet_conversation/C = new /datum/ntnet_conversation()
|
var/datum/ntnet_conversation/C = new /datum/ntnet_conversation()
|
||||||
C.add_client(src)
|
C.add_client(src)
|
||||||
C.operator = src
|
C.operator_admin = src
|
||||||
C.title = channel_title
|
C.title = channel_title
|
||||||
active_channel = C.id
|
active_channel = C.id
|
||||||
return TRUE
|
return TRUE
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
"msg" = M
|
"msg" = M
|
||||||
)))
|
)))
|
||||||
data["messages"] = messages
|
data["messages"] = messages
|
||||||
data["is_operator"] = (channel.operator == src) || netadmin_mode
|
data["is_operator"] = (channel.operator_admin == src) || netadmin_mode
|
||||||
else
|
else
|
||||||
data["clients"] = list()
|
data["clients"] = list()
|
||||||
data["messages"] = list()
|
data["messages"] = list()
|
||||||
|
|||||||
@@ -63,16 +63,16 @@ var/global/const/OOP_GROUP = OOP_UNARY + 1 //()
|
|||||||
Class: operator
|
Class: operator
|
||||||
See <Binary Operators> and <Unary Operators> for subtypes.
|
See <Binary Operators> and <Unary Operators> for subtypes.
|
||||||
*/
|
*/
|
||||||
/node/expression/operator
|
/node/expression/operator_node
|
||||||
var/node/expression/exp
|
var/node/expression/exp
|
||||||
var/tmp/name
|
var/tmp/name
|
||||||
var/tmp/precedence
|
var/tmp/precedence
|
||||||
|
|
||||||
/node/expression/operator/New()
|
/node/expression/operator_node/New()
|
||||||
.=..()
|
.=..()
|
||||||
if(!src.name) src.name="[src.type]"
|
if(!src.name) src.name="[src.type]"
|
||||||
|
|
||||||
/node/expression/operator/ToString()
|
/node/expression/operator_node/ToString()
|
||||||
return "operator: [name]"
|
return "operator: [name]"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
Class: binary
|
Class: binary
|
||||||
Represents a binary operator in the AST. A binary operator takes two operands (ie x and y) and returns a value.
|
Represents a binary operator in the AST. A binary operator takes two operands (ie x and y) and returns a value.
|
||||||
*/
|
*/
|
||||||
/node/expression/operator/binary
|
/node/expression/operator_node/binary
|
||||||
var/node/expression/exp2
|
var/node/expression/exp2
|
||||||
|
|
||||||
////////// Comparison Operators //////////
|
////////// Comparison Operators //////////
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
Returns true if x = y.
|
Returns true if x = y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Equal
|
/node/expression/operator_node/binary/Equal
|
||||||
precedence=OOP_EQUAL
|
precedence=OOP_EQUAL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
Returns true if x and y aren't equal.
|
Returns true if x and y aren't equal.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/NotEqual
|
/node/expression/operator_node/binary/NotEqual
|
||||||
precedence=OOP_EQUAL
|
precedence=OOP_EQUAL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
Returns true if x > y.
|
Returns true if x > y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Greater
|
/node/expression/operator_node/binary/Greater
|
||||||
precedence=OOP_COMPARE
|
precedence=OOP_COMPARE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
Returns true if x < y.
|
Returns true if x < y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Less
|
/node/expression/operator_node/binary/Less
|
||||||
precedence=OOP_COMPARE
|
precedence=OOP_COMPARE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
Returns true if x >= y.
|
Returns true if x >= y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/GreaterOrEqual
|
/node/expression/operator_node/binary/GreaterOrEqual
|
||||||
precedence=OOP_COMPARE
|
precedence=OOP_COMPARE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
Returns true if x <= y.
|
Returns true if x <= y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/LessOrEqual
|
/node/expression/operator_node/binary/LessOrEqual
|
||||||
precedence=OOP_COMPARE
|
precedence=OOP_COMPARE
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
Returns true if x and y are true.
|
Returns true if x and y are true.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/LogicalAnd
|
/node/expression/operator_node/binary/LogicalAnd
|
||||||
precedence=OOP_AND
|
precedence=OOP_AND
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
Returns true if x, y, or both are true.
|
Returns true if x, y, or both are true.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/LogicalOr
|
/node/expression/operator_node/binary/LogicalOr
|
||||||
precedence=OOP_OR
|
precedence=OOP_OR
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
Returns true if either x or y but not both are true.
|
Returns true if either x or y but not both are true.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/LogicalXor //Not implemented in nS
|
/node/expression/operator_node/binary/LogicalXor //Not implemented in nS
|
||||||
precedence=OOP_OR
|
precedence=OOP_OR
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
011 & 110 = 010
|
011 & 110 = 010
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/BitwiseAnd
|
/node/expression/operator_node/binary/BitwiseAnd
|
||||||
precedence=OOP_BIT
|
precedence=OOP_BIT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
011 | 110 = 111
|
011 | 110 = 111
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/BitwiseOr
|
/node/expression/operator_node/binary/BitwiseOr
|
||||||
precedence=OOP_BIT
|
precedence=OOP_BIT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
011 xor 110 = 101
|
011 xor 110 = 101
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/BitwiseXor
|
/node/expression/operator_node/binary/BitwiseXor
|
||||||
precedence=OOP_BIT
|
precedence=OOP_BIT
|
||||||
|
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
Returns the sum of x and y.
|
Returns the sum of x and y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Add
|
/node/expression/operator_node/binary/Add
|
||||||
precedence=OOP_ADD
|
precedence=OOP_ADD
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
Returns the difference of x and y.
|
Returns the difference of x and y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Subtract
|
/node/expression/operator_node/binary/Subtract
|
||||||
precedence=OOP_ADD
|
precedence=OOP_ADD
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
Returns the product of x and y.
|
Returns the product of x and y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Multiply
|
/node/expression/operator_node/binary/Multiply
|
||||||
precedence=OOP_MULTIPLY
|
precedence=OOP_MULTIPLY
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
Returns the quotient of x and y.
|
Returns the quotient of x and y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Divide
|
/node/expression/operator_node/binary/Divide
|
||||||
precedence=OOP_MULTIPLY
|
precedence=OOP_MULTIPLY
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -162,7 +162,7 @@
|
|||||||
Returns x raised to the power of y.
|
Returns x raised to the power of y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Power
|
/node/expression/operator_node/binary/Power
|
||||||
precedence=OOP_POW
|
precedence=OOP_POW
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -170,5 +170,5 @@
|
|||||||
Returns the remainder of x / y.
|
Returns the remainder of x / y.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/binary/Modulo
|
/node/expression/operator_node/binary/Modulo
|
||||||
precedence=OOP_MULTIPLY
|
precedence=OOP_MULTIPLY
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Class: unary
|
Class: unary
|
||||||
Represents a unary operator in the AST. Unary operators take a single operand (referred to as x below) and return a value.
|
Represents a unary operator in the AST. Unary operators take a single operand (referred to as x below) and return a value.
|
||||||
*/
|
*/
|
||||||
/node/expression/operator/unary
|
/node/expression/operator_node/unary
|
||||||
precedence=OOP_UNARY
|
precedence=OOP_UNARY
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
!true = false and !false = true
|
!true = false and !false = true
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/unary/LogicalNot
|
/node/expression/operator_node/unary/LogicalNot
|
||||||
name="logical not"
|
name="logical not"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
~10 (decimal 2) = 01 (decimal 1).
|
~10 (decimal 2) = 01 (decimal 1).
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/unary/BitwiseNot
|
/node/expression/operator_node/unary/BitwiseNot
|
||||||
name="bitwise not"
|
name="bitwise not"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
Returns -x.
|
Returns -x.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/unary/Minus
|
/node/expression/operator_node/unary/Minus
|
||||||
name="minus"
|
name="minus"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
A special unary operator representing a value in parentheses.
|
A special unary operator representing a value in parentheses.
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
/node/expression/operator/unary/group
|
/node/expression/operator_node/unary/group
|
||||||
precedence=OOP_GROUP
|
precedence=OOP_GROUP
|
||||||
|
|
||||||
/node/expression/operator/unary/New(node/expression/exp)
|
/node/expression/operator_node/unary/New(node/expression/exp)
|
||||||
src.exp=exp
|
src.exp=exp
|
||||||
return ..()
|
return ..()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/n_Interpreter/proc/Eval(node/expression/exp)
|
/n_Interpreter/proc/Eval(node/expression/exp)
|
||||||
if(istype(exp, /node/expression/FunctionCall))
|
if(istype(exp, /node/expression/FunctionCall))
|
||||||
return RunFunction(exp)
|
return RunFunction(exp)
|
||||||
else if(istype(exp, /node/expression/operator))
|
else if(istype(exp, /node/expression/operator_node))
|
||||||
return EvalOperator(exp)
|
return EvalOperator(exp)
|
||||||
else if(istype(exp, /node/expression/value/literal))
|
else if(istype(exp, /node/expression/value/literal))
|
||||||
var/node/expression/value/literal/lit=exp
|
var/node/expression/value/literal/lit=exp
|
||||||
@@ -34,57 +34,57 @@
|
|||||||
else
|
else
|
||||||
return exp
|
return exp
|
||||||
|
|
||||||
/n_Interpreter/proc/EvalOperator(node/expression/operator/exp)
|
/n_Interpreter/proc/EvalOperator(node/expression/operator_node/exp)
|
||||||
if(istype(exp, /node/expression/operator/binary))
|
if(istype(exp, /node/expression/operator_node/binary))
|
||||||
var/node/expression/operator/binary/bin=exp
|
var/node/expression/operator_node/binary/bin=exp
|
||||||
switch(bin.type)
|
switch(bin.type)
|
||||||
if(/node/expression/operator/binary/Equal)
|
if(/node/expression/operator_node/binary/Equal)
|
||||||
return Equal(Eval(bin.exp), Eval(bin.exp2))
|
return Equal(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/NotEqual)
|
if(/node/expression/operator_node/binary/NotEqual)
|
||||||
return NotEqual(Eval(bin.exp), Eval(bin.exp2))
|
return NotEqual(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Greater)
|
if(/node/expression/operator_node/binary/Greater)
|
||||||
return Greater(Eval(bin.exp), Eval(bin.exp2))
|
return Greater(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Less)
|
if(/node/expression/operator_node/binary/Less)
|
||||||
return Less(Eval(bin.exp), Eval(bin.exp2))
|
return Less(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/GreaterOrEqual)
|
if(/node/expression/operator_node/binary/GreaterOrEqual)
|
||||||
return GreaterOrEqual(Eval(bin.exp), Eval(bin.exp2))
|
return GreaterOrEqual(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/LessOrEqual)
|
if(/node/expression/operator_node/binary/LessOrEqual)
|
||||||
return LessOrEqual(Eval(bin.exp), Eval(bin.exp2))
|
return LessOrEqual(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/LogicalAnd)
|
if(/node/expression/operator_node/binary/LogicalAnd)
|
||||||
return LogicalAnd(Eval(bin.exp), Eval(bin.exp2))
|
return LogicalAnd(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/LogicalOr)
|
if(/node/expression/operator_node/binary/LogicalOr)
|
||||||
return LogicalOr(Eval(bin.exp), Eval(bin.exp2))
|
return LogicalOr(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/LogicalXor)
|
if(/node/expression/operator_node/binary/LogicalXor)
|
||||||
return LogicalXor(Eval(bin.exp), Eval(bin.exp2))
|
return LogicalXor(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/BitwiseAnd)
|
if(/node/expression/operator_node/binary/BitwiseAnd)
|
||||||
return BitwiseAnd(Eval(bin.exp), Eval(bin.exp2))
|
return BitwiseAnd(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/BitwiseOr)
|
if(/node/expression/operator_node/binary/BitwiseOr)
|
||||||
return BitwiseOr(Eval(bin.exp), Eval(bin.exp2))
|
return BitwiseOr(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/BitwiseXor)
|
if(/node/expression/operator_node/binary/BitwiseXor)
|
||||||
return BitwiseXor(Eval(bin.exp), Eval(bin.exp2))
|
return BitwiseXor(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Add)
|
if(/node/expression/operator_node/binary/Add)
|
||||||
return Add(Eval(bin.exp), Eval(bin.exp2))
|
return Add(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Subtract)
|
if(/node/expression/operator_node/binary/Subtract)
|
||||||
return Subtract(Eval(bin.exp), Eval(bin.exp2))
|
return Subtract(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Multiply)
|
if(/node/expression/operator_node/binary/Multiply)
|
||||||
return Multiply(Eval(bin.exp), Eval(bin.exp2))
|
return Multiply(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Divide)
|
if(/node/expression/operator_node/binary/Divide)
|
||||||
return Divide(Eval(bin.exp), Eval(bin.exp2))
|
return Divide(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Power)
|
if(/node/expression/operator_node/binary/Power)
|
||||||
return Power(Eval(bin.exp), Eval(bin.exp2))
|
return Power(Eval(bin.exp), Eval(bin.exp2))
|
||||||
if(/node/expression/operator/binary/Modulo)
|
if(/node/expression/operator_node/binary/Modulo)
|
||||||
return Modulo(Eval(bin.exp), Eval(bin.exp2))
|
return Modulo(Eval(bin.exp), Eval(bin.exp2))
|
||||||
else
|
else
|
||||||
RaiseError(new/runtimeError/UnknownInstruction())
|
RaiseError(new/runtimeError/UnknownInstruction())
|
||||||
return
|
return
|
||||||
switch(exp.type)
|
switch(exp.type)
|
||||||
if(/node/expression/operator/unary/Minus)
|
if(/node/expression/operator_node/unary/Minus)
|
||||||
return Minus(Eval(exp.exp))
|
return Minus(Eval(exp.exp))
|
||||||
if(/node/expression/operator/unary/LogicalNot)
|
if(/node/expression/operator_node/unary/LogicalNot)
|
||||||
return LogicalNot(Eval(exp.exp))
|
return LogicalNot(Eval(exp.exp))
|
||||||
if(/node/expression/operator/unary/BitwiseNot)
|
if(/node/expression/operator_node/unary/BitwiseNot)
|
||||||
return BitwiseNot(Eval(exp.exp))
|
return BitwiseNot(Eval(exp.exp))
|
||||||
if(/node/expression/operator/unary/group)
|
if(/node/expression/operator_node/unary/group)
|
||||||
return Eval(exp.exp)
|
return Eval(exp.exp)
|
||||||
else
|
else
|
||||||
RaiseError(new/runtimeError/UnknownInstruction())
|
RaiseError(new/runtimeError/UnknownInstruction())
|
||||||
|
|||||||
@@ -69,29 +69,29 @@ associated values are <nS_Keyword> types of which the <n_Keyword.Parse()> proc w
|
|||||||
)
|
)
|
||||||
|
|
||||||
var/list/unary_operators =list(
|
var/list/unary_operators =list(
|
||||||
"!" = /node/expression/operator/unary/LogicalNot,
|
"!" = /node/expression/operator_node/unary/LogicalNot,
|
||||||
"~" = /node/expression/operator/unary/BitwiseNot,
|
"~" = /node/expression/operator_node/unary/BitwiseNot,
|
||||||
"-" = /node/expression/operator/unary/Minus
|
"-" = /node/expression/operator_node/unary/Minus
|
||||||
)
|
)
|
||||||
|
|
||||||
var/list/binary_operators=list(
|
var/list/binary_operators=list(
|
||||||
"==" = /node/expression/operator/binary/Equal,
|
"==" = /node/expression/operator_node/binary/Equal,
|
||||||
"!=" = /node/expression/operator/binary/NotEqual,
|
"!=" = /node/expression/operator_node/binary/NotEqual,
|
||||||
">" = /node/expression/operator/binary/Greater,
|
">" = /node/expression/operator_node/binary/Greater,
|
||||||
"<" = /node/expression/operator/binary/Less,
|
"<" = /node/expression/operator_node/binary/Less,
|
||||||
">=" = /node/expression/operator/binary/GreaterOrEqual,
|
">=" = /node/expression/operator_node/binary/GreaterOrEqual,
|
||||||
"<=" = /node/expression/operator/binary/LessOrEqual,
|
"<=" = /node/expression/operator_node/binary/LessOrEqual,
|
||||||
"&&" = /node/expression/operator/binary/LogicalAnd,
|
"&&" = /node/expression/operator_node/binary/LogicalAnd,
|
||||||
"||" = /node/expression/operator/binary/LogicalOr,
|
"||" = /node/expression/operator_node/binary/LogicalOr,
|
||||||
"&" = /node/expression/operator/binary/BitwiseAnd,
|
"&" = /node/expression/operator_node/binary/BitwiseAnd,
|
||||||
"|" = /node/expression/operator/binary/BitwiseOr,
|
"|" = /node/expression/operator_node/binary/BitwiseOr,
|
||||||
"`" = /node/expression/operator/binary/BitwiseXor,
|
"`" = /node/expression/operator_node/binary/BitwiseXor,
|
||||||
"+" = /node/expression/operator/binary/Add,
|
"+" = /node/expression/operator_node/binary/Add,
|
||||||
"-" = /node/expression/operator/binary/Subtract,
|
"-" = /node/expression/operator_node/binary/Subtract,
|
||||||
"*" = /node/expression/operator/binary/Multiply,
|
"*" = /node/expression/operator_node/binary/Multiply,
|
||||||
"/" = /node/expression/operator/binary/Divide,
|
"/" = /node/expression/operator_node/binary/Divide,
|
||||||
"^" = /node/expression/operator/binary/Power,
|
"^" = /node/expression/operator_node/binary/Power,
|
||||||
"%" = /node/expression/operator/binary/Modulo)
|
"%" = /node/expression/operator_node/binary/Modulo)
|
||||||
|
|
||||||
/n_scriptOptions/nS_Options/New()
|
/n_scriptOptions/nS_Options/New()
|
||||||
.=..()
|
.=..()
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
Proc: Precedence
|
Proc: Precedence
|
||||||
Compares two operators, decides which is higher in the order of operations, and returns <SHIFT> or <REDUCE>.
|
Compares two operators, decides which is higher in the order of operations, and returns <SHIFT> or <REDUCE>.
|
||||||
*/
|
*/
|
||||||
/n_Parser/nS_Parser/proc/Precedence(node/expression/operator/top, node/expression/operator/input)
|
/n_Parser/nS_Parser/proc/Precedence(node/expression/operator_node/top, node/expression/operator_node/input)
|
||||||
if(istype(top))
|
if(istype(top))
|
||||||
top=top.precedence
|
top=top.precedence
|
||||||
if(istype(input))
|
if(istype(input))
|
||||||
@@ -88,7 +88,7 @@ See Also:
|
|||||||
- <GetBinaryOperator()>
|
- <GetBinaryOperator()>
|
||||||
- <GetUnaryOperator()>
|
- <GetUnaryOperator()>
|
||||||
*/
|
*/
|
||||||
/n_Parser/nS_Parser/proc/GetOperator(O, type=/node/expression/operator, L[])
|
/n_Parser/nS_Parser/proc/GetOperator(O, type=/node/expression/operator_node, L[])
|
||||||
if(istype(O, type)) return O //O is already the desired type
|
if(istype(O, type)) return O //O is already the desired type
|
||||||
if(istype(O, /token)) O=O:value //sets O to text
|
if(istype(O, /token)) O=O:value //sets O to text
|
||||||
if(istext(O)) //sets O to path
|
if(istext(O)) //sets O to path
|
||||||
@@ -108,7 +108,7 @@ See Also:
|
|||||||
- <GetUnaryOperator()>
|
- <GetUnaryOperator()>
|
||||||
*/
|
*/
|
||||||
/n_Parser/nS_Parser/proc/GetBinaryOperator(O)
|
/n_Parser/nS_Parser/proc/GetBinaryOperator(O)
|
||||||
return GetOperator(O, /node/expression/operator/binary, options.binary_operators)
|
return GetOperator(O, /node/expression/operator_node/binary, options.binary_operators)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Proc: GetUnaryOperator
|
Proc: GetUnaryOperator
|
||||||
@@ -120,7 +120,7 @@ See Also:
|
|||||||
- <GetBinaryOperator()>
|
- <GetBinaryOperator()>
|
||||||
*/
|
*/
|
||||||
/n_Parser/nS_Parser/proc/GetUnaryOperator(O)
|
/n_Parser/nS_Parser/proc/GetUnaryOperator(O)
|
||||||
return GetOperator(O, /node/expression/operator/unary, options.unary_operators)
|
return GetOperator(O, /node/expression/operator_node/unary, options.unary_operators)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Proc: Reduce
|
Proc: Reduce
|
||||||
@@ -128,15 +128,15 @@ Takes the operator on top of the opr stack and assigns its operand(s). Then this
|
|||||||
of the val stack.
|
of the val stack.
|
||||||
*/
|
*/
|
||||||
/n_Parser/nS_Parser/proc/Reduce(stack/opr, stack/val)
|
/n_Parser/nS_Parser/proc/Reduce(stack/opr, stack/val)
|
||||||
var/node/expression/operator/O=opr.Pop()
|
var/node/expression/operator_node/O=opr.Pop()
|
||||||
if(!O) return
|
if(!O) return
|
||||||
if(!istype(O))
|
if(!istype(O))
|
||||||
errors+=new/scriptError("Error reducing expression - invalid operator.")
|
errors+=new/scriptError("Error reducing expression - invalid operator.")
|
||||||
return
|
return
|
||||||
//Take O and assign its operands, popping one or two values from the val stack
|
//Take O and assign its operands, popping one or two values from the val stack
|
||||||
//depending on whether O is a binary or unary operator.
|
//depending on whether O is a binary or unary operator.
|
||||||
if(istype(O, /node/expression/operator/binary))
|
if(istype(O, /node/expression/operator_node/binary))
|
||||||
var/node/expression/operator/binary/B=O
|
var/node/expression/operator_node/binary/B=O
|
||||||
B.exp2=val.Pop()
|
B.exp2=val.Pop()
|
||||||
B.exp =val.Pop()
|
B.exp =val.Pop()
|
||||||
val.Push(B)
|
val.Push(B)
|
||||||
@@ -203,7 +203,7 @@ See Also:
|
|||||||
continue
|
continue
|
||||||
val.Push(ParseParenExpression())
|
val.Push(ParseParenExpression())
|
||||||
else if(istype(curToken, /token/symbol)) //Operator found.
|
else if(istype(curToken, /token/symbol)) //Operator found.
|
||||||
var/node/expression/operator/curOperator //Figure out whether it is unary or binary and get a new instance.
|
var/node/expression/operator_node/curOperator //Figure out whether it is unary or binary and get a new instance.
|
||||||
if(src.expecting==OPERATOR)
|
if(src.expecting==OPERATOR)
|
||||||
curOperator=GetBinaryOperator(curToken)
|
curOperator=GetBinaryOperator(curToken)
|
||||||
if(!curOperator)
|
if(!curOperator)
|
||||||
@@ -297,7 +297,7 @@ See Also:
|
|||||||
/n_Parser/nS_Parser/proc/ParseParenExpression()
|
/n_Parser/nS_Parser/proc/ParseParenExpression()
|
||||||
if(!CheckToken("(", /token/symbol))
|
if(!CheckToken("(", /token/symbol))
|
||||||
return
|
return
|
||||||
return new/node/expression/operator/unary/group(ParseExpression(list(")")))
|
return new/node/expression/operator_node/unary/group(ParseExpression(list(")")))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Proc: ParseParamExpression
|
Proc: ParseParamExpression
|
||||||
|
|||||||
Reference in New Issue
Block a user