@@ -248,6 +248,7 @@ include hocc
248
248
neutral pArgument_Expr < pExpr_Constant
249
249
neutral pArgument_Cident
250
250
neutral pExpr_PrefixOp_Expr
251
+ neutral pPrefixOp_Sign
251
252
252
253
neutral pLgroup < pExpr_Expr_Arguments, pArgument_Expr, pArgument_Cident, pExpr_PrefixOp_Expr
253
254
left pLazy < pLgroup
@@ -258,10 +259,11 @@ include hocc
258
259
right pColonOp < pPlusOp
259
260
right pAtOp < pColonOp
260
261
left pEqOp < pAtOp
261
- left pConstant < pEqOp
262
262
right pAnd < pEqOp
263
263
right pOr < pAnd
264
- left pComma < pConstant, pColonOp, pExpr_Constr_Expr
264
+ neutral pInfixOp < pOr, pPrefixOp_Sign
265
+ left pConstant < pInfixOp
266
+ left pComma < pOr, pConstant, pColonOp, pExpr_Constr_Expr
265
267
right pColonEq < pComma
266
268
neutral pIf < pColonEq
267
269
right pSemi < pIf
@@ -325,6 +327,7 @@ include hocc
325
327
# Punctuation.
326
328
token TILDE "~" of token_simple prec pTilde
327
329
token QMARK "?" of token_simple prec pTilde
330
+ token PLUS "+" of token_simple prec pPlusOp
328
331
token MINUS "-" of token_simple prec pPlusOp
329
332
token LT "<" of token_simple prec pEqOp
330
333
token LT_EQ "<=" of token_simple prec pEqOp
@@ -352,7 +355,7 @@ include hocc
352
355
token RARRAY "|]" of token_simple
353
356
token BSLASH "\\" of token_simple
354
357
token TICK "'" of token_simple
355
- token CARET "^" of token_simple
358
+ token CARET "^" of token_simple prec pAtOp
356
359
token AMP "&" of token_simple
357
360
token AMP_AMP "&&" of token_simple
358
361
token XMARK "!" of token_simple prec pTilde
@@ -442,15 +445,17 @@ include hocc
442
445
| "type" Rec CIDENT TypeParams ":" CIDENT TypeArgs "=" "{" (* XXX *) "}"
443
446
-> CModuleDef
444
447
445
- nonterm PrefixOp of xxx prec pTilde ::=
446
- | TILDE_OP
447
- | QMARK_OP
448
- | "~"
449
- | "?"
450
- | "!"
448
+ nonterm PrefixOp of xxx ::=
449
+ | TILDE_OP prec pTilde
450
+ | QMARK_OP prec pTilde
451
+ | "~" prec pTilde
452
+ | "?" prec pTilde
453
+ | "+" prec pPrefixOp_Sign
454
+ | "-" prec pPrefixOp_Sign
455
+ | "!" prec pTilde
451
456
-> Xxx
452
457
453
- nonterm InfixOp of xxx ::=
458
+ nonterm InfixOp of xxx prec pInfixOp ::=
454
459
| "and"
455
460
| "or"
456
461
| STAR_STAR_OP
@@ -468,7 +473,7 @@ include hocc
468
473
| BAR_OP
469
474
| COLON_OP
470
475
| DOT_OP
471
- | "~ "
476
+ | "+ "
472
477
| "-"
473
478
| "<"
474
479
| "<="
@@ -477,8 +482,6 @@ include hocc
477
482
| ">"
478
483
| ":="
479
484
| "^"
480
- | "&"
481
- | "&&"
482
485
-> Xxx
483
486
484
487
nonterm OperatorName of xxx ::=
@@ -579,7 +582,7 @@ include hocc
579
582
| "{" Expr "with" Field FieldListTl "}"
580
583
| Expr Arguments prec pExpr_Expr_Arguments
581
584
| PrefixOp Expr prec pExpr_PrefixOp_Expr
582
- | "-" Expr prec pTilde
585
+ | Expr InfixOp Expr prec pInfixOp
583
586
-> Xxx
584
587
585
588
nonterm Exprs of xxx prec pComma ::=
0 commit comments