Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Lean/Parser/Term.lean
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ namespace Term
def byTactic' := leading_parser
"by " >> Tactic.tacticSeqIndentGt

/-- `termBeforeBy` is defined as `withForbidden("by", term)`, which will parse a term but
disallows `by` outside of a bracketing construct. This is used for parsers like `show p by ...`
or `suffices p by ...`, where we do not want `p by ...` to be parsed as an application of `p` to a
`by` block, which would otherwise be allowed. -/
def termBeforeBy := withForbidden "by" termParser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, since this is not used anywhere yet, you'll have to tag it with @[run_builtin_parser_attribute_hooks] to make the alias work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need to use it in this file, but I had originally left this for the follow-up PR. I've now added the two uses in this PR.


-- TODO: rename to e.g. `afterSemicolonOrLinebreak`
def optSemicolon (p : Parser) : Parser :=
ppDedent $ semicolonOrLinebreak >> ppLine >> p
Expand Down Expand Up @@ -1036,6 +1042,7 @@ builtin_initialize
register_parser_alias attrKind
register_parser_alias optSemicolon
register_parser_alias structInstFields
register_parser_alias termBeforeBy

end Parser
end Lean
2 changes: 2 additions & 0 deletions src/stdlib_flags.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "util/options.h"

// please update stage0

namespace lean {
options get_default_options() {
options opts;
Expand Down
Loading