Jeremy Dawson
2018-08-06 06:53:46 UTC
Hi,
In the following theory file,
theory Scratch imports Main begin
setup {* Thy_Header.add_keywords
[(("myname", Position.none), (("diag", []), []))] ; *}
ML {*
val _ =
Outer_Syntax.command \<^command_keyword>\<open>myname\<close> "print
myname"
(Scan.succeed (Toplevel.keep (fn _ => writeln "jeremy")));
*}
print_commands
print_commands
myname
end
the print_commands commands shows that the new command "myname" has been
added, but when we get to using it, it fails with a message like
command expected but identifier myname found
Why is this?
When I replace the use of Thy_Header.add_keywords with inserting
keyword myname :: "diag" in the theory file header it works OK
What is happening here?
Thanks
Jeremy
In the following theory file,
theory Scratch imports Main begin
setup {* Thy_Header.add_keywords
[(("myname", Position.none), (("diag", []), []))] ; *}
ML {*
val _ =
Outer_Syntax.command \<^command_keyword>\<open>myname\<close> "print
myname"
(Scan.succeed (Toplevel.keep (fn _ => writeln "jeremy")));
*}
print_commands
print_commands
myname
end
the print_commands commands shows that the new command "myname" has been
added, but when we get to using it, it fails with a message like
command expected but identifier myname found
Why is this?
When I replace the use of Thy_Header.add_keywords with inserting
keyword myname :: "diag" in the theory file header it works OK
What is happening here?
Thanks
Jeremy