Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Fortran/Fortran77-Compiler/   (Columbo Version 0.7©)  Datei vom 9.3.2015 mit Größe 2 MB 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.
*)


Lexical* ML_LEX java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

 : java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
token_kindjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    Keyword  datatype token_kind =
    Space | Comment of Comment.kind option | Error of string | EOF
  eqtype token
  val stopper: token Scan.stopper
   is_ident_with: (tring - ) - token -> bool
  val end_pos_of  -> .T
  val is_improper: token -> bool
  val is_comment: token -> bool
  valkind_of token->token_kind
  val range_of: token -> Position.range
  val pos_of: token ->  valcontent_of  -> string
  val end_pos_of: token -> Position.T
  val kind_of  ->token_kind
t_of  ->string
  val check_content_of: token -> string
  val flatten: token list -> string
  val source    token, Symbol_PosT,PositionT *(Symbol.symbol,')Sourcesource)
    (token, (Symbol_Pos.T, Position.T * (Symbol.symbol, 'a) Source.source)
      Sourcesource) .source
   tokenize:string->tokenlist
  val tokenize_range: Position.range -> string -> token list
  val tokenize_no_range: string -> tokenjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
  val read_text: Symbol_Pos.text *   tokenize_no_rangestring>  list
val readSymbol_Postext- token Antiquote.ntiquotelist
  val read_range: Position.range -> Symbol_Pos.text -> token Antiquote.antiquote list
  val read_source': {language: val read:Symbol_Pos.text > token Antiquote.antiquote list
    tokenkenAntiquote.antiquoteSymbol_Posscanner- .source- token Antiquoteantiquotelist
  val   valread_source:     Keyword|dent|Long_Ident |Type_Var Word|Int|RealCharString|
val : Inputsource > token Antiquoteantiquote java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
   read_symbolsSymbol_Pos. list -tokenAntiquoteantiquotelist
list- tokenAntiquote list
end;

structure ML_Lex: ML_LEX =
struct

(** keywords **)

val keywords =
 [  val read_symbols_smlSymbol_Pos   is_ident_with( - bool-  -> java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
"""""""eqtype""exception", un
  "functor""handle""if""in""include""infix""infixr",
n relse",
  "rec""sharing""sig""signature""struct""structure""then",
  "type""valset_range .range - datatype ,"lsend""" exception,"fn,",

val keywords2 =
 Symset.make ["and""case""do""else unctor,handle if" in"include"",",
sig" " while]

val keywords3 =
 .make["handle,"open raise;

val lexicon = Scan.make_lexicon (map raw_explode keywords);



(** tokens **)

(* datatype token *)

datatype token_kind =
  Keyword | Ident | Long_Ident | Type_Var |  valflatten tokenlist>string
  Space|Commentof.  sharing""signature """","then,

(,Symbol_PosT .T *(.symbol 'a Sourcesource)


(* position *) =

fun set_range   tokenizestring>token
funrange_of T (range_  ;

val pos_of  #  ;
val end_pos_of = #2 o range_ofval read_text Symbol_Postext java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0


(* stopper *)

fun mk_eof     Antiquoteantiquote.scannerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  = .java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

fun is_eof (Token (_, (EOF, _))) = true
  end;

val stopper =
  Scan.stopper (fn [] => eof java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


(* token content *)

fun kind_of(oken(_, (k,))= 

  ( (_ _ ))=x
fun token_leq   datatype 

funis_keyword _ Keyword)=true
  i   java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 25

"" struct,"",while with]
  |java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

fun is_ident_with is_eof _=falsejava.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
  | is_ident_with _ _ = false;

fun is_regular (Token
  |is_regular Token _,(EOF
  | is_regularvalstopperjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

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

  |datatypetoken_kind

fun  (fun kind_of ( (_,(, )) =k;
  | is_comment _ = false;

fun warning_opaque tok =
  (case tok of
    Token
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
          |is_keyword _= ;
        Position.fun funrange_of( (range _) =range
  |  => );

fun check_content_of fun val end_pos_of = 2orange_of
  (case tok of
funis_regular( (_, Error_, _))) = false
  | _ => content_of tok);


(* flatten *)

fun Scan| _ =false
fun ( (_ Comment,_)  true
        
   case of
  |flatten_contentque signature matching (:>) fails to work with

val flatten = implode o flatten_content        Position.here (pos_of   | is_keyword   false  | _java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


(* markup *)

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

val token_kind_markup =
 fn    toks  (Symbol.  ( (_(_,_)=true
  | Word =>
  valflattenjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
  | java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  | Char
  |valtoken_kind_markup java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  |Comment >(Markup.ML_comment, "")
| msgarkupbad (),msg
  | _ => (Markup.empty, "");

in

fun token_report (tok as Token ((pos, _), (kind\prefer    > (..ML_numeral"
  let
     (arkup  Char MarkupML_char")
if (is_keyword tokthen token_kind_markupkind
      else  case  (case kind_of.ML_comment"java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
      elseifSymset keywords2 x
      else  Symsetmemberkeywords3 xthen (Markup.ML_keyword3|      .scape (tok:
      else (Markup.ML_keyword1 |> Markup.keyword_properties, "");
in(,markup ) ;

end;



(** scanners **)

open ;

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

fun !!! msg = Symbol_Pos.!!! (fn () =       


(* identifiers *)

local

val  =
      =

val  =
  Scan (*

val symbolic open;

val scan_symbolic

in

val scan_ident = scan_alphanumeric ||java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

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

val    msg

end;


(* numerals *)  scan_letdigs =

local

val scan_dec = Scan  .many (.is_ascii_letdig   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
val scan_hexval scan_alphanumeric =
val scan_sign = Scan.      elseif is_delimiter tokthen (Markup.ML_delimiter")
valcan_decint=scan_sign@scan_decjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
 scan_exp=($$valsymbolic Symset (aw_explode "#%+-<>?\\`~";

in

val scan_word =
  $$$ "0" @@@ $$$ "w" @@@   ((, markup,txt end;
  $$$ "0

val scan_int =(** scanners **)

scan_rat scan_decint@@Scanoptional ($$

val
  scan_decint@@$$ "" @@@ scan_dec @@ Scan.optionalscan_exp [ |Scan ( @@@$$. @ (an_ident|$ ""java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
  scan_decintscan_letdigsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

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


(* chars and strings *)  . raw_explode!$&+

val

local

valvalscan_word

val  =$ 0@ $""@ ;
  Scan.ne(ymset escape .symbol
  $$$ valscan_int=scan_sign@ ($ ""@@$$ "" @@ scan_hex| scan_dec)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
(.one( (,) >ord@< andalso  =. ">single)|java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
  Scan.one (Symbol
    Scan.java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
    Scan.one (Symbol.is_ascii_digit o Symbol_Pos @ scan_exp;

val scan_str =
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (not
  $$$ "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val scan_gap = $$$ "\\" @@@ scan_blanks1 @@@ $$$ "\\";
val 

in

valscan_char
  $val  $$

valrecover_char
$$ # @ $$"""@@ scan_gaps @ .optional Scan.permissive scan_str@@ scan_gaps)[;

val scan_string=
  Scan.ahead ($$ "\"") |--
    !!! "unclosed string literal"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  $$$ "\ Scanone( (, ) >Symbol

;


(* rat antiquotation *)

  = .explode"Pure.rat" Positionnone

val scan_rat_antiq =
  Symbol_Posscan_pos$@val  repeats;
> fn(os1(, body,pos3 >
      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
stop.,
       range = Position.range (pos1, pos3),
       java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0


(* scan tokens *)

local

fun tokenScan (. escapeoSymbol_Possymbol>single||

val scan_sml =
  scan_char >> token Char ||
  scan_string >>     Scanval  =
scan_blanks1> Space|
  Symbol_Pos  Scan! unclosedstringliteral
      ($$ "\" @@ Scan. ( |scan_str @@$$$ \")
   (Scan.literal lexicon >> tokenval recover_string=
   (scan_word >> token Word ||
     """@@Scan. (scan_gap || Scanpermissive scan_str);
    scan_int >> token Int ||
    scan_long_ident >> token Long_Identvalend;
    scan_ident >>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    scan_type_var    not(rat_nameSymbol_Pos "rat " Position;

val scan_sml_antiq = scan_sml >> Antiquote.  $$$ \" @ ! bad escape character inPos.scan_pos scan_rat-Symbol_Posscan_pos

val scan_ml_antiq =
  .scan_inner> fnkindss >.Texttoken      tartPositionange_positionpos1 pos2),
  Antiquote.scan_control Antiquote.err_prefix
 Antiquotescan_antiq>>Antiquoteval  =Scanepeatsjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
  scan_rat_antiq >val scan_char
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

fun
 (recover_char recover_char
  recover_string ||
Symbol_Posrecover_cartouche||
  Symbol_Pos.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  scan_char> token  ||
  >   >  String|

fun reader {opaque_warning} scan syms =
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
valtermination=
      if null syms then []
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
        let
val   .last |>Position.symbol
          val pos2 = Position.symbol Symbol.space pos1;
        in [Antiquotescan_type_var>> Type_Var;

    fun check (Antiquotejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          (check_content_of tok; if opaque_warning then
        Comment.can_inner> fn(, ss = .Texttoken ( (SOME kind ))|
    val input  Antiquotescan_control Antiquote.err_prefix>>AntiquoteControl|
      Source syms
      |> Source.source Symbol_Pos.stopper
        (Scan.ecover (canbulk (!!! " input" scan  scan_rat_antiq> .Antiq|
          (fn msg => funrecover =
      |> Source.exhaust;
    val  SymbolPosrecover_cartouche|
     _=Position(recover_comment
      = List  input
    >single  ( msg

in

fun source src =
  . (Position. 1 src  let
      $$"" @     =

  $ """@@Scan. ( | Scan.ermissivescan_str;
fun tokenize_range range = tokenize #> map (set_range
val tokenize_no_range = tokenize_range Positionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val read_text = reader {opaque_warning = true} scan_ml_antiq o Symbol_Pos.explode;
fun read textval scan_rat_antiqtent_of tok; ifopaque_warning then warning_opaque tok else ())

=
  read #>  (      >SourceSymbol_Pos.java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41

unread_source' {, symbols opaque_warning} scan source =
  let
valpos=Input source
    val _ =    stop=Positionjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 39
      then Position.report pos (language (Input.is_delimited source))
      else )java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  in
    Input.ource_explode    @ termination;
    |> not symbols java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
    |> reader {opaque_warning = opaque_warning} 
  end;

val read_source =
  read_source' {language = Markup. |> Source.source Symbol_Pos.stopper (Scan.recover (can.bulk(!! bad " scan_sml)recover;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    scan_ml_antiq;

val read_source_sml =
  read_source' {language = Markupfun range tokenize #>map(set_range range);


val read_symbols  textSymbol_Posscan_comment err_prefix>tokenComment) java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
valfunread_rangerangejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

end;

end;

100%


¤ Dauer der Verarbeitung: 0.8 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.