LiteScript icon indicating copy to clipboard operation
LiteScript copied to clipboard

ERROR: test.lite:2:1. Module: found ' '(EOF) but 'NEWLINE' required

Open mationai opened this issue 10 years ago • 2 comments

I have a simple test.lite file, created simply via vi:

print "hi"

lite -run test.lite gave me:

ERROR: test.lite:3:1. Module: found ' '(EOF) but 'NEWLINE' required

Again, the file is created simply with vi, so file encoding is the standard unix (on OSX). Also, why does it say line 3? The file only as a single line, w/o any CRs.

running the latest v0.8.8 Build

mationai avatar Oct 22 '14 00:10 mationai

Try indenting 4 spaces the line. code is always indented at least 4 spaces. (Note: ''' won't do).

$ echo "    print 'hi'">test.lite
$ lite -v 0 -run test.lite
hi

$ echo "print 'hi'">test.lite
$ lite -v 0 -run test.lite
 ERROR: test.lite:3:1. Module: found ' '(EOF) but 'NEWLINE' required 
 test.lite:3:1. Module: found ' '(EOF) but 'NEWLINE' required 

luciotato avatar Oct 22 '14 04:10 luciotato

Would separating the requirement to have 4 indented spaces to only .md files be worth while? I like liteScript for its smart static type system and other goodies, not for the .md part, so forcing 4 spaces everywhere is a bad idea for my use case (and I imagine for many or perhaps most people too). I tried to remove that requirement from Grammar and Parser, but blockIndent <= parentIndent still failed in ASTBase. So currently I'm adding a step in my gulp process to insert indentations. If I didn't have to do that, it would be great.

mationai avatar Oct 22 '14 18:10 mationai