Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: token propagation when using a custom scanner (#51)
Hi. I just noticed that the Token.template file in the Std directory uses an old representation of how token names get propagated into a Token.java file when using plcc.py with the '!pattern=' flag in the input file. The '!pattern=' flag is typically used when writing a compiler and not a PLCC-generated interpreter. In this case, the user must supply a stand-alone scanner (Scan.java) instead of using the Scan.java found in the Std library directory. Such a Scan.java file must still implement the IScan interface, so its 'cur' method must still return a Token object. Token.template (instead of Token.pattern) in the Std library is used to generate Token.java when PLCC is flagged to use a hand-crafted scanner other than the Scan.java in the Std directory. Note that this only applies in the case where PLCC is used to create a compiler instead of an interpreter. I have uploaded Token.template into the plcc.pithon.net directory. This will *not* have any effect on any of the examples in the Code directory, since none of these examples use the '!pattern=' flag. Tim Co-authored-by: Timothy Fossum <[email protected]>
- Loading branch information