Commit 13191082 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Removed commented code

parent f17d4326
......@@ -75,109 +75,69 @@
%%
main:
| dec=sig_or_lex+ EOI { fun ?(overwrite=false) e -> List.fold_left (fun acc d -> d ~overwrite acc) e dec
}
main:
| dec=sig_or_lex+ EOI { fun ?(overwrite=false) e -> List.fold_left (fun acc d -> d ~overwrite acc) e dec
}
sig_or_lex:
| s=signature { fun ~overwrite e -> s ~overwrite e }
| l=lexicon { fun ~overwrite e -> l ~overwrite e }
signature :
| SIG_OPEN id=IDENT EQUAL entries = end_of_dec (sig_entry)
{
fun ~overwrite e ->
let s,loc = id in
if is_signature s e then
raise (Error.(Error (Env_error (Duplicated_signature s,loc))))
else
let new_sig =
List.fold_left
(fun acc entry -> entry acc e)
(Environment.Signature1.empty id)
entries in
Environment.(insert ~overwrite (Signature new_sig) ~to_be_dumped:true e)
}
(*
signature_end_of_dec :
| entry = sig_entry SEMICOLON? END_OF_DEC
{
[entry]
}
| entry = sig_entry SEMICOLON entries = signature_end_of_dec
{ entry :: entries }
*)
(*
| SIG_OPEN id=IDENT EQUAL entries=separated_list(SEMICOLON,sig_entry) END_OF_DEC
{
fun e ->
let s,loc = id in
if is_signature s e then
raise (Error.(Error (Env_error (Duplicated_signature s,loc))))
else
let new_sig =
List.fold_left
(fun acc entry -> entry acc e)
(Environment.Signature1.empty id)
entries in
Environment.(insert (Signature new_sig) false e)
}
*)
| s=signature { fun ~overwrite e -> s ~overwrite e }
| l=lexicon { fun ~overwrite e -> l ~overwrite e }
signature :
| SIG_OPEN id=IDENT EQUAL entries = end_of_dec (sig_entry)
{
fun ~overwrite e ->
let s,loc = id in
if is_signature s e then
raise (Error.(Error (Env_error (Duplicated_signature s,loc))))
else
let new_sig =
List.fold_left
(fun acc entry -> entry acc e)
(Environment.Signature1.empty id)
entries in
Environment.(insert ~overwrite (Signature new_sig) ~to_be_dumped:true e)
}
lexicon :
| LEX_OPEN lex=lex_declaration
{fun ~overwrite e -> lex ~overwrite ~non_linear:false e }
| NL_LEX_OPEN lex=lex_declaration
{fun ~overwrite e -> lex ~overwrite ~non_linear:true e }
| LEX_OPEN lex=IDENT EQUAL exp=lexicon_exp {fun ~overwrite e ->
let new_lex = exp (Some lex) e in
Environment.(insert ~overwrite (Lexicon new_lex) ~to_be_dumped:true e)}
| LEX_OPEN lex=lex_declaration
{fun ~overwrite e -> lex ~overwrite ~non_linear:false e }
| NL_LEX_OPEN lex=lex_declaration
{fun ~overwrite e -> lex ~overwrite ~non_linear:true e }
| LEX_OPEN lex=IDENT EQUAL exp=lexicon_exp {fun ~overwrite e ->
let new_lex = exp (Some lex) e in
Environment.(insert ~overwrite (Lexicon new_lex) ~to_be_dumped:true e)}
%inline lex_declaration :
(*| lex=IDENT LPAREN abs=IDENT RPAREN COLON obj=IDENT EQUAL END_OF_DEC
{
fun ~non_linear e ->
let lex_name,lex_loc = lex in
let abs',obj'= get_sig abs e,get_sig obj e in
if is_lexicon lex_name e then
raise (Error.(Error (Env_error (Duplicated_lexicon lex_name,lex_loc))))
else
let lex' = Environment.Lexicon.empty lex ~abs:abs' ~obj:obj' ~non_linear in
Environment.(insert (Lexicon lex') false e)
}
*)
| lex=IDENT LPAREN abs=IDENT RPAREN COLON obj=IDENT EQUAL entries = end_of_dec(lex_entry)
{fun ~overwrite ~non_linear e ->
let lex_name,lex_loc = lex in
let abs',obj'= get_sig abs e,get_sig obj e in
if is_lexicon lex_name e then
raise (Error.(Error (Env_error (Duplicated_lexicon lex_name,lex_loc))))
else
let lex' = List.fold_left
(fun acc entry -> entry acc e)
(Environment.Lexicon.empty lex ~abs:abs' ~obj:obj' ~non_linear)
entries in
let () = Environment.Lexicon.check lex' in
Environment.(insert ~overwrite (Lexicon lex') ~to_be_dumped:true e)
}
end_of_dec(entry_type):
| entry = entry_type SEMICOLON? END_OF_DEC { [entry] }
| entry = entry_type SEMICOLON entries = end_of_dec(entry_type) { entry :: entries }
lexicon_exp0 :
| lex = IDENT { fun _ e -> get_lex lex e }
| LPAREN lex = lexicon_exp RPAREN { lex }
lexicon_exp :
| lex = lexicon_exp0 { lex }
| lex1 = lexicon_exp0 COMPOSE lex2 = lexicon_exp
| lex=IDENT LPAREN abs=IDENT RPAREN COLON obj=IDENT EQUAL entries = end_of_dec(lex_entry)
{fun ~overwrite ~non_linear e ->
let lex_name,lex_loc = lex in
let abs',obj'= get_sig abs e,get_sig obj e in
if is_lexicon lex_name e then
raise (Error.(Error (Env_error (Duplicated_lexicon lex_name,lex_loc))))
else
let lex' = List.fold_left
(fun acc entry -> entry acc e)
(Environment.Lexicon.empty lex ~abs:abs' ~obj:obj' ~non_linear)
entries in
let () = Environment.Lexicon.check lex' in
Environment.(insert ~overwrite (Lexicon lex') ~to_be_dumped:true e)
}
end_of_dec(entry_type):
| entry = entry_type SEMICOLON? END_OF_DEC { [entry] }
| entry = entry_type SEMICOLON entries = end_of_dec(entry_type) { entry :: entries }
lexicon_exp0 :
| lex = IDENT { fun _ e -> get_lex lex e }
| LPAREN lex = lexicon_exp RPAREN { lex }
lexicon_exp :
| lex = lexicon_exp0 { lex }
| lex1 = lexicon_exp0 COMPOSE lex2 = lexicon_exp
{
fun name e ->
let l1,l2 = (lex1 None e),(lex2 None e) in
......@@ -192,4 +152,4 @@ lexicon :
new_name,new_loc in
Environment.Lexicon.compose l1 l2 new_name
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment