Skip to content

Commit 792d9e0

Browse files
committed
remove do not ignore attribute on comments as it does not make sense now we have channels
1 parent d233f94 commit 792d9e0

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/sly/lexer/GenericLexer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,6 @@ public Token<IN> Transcode(FSMMatch<GenericToken> match)
12481248
tok.IsIndent = match.IsIndent;
12491249
tok.IsUnIndent = match.IsUnIndent;
12501250
tok.IndentationLevel = match.IndentationLevel;
1251-
tok.Notignored = match.Result.Notignored;
12521251
tok.Channel = match.Result.Channel;
12531252
tok.DecimalSeparator = match.DecimalSeparator;
12541253
tok.DateTimeValue = match.DateTimeValue;

src/sly/lexer/LexerBuilder.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,29 +412,27 @@ private static IEnumerable<char[]> ParseIdentifierPattern(string pattern)
412412
}
413413
}
414414

415-
private static NodeCallback<GenericToken> GetCallbackSingle<IN>(IN token, bool doNotIgnore, int channel)
415+
private static NodeCallback<GenericToken> GetCallbackSingle<IN>(IN token, int channel)
416416
where IN : struct
417417
{
418418
NodeCallback<GenericToken> callback = match =>
419419
{
420420
match.Properties[GenericLexer<IN>.DerivedToken] = token;
421421
match.Result.IsComment = true;
422422
match.Result.CommentType = CommentType.Single;
423-
match.Result.Notignored = doNotIgnore;
424423
match.Result.Channel = channel;
425424
return match;
426425
};
427426
return callback;
428427
}
429428

430-
private static NodeCallback<GenericToken> GetCallbackMulti<IN>(IN token, bool doNotIgnore, int channel)
429+
private static NodeCallback<GenericToken> GetCallbackMulti<IN>(IN token, int channel)
431430
where IN : struct
432431
{
433432
NodeCallback<GenericToken> callbackMulti = match =>
434433
{
435434
match.Properties[GenericLexer<IN>.DerivedToken] = token;
436435
match.Result.IsComment = true;
437-
match.Result.Notignored = doNotIgnore;
438436
match.Result.CommentType = CommentType.Multi;
439437
match.Result.Channel = channel;
440438
return match;
@@ -636,8 +634,7 @@ private static BuildResult<ILexer<IN>> BuildGenericLexer<IN>(IDictionary<IN, Lis
636634
fsmBuilder.ConstantTransition(commentAttr.SingleLineCommentStart);
637635
fsmBuilder.Mark(GenericLexer<IN>.single_line_comment_start);
638636
fsmBuilder.End(GenericToken.Comment);
639-
fsmBuilder.CallBack(GetCallbackSingle<IN>(comment.Key, commentAttr.DoNotIgnore,
640-
commentAttr.Channel));
637+
fsmBuilder.CallBack(GetCallbackSingle<IN>(comment.Key, commentAttr.Channel));
641638
}
642639

643640
var hasMultiLine = !string.IsNullOrWhiteSpace(commentAttr.MultiLineCommentStart);
@@ -650,8 +647,7 @@ private static BuildResult<ILexer<IN>> BuildGenericLexer<IN>(IDictionary<IN, Lis
650647
fsmBuilder.ConstantTransition(commentAttr.MultiLineCommentStart);
651648
fsmBuilder.Mark(GenericLexer<IN>.multi_line_comment_start);
652649
fsmBuilder.End(GenericToken.Comment);
653-
fsmBuilder.CallBack(GetCallbackMulti(comment.Key, commentAttr.DoNotIgnore,
654-
commentAttr.Channel));
650+
fsmBuilder.CallBack(GetCallbackMulti(comment.Key, commentAttr.Channel));
655651
}
656652
}
657653
}

src/sly/lexer/Token.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public class Token<T> where T:struct
2626
public char DecimalSeparator = '.';
2727
[JsonIgnore]
2828
public char CharDelimiter ='\'';
29-
[JsonIgnore]
30-
public bool Notignored;
29+
3130

3231
[JsonIgnore] private string _hexaPrefix = "0x";
3332

src/sly/lexer/attributes/CommentsAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class CommentAttribute : Attribute
1212

1313
public string SingleLineCommentStart;
1414

15-
public bool DoNotIgnore = false;
1615

1716
public int Channel = 1;
1817

@@ -22,7 +21,7 @@ public CommentAttribute(string singleLineStart, string multiLineStart, string mu
2221
SingleLineCommentStart = singleLineStart;
2322
MultiLineCommentStart = multiLineStart;
2423
MultiLineCommentEnd = multiLineEnd;
25-
DoNotIgnore = doNotIgnore;
24+
//DoNotIgnore = doNotIgnore;
2625
Channel = channel;
2726
}
2827
}

0 commit comments

Comments
 (0)