8000 Recursive rules · Issue #14 · sliekens/Txt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 24, 2020. It is now read-only.

Recursive rules #14

Open
sliekens opened this issue Apr 30, 2016 · 1 comment
Open

Recursive rules #14

sliekens opened this issue Apr 30, 2016 · 1 comment

Comments

@sliekens
Copy link
Owner

It's not possible right now to construct a rule that references itself.

grouping = "(" *(ALPHA / grouping) ")"
         ; matches ()
         ; matches (abc)
         ; matches (abc())
         ; matches (abc(abc))
         ; etc.

The reason is that, for this example, the GroupingLexer must be materialized before it can be added to its own list of lexer rules. This is not supported right now because of an oversight.

@sliekens sliekens added the bug label Apr 30, 2016
@sliekens
Copy link
Owner Author

Probably the best option at this time is to add a delegating lexer class that can be configured after materializing the lexer rule.

var proxy = new DelegatingLexer<Grouping>();
var groupingLexer = new GroupingLexer(..., proxy);
proxy.Rule = groupingLexer;

All problems in computer science can be solved by another level of indirection

sliekens added a commit that referenced this issue Apr 30, 2016
 Relates to #14
sliekens added a commit that referenced this issue Apr 30, 2016
Relates to #14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant
0