mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Telecomms Refactor & CodeMirror
This commit does the following:
- A lot of shit I am really too tired to fucking write about
- Absolute pathed telecomms scripting
- Browser Datum traffic control
- Absolutely lovely replacement for the fucking skin TCS window, using
codemirror
- CodeMirror integration for nanoUI
- Sorta, I didn't work on this as much as I wanted to, because IT TOOK
11 FUCKING HOURS TO GET THE BROWSER DATUM TO WORK
This commit is contained in:
@@ -5,128 +5,165 @@
|
||||
Class: scriptError
|
||||
An error scanning or parsing the source code.
|
||||
*/
|
||||
/scriptError
|
||||
var
|
||||
/datum/scriptError
|
||||
/*
|
||||
Var: message
|
||||
A message describing the problem.
|
||||
*/
|
||||
message
|
||||
New(msg=null)
|
||||
if(msg)message=msg
|
||||
var/message
|
||||
|
||||
BadToken
|
||||
message="Unexpected token: "
|
||||
var/token/token
|
||||
New(token/t)
|
||||
token=t
|
||||
if(t&&t.line) message="[t.line]: [message]"
|
||||
if(istype(t))message+="[t.value]"
|
||||
else message+="[t]"
|
||||
/datum/scriptError/New(msg = null)
|
||||
if(msg)message = msg
|
||||
|
||||
InvalidID
|
||||
parent_type=/scriptError/BadToken
|
||||
message="Invalid identifier name: "
|
||||
/datum/scriptError/BadToken
|
||||
message = "Unexpected token: "
|
||||
var/datum/token/token
|
||||
|
||||
ReservedWord
|
||||
parent_type=/scriptError/BadToken
|
||||
message="Identifer using reserved word: "
|
||||
/datum/scriptError/BadToken/New(datum/token/t)
|
||||
token = t
|
||||
if(t && t.line)
|
||||
message = "[t.line]: [message]"
|
||||
|
||||
BadNumber
|
||||
parent_type=/scriptError/BadToken
|
||||
message = "Bad number: "
|
||||
if(istype(t))
|
||||
message += "[t.value]"
|
||||
|
||||
BadReturn
|
||||
var/token/token
|
||||
message = "Unexpected return statement outside of a function."
|
||||
New(token/t)
|
||||
src.token=t
|
||||
else
|
||||
message += "[t]"
|
||||
|
||||
EndOfFile
|
||||
message = "Unexpected end of file."
|
||||
/datum/scriptError/InvalidID
|
||||
parent_type = /datum/scriptError/BadToken
|
||||
message = "Invalid identifier name: "
|
||||
|
||||
ExpectedToken
|
||||
message="Expected: '"
|
||||
New(id, token/T)
|
||||
if(T && T.line) message="[T.line]: [message]"
|
||||
message+="[id]'. "
|
||||
if(T)message+="Found '[T.value]'."
|
||||
/datum/scriptError/ReservedWord
|
||||
parent_type = /datum/scriptError/BadToken
|
||||
message = "Identifer using reserved word: "
|
||||
|
||||
/datum/scriptError/BadNumber
|
||||
parent_type = /datum/scriptError/BadToken
|
||||
message = "Bad number: "
|
||||
|
||||
/datum/scriptError/BadReturn
|
||||
var/datum/token/token
|
||||
message = "Unexpected return statement outside of a function."
|
||||
|
||||
/datum/scriptError/BadReturn/New(datum/token/t)
|
||||
src.token = t
|
||||
|
||||
/datum/scriptError/EndOfFile
|
||||
message = "Unexpected end of file."
|
||||
|
||||
/datum/scriptError/ExpectedToken
|
||||
message = "Expected: '"
|
||||
|
||||
/datum/scriptError/ExpectedToken/New(id, datum/token/T)
|
||||
if(T && T.line)
|
||||
message = "[T.line]: [message]"
|
||||
|
||||
message += "[id]'. "
|
||||
|
||||
if(T)
|
||||
message += "Found '[T.value]'."
|
||||
|
||||
|
||||
UnterminatedComment
|
||||
message="Unterminated multi-line comment statement: expected */"
|
||||
/datum/scriptError/UnterminatedComment
|
||||
message = "Unterminated multi-line comment statement: expected */"
|
||||
|
||||
DuplicateFunction
|
||||
New(name, token/t)
|
||||
message="Function '[name]' defined twice."
|
||||
/datum/scriptError/DuplicateFunction/New(name, datum/token/t)
|
||||
message = "Function '[name]' defined twice."
|
||||
|
||||
/datum/scriptError/ParameterFunction
|
||||
message = "You cannot use a function inside a parameter."
|
||||
|
||||
/datum/scriptError/ParameterFunction/New(datum/token/t)
|
||||
var/line = "?"
|
||||
if(t)
|
||||
line = t.line
|
||||
message = "[line]: [message]"
|
||||
|
||||
/*
|
||||
Class: runtimeError
|
||||
An error thrown by the interpreter in running the script.
|
||||
*/
|
||||
/runtimeError
|
||||
var
|
||||
name
|
||||
/datum/runtimeError
|
||||
var/name
|
||||
/*
|
||||
Var: message
|
||||
A basic description as to what went wrong.
|
||||
*/
|
||||
message
|
||||
stack/stack
|
||||
|
||||
proc
|
||||
var/message
|
||||
var/datum/stack/stack
|
||||
/*
|
||||
Proc: ToString
|
||||
Returns a description of the error suitable for showing to the user.
|
||||
*/
|
||||
ToString()
|
||||
. = "[name]: [message]"
|
||||
if(!stack.Top()) return
|
||||
.+="\nStack:"
|
||||
while(stack.Top())
|
||||
var/node/statement/FunctionCall/stmt=stack.Pop()
|
||||
. += "\n\t [stmt.func_name]()"
|
||||
/datum/runtimeError/proc/ToString()
|
||||
. = "[name]: [message]"
|
||||
if(!stack.Top())
|
||||
return
|
||||
|
||||
TypeMismatch
|
||||
name="TypeMismatchError"
|
||||
New(op, a, b)
|
||||
message="Type mismatch: '[a]' [op] '[b]'"
|
||||
. += "\nStack:"
|
||||
while(stack.Top())
|
||||
var/datum/node/statement/FunctionCall/stmt = stack.Pop()
|
||||
. += "\n\t [stmt.func_name]()"
|
||||
|
||||
UnexpectedReturn
|
||||
name="UnexpectedReturnError"
|
||||
message="Unexpected return statement."
|
||||
/datum/runtimeError/TypeMismatch
|
||||
name = "TypeMismatchError"
|
||||
|
||||
UnknownInstruction
|
||||
name="UnknownInstructionError"
|
||||
message="Unknown instruction type. This may be due to incompatible compiler and interpreter versions or a lack of implementation."
|
||||
/datum/runtimeError/TypeMismatch/New(op, a, b)
|
||||
message = "Type mismatch: '[a]' [op] '[b]'"
|
||||
|
||||
UndefinedVariable
|
||||
name="UndefinedVariableError"
|
||||
New(variable)
|
||||
message="Variable '[variable]' has not been declared."
|
||||
/datum/runtimeError/TypeMismatch/unary/New(op, a)
|
||||
message = "Type mismatch: [op]'[a]'"
|
||||
|
||||
UndefinedFunction
|
||||
name="UndefinedFunctionError"
|
||||
New(function)
|
||||
message="Function '[function]()' has not been defined."
|
||||
/datum/runtimeError/TypeMismatch/New(op, a, b)
|
||||
message = "Type mismatch: '[a]' [op] '[b]'"
|
||||
|
||||
DuplicateVariableDeclaration
|
||||
name="DuplicateVariableError"
|
||||
New(variable)
|
||||
message="Variable '[variable]' was already declared."
|
||||
/datum/runtimeError/UnexpectedReturn
|
||||
name = "UnexpectedReturnError"
|
||||
message = "Unexpected return statement."
|
||||
|
||||
IterationLimitReached
|
||||
name="MaxIterationError"
|
||||
message="A loop has reached its maximum number of iterations."
|
||||
/datum/runtimeError/UnknownInstruction
|
||||
name = "UnknownInstructionError"
|
||||
message = "Unknown instruction type. This may be due to incompatible compiler and interpreter versions or a lack of implementation."
|
||||
|
||||
RecursionLimitReached
|
||||
name="MaxRecursionError"
|
||||
message="The maximum amount of recursion has been reached."
|
||||
/datum/runtimeError/UndefinedVariable
|
||||
name = "UndefinedVariableError"
|
||||
|
||||
DivisionByZero
|
||||
name="DivideByZeroError"
|
||||
message="Division by zero attempted."
|
||||
/datum/runtimeError/UndefinedVariable/New(variable)
|
||||
message = "Variable '[variable]' has not been declared."
|
||||
|
||||
MaxCPU
|
||||
name="MaxComputationalUse"
|
||||
message="Maximum amount of computational cycles reached (>= 1000)."
|
||||
/datum/runtimeError/UndefinedFunction
|
||||
name = "UndefinedFunctionError"
|
||||
|
||||
/datum/runtimeError/UndefinedFunction/New(function)
|
||||
message = "Function '[function]()' has not been defined."
|
||||
|
||||
/datum/runtimeError/DuplicateVariableDeclaration
|
||||
name = "DuplicateVariableError"
|
||||
|
||||
/datum/runtimeError/DuplicateVariableDeclaration/New(variable)
|
||||
message="Variable '[variable]' was already declared."
|
||||
|
||||
/datum/runtimeError/IterationLimitReached
|
||||
name = "MaxIterationError"
|
||||
message = "A loop has reached its maximum number of iterations."
|
||||
|
||||
/datum/runtimeError/RecursionLimitReached
|
||||
name = "MaxRecursionError"
|
||||
message = "The maximum amount of recursion has been reached."
|
||||
|
||||
/datum/runtimeError/DivisionByZero
|
||||
name = "DivideByZeroError"
|
||||
message = "Division by zero attempted."
|
||||
|
||||
/datum/runtimeError/MaxCPU
|
||||
name = "MaxComputationalUse"
|
||||
message = "Maximum amount of computational cycles reached (>= 1000)."
|
||||
|
||||
/datum/runtimeError/VectorLimit
|
||||
name = "VectorSizeOverflow"
|
||||
message = "Maximum vector size reached"
|
||||
|
||||
/datum/runtimeError/StringLimit
|
||||
name = "StringSizeOverflow"
|
||||
message = "Maximum string size reached"
|
||||
|
||||
Reference in New Issue
Block a user