src/Pure/Isar/outer_lex.ML
changeset 27799 52f07d5292cd
parent 27780 7d0910f662f7
child 27814 05a50886dacb
equal deleted inserted replaced
27798:b96c73f11a23 27799:52f07d5292cd
   281 
   281 
   282 local
   282 local
   283 
   283 
   284 fun token_leq ((_, syms1), (_, syms2)) = length syms1 <= length syms2;
   284 fun token_leq ((_, syms1), (_, syms2)) = length syms1 <= length syms2;
   285 
   285 
   286 fun token k ss = Token (SymbolPos.implode ss, (k, implode (map symbol ss)));
   286 fun token k ss =
   287 fun token_delim k (pos1, (ss, pos2)) =
   287   Token ((SymbolPos.implode ss, SymbolPos.range ss), (k, SymbolPos.content ss));
   288   Token (SymbolPos.implode_delim pos1 pos2 ss, (k, implode (map symbol ss)));
   288 
       
   289 fun token_range k (pos1, (ss, pos2)) =
       
   290   Token (SymbolPos.implode_range pos1 pos2 ss, (k, SymbolPos.content ss));
   289 
   291 
   290 fun scan (lex1, lex2) = !!! "bad input"
   292 fun scan (lex1, lex2) = !!! "bad input"
   291   (scan_string >> token_delim String ||
   293   (scan_string >> token_range String ||
   292     scan_alt_string >> token_delim AltString ||
   294     scan_alt_string >> token_range AltString ||
   293     scan_verbatim >> token_delim Verbatim ||
   295     scan_verbatim >> token_range Verbatim ||
   294     scan_comment >> token_delim Comment ||
   296     scan_comment >> token_range Comment ||
   295     scan_space >> token Space ||
   297     scan_space >> token Space ||
   296     scan_malformed >> token Malformed ||
   298     scan_malformed >> token Malformed ||
   297     Scan.one (Symbol.is_sync o symbol) >> (token Sync o single) ||
   299     Scan.one (Symbol.is_sync o symbol) >> (token Sync o single) ||
   298     (Scan.max token_leq
   300     (Scan.max token_leq
   299       (Scan.max token_leq
   301       (Scan.max token_leq