mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
[MIRROR] Linter diagnostics + bans non-var relative pathing
This commit is contained in:
@@ -41,23 +41,20 @@ var
|
||||
/*
|
||||
Class: node
|
||||
*/
|
||||
/node
|
||||
proc
|
||||
ToString()
|
||||
return "[src.type]"
|
||||
/node/proc/ToString()
|
||||
return "[src.type]"
|
||||
/*
|
||||
Class: identifier
|
||||
*/
|
||||
/node/identifier
|
||||
var
|
||||
id_name
|
||||
var/id_name
|
||||
|
||||
New(id)
|
||||
.=..()
|
||||
src.id_name=id
|
||||
/node/identifier/New(id)
|
||||
.=..()
|
||||
src.id_name=id
|
||||
|
||||
ToString()
|
||||
return id_name
|
||||
/node/identifier/ToString()
|
||||
return id_name
|
||||
|
||||
/*
|
||||
Class: expression
|
||||
@@ -68,72 +65,64 @@ var
|
||||
See <Binary Operators> and <Unary Operators> for subtypes.
|
||||
*/
|
||||
/node/expression/operator
|
||||
var
|
||||
node/expression/exp
|
||||
tmp
|
||||
name
|
||||
precedence
|
||||
var/node/expression/exp
|
||||
var/tmp/name
|
||||
var/tmp/precedence
|
||||
|
||||
New()
|
||||
.=..()
|
||||
if(!src.name) src.name="[src.type]"
|
||||
/node/expression/operator/New()
|
||||
.=..()
|
||||
if(!src.name) src.name="[src.type]"
|
||||
|
||||
ToString()
|
||||
return "operator: [name]"
|
||||
/node/expression/operator/ToString()
|
||||
return "operator: [name]"
|
||||
|
||||
/*
|
||||
Class: FunctionCall
|
||||
*/
|
||||
/node/expression/FunctionCall
|
||||
//Function calls can also be expressions or statements.
|
||||
var
|
||||
func_name
|
||||
node/identifier/object
|
||||
list/parameters=new
|
||||
var/func_name
|
||||
var/node/identifier/object
|
||||
var/list/parameters = list()
|
||||
|
||||
/*
|
||||
Class: literal
|
||||
*/
|
||||
/node/expression/value/literal
|
||||
var
|
||||
value
|
||||
var/value
|
||||
|
||||
New(value)
|
||||
.=..()
|
||||
src.value=value
|
||||
/node/expression/value/literal/New(value)
|
||||
.=..()
|
||||
src.value=value
|
||||
|
||||
ToString()
|
||||
return src.value
|
||||
/node/expression/value/literal/ToString()
|
||||
return src.value
|
||||
|
||||
/*
|
||||
Class: variable
|
||||
*/
|
||||
/node/expression/value/variable
|
||||
var
|
||||
node
|
||||
object //Either a node/identifier or another node/expression/value/variable which points to the object
|
||||
node/identifier
|
||||
id
|
||||
var/node/object //Either a node/identifier or another node/expression/value/variable which points to the object
|
||||
var/node/identifier/id
|
||||
|
||||
|
||||
New(ident)
|
||||
.=..()
|
||||
id=ident
|
||||
if(istext(id))id=new(id)
|
||||
/node/expression/value/variable/New(ident)
|
||||
.=..()
|
||||
id=ident
|
||||
if(istext(id))id=new(id)
|
||||
|
||||
ToString()
|
||||
return src.id.ToString()
|
||||
/node/expression/value/variable/ToString()
|
||||
return src.id.ToString()
|
||||
|
||||
/*
|
||||
Class: reference
|
||||
*/
|
||||
/node/expression/value/reference
|
||||
var
|
||||
datum/value
|
||||
var/datum/value
|
||||
|
||||
New(value)
|
||||
.=..()
|
||||
src.value=value
|
||||
/node/expression/value/reference/New(value)
|
||||
.=..()
|
||||
src.value=value
|
||||
|
||||
ToString()
|
||||
return "ref: [src.value] ([src.value.type])"
|
||||
/node/expression/value/reference/ToString()
|
||||
return "ref: [src.value] ([src.value.type])"
|
||||
@@ -9,12 +9,10 @@
|
||||
and not just in the global scope as in many languages.
|
||||
*/
|
||||
/node/BlockDefinition
|
||||
var/list
|
||||
statements = new
|
||||
functions = new
|
||||
initial_variables = new
|
||||
var/list/statements = list()
|
||||
var/list/functions = list()
|
||||
var/list/initial_variables = list()
|
||||
|
||||
proc
|
||||
/*
|
||||
Proc: SetVar
|
||||
Defines a permanent variable. The variable will not be deleted when it goes out of scope.
|
||||
@@ -26,8 +24,8 @@
|
||||
See Also:
|
||||
- <n_Interpreter.SetVar()>
|
||||
*/
|
||||
SetVar(name, value)
|
||||
initial_variables[name]=value
|
||||
/node/BlockDefinition/proc/SetVar(name, value)
|
||||
initial_variables[name]=value
|
||||
|
||||
|
||||
/*
|
||||
@@ -35,14 +33,13 @@
|
||||
A block object representing the global scope.
|
||||
*/
|
||||
//
|
||||
GlobalBlock
|
||||
New()
|
||||
initial_variables["null"]=null
|
||||
return ..()
|
||||
/node/BlockDefinition/GlobalBlock/New()
|
||||
initial_variables["null"]=null
|
||||
return ..()
|
||||
|
||||
/*
|
||||
Class: FunctionBlock
|
||||
A block representing a function body.
|
||||
*/
|
||||
//
|
||||
FunctionBlock
|
||||
/node/BlockDefinition/FunctionBlock
|
||||
@@ -16,48 +16,48 @@
|
||||
Returns true if x = y.
|
||||
*/
|
||||
//
|
||||
Equal
|
||||
precedence=OOP_EQUAL
|
||||
/node/expression/operator/binary/Equal
|
||||
precedence=OOP_EQUAL
|
||||
|
||||
/*
|
||||
Class: NotEqual
|
||||
Returns true if x and y aren't equal.
|
||||
*/
|
||||
//
|
||||
NotEqual
|
||||
precedence=OOP_EQUAL
|
||||
/node/expression/operator/binary/NotEqual
|
||||
precedence=OOP_EQUAL
|
||||
|
||||
/*
|
||||
Class: Greater
|
||||
Returns true if x > y.
|
||||
*/
|
||||
//
|
||||
Greater
|
||||
precedence=OOP_COMPARE
|
||||
/node/expression/operator/binary/Greater
|
||||
precedence=OOP_COMPARE
|
||||
|
||||
/*
|
||||
Class: Less
|
||||
Returns true if x < y.
|
||||
*/
|
||||
//
|
||||
Less
|
||||
precedence=OOP_COMPARE
|
||||
/node/expression/operator/binary/Less
|
||||
precedence=OOP_COMPARE
|
||||
|
||||
/*
|
||||
Class: GreaterOrEqual
|
||||
Returns true if x >= y.
|
||||
*/
|
||||
//
|
||||
GreaterOrEqual
|
||||
precedence=OOP_COMPARE
|
||||
/node/expression/operator/binary/GreaterOrEqual
|
||||
precedence=OOP_COMPARE
|
||||
|
||||
/*
|
||||
Class: LessOrEqual
|
||||
Returns true if x <= y.
|
||||
*/
|
||||
//
|
||||
LessOrEqual
|
||||
precedence=OOP_COMPARE
|
||||
/node/expression/operator/binary/LessOrEqual
|
||||
precedence=OOP_COMPARE
|
||||
|
||||
|
||||
////////// Logical Operators //////////
|
||||
@@ -67,24 +67,24 @@
|
||||
Returns true if x and y are true.
|
||||
*/
|
||||
//
|
||||
LogicalAnd
|
||||
precedence=OOP_AND
|
||||
/node/expression/operator/binary/LogicalAnd
|
||||
precedence=OOP_AND
|
||||
|
||||
/*
|
||||
Class: LogicalOr
|
||||
Returns true if x, y, or both are true.
|
||||
*/
|
||||
//
|
||||
LogicalOr
|
||||
precedence=OOP_OR
|
||||
/node/expression/operator/binary/LogicalOr
|
||||
precedence=OOP_OR
|
||||
|
||||
/*
|
||||
Class: LogicalXor
|
||||
Returns true if either x or y but not both are true.
|
||||
*/
|
||||
//
|
||||
LogicalXor //Not implemented in nS
|
||||
precedence=OOP_OR
|
||||
/node/expression/operator/binary/LogicalXor //Not implemented in nS
|
||||
precedence=OOP_OR
|
||||
|
||||
|
||||
////////// Bitwise Operators //////////
|
||||
@@ -97,8 +97,8 @@
|
||||
011 & 110 = 010
|
||||
*/
|
||||
//
|
||||
BitwiseAnd
|
||||
precedence=OOP_BIT
|
||||
/node/expression/operator/binary/BitwiseAnd
|
||||
precedence=OOP_BIT
|
||||
|
||||
/*
|
||||
Class: BitwiseOr
|
||||
@@ -108,8 +108,8 @@
|
||||
011 | 110 = 111
|
||||
*/
|
||||
//
|
||||
BitwiseOr
|
||||
precedence=OOP_BIT
|
||||
/node/expression/operator/binary/BitwiseOr
|
||||
precedence=OOP_BIT
|
||||
|
||||
/*
|
||||
Class: BitwiseXor
|
||||
@@ -119,8 +119,8 @@
|
||||
011 xor 110 = 101
|
||||
*/
|
||||
//
|
||||
BitwiseXor
|
||||
precedence=OOP_BIT
|
||||
/node/expression/operator/binary/BitwiseXor
|
||||
precedence=OOP_BIT
|
||||
|
||||
|
||||
////////// Arithmetic Operators //////////
|
||||
@@ -130,45 +130,45 @@
|
||||
Returns the sum of x and y.
|
||||
*/
|
||||
//
|
||||
Add
|
||||
precedence=OOP_ADD
|
||||
/node/expression/operator/binary/Add
|
||||
precedence=OOP_ADD
|
||||
|
||||
/*
|
||||
Class: Subtract
|
||||
Returns the difference of x and y.
|
||||
*/
|
||||
//
|
||||
Subtract
|
||||
precedence=OOP_ADD
|
||||
/node/expression/operator/binary/Subtract
|
||||
precedence=OOP_ADD
|
||||
|
||||
/*
|
||||
Class: Multiply
|
||||
Returns the product of x and y.
|
||||
*/
|
||||
//
|
||||
Multiply
|
||||
precedence=OOP_MULTIPLY
|
||||
/node/expression/operator/binary/Multiply
|
||||
precedence=OOP_MULTIPLY
|
||||
|
||||
/*
|
||||
Class: Divide
|
||||
Returns the quotient of x and y.
|
||||
*/
|
||||
//
|
||||
Divide
|
||||
precedence=OOP_MULTIPLY
|
||||
/node/expression/operator/binary/Divide
|
||||
precedence=OOP_MULTIPLY
|
||||
|
||||
/*
|
||||
Class: Power
|
||||
Returns x raised to the power of y.
|
||||
*/
|
||||
//
|
||||
Power
|
||||
precedence=OOP_POW
|
||||
/node/expression/operator/binary/Power
|
||||
precedence=OOP_POW
|
||||
|
||||
/*
|
||||
Class: Modulo
|
||||
Returns the remainder of x / y.
|
||||
*/
|
||||
//
|
||||
Modulo
|
||||
precedence=OOP_MULTIPLY
|
||||
/node/expression/operator/binary/Modulo
|
||||
precedence=OOP_MULTIPLY
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
!true = false and !false = true
|
||||
*/
|
||||
//
|
||||
LogicalNot
|
||||
name="logical not"
|
||||
/node/expression/operator/unary/LogicalNot
|
||||
name="logical not"
|
||||
|
||||
/*
|
||||
Class: BitwiseNot
|
||||
@@ -27,25 +27,25 @@
|
||||
~10 (decimal 2) = 01 (decimal 1).
|
||||
*/
|
||||
//
|
||||
BitwiseNot
|
||||
name="bitwise not"
|
||||
/node/expression/operator/unary/BitwiseNot
|
||||
name="bitwise not"
|
||||
|
||||
/*
|
||||
Class: Minus
|
||||
Returns -x.
|
||||
*/
|
||||
//
|
||||
Minus
|
||||
name="minus"
|
||||
/node/expression/operator/unary/Minus
|
||||
name="minus"
|
||||
|
||||
/*
|
||||
Class: group
|
||||
A special unary operator representing a value in parentheses.
|
||||
*/
|
||||
//
|
||||
group
|
||||
precedence=OOP_GROUP
|
||||
/node/expression/operator/unary/group
|
||||
precedence=OOP_GROUP
|
||||
|
||||
New(node/expression/exp)
|
||||
src.exp=exp
|
||||
return ..()
|
||||
/node/expression/operator/unary/New(node/expression/exp)
|
||||
src.exp=exp
|
||||
return ..()
|
||||
|
||||
@@ -11,22 +11,20 @@
|
||||
Represents a call to a function.
|
||||
*/
|
||||
//
|
||||
FunctionCall
|
||||
var
|
||||
func_name
|
||||
node/identifier/object
|
||||
list/parameters=new
|
||||
/node/statement/FunctionCall
|
||||
var/func_name
|
||||
var/node/identifier/object
|
||||
var/list/parameters=list()
|
||||
|
||||
/*
|
||||
Class: FunctionDefinition
|
||||
Defines a function.
|
||||
*/
|
||||
//
|
||||
FunctionDefinition
|
||||
var
|
||||
func_name
|
||||
list/parameters=new
|
||||
node/BlockDefinition/FunctionBlock/block
|
||||
/node/statement/FunctionDefinition
|
||||
var/func_name
|
||||
var/list/parameters=list()
|
||||
var/node/BlockDefinition/FunctionBlock/block
|
||||
|
||||
/*
|
||||
Class: VariableAssignment
|
||||
@@ -40,13 +38,10 @@
|
||||
- <VariableDeclaration>
|
||||
*/
|
||||
//
|
||||
VariableAssignment
|
||||
var
|
||||
node
|
||||
identifier
|
||||
object
|
||||
var_name
|
||||
expression/value
|
||||
/node/statement/VariableAssignment
|
||||
var/node/identifier/object
|
||||
var/node/identifier/var_name
|
||||
var/node/expression/value
|
||||
|
||||
/*
|
||||
Class: VariableDeclaration
|
||||
@@ -56,67 +51,56 @@
|
||||
- <VariableAssignment>
|
||||
*/
|
||||
//
|
||||
VariableDeclaration
|
||||
var
|
||||
node
|
||||
identifier
|
||||
object
|
||||
var_name
|
||||
/node/statement/VariableDeclaration
|
||||
var/node/identifier/object
|
||||
var/node/identifier/var_name
|
||||
|
||||
/*
|
||||
Class: IfStatement
|
||||
*/
|
||||
//
|
||||
IfStatement
|
||||
var
|
||||
node
|
||||
BlockDefinition
|
||||
block
|
||||
else_block //may be null
|
||||
expression/cond
|
||||
/node/statement/IfStatement
|
||||
var/node/BlockDefinition/block
|
||||
var/node/BlockDefinition/else_block // may be null
|
||||
var/node/expression/cond
|
||||
|
||||
/*
|
||||
Class: WhileLoop
|
||||
Loops while a given condition is true.
|
||||
*/
|
||||
//
|
||||
WhileLoop
|
||||
var
|
||||
node
|
||||
BlockDefinition/block
|
||||
expression/cond
|
||||
/node/statement/WhileLoop
|
||||
var/node/BlockDefinition/block
|
||||
var/node/expression/cond
|
||||
|
||||
/*
|
||||
Class: ForLoop
|
||||
Loops while test is true, initializing a variable, increasing the variable
|
||||
*/
|
||||
ForLoop
|
||||
var
|
||||
node
|
||||
BlockDefinition/block
|
||||
expression/test
|
||||
expression/init
|
||||
expression/increment
|
||||
/node/statement/ForLoop
|
||||
var/node/BlockDefinition/block
|
||||
var/node/expression/test
|
||||
var/node/expression/init
|
||||
var/node/expression/increment
|
||||
|
||||
/*
|
||||
Class: BreakStatement
|
||||
Ends a loop.
|
||||
*/
|
||||
//
|
||||
BreakStatement
|
||||
/node/statement/BreakStatement
|
||||
|
||||
/*
|
||||
Class: ContinueStatement
|
||||
Skips to the next iteration of a loop.
|
||||
*/
|
||||
//
|
||||
ContinueStatement
|
||||
/node/statement/ContinueStatement
|
||||
|
||||
/*
|
||||
Class: ReturnStatement
|
||||
Ends the function and returns a value.
|
||||
*/
|
||||
//
|
||||
ReturnStatement
|
||||
var
|
||||
node/expression/value
|
||||
/node/statement/ReturnStatement
|
||||
var/node/expression/value
|
||||
Reference in New Issue
Block a user