+ - * / % ^
|
Arithmetic Operators |
== += -= *= /= %= ^=
&= |= ~=
:<<:= :>>:= :>>>:=
.=
|
Assignment Operators |
& | ~ !
:<<: :>>: :>>>:
|
Bitwise Operators |
== != < <= > >=
|
Comparison Operators |
| ` |
|
&& |
Operand And |
. |
Context Access Operator |
?. |
Conditional Access Operator |
.[...] |
Context Block Operator |
?.[...] |
Conditional Context Block Operator |
->Type ->(as Type)
|
Conversion Operators |
(...) |
Expression Grouping Operator |
(value1,value2...) (name1:value1,...)
|
Tuple Creation |
[...] |
Indexed Access Operator |
?[...] |
Conditional Indexed Access Operator |
// |
String-Indexed Access Operator |
?// |
Conditional String-Indexed Access Operator |
and or xor not ?
|
Logical Operators |
.. ..< ..> downTo
|
Range Operators |
is is not
|
Reference Comparison Operators |
++ --
|
Stepper Operators |
instanceOf isType $hasMethod, $isCompound $isPrimitive $isReference
|
Type Evaluation Operators |
=> |
obj => m creates a callback function that calls obj.m(...) when invoked. |
?=> |
obj ?=> m creates a callback function using a weak reference to the context object. |
@[...] |
Creates a Variant list using the same internal syntax as a JSON array. |
@{...} |
Creates a Variant table using the same internal syntax as a JSON object. With key:value pairs, the key can be either a literal string or an identifier (local person = @{ name:{first:"Brom",last:"Bresenham"}, id:1 }). |
&flag_param, &default_param=<value>
|
This is the named argument, flag parameter, and default parameter syntax used for Named Arguments in method calls and methods. |
@property_name |
Performs a direct property access that bypasses getter and setter methods. |
%value |
Calls description() on the value if non-null or else evaluates to literal String "null". |
<<TypeName>> |
Returns the TypeInfo metaclass of the specified type name. Part of Rogue's Introspection (AKA Reflection) system. |
| [abstract] |
[abstract] classes cannot be instantiated, but they can be extended and they can be used as object reference types. [abstract] methods have a signature (specification) but no statements (definition). They must be overridden in an extended class or else the extended class must also be [abstract]. Classes containing [abstract] methods must in turn be declared [abstract]. |
| [append] |
Aspects and Augments can mark methods as [append], which merges them with any existing method in the target class. |
$api |
Meta-command that gives selected classes or libraries the [api] attribute. |
| [api] |
A library marked [api] ensures that all classes within the library are given the [api] attribute. A class marked [api] ensures the class and all of its methods are marked [essential], which makes them part of the transpiled C output. |
| aspect |
Aspects are similar to Java interfaces but also allow for property and method definitions. |
| assert |
In --debug mode, assert <expression> throws an AssertionError if the given expression is not truthy. In release mode no check is performed. |
| augment |
Augments can modify classes outside of their original definitions. This can be used for separation of concerns or to patch a class definition. |
| [bitflags] |
An enum with the [bitflags] attribute defines its category values as powers of two - 1,2,4,8,... instead of 0,1,2,3,.... |
| block |
An independently-scoped block of code. |
| Byte |
Unsigned 8-bit integer (unsigned char). |
| CATEGORIES |
The default class section for an enum. |
| Character |
Unsigned 32-bit value designed to hold Unicode characters. |
| class |
Define a new datatype as a standard object class or a pass-by-value compound class. |
| Comments |
# single-line, #{...multi-line...}#, ----...HR comment..., ====...HR comment.... |
| Compounds |
Compounds are pass-by-value objects. |
| contingent |
contingent control structure (contingent / necessary / sufficient / escapeContingent / satisfied / unsatisfied / endContingent). |
| Conversion Methods |
Methods that define how conversions between various types are performed. |
| [critical] [criticalOverride] |
A method overriding a [critical] method must make a prior call to the critical method or else include the [criticalOverride] attribute. In addition, a critical method override automatically becomes a [critical] method itself. |
| $defaultValue<<OfType>> |
A templated command that evaluates to the default value of a given type (0/false/null/etc.). |
| $define |
Define an identifier as an arbitrary expression. |
| ensure<<variable>>(args) |
A templated command that creates and assigns a new object if the given reference variable is null or zero. |
| enum |
Create an enumerated type. |
| escapeBlock escapeContingent escapeForEach escapeIf escapeLoop escapeTry escapeWhile |
Escape commands analogous to break in C-family languages. |
| [essential] |
An [essential] class is included in the transpiled C output even if it is unused. If a class is an [essential singleton] then the singleton is created on launch instead of on first use. Unused methods will be culled from an [essential] class unless the methods are marked [essential] as well. Giving a class the [api] attribute makes the class and all of its methods [essential]. |
| $exists<<...>> |
Templated meta-command the evaluates to true or false depending on whether the enclosed access commmand is valid. Valid access commands are TypeName, Constructor(...), and object.access(...). |
| [export] |
A uses attribute which specifies that a library used by this library is also automatically used by any other libraries that use this library. |
| [fallback] |
If a [fallback] method (named e.g. x() or set_x(...)) is a getter or setter for a property of the same name (x), the property will be accessed directly when possible without going through the access method. This can be useful for method-only aspect classes which are incorporated into regular classes that define a property with the same name. |
| [faux] |
A property attribute used to create a Rogue-side reflection of a native property. |
| $fileBytes(...) |
Meta-command that loads a file as a Byte[] list at compile time. |
| $fileString(...) |
Meta-command that loads a file as a literal String at compile time. |
| forEach |
A control structure to iterate over all the values in a collection or a numerical range. |
| Function |
Defines a function type. |
| function |
Defines a function. |
| Functors |
Convenience syntax that allows objects to be used like functions. If a class defines a method call(...), then writing obj(...) translates into obj.call(...). |
| GLOBAL METHODS |
Begins a class section that defines global methods (AKA static methods). |
| GLOBAL PROPERTIES |
Begins a class section that defines global properties (AKA static properties). |
<GlobalID> |
A GlobalID program-global enumeration. |
| $id(...) |
Meta-command that concatenates and converts one or more tokens into an "identifier" token. |
| if/elseIf/else/endIf |
Standard conditional control structure. |
| if-local |
Similar to Swift's if-let. |
| $include |
Includes the specified file as part of the project. |
| $includeFolder |
Recursively includes .rogue source files in a specified folder. |
| instanceOf |
Type evaluation operator. |
| [insert] |
Aspects and Augments can mark methods as [insert], which merges them with any existing method in the target class. |
| $isCompound<<Type>> |
Type evaluation operator. |
| $isDefined(...) |
Evaluates to true if the specified ID has been $defined, or false if not. |
| $isEnum<<Type>> |
Type evaluation operator. |
| $isPrimitive<<Type>> |
Type evaluation operator. |
| $isReference<<Type>> |
Type evaluation operator. |
| isType |
Type evaluation operator. |
| Int32 |
32-bit integer (int). |
| Int64 |
64-bit integer (long long int). |
| Lists |
Rogue uses mutable arrays called Lists (AKA array-lists). |
| local |
Declares local variables. |
| $localDefine |
A define that is scope-limited to the remainder of the current file. |
| $localMacro |
A macro that is scope-limited to the remainder of the current file. |
| localize |
localize x is shorthand for local x = x. It's a more elegant way to cache a local copy of a property or method call. It also works with any complex expression that ends with a final named access. For example, localize st.split(',') is equivalent to local split = st.split(','). Syntax: localize expression1 [, expression2, ...]
|
| Logical |
true or false (boolean). |
| loop/loop(n)/endLoop |
Simple loop structure for infinite loops and fixed count loops. |
| $lowercase(...) |
Meta-command that concatenates and converts one or more tokens into a literal lowercase string token. |
| $macro |
Create a function-style macro that replaces its call with a parameterized code block. |
| METHODS |
Begins a class section containing object methods. |
| library |
Sets the library (namespace) that any following program elements will belong to. |
| mutating |
Allows a compound method to alter properties of this compound. |
| NATIVE |
Begins a native code class section. |
| native "..." |
Specifies a native property belonging to a class. |
| native(...) |
An inline native expression. |
| nativeHeader |
Arbitrary code written to the generated .h file. |
| nativeCode |
Arbitrary code written to the generated .c file (or .cpp etc.). |
| nativeType |
Defines a datatype that can be used to pass native values of an arbitrary C type between Rogue and C. |
| necessary |
Conditional control change for the enclosing contingent. |
| new<<expression>>(args) |
Templated operator that uses the type of the template expression to create a new object. |
| nextIteration |
Proceeds to the next iteration of the current loop, skipping any remaining statements in the current iteration. Analogous to continue in C-family languages. |
| [novel] |
An opt-in safety attribute that ensures the current method is not overriding a prior (base class) method with the same signature. See also [override]. |
| null |
A null object reference. |
| Operator Methods |
Methods that allow math operators (+, -, etc.) to be used with objects and compounds. |
| Optional Types |
Any type name ending with ? is an optional type. |
| [override] |
An opt-in safety attribute that ensures the current method overrides a prior (base class) method with the same signature. See also [novel]. |
| [preferred] |
A [preferred] method will be chosen among otherwise ambiguous methods when resolving a call. |
| Primitives |
Built-in pass-by-value variable types: Logical, Byte, Character, Int32, Int64, Real32, Real64. |
| print |
Print one or more expressions to the standard output. |
| println |
Print zero or more expressions to the standard output followed by a newline. |
| prior |
Calls the overridden version of a method. Known as super in some languages. |
| prior<<BaseType/>/> |
Calls the overridden version of a method. Known as super in some languages. |
| [propagated] |
A [propagated] method is treated as an override in extended classes instead of being inherited, which affects the types of this, $thisType, and ThisType. |
| PROPERTIES |
A class section that declares object properties (instance variables/member variables). |
| Real32 |
32-bit real number (float). |
| Real64 |
64-bit real number (double). |
| $requireRogue |
Specifies the minimum version of Rogue required to compile. |
| return |
Terminates execution of the current method or routine, optionally returning a value. |
| $rogueVersion |
Evaluates to a string containing the version of Rogue supported by the compiler. |
| roguec |
The Rogue compiler. |
| $rot13(...) |
Meta-command that concatenates and converts one or more tokens into a literal string token with rot13 lightweight obfuscation applied. Use String.rot13() to deobfuscate. |
| $rot47(...) |
Meta-command that concatenates and converts one or more tokens into a literal string token with rot47 lightweight obfuscation applied. Use String.rot47() to deobfuscate. |
| routine |
A global-scope/library-scope procedure (AKA function). |
| satisfied |
A contingent clause executed when a contingent has a sufficient condition or if all contingent statements execute with all necessary conditions evaluating to true. |
| singleton |
Allows the type name to be used as a reference to a singleton object of that type. |
| $sourceFilepath |
Evaluates to the String filepath of the current source file. |
| $sourceLine |
Evaluates to the Int32 current line number. |
| STATES |
Begins a class section of state machine syntax. |
| $string(...) |
Meta-command that concatenates and converts one or more tokens into a literal string token. |
| String |
Built-in variable type for storing text. |
| subclass |
Begins an anonymous subclass definition. |
| sufficient |
Conditional control change for the enclosing contingent. |
| swapValues |
swapValues(a,b) exchanges the values of variables a and b. |
| Tables |
Rogue uses Tables to implement key-value collections (AKA dictionaries or maps). |
| $target(...) |
Compile-time check to determine if a particular compile target has been specified. |
| temporarily |
Temporarily reassigns an existing value within the scope of this control structure. |
$thisModule |
Meta-identifier that gets replaced with the name of the current library. Most useful in macros. |
$thisType |
A special type name that resolves to the current type context before aspect methods are incorporated. Operates at the token level. More flexible than ThisType (allowing for $thisType[] etc.) but in aspects is constrained to reference the aspect type rather than the incorporating class type. |
| ThisType |
A special type name that resolves to the current type context after aspect methods are incorporated. Operates at the AST node level. Less flexible than $thisType (cannot write ThisType[] etc.) but when used in aspects methods, refers to the incorporating class type rather than the aspect type. |
| throw |
Throws an exception that can be handled with a try/catch further up the call stack. |
| trace |
Print debug info. |
| try/catch |
Exception handling. |
| Tuples |
Ad-hoc compounds that can group multiple values without explicitly defining a class. |
| undefined |
A literal of type Variant, equivalent to Variant(). |
| unsatisfied |
A contingent clause executed when a necessary contingent condition is false. |
| $uppercase(...) |
Meta-command that concatenates and converts one or more tokens into a literal uppercase string token. |
| use |
Allows structured access to arbitrary resources. |
| uses |
Includes the specified library file and adds its namespace to the current library. |
| JSON |
A class that parses a JSON string or file and returns it as a Variant. |
| Variant |
A datatype which can be assigned many different types of values and can be encoded as a JSON string. |
| which{a:x||y} ?:{a:x||y} |
The inline which is analogous to C's decision operator (AKA ternary operator). |
| which/case/others/endWhich |
Selection control structure analogous to switch. |
| whichIs/case/others/endWhichIs |
Similar to which but uses is instead of == to test. |
| while/endWhile |
Standard conditional loop. |