Commit 05bb92ba authored by Andrei Paskevich's avatar Andrei Paskevich

Parser: "(+)_spec" can be user-defined, "(+)'spec" can not.

parent a8f712d7
This diff is collapsed.
......@@ -239,8 +239,10 @@ rule token = parse
{ RIGHTSQ }
| "]" (quote+ as s)
{ RIGHTSQ_QUOTE s }
| ")" (['\'' '_'] alpha suffix core_suffix* as s)
| ")" ('\'' alpha suffix core_suffix* as s)
{ RIGHTPAR_QUOTE s }
| ")" ('_' alpha suffix core_suffix* as s)
{ RIGHTPAR_USCORE s }
| op_char_pref op_char_4* quote* as s
{ OPPREF s }
| op_char_1234* op_char_1 op_char_1234* quote* as s
......
......@@ -151,6 +151,7 @@
%token <string> QUOTE_LIDENT
%token <string> RIGHTSQ_QUOTE (* ]'' *)
%token <string> RIGHTPAR_QUOTE (* )'spec *)
%token <string> RIGHTPAR_USCORE (* )_spec *)
(* keywords *)
......@@ -1263,12 +1264,16 @@ lident_rich:
lident_op:
| LEFTPAR lident_op_str RIGHTPAR
{ mk_id $2 $startpos($2) $endpos($2) }
| LEFTPAR lident_op_str RIGHTPAR_USCORE
{ mk_id ($2^$3) $startpos $endpos }
| LEFTPAR lident_op_str RIGHTPAR_QUOTE
{ mk_id ($2^$3) $startpos $endpos }
lident_op_nq:
| LEFTPAR lident_op_str RIGHTPAR
{ mk_id $2 $startpos($2) $endpos($2) }
| LEFTPAR lident_op_str RIGHTPAR_USCORE
{ mk_id ($2^$3) $startpos $endpos }
| LEFTPAR lident_op_str RIGHTPAR_QUOTE
{ let loc = floc $startpos $endpos in
Loc.errorm ~loc "Symbol (%s)%s cannot be user-defined" $2 $3 }
......
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