diff --git a/README.md b/README.md index 3e354f5..09ff1f5 100644 --- a/README.md +++ b/README.md @@ -203,7 +203,6 @@ private static Lexeme ScanNumber(ILexemeBuilder builder) ? builder.Build(new NumberToken(number)) : throw new Exception("Could not parse number: " + builder.CurrentToken); } -} ``` ## Line position calculation @@ -283,16 +282,17 @@ The Match function works very similar to the lexeme factory, when the rule match This is illustrated in this simple example, where we call `Discard()` to advance the stream only when we create a `Lexeme`. ```cs - public Option Match(ILexemeBuilder builder) +public Option Match(ILexemeBuilder builder) +{ + if (builder.Peek() is '=') { - if (builder.Peek() is '=') - { - builder.Discard() + builder.Discard(); - return builder.Build(new EqualToken()) - } else { - return Option.None; - } + return builder.Build(new EqualToken()); + } else { + return Option.None; + } +} ``` ## Change the default implementations. @@ -348,8 +348,8 @@ When registering the reader you have access to the `expression` as given to the `ILexemeWalker` is usually stateful (track the position and change it on `Pop`) and has two methods to implemlent. ```cs - Lexeme Pop(); - Lexeme Peek(int lookAhead = 0); +Lexeme Pop(); +Lexeme Peek(int lookAhead = 0); ``` When registering the reader you have access to the `lexemes` and the `newEpsilonToken` factory delegate.