qscript.compiler.misc

Some misc stuff used by the compiler

Members

Functions

canCallFunction
bool canCallFunction(string fName, DataType[] argTypes)

checks if a function can be called with a set of arguments.

checkBrackets
bool checkBrackets(TokenList tokens, LinkedList!CompileError errors)

Checks if the brackets in a tokenlist are in correct order, and are closed

decodeFunctionName
bool decodeFunctionName(string encodedName, string name, DataType[] argTypes)

reads a byte code style function name into a function name and argument types

decodeString
string decodeString(string s)

decodes a string. i.e, converts \t to tab, \" to ", etc The string must not be surrounded by quoation marks

encodeFunctionName
string encodeFunctionName(string name, DataType[] argTypes)

converts a function name and it's arguments to a byte code style function name

encodeString
string encodeString(string s)

encodes a string. i.e converts characters like tab, newline, to \t, \n ... The string must not be enclosed in quotation marks

matchArguments
bool matchArguments(DataType[] definedTypes, DataType[] argTypes)

matches argument types with defined argument types. Used by ASTGen and compiler.d.

removeWhitespace
string removeWhitespace(string line, char commentStart)

removes "extra" whitespace from a string. i.e, if there are more than 1 consecutive spaces/tabs, one is removed

splitArray
Token[][] splitArray(Token[] array)

splits an array in tokens format to it's elements

strEnd
integer strEnd(string s, uinteger i)

Returns the index of the quotation mark that ends a string

tokenBracketPos
uinteger tokenBracketPos(Token[] tokens, uinteger index)

Returns index of closing/openinig bracket of the provided bracket

Structs

CompileError
struct CompileError

Used by compiler's functions to return error

DataType
struct DataType

used to store data types for data at compile time

Function
struct Function

To store information about a function

Token
struct Token

Each token is stored as a Token with the type and the actual token

TokenList
struct TokenList

To store Tokens with Types where the line number of each token is required

Variables

BOOL_OPERATORS
string[] BOOL_OPERATORS;

An array containing all bool-operators (operators that return true/false)

DATA_TYPES
string[] DATA_TYPES;

data types

IDENT_CHARS
char[] IDENT_CHARS;

An array containing all chars that an identifier can contain

INBUILT_FUNCTIONS
Function[] INBUILT_FUNCTIONS;

Inbuilt QScript functions (like length(void[]))

KEYWORDS
string[] KEYWORDS;

An array containing all keywords

OPERATORS
string[] OPERATORS;

An array containing another array conatining double-operand operators

SOPERATORS
string[] SOPERATORS;

single-operand operators

Meta