Skip to content
Snippets Groups Projects
Commit 8239ab05 authored by Ralf Jung's avatar Ralf Jung
Browse files

ProofMode intro patterns: accept _ as part of variable names

parent d0743f7e
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,6 @@ Module intro_pat. ...@@ -29,7 +29,6 @@ Module intro_pat.
Inductive token := Inductive token :=
| TName : string token | TName : string token
| TAnom : token | TAnom : token
| TDrop : token
| TFrame : token | TFrame : token
| TBar : token | TBar : token
| TBracketL : token | TBracketL : token
...@@ -55,7 +54,6 @@ Fixpoint tokenize_go (s : string) (k : list token) (kn : string) : list token := ...@@ -55,7 +54,6 @@ Fixpoint tokenize_go (s : string) (k : list token) (kn : string) : list token :=
match s with match s with
| "" => rev (cons_name kn k) | "" => rev (cons_name kn k)
| String "?" s => tokenize_go s (TAnom :: cons_name kn k) "" | String "?" s => tokenize_go s (TAnom :: cons_name kn k) ""
| String "_" s => tokenize_go s (TDrop :: cons_name kn k) ""
| String "$" s => tokenize_go s (TFrame :: cons_name kn k) "" | String "$" s => tokenize_go s (TFrame :: cons_name kn k) ""
| String "[" s => tokenize_go s (TBracketL :: cons_name kn k) "" | String "[" s => tokenize_go s (TBracketL :: cons_name kn k) ""
| String "]" s => tokenize_go s (TBracketR :: cons_name kn k) "" | String "]" s => tokenize_go s (TBracketR :: cons_name kn k) ""
...@@ -77,6 +75,7 @@ Fixpoint tokenize_go (s : string) (k : list token) (kn : string) : list token := ...@@ -77,6 +75,7 @@ Fixpoint tokenize_go (s : string) (k : list token) (kn : string) : list token :=
| String a s => | String a s =>
if is_space a then tokenize_go s (cons_name kn k) "" if is_space a then tokenize_go s (cons_name kn k) ""
else tokenize_go s k (String a kn) else tokenize_go s k (String a kn)
(* TODO: Complain about invalid characters, to future-proof this against making more characters special. *)
end. end.
Definition tokenize (s : string) : list token := tokenize_go s [] "". Definition tokenize (s : string) : list token := tokenize_go s [] "".
...@@ -129,9 +128,9 @@ Fixpoint close_conj_list (k : stack) ...@@ -129,9 +128,9 @@ Fixpoint close_conj_list (k : stack)
Fixpoint parse_go (ts : list token) (k : stack) : option stack := Fixpoint parse_go (ts : list token) (k : stack) : option stack :=
match ts with match ts with
| [] => Some k | [] => Some k
| TName "_" :: ts => parse_go ts (SPat IDrop :: k)
| TName s :: ts => parse_go ts (SPat (IName s) :: k) | TName s :: ts => parse_go ts (SPat (IName s) :: k)
| TAnom :: ts => parse_go ts (SPat IAnom :: k) | TAnom :: ts => parse_go ts (SPat IAnom :: k)
| TDrop :: ts => parse_go ts (SPat IDrop :: k)
| TFrame :: ts => parse_go ts (SPat IFrame :: k) | TFrame :: ts => parse_go ts (SPat IFrame :: k)
| TBracketL :: ts => parse_go ts (SList :: k) | TBracketL :: ts => parse_go ts (SList :: k)
| TBar :: ts => parse_go ts (SBar :: k) | TBar :: ts => parse_go ts (SBar :: k)
......
...@@ -42,6 +42,7 @@ Fixpoint tokenize_go (s : string) (k : list token) (kn : string) : list token := ...@@ -42,6 +42,7 @@ Fixpoint tokenize_go (s : string) (k : list token) (kn : string) : list token :=
| String a s => | String a s =>
if is_space a then tokenize_go s (cons_name kn k) "" if is_space a then tokenize_go s (cons_name kn k) ""
else tokenize_go s k (String a kn) else tokenize_go s k (String a kn)
(* TODO: Complain about invalid characters, to future-proof this against making more characters special. *)
end. end.
Definition tokenize (s : string) : list token := tokenize_go s [] "". Definition tokenize (s : string) : list token := tokenize_go s [] "".
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment