jhasse / coffeepp

Little language that compiles into C++
https://bixense.com/coffeepp/
zlib License
31 stars 3 forks source link

Missing } after function when indenting with two spaces #4

Closed Shoozza closed 7 years ago

Shoozza commented 7 years ago

When indenting with spaces (tested with 1, 2, 3, 4 and 8 spaces - same issue) the closing } is missing. No issue when using a single tab for indentation.

Example code:

include stdio.h

int main():
  puts("hi")
  return 0

Expected result:

#include "main.hpp"

#include <stdio.h>

int main() {
  puts("hi");
  return 0;
}

Actual result:

#include "main.hpp"

#include <stdio.h>

int main() {
  puts("hi");
  return 0;

Maybe make sure people only use tabs? The website states following: Choose tabs or a specific number of spaces and stick to your choice throughout your file.

Tested with current master branch (78115dc) on Windows 10. Command: coffee++ main.cf++

jhasse commented 7 years ago

Thanks for opening the issue! I totally forgot about indention with spaces. Should work now, I've added your example as a unit test.

Btw: Unfortunately Coffee++'s code in general is pretty basic and not all features which are presented on the website work in practice :/