src/Pure/Isar/args.ML
changeset 58017 5bdb58845eab
parent 58012 0b0519c41229
child 59064 a8bcb5a446c8
equal deleted inserted replaced
58016:28e5ccf4a27f 58017:5bdb58845eab
    37   val internal_name: (string * morphism) parser
    37   val internal_name: (string * morphism) parser
    38   val internal_typ: typ parser
    38   val internal_typ: typ parser
    39   val internal_term: term parser
    39   val internal_term: term parser
    40   val internal_fact: thm list parser
    40   val internal_fact: thm list parser
    41   val internal_attribute: (morphism -> attribute) parser
    41   val internal_attribute: (morphism -> attribute) parser
       
    42   val internal_declaration: declaration parser
    42   val named_source: (Token.T -> Token.src) -> Token.src parser
    43   val named_source: (Token.T -> Token.src) -> Token.src parser
    43   val named_typ: (string -> typ) -> typ parser
    44   val named_typ: (string -> typ) -> typ parser
    44   val named_term: (string -> term) -> term parser
    45   val named_term: (string -> term) -> term parser
    45   val named_fact: (string -> string option * thm list) -> thm list parser
    46   val named_fact: (string -> string option * thm list) -> thm list parser
    46   val named_attribute:
    47   val named_attribute: (string * Position.T -> morphism -> attribute) ->
    47     (string * Position.T -> morphism -> attribute) -> (morphism -> attribute) parser
    48     (morphism -> attribute) parser
       
    49   val text_declaration: (Symbol_Pos.source -> declaration) -> declaration parser
    48   val typ_abbrev: typ context_parser
    50   val typ_abbrev: typ context_parser
    49   val typ: typ context_parser
    51   val typ: typ context_parser
    50   val term: term context_parser
    52   val term: term context_parser
    51   val term_pattern: term context_parser
    53   val term_pattern: term context_parser
    52   val term_abbrev: term context_parser
    54   val term_abbrev: term context_parser
   135 val internal_name = value (fn Token.Name a => a);
   137 val internal_name = value (fn Token.Name a => a);
   136 val internal_typ = value (fn Token.Typ T => T);
   138 val internal_typ = value (fn Token.Typ T => T);
   137 val internal_term = value (fn Token.Term t => t);
   139 val internal_term = value (fn Token.Term t => t);
   138 val internal_fact = value (fn Token.Fact (_, ths) => ths);
   140 val internal_fact = value (fn Token.Fact (_, ths) => ths);
   139 val internal_attribute = value (fn Token.Attribute att => att);
   141 val internal_attribute = value (fn Token.Attribute att => att);
       
   142 val internal_declaration = value (fn Token.Declaration decl => decl);
   140 
   143 
   141 fun named_source read = internal_source || named >> evaluate Token.Source read;
   144 fun named_source read = internal_source || named >> evaluate Token.Source read;
   142 
   145 
   143 fun named_typ read = internal_typ || named >> evaluate Token.Typ (read o Token.inner_syntax_of);
   146 fun named_typ read = internal_typ || named >> evaluate Token.Typ (read o Token.inner_syntax_of);
   144 fun named_term read = internal_term || named >> evaluate Token.Term (read o Token.inner_syntax_of);
   147 fun named_term read = internal_term || named >> evaluate Token.Term (read o Token.inner_syntax_of);
   149   alt_string >> evaluate Token.Fact (get o Token.inner_syntax_of) >> #2;
   152   alt_string >> evaluate Token.Fact (get o Token.inner_syntax_of) >> #2;
   150 
   153 
   151 fun named_attribute att =
   154 fun named_attribute att =
   152   internal_attribute ||
   155   internal_attribute ||
   153   named >> evaluate Token.Attribute (fn tok => att (Token.content_of tok, Token.pos_of tok));
   156   named >> evaluate Token.Attribute (fn tok => att (Token.content_of tok, Token.pos_of tok));
       
   157 
       
   158 fun text_declaration read =
       
   159   internal_declaration ||
       
   160   text_token >> evaluate Token.Declaration (read o Token.source_position_of);
   154 
   161 
   155 
   162 
   156 (* terms and types *)
   163 (* terms and types *)
   157 
   164 
   158 val typ_abbrev = Scan.peek (named_typ o Proof_Context.read_typ_abbrev o Context.proof_of);
   165 val typ_abbrev = Scan.peek (named_typ o Proof_Context.read_typ_abbrev o Context.proof_of);