Parser error checking

Errors are something you must embrace if you wish to become an awesome coder. No matter how awesome you get, you will always have errors—but your errors will become progressively more interesting.

Warnings and errors are two of the hippest and coolest things about SkookumScript. Developers experience warnings and errors every day, and it pays to have a good workflow associated with them. Before attempting to run your code, the SkookumScript parser does as much up-front work as possible to detect errors. SkookumScript can detect over 150 kinds of errors, and issue seven different warnings of varying sternness. (Don’t worry, you’ll experience them all eventually.)

Lexical (spelling) errors

Everybody makes typos (or as Computer Science PhDs prefer to call them, “booby-boo-boos”). But luckily for humanity, SkookumScript’s sophisticated error-checking will prevent your typos from causing mayhem on a planetary scale. (Well, usually.)

println("Hello, world!")
printl("I'll be your megalomaniacal overlord for today.")

If you select the above two lines and press F4, you will get the following rap on the knuckles:

ERROR: The method 'printl()' does not exist for an instance of
the class 'SkookumDemo'.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
println("Hello, world!")
printl("I'll be your megalomaniacal overlord for today.")
-----^ <<<< Line: 2, columns: 1-7
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

As you can see, an n is missing in println. Just type in the fix (perhaps assisted by auto-complete, which, if anything, is usually over-eager to make suggestions) and try again.

Note that no part of a code selection will be executed if the parser encounters an error in any part of the selection.

Syntax (grammar) errors

This bit of code is missing an end bracket:

42.max(33.min(11.max(9))

If you evaluate it, you will get the following sharp slap on the buttocks:

ERROR: Expected the end of the invocation list ')', but did not
find it. [Too many arguments supplied?]
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
42.max(33.min(11.max(9))
>>>>>>>>>>>>>>>>>>>>>>> ^ <<<< Line: 1, column: 25
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

The compiler will heroically attempt to pinpoint the location where the fix should go. Yes, it’s still a hero even it turns out to be incorrect.

Semantic (meaning and logic) errors

Sometimes code might look error-free at first glance, yet still have errors in logic or meaning. The SkookumScript compiler will craftily catch these too.

42.max("amok")

If you try to execute the above code, you will get the following slap across the face with a cold, wet fish:

ERROR: The argument supplied to parameter named 'num' was
expected to be of type 'Integer' and it is type 'String' which
is not compatible.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
42.max("amok") 
>>>>>>>>>>>> ^ <<<< Line: 1, column: 14
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

The max() method expects a number, not a string.

More helpful help from the SkookumIDE compiler

The SkookumIDE has a few mechanisms to spot and prevent errors, even as you are typing code.

Auto-parse

If you enable the “View” → “Toggle Auto-Parse Selections” setting, the compiler will automatically parse any text you select to determine if it is valid. If it is not valid, the compiler adds a red wavy underline to the problem area. This is a valuable early-warning system that saves you the humiliation of pressing F4 and being swiftly rejected.

Enabling the “View” → “Toggle Auto-Parse Editor” setting does the same thing for files (such as methods and coroutines) in the source editor window, even when you don’t have text selected.

Bracket highlighting

The bracket grouping symbols—[ ] for blocks, ( ) for invocation arguments, and { } for lists—all have slight color differences between different group pairs, with three alternating colors representing levels of nesting. In the default color style, the first bracket for a group will be a bright light green, the next will be a slightly darker green, and the next will be darker still. Each matching closing bracket will have a matching color, so you can tell at a glance which brackets match.

Class highlighting

When you type class names into a SkookumIDE workbench or editor window, valid (known) classes will be colored default yellow, while invalid (unknown) classes will be colored default orange. This catches class name typos as they are being written—and more importantly, it adds a refreshing default citrus ambiance to your code.