-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish dfa optimizer,add antlr style labels and var names
- Loading branch information
Showing
26 changed files
with
207 additions
and
12,040 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package mesut.parserx.gen; | ||
|
||
import mesut.parserx.nodes.*; | ||
|
||
//replaces references with regex contents | ||
public class PrepareLexer extends SimpleTransformer { | ||
|
||
Tree tree; | ||
|
||
public PrepareLexer(Tree tree) { | ||
this.tree = tree; | ||
} | ||
|
||
public Tree prepare() { | ||
for (TokenDecl tokenDecl : tree.tokens) { | ||
transformToken(tokenDecl); | ||
} | ||
return tree; | ||
} | ||
|
||
@Override | ||
public Node transformName(NameNode node, Node parent) { | ||
TokenDecl tokenDecl = tree.getToken(node.name); | ||
if (tokenDecl == null) { | ||
throw new RuntimeException("invalid token: " + node.name); | ||
} | ||
return tokenDecl.regex; | ||
} | ||
} |
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.