-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: completed tokens receiving handling for List nodes. Working with…
… unspecified content resolving
- Loading branch information
Showing
9 changed files
with
252 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,86 @@ | ||
namespace GDShrapt.Reader | ||
using System.Text; | ||
|
||
namespace GDShrapt.Reader | ||
{ | ||
internal class GDContentResolver : GDIntendedResolver | ||
internal class GDContentResolver : GDResolver | ||
{ | ||
new IIntendedTokenReceiver<GDNode> Owner { get; } | ||
public GDContentResolver(IIntendedTokenReceiver<GDNode> owner, int lineIntendation) | ||
: base(owner, lineIntendation) | ||
|
||
readonly StringBuilder _sequence = new StringBuilder(); | ||
|
||
GDSpace _lastSpace; | ||
|
||
public GDContentResolver(IIntendedTokenReceiver<GDNode> owner) | ||
: base(owner) | ||
{ | ||
Owner = owner; | ||
} | ||
|
||
|
||
internal override void HandleCharAfterIntendation(char c, GDReadingState state) | ||
internal override void HandleChar(char c, GDReadingState state) | ||
{ | ||
throw new System.NotImplementedException(); | ||
if (IsSpace(c)) | ||
{ | ||
if (_sequence.Length == 0) | ||
{ | ||
state.PushAndPass(_lastSpace = new GDSpace(), c); | ||
} | ||
else | ||
{ | ||
HandleSequence(_sequence.ToString()); | ||
} | ||
} | ||
else | ||
{ | ||
//if (char. | ||
|
||
if (char.IsLetter(c)) | ||
{ | ||
_sequence.Append(c); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
internal override void HandleNewLineAfterIntendation(GDReadingState state) | ||
private void HandleSequence(string seq) | ||
{ | ||
throw new System.NotImplementedException(); | ||
|
||
} | ||
|
||
internal override void HandleSharpCharAfterIntendation(GDReadingState state) | ||
internal override void HandleNewLineChar(GDReadingState state) | ||
{ | ||
throw new System.NotImplementedException(); | ||
if (_sequence.Length == 0) | ||
{ | ||
if (_lastSpace != null) | ||
{ | ||
Owner.HandleReceivedToken(_lastSpace); | ||
_lastSpace = null; | ||
} | ||
|
||
Owner.AddNewLine(); | ||
} | ||
else | ||
{ | ||
HandleSequence(_sequence.ToString()); | ||
} | ||
} | ||
|
||
internal override void HandleSharpChar(GDReadingState state) | ||
{ | ||
if (_sequence.Length == 0) | ||
{ | ||
if (_lastSpace != null) | ||
{ | ||
Owner.HandleReceivedToken(_lastSpace); | ||
_lastSpace = null; | ||
} | ||
|
||
Owner.HandleReceivedToken(state.PushAndPass(new GDComment(), '#')); | ||
} | ||
else | ||
{ | ||
HandleSequence(_sequence.ToString()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.