programming error (function definition not allowed before token)

//---------------------------------------------------------------------
// Program: dual_chaser
//
// Description: 12 LED dual chaser. One led moves from left to right
// while the second LED moves from right to left.
// LEDs and series resistors connected to pins 2 to 13.
//
// Date: 8 April 2016 Author: W.A. Smith
// http://startingelectronics.org
//---------------------------------------------------------------------

// change speed of display here
#define SPEED_MS 100

void setup() {
// set up pins 2 to 13 as outputs
for (int i = 2; i <= 13; i++) {
pinMode(i, OUTPUT);
}
}

uint16_t chase2 = 13; // keeps track of second LED movement

void loop() {
// move first LED from left to right and second from right to left
for (int i = 2; i < 13; i++) {
allLEDsOff();
digitalWrite(i, HIGH); // chaser 1
digitalWrite(chase2, HIGH); // chaser 2
chase2--;
// stop LEDs from appearing to stand still in the middle
if (chase2 != 7) {
delay(SPEED_MS);
}
}

// move first LED from right to left and second LED from left to right
for (int i = 13; i > 2; i--) {
allLEDsOff();
digitalWrite(i, HIGH); // chaser 1
digitalWrite(chase2, HIGH); // chaser 2
chase2++;
// stop LEDs from appearing to stand still in the middle
if (chase2 != 8) {
delay(SPEED_MS);
}
}
}

// function to switch all LEDs off
void allLEDsOff(void)
{
for (int i = 2; i <= 13; i++) {
digitalWrite(i, LOW);
}
}

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup (the smiley face in your code above for example), leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.

The posted code compiles without errors or warnings in ver 1.6.5 of the Arduino IDE, board Arduino Uno.

Sketch uses 1,190 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 11 bytes (0%) of dynamic memory, leaving 2,037 bytes for local variables. Maximum is 2,048 bytes.