-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the abstract syntax for tokens
Instead of deferring the handling of `$$` to the backends, properly parse the `$$` syntax up front, and store the result in the AST. Note that the GLR backend was improperly substituting the `$$` twice. Now that we have better types, this was surfaced as type error, and then removed. Fixes #295
- Loading branch information
1 parent
43e192a
commit 17d3c93
Showing
9 changed files
with
98 additions
and
64 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
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,13 @@ | ||
module Happy.Grammar.ExpressionWithHole where | ||
|
||
-- | The overall expression is | ||
-- 'tokLeft ++ substitutedForHole ++ tokRight'. | ||
data ExpressionWithHole | ||
= ExpressionWithHole { | ||
exprLeft :: String, | ||
exprRight :: String | ||
} | ||
deriving (Eq, Show) | ||
|
||
substExpressionWithHole :: ExpressionWithHole -> String -> String | ||
substExpressionWithHole (ExpressionWithHole l r) = \repr -> l ++ repr ++ r |
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