Commits

Sébastien Ferré committed cb66706

Change in printing of Plus and Minus (no leading white).
Add of 'parse_tokens': try to parse a given list of tokens.

Comments (0)

Files changed (1)

     | LeftPar -> pp_print_string ff "("
     | RightPar -> pp_print_string ff ")"
     | Minus ->
+(*
 	( match pred with
 	| Ident _ | Term _ -> pp_print_string ff " "
 	| _ -> ());
+*)
 	pp_print_string ff "-"
     | Plus ->
+(*
 	( match pred with
 	| Ident _ | Term _ -> pp_print_string ff " "
 	| _ -> ());
+*)
 	pp_print_string ff "+"
     | Equal -> pp_print_string ff "="
     | LeftAcc -> pp_print_string ff "{"
 (* fonctions generiques pour le parsing *)
 (* ------------------------------------ *)
 
+(* parsing of a list of tokens *)
+let rec parse_tokens : t_list -> t_stream -> unit =
+fun toks str ->
+  match toks with
+  | [] -> (match str with parser [<>] -> ())
+  | tok::toks -> (match str with parser [<'t when t = tok; _ = parse_tokens toks ?? "Syntax error: "^stringizer toks^" expected after "^stringizer [tok]>] -> ())
+
+(* parsing an indefinite number of pattern given some parser *)
+let rec parse_star p = parser
+  [<x = p; xs = parse_star p>] -> x::xs
+| [<>] -> []
+
 (* parsing of proposition-like language, where operations and atoms are parameterized *)
 
 type 'a spec_prop = { 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.