Skip to content

Commit

Permalink
Getter setter test
Browse files Browse the repository at this point in the history
  • Loading branch information
bdke committed Nov 6, 2024
1 parent d8e20b6 commit 47639d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/sly/lexer/LexerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ private static BuildResult<ILexer<IN>> BuildRegexLexer<IN>(
{
foreach (var lexeme in lexemes.lexemes)
{
var channel = lexeme.Channel == int.MinValue ? 0 : lexeme.Channel;
lexer.AddDefinition(new TokenDefinition<IN>(tokenID, lexeme.Pattern, channel,
lexer.AddDefinition(new TokenDefinition<IN>(tokenID, lexeme.Pattern, lexeme.Channel,
lexeme.IsSkippable,
lexeme.IsLineEnding));
}
Expand Down
7 changes: 3 additions & 4 deletions src/sly/lexer/attributes/LexemeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ public LexemeAttribute(string pattern, bool isSkippable = false, bool isLineEndi
IsLineEnding = isLineEnding;
}


public LexemeAttribute(GenericToken generic, params string[] parameters)
public LexemeAttribute(GenericToken generic, params string[] parameters)
{
Channel = 0;
GenericToken = generic;
GenericTokenParameters = parameters;
}
Expand Down Expand Up @@ -63,7 +61,8 @@ public LexemeAttribute(GenericToken generic, IdentifierType idType, string start

public bool IsLineEnding { get; set; }

public int Channel { get; set; } = int.MinValue;
private int _channel = int.MinValue;
public int Channel { get => _channel != int.MinValue ? _channel : 0; set => _channel = value; }


public bool HasGenericTokenParameters => GenericTokenParameters != null && GenericTokenParameters.Length > 0;
Expand Down

0 comments on commit 47639d4

Please sign in to comment.