[svn] r5868: nemerle/trunk/ncc: parsing/PreParserIndent.n
testsuite/positive/indentation-syntax.n
malekith
svnadmin at nemerle.org
Sun Oct 30 14:54:07 CET 2005
Log:
Don't generate ; when there was one already or when the next line begins with {.
Author: malekith
Date: Sun Oct 30 14:54:06 2005
New Revision: 5868
Modified:
nemerle/trunk/ncc/parsing/PreParserIndent.n
nemerle/trunk/ncc/testsuite/positive/indentation-syntax.n
Modified: nemerle/trunk/ncc/parsing/PreParserIndent.n
==============================================================================
--- nemerle/trunk/ncc/parsing/PreParserIndent.n (original)
+++ nemerle/trunk/ncc/parsing/PreParserIndent.n Sun Oct 30 14:54:06 2005
@@ -41,6 +41,7 @@
mutable insertLocation : Location;
mutable had_some_real_input : bool;
+ mutable last_token_was_semicolon : bool;
mutable force_brace_after_newline : bool;
indent_strings : Stack [string] = Stack (20);
@@ -71,6 +72,8 @@
unless (lexer_tok is Token.EndOfFile)
had_some_real_input = true;
+ last_token_was_semicolon = lexer_tok is Operator (";");
+
match (lexer_tok) {
| Token.EndOfFile =>
insertLocation = lexer_tok.Location;
@@ -217,7 +220,9 @@
// If we have remained at the same indentation level
if (new_indent == CurrentIndent) {
- when (had_some_real_input) {
+ when (had_some_real_input &&
+ !last_token_was_semicolon &&
+ !(tok is Token.BeginBrace)) {
//Message.Debug (tok.Location, $"Generate ';'");
tokens_pending.Push (Token.Semicolon (insertLocation, true));
}
Modified: nemerle/trunk/ncc/testsuite/positive/indentation-syntax.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/indentation-syntax.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/indentation-syntax.n Sun Oct 30 14:54:06 2005
@@ -5,18 +5,22 @@
// 6. Add 'set' keyword for namespace and class
// 7. Add two kinds of line-continuation
-using System.Console
+using System.Console;
using Nemerle.Utility
set namespace Test
set class App
[Accessor] \
-static some_field : int = 12;
+static some_field : int = 12
[Accessor] \
static some_field_2 : int = 12;
+foo () : void
+{
+}
+
static Main() : void
// 3.
Write("Hello")
@@ -24,7 +28,7 @@
// 4.
def n = 1
when (n > 0)
- Write(", World")
+ Write(", World");
WriteLine("!")
// 5.
@@ -42,7 +46,7 @@
b
)
def d = a +
- c
+ c;
match ("foo")
| "bar" => {}
| "foo" => {}
More information about the svn
mailing list