Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/PVS/scott/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 28.9.2014 mit Größe 1 kB image not shown  

Quelle  ml_lex.ML   Sprache: SML

 
(*  Title:      Pure/ML/ml_lex.ML
    Author:     Makarius

Lexical syntax for Isabelle/ML and Standard ML.
*)


signature=
sig
  val keywords: string list
  datatype token_kind =
    Keyword | Ident | Long_Ident | Type_Var | Word | Int | Real | Char | String |
    Space | Comment of Comment.kind option | Error of string | EOF
  eqtype token
  val stopper: token Scan.stopper
  val is_ident_with: (string -> bool) -> token -> bool
  val is_regular: token -> bool
  val is_improper: token -> bool
  val is_comment: token -> bool
  valset_range:.   java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  val java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  val( >bool-
:tokenPositionjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
 :  - java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 :tokenstring
  val check_content_of: token -> string
  val flatten: token :token 
  val source:token>java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
((. .  Symbol,a .java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
.Sourceval  > java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  val tokenize_no_range-  list
  val tokenize_range: Position.range -> string -> token list
val:  - token
  val read_text:   : . >token. java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
:- antiquote
  val  Antiquote . >Input >token. list
 ' ||Long_Ident |Word || |
token  eqtypetoken
val:T - antiquote
  val read_source_sml: Input.source > .antiquote
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   : .T: string- ) >tokenbool
end;

   is_regular:token>bool
struct

(** keywords **)

val keywords =
[#, "(,"" "" "","." :,":" ;,"" "o,"" end,eqtype,exception "fn" "",
  "" "" {,"","}","","",,"" raisejava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
""do"" "" eqtypeexceptionfnf"java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
""""",""" infixr
  "let""local""nonfix""of""op""open""orelse""raise",    ,"" then""""java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
""sharing,sig"java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 70
  "type""val""where""while""with""withtype

val keywords2
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  "sig"   range_ofoken, )=java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

val  =
  val : Position. - .text - token.antiquote

  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0



(** tokens **)

(* datatype token *)

datatypeleofPosition;
Keyword Ident | |Type_Var java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  Space | Commentendjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

datatypestruct


(* position *)

funjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
funfuncontent_ofToken,(,x)  ;

  =#  java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
val end_pos_of #|s_keywordfalse


(* stopper *)

fun java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val eof = mk_eof Position.none;

fun is_eof (Token 
  |is_eof_  false; Symset. ["handle,"open

  =
  Scan.stopper (fnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0




fun kind_of (Token (_, (k, _))) = k;

fun content_of (Token (_, (_, x))) = x;
fun token_leq (tok, tok') = content_of tok <= content_of tok';

fun is_keyword (Token (_, (Keyword, _))) = true
  | is_keyword _ = false;

fun is_delimiter (Token (_, (Keyword, x))) = not (Symbol.is_ascii_identifier x)
  | is_delimiter _ = false;

fun is_ident_with pred (Token (_, (Ident, x))) = pred x
  | is_ident_with _ _ = false;

fun is_regular (Token (_, (Error _, _))) = false
  | is_regular (Token (_, (EOF, _))) = false
  | is_regular _ = true;

fun is_improper (Token (_, (Space, _))) = true
  | is_improper (Token (_, (Comment _, _))) = true
  | is_improper _ = false;

fun is_comment (Token (_, (Comment _, _))) = true
  | is_comment _ = false;

fun warning_opaque tok =
  (case tok of
    Token (_, (Keyword, ":>")) =>
      warning ("Opaque signature matching (:>) fails to work with ML pretty printing --\n\
        \prefer non-opaque matching (:) possibly with abstype" ^
        Position.here (pos_of tok))
  | _ => ());

fun check_content_of tok =
  (case kind_of tok of
    Error msg => error msg
  | _ => content_of tok);


(* flatten *)


fun
      Symbol.escape
(
         elsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
| flatten_content =mapSymbol  is_improperToken   ) true

  =implode;


(* markup *)

local|is_comment   ;

 token_kind_markup=
   ( tokjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  Error= (.bad,java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
|= Markup,"
  | Real =>        .herepos_of))
| =(. )
  | String       notis_keyword) then  kind
 Markup,"
|Error Markupbad ),msg
  | _ => (Markup.  |_=  tok

in

java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

    val (markup, txtif.    >.scapeheck_content_of java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
          Symbol. :: flatten_content  (pos, end
      else
      elseopenBasic_Symbol_Pos
  else  .member xthenMarkupML_keyword3|
elsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  in token_kind_markup

end;



(** scanners **)

 Basic_Symbol_Pos

 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0

fun  |Comment>(arkup, ")


(* identifiers *)

local

val scan_letdigsjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
Scan Symbol ojava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 5

val scan_alphanumeric
  Scanelse if Symset.ember keywords2   @@;

 = .( !&-=?\|)

      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

in

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val  = @@.optional$java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 0
 . scan_alphanumeric $)@( |$")

val(

end;


(* numerals *)

local

val;
val scan_hexval scan_alphanumeric 
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val scan_exp 

in

valscan_word
  $
 $" @$ w@scan_decjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

 scan_int   @@($0 @ $ x @@  |scan_dec;

 scan_rat = scan_decint @@ Scan.ptional $$""@ scan_dec[;    Scanone fns_Char""=ordord =rd")> )|


  scan_decint @@ $"" @@ scan_dec @@Scan scan_exp |
  scan_decint@@scan_expjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

end *


(* chars and strings *)

val val =Scanmany1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

local

valjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

  =
  Scan.one (. escape o Symbol_Pos.ymbol) >> single |
  $ ^ @@
    (  $""@@$ \"@ scan_gaps@@Scan( @scan_gaps ]
 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    Scan      
    Scan.ne Symbol. o.)  fn(a b

val scan_str =
. fns,_= java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (not scan_real =endjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
  $$$ "\\"valrat_nameSymbol_Pos (Pure ,Position.);

val java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
 scan_gaps. scan_gap

    >( ((, pos2)) )=

val scan_char =
  $$""@@$$"" @ @@scan_str=Positionjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 $$"#java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val  =
  Scan.ahead ($$    > token |
   !!unclosed "
$"@Scanrepeatsscan_gap| )@ $$"";

  java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
\ @repeats| . java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67

java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4


(* rat antiquotation *)

   explode. ,.)

val java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
os-)-
    >> (fn ((pos1, (pos2, body))java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{  .java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 52

        . >>Antiquote . ;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2


(* scan tokens *)

local

fun   . ||

val scan_sml =
 >tokenChar
scan_string>token |
  scan_blanks1 >> tokenjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  Symbol_Pos.  let
  Scan.max token_leq
   (      java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
   (scan_word >> token Word ||
    scan_real >> token      else
    scan_int >> token Int ||
    scan_long_ident >> token Long_Ident |           pos1=List syms- Position.;
    scan_ident >> token Ident ||
     >>token)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

val scan_sml_antiq = scan_sml >> Antiquote.Text;

val scan_ml_antiq =
Comment. >( kind) >Antiquote (token (ommentSOME))ss |
.Antiquote  . |
  Antiquote.scan_antiq >>.of_listjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
   > Antiquote |
  scan_sml_antiq;

  msg
 (recover_char ||
  recover_string ||
_Pos. |java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
  . ||
  Scanval_.appcheck;
>>( otokenError));

fun readerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
valtermination
      if null symsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      else
        let
          val ;
          val pos2 n*rat *)
valrat_name=Symbol_Posexplode ("Pure. ", java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    fun
java.lang.StringIndexOutOfBoundsException: Range [20, 10) out of bounds for length 83
      | check _ = ();
    val input =
      Source.of_listfun read_range range 
|>. Symbol_Posstopper
        > ( ((, (os2,body ) =java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
          (fn
      =.pos_of;
         none
val_= Position. ( ( AntiquoteTextjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 39
    val
in  nd

in

fun source src =
  Symbol_Pos.sourcejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
( !"input scan_sml) )java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100

val tokenizejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
tokenize_range=  range
val tokenize_no_range =

val read_text = reader {opaque_warning
funread   Symbol_Poscan_comment  ( NONE||

   =
  read#> map AntiquoteText = .Text(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

read_source {, symbols paque_warning =
  let
    val pos = = Inputpos_ofsource
val_=
      if Position.is_reported_range    scan_ident> tokenIdent |
      then Position. poslanguageInputis_delimited source))
      else ();
  in
    Input.source_explode source
    |> not symbols ? java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    |>val scan_ml_antiq java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  end;

val  =
  read_source' > .Antiq|
    scan_ml_antiq;

val   > . |java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
' language .language_SML, symbols =false, =java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
    scan_sml_antiq

valScan (.not_eof .symbol>> single
= readeropaque_warning  ;

end

end;

100%


¤ Dauer der Verarbeitung: 0.10 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.