Commit 9edfa5e2 authored by POTTIER Francois's avatar POTTIER Francois

Renamed and documented [new_precedence_level].

parent f31bed55
......@@ -90,7 +90,7 @@ declaration:
(List.map Parameters.with_pos ss) }
| k = priority_keyword ss = clist(symbol)
{ let prec = ParserAux.current_token_precedence $startpos(k) $endpos(k) in
{ let prec = ParserAux.new_precedence_level $startpos(k) $endpos(k) in
List.map (Positions.map (fun symbol -> DTokenProperties (symbol, k, prec))) ss }
| PARAMETER t = OCAMLTYPE
......
open Positions
open Syntax
let current_token_precedence =
let new_precedence_level =
let c = ref 0 in
fun pos1 pos2 ->
incr c;
......
......@@ -3,9 +3,16 @@
open Syntax
(* [new_precedence_level pos1 pos2] creates a new precendence level,
which is stronger than any previously created levels, for tokens.
It should be called every time a [%left], [%right], or [%nonassoc]
declaration is found. The positions are the positions of this
declaration in the source code. *)
val new_precedence_level: Lexing.position -> Lexing.position -> precedence_level
(* TEMPORARY document *)
val current_token_precedence: Lexing.position -> Lexing.position -> precedence_level
val current_reduce_precedence: unit -> precedence_level
(* [check_production_group] accepts a production group and checks that all
......
......@@ -86,7 +86,7 @@ declaration:
Positions.mapd (fun nt -> DStart nt, DType ($2, ParameterVar ntloc)) ntloc) $3 }
| priority_keyword symbols
{ let prec = ParserAux.current_token_precedence (rhs_start_pos 1) (rhs_end_pos 1) in
{ let prec = ParserAux.new_precedence_level (rhs_start_pos 1) (rhs_end_pos 1) in
List.map (Positions.map (fun symbol -> DTokenProperties (symbol, $1, prec))) $2 }
| PARAMETER OCAMLTYPE
......
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