Skip to content

Commit

Permalink
clean:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhang committed Oct 13, 2012
1 parent 6de1025 commit 6dcc827
Show file tree
Hide file tree
Showing 20 changed files with 36,080 additions and 470 deletions.
16 changes: 9 additions & 7 deletions cold/FanGrammar.ml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ type styp =
| STtok of loc | STtok of loc
| STtyp of Ast.ctyp | STtyp of Ast.ctyp


type attr = string

type entry = { type entry = {
name:name; name:name;
pos:Ast.expr option; pos:Ast.expr option;
levels:level list} levels:level list}
and level = {label:string option; assoc:Ast.expr option; rules:rule list} and level = {label:string option; assoc:Ast.expr option; rules:rule list}
and rule = {prod:symbol list; action:Ast.expr option} and rule = {prod:symbol list; action:Ast.expr option}
and symbol = {used:string list; text:text; styp:styp; pattern:Ast.patt option} and symbol = {used:string list; text:text; styp:styp; pattern:Ast.patt option}
Expand All @@ -28,9 +30,9 @@ and text =
| TXrules of loc * (text list * Ast.expr) list | TXrules of loc * (text list * Ast.expr) list
| TXself of loc | TXself of loc
| TXkwd of loc * string | TXkwd of loc * string
| TXtok of loc * Ast.expr * string | TXtok of loc * Ast.expr * attr * string


type used = type used =
Unused Unused
| UsedScanned | UsedScanned
| UsedNotScanned | UsedNotScanned
26 changes: 18 additions & 8 deletions cold/FanGrammarTools.ml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ let string_of_patt =
let check_not_tok = let check_not_tok =
fun s -> fun s ->
(match s with (match s with
| {text = TXtok (_loc, _, _); _ } -> | {text = TXtok (_loc, _, _, _); _ } ->
(FanLoc.raise _loc ( (FanLoc.raise _loc (
(Stream.Error (Stream.Error
("Deprecated syntax, use a sub rule. " ^ ("Deprecated syntax, use a sub rule. " ^
Expand Down Expand Up @@ -436,7 +436,7 @@ let text_of_action =
( (Ast.ExId (_loc, ( (Ast.IdLid (_loc, s)) ))) ))) ))) ( (Ast.ExId (_loc, ( (Ast.IdLid (_loc, s)) ))) ))) )))
), act)) ), i) ), act)) ), i)
| {pattern = Some (p); | {pattern = Some (p);
text = TXtok (_, _, _); _ } -> text = TXtok (_, _, _, _); _ } ->
let id = (prefix ^ ( (string_of_int i) )) in let id = (prefix ^ ( (string_of_int i) )) in
(( ((
(Some (Some
Expand Down Expand Up @@ -805,7 +805,8 @@ let rec make_expr =
( (Ast.ExStr (_loc, kwd)) ( (Ast.ExStr (_loc, kwd))
))) )))
| TXtok | TXtok
(_loc, match_fun, descr) -> (_loc, match_fun, attr,
descr) ->
(Ast.ExApp (Ast.ExApp
(_loc, ( (_loc, (
(Ast.ExVrn (Ast.ExVrn
Expand All @@ -814,10 +815,19 @@ let rec make_expr =
(_loc, ( (_loc, (
(Ast.ExCom (Ast.ExCom
(_loc, match_fun, ( (_loc, match_fun, (
(Ast.ExStr (Ast.ExTup
(_loc, ( (_loc, (
(Ast.safe_string_escaped (Ast.ExCom
descr) ))) ))) (_loc, (
(Ast.ExVrn
(_loc,
attr)) ),
(
(Ast.ExStr
(_loc, (
(Ast.safe_string_escaped
descr) )))
))) ))) )))
))) ))) ))) )))
and make_expr_rules = and make_expr_rules =
fun _loc -> fun _loc ->
Expand Down Expand Up @@ -1211,7 +1221,7 @@ let mk_tok =
let text = let text =
(TXtok (TXtok
(_loc, match_fun, (_loc, match_fun,
descr)) in "Normal", descr)) in
{used = [] ; {used = [] ;
text = text; text = text;
styp = t; styp = t;
Expand Down Expand Up @@ -1258,7 +1268,7 @@ let mk_tok =
let text = let text =
(TXtok (TXtok
(_loc, match_fun, (_loc, match_fun,
descr)) in "Antiquot", descr)) in
{used = [] ; {used = [] ;
text = text; text = text;
styp = t; styp = t;
Expand Down
Loading

0 comments on commit 6dcc827

Please sign in to comment.