vscode-quakec
vscode-quakec copied to clipboard
[DRAFT] Support for MODELGEN Commands
Summary
Provide robust support for MODELGEN commands (called commands in this document for brevity). Specifically the $frame command, which defines names in the scope.
1. Specifications
A command is:
- A line of QuakeC source that begins with the character
$ - Typically a single line, but can be multiline.
- May be followed by 0-n arguments.
- Is considered an error if not recognized.
1.1. $frame Command
- Is a single line command.
- Takes 0-n name arguments.
- Creates a frame macro for each given name.
1.2. Frame Macros
- May only be an rvalue.
- Is of
floattype. - May be defined multiple times.
2. Proposal
TODO: Complete proposal
3. Examples
3.1 Basic Definition
$frame macro1 macro2
Defines two constants $macro1 and $macro2
3.2 Basic RValue Usages
$frame macro1 macro2
void() f = {
local float x = $macro1;
local float y = $macro1 + 1;
};
Valid usages as an rvalue.
3.3 Duplicate Frame Macro Names
$frame macro1 macro2 macro2
Should warn about duplicate name $macro2.
3.4 Using Frame Macro Incorrectly as a Definition
$frame macro1 macro2
$macro1 = 2
Should treat $macro1 as an unknown modelgen command and discard it.
3.5 Using Frame Macro Incorrectly as a Statement
$frame macro1 macro2
void() f = {
$macro1 = 2;
}
Should give an error, complaining that $macro1 is a const value and cannot be assigned.