[svn] r5867: nemerle/trunk/ncc: parsing/PreParserIndent.n
testsuite/positive/indentation-syntax.n
malekith
svnadmin at nemerle.org
Sun Oct 30 14:19:21 CET 2005
Log:
Kill the line-starts-with-operator rule. Make backslash always merge lines.
Author: malekith
Date: Sun Oct 30 14:19:21 2005
New Revision: 5867
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:19:21 2005
@@ -43,7 +43,6 @@
mutable had_some_real_input : bool;
mutable force_brace_after_newline : bool;
- mutable skip_semicolon : bool;
indent_strings : Stack [string] = Stack (20);
tokens_pending : Queue [Token] = Queue ();
@@ -72,10 +71,6 @@
unless (lexer_tok is Token.EndOfFile)
had_some_real_input = true;
- when (skip_semicolon)
- throw PreParserException (lexer_tok.Location,
- "unexpected `\\' in middle of a line");
-
match (lexer_tok) {
| Token.EndOfFile =>
insertLocation = lexer_tok.Location;
@@ -91,8 +86,13 @@
tokens_pending.Push (lexer_tok);
- | Token.Operator ("\\") =>
- skip_semicolon = true;
+ | Token.Operator ("\\") when indentation_syntax_active =>
+ match (lexer.GetToken ()) {
+ | Token.Indent => {}
+ | _ =>
+ throw PreParserException (lexer_tok.Location,
+ "unexpected `\\' in middle of a line");
+ }
| BeginBrace
| BeginRound
@@ -205,9 +205,6 @@
get_token_after_indent (tok, new_indent)
| _ =>
- def add_semicolon = had_some_real_input && !skip_semicolon;
- skip_semicolon = false;
-
// If we have not unindented
if (new_indent.Length >= CurrentIndent.Length) {
//Message.Debug ($ "ni=$(display_space(new_indent)) ci=$(display_space(CurrentIndent))");
@@ -220,7 +217,7 @@
// If we have remained at the same indentation level
if (new_indent == CurrentIndent) {
- when (add_semicolon) {
+ when (had_some_real_input) {
//Message.Debug (tok.Location, $"Generate ';'");
tokens_pending.Push (Token.Semicolon (insertLocation, true));
}
@@ -229,18 +226,12 @@
}
// If we've indented further than the previous line
else {
- match (tok) {
- | Token.Operator (x) when x != "|" =>
- handle_real_token (tok)
-
- | _ =>
indent_strings.Push (new_indent);
tokens_pending.Push (Token.BeginBrace (insertLocation, true));
handle_real_token (tok);
//Message.Debug (tok.Location, "Generate '{'");
}
}
- }
// Otherwise, we've unintented:
else {
if (indent_strings.Contains (new_indent)) {
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:19:21 2005
@@ -14,6 +14,9 @@
[Accessor] \
static some_field : int = 12;
+[Accessor] \
+ static some_field_2 : int = 12;
+
static Main() : void
// 3.
Write("Hello")
More information about the svn
mailing list