mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-29 16:19:36 +01:00
[MIRROR] Staticpath [MDB ignore] (#12445)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
co-authored by
Kashargul
parent
cc106f8032
commit
ba5224fbcb
@@ -14,19 +14,19 @@ File: Options
|
||||
/*
|
||||
Class: n_scriptOptions
|
||||
*/
|
||||
/n_scriptOptions/proc/CanStartID(char) //returns true if the character can start a variable, function, or keyword name (by default letters or an underscore)
|
||||
/datum/n_scriptOptions/proc/CanStartID(char) //returns true if the character can start a variable, function, or keyword name (by default letters or an underscore)
|
||||
if(!isnum(char))char=text2ascii(char)
|
||||
return (char in ASCII_A to ASCII_Z) || (char in ASCII_LOWER_A to ASCII_LOWER_Z) || char==ASCII_UNDERSCORE || char==ASCII_DOLLAR
|
||||
|
||||
/n_scriptOptions/proc/IsValidIDChar(char) //returns true if the character can be in the body of a variable, function, or keyword name (by default letters, numbers, and underscore)
|
||||
/datum/n_scriptOptions/proc/IsValidIDChar(char) //returns true if the character can be in the body of a variable, function, or keyword name (by default letters, numbers, and underscore)
|
||||
if(!isnum(char))char=text2ascii(char)
|
||||
return CanStartID(char) || IsDigit(char)
|
||||
|
||||
/n_scriptOptions/proc/IsDigit(char)
|
||||
/datum/n_scriptOptions/proc/IsDigit(char)
|
||||
if(!isnum(char))char=text2ascii(char)
|
||||
return char in ASCII_ZERO to ASCII_NINE
|
||||
|
||||
/n_scriptOptions/proc/IsValidID(id) //returns true if all the characters in the string are okay to be in an identifier name
|
||||
/datum/n_scriptOptions/proc/IsValidID(id) //returns true if all the characters in the string are okay to be in an identifier name
|
||||
if(!CanStartID(id)) //don't need to grab first char in id, since text2ascii does it automatically
|
||||
return 0
|
||||
if(length(id)==1) return 1
|
||||
@@ -39,7 +39,7 @@ File: Options
|
||||
Class: nS_Options
|
||||
An implementation of <n_scriptOptions> for the n_Script language.
|
||||
*/
|
||||
/n_scriptOptions/nS_Options
|
||||
/datum/n_scriptOptions/nS_Options
|
||||
var/list/symbols = list("(", ")", "\[", "]", ";", ",", "{", "}") //scanner - Characters that can be in symbols
|
||||
/*
|
||||
Var: keywords
|
||||
@@ -47,13 +47,13 @@ An associative list used by the parser to parse keywords. Indices are strings wh
|
||||
associated values are <nS_Keyword> types of which the <n_Keyword.Parse()> proc will be called.
|
||||
*/
|
||||
var/list/keywords = list(
|
||||
"if" = /n_Keyword/nS_Keyword/kwIf,
|
||||
"else" = /n_Keyword/nS_Keyword/kwElse,
|
||||
"while" = /n_Keyword/nS_Keyword/kwWhile,
|
||||
"break" = /n_Keyword/nS_Keyword/kwBreak,
|
||||
"continue" = /n_Keyword/nS_Keyword/kwContinue,
|
||||
"return" = /n_Keyword/nS_Keyword/kwReturn,
|
||||
"def" = /n_Keyword/nS_Keyword/kwDef
|
||||
"if" = /datum/n_Keyword/nS_Keyword/kwIf,
|
||||
"else" = /datum/n_Keyword/nS_Keyword/kwElse,
|
||||
"while" = /datum/n_Keyword/nS_Keyword/kwWhile,
|
||||
"break" = /datum/n_Keyword/nS_Keyword/kwBreak,
|
||||
"continue" = /datum/n_Keyword/nS_Keyword/kwContinue,
|
||||
"return" = /datum/n_Keyword/nS_Keyword/kwReturn,
|
||||
"def" = /datum/n_Keyword/nS_Keyword/kwDef
|
||||
)
|
||||
|
||||
var/list/assign_operators = list(
|
||||
@@ -70,31 +70,31 @@ associated values are <nS_Keyword> types of which the <n_Keyword.Parse()> proc w
|
||||
)
|
||||
|
||||
var/list/unary_operators =list(
|
||||
"!" = /node/expression/op/unary/LogicalNot,
|
||||
"~" = /node/expression/op/unary/BitwiseNot,
|
||||
"-" = /node/expression/op/unary/Minus
|
||||
"!" = /datum/node/expression/op/unary/LogicalNot,
|
||||
"~" = /datum/node/expression/op/unary/BitwiseNot,
|
||||
"-" = /datum/node/expression/op/unary/Minus
|
||||
)
|
||||
|
||||
var/list/binary_operators=list(
|
||||
"==" = /node/expression/op/binary/Equal,
|
||||
"!=" = /node/expression/op/binary/NotEqual,
|
||||
">" = /node/expression/op/binary/Greater,
|
||||
"<" = /node/expression/op/binary/Less,
|
||||
">=" = /node/expression/op/binary/GreaterOrEqual,
|
||||
"<=" = /node/expression/op/binary/LessOrEqual,
|
||||
"&&" = /node/expression/op/binary/LogicalAnd,
|
||||
"||" = /node/expression/op/binary/LogicalOr,
|
||||
"&" = /node/expression/op/binary/BitwiseAnd,
|
||||
"|" = /node/expression/op/binary/BitwiseOr,
|
||||
"`" = /node/expression/op/binary/BitwiseXor,
|
||||
"+" = /node/expression/op/binary/Add,
|
||||
"-" = /node/expression/op/binary/Subtract,
|
||||
"*" = /node/expression/op/binary/Multiply,
|
||||
"/" = /node/expression/op/binary/Divide,
|
||||
"^" = /node/expression/op/binary/Power,
|
||||
"%" = /node/expression/op/binary/Modulo)
|
||||
"==" = /datum/node/expression/op/binary/Equal,
|
||||
"!=" = /datum/node/expression/op/binary/NotEqual,
|
||||
">" = /datum/node/expression/op/binary/Greater,
|
||||
"<" = /datum/node/expression/op/binary/Less,
|
||||
">=" = /datum/node/expression/op/binary/GreaterOrEqual,
|
||||
"<=" = /datum/node/expression/op/binary/LessOrEqual,
|
||||
"&&" = /datum/node/expression/op/binary/LogicalAnd,
|
||||
"||" = /datum/node/expression/op/binary/LogicalOr,
|
||||
"&" = /datum/node/expression/op/binary/BitwiseAnd,
|
||||
"|" = /datum/node/expression/op/binary/BitwiseOr,
|
||||
"`" = /datum/node/expression/op/binary/BitwiseXor,
|
||||
"+" = /datum/node/expression/op/binary/Add,
|
||||
"-" = /datum/node/expression/op/binary/Subtract,
|
||||
"*" = /datum/node/expression/op/binary/Multiply,
|
||||
"/" = /datum/node/expression/op/binary/Divide,
|
||||
"^" = /datum/node/expression/op/binary/Power,
|
||||
"%" = /datum/node/expression/op/binary/Modulo)
|
||||
|
||||
/n_scriptOptions/nS_Options/New()
|
||||
/datum/n_scriptOptions/nS_Options/New()
|
||||
.=..()
|
||||
for(var/O in assign_operators+binary_operators+unary_operators)
|
||||
if(!symbols.Find(O)) symbols+=O
|
||||
|
||||
Reference in New Issue
Block a user