markup non-identifier keyword as operator;
authorwenzelm
Sun, 30 May 2010 14:14:30 +0200
changeset 37192 8cdddd689ea9
parent 37191 beb9a8695263
child 37193 a4b2bb0dab08
markup non-identifier keyword as operator;
lib/html/isabelle.css
src/Pure/General/markup.ML
src/Pure/Thy/thy_syntax.ML
--- a/lib/html/isabelle.css	Sun May 30 13:47:12 2010 +0200
+++ b/lib/html/isabelle.css	Sun May 30 14:14:30 2010 +0200
@@ -38,6 +38,7 @@
 .loc, loc  { color: #D2691E; }
 
 .keyword, keyword      { font-weight: bold; }
+.operator, operator    { }
 .command, command      { font-weight: bold; }
 .ident, ident          { }
 .string, string        { color: #008B00; }
--- a/src/Pure/General/markup.ML	Sun May 30 13:47:12 2010 +0200
+++ b/src/Pure/General/markup.ML	Sun May 30 14:14:30 2010 +0200
@@ -83,6 +83,7 @@
   val keyword_declN: string val keyword_decl: string -> T
   val command_declN: string val command_decl: string -> string -> T
   val keywordN: string val keyword: string -> T
+  val operatorN: string val operator: T
   val commandN: string val command: string -> T
   val identN: string val ident: T
   val stringN: string val string: T
@@ -271,6 +272,7 @@
 fun command_decl name kind : T = (command_declN, [(nameN, name), (kindN, kind)]);
 
 val (keywordN, keyword) = markup_string "keyword" nameN;
+val (operatorN, operator) = markup_elem "operator";
 val (commandN, command) = markup_string "command" nameN;
 val (identN, ident) = markup_elem "ident";
 val (stringN, string) = markup_elem "string";
--- a/src/Pure/Thy/thy_syntax.ML	Sun May 30 13:47:12 2010 +0200
+++ b/src/Pure/Thy/thy_syntax.ML	Sun May 30 14:14:30 2010 +0200
@@ -67,13 +67,17 @@
   | Token.Sync          => Markup.control
   | Token.EOF           => Markup.control;
 
+fun token_markup tok =
+  if Token.keyword_with (not o Syntax.is_identifier) tok then Markup.operator
+  else token_kind_markup (Token.kind_of tok);
+
 in
 
 fun present_token tok =
-  Markup.enclose (token_kind_markup (Token.kind_of tok)) (Output.output (Token.unparse tok));
+  Markup.enclose (token_markup tok) (Output.output (Token.unparse tok));
 
 fun report_token tok =
-  Position.report (token_kind_markup (Token.kind_of tok)) (Token.position_of tok);
+  Position.report (token_markup tok) (Token.position_of tok);
 
 end;