From 86eb589bd346e31936bc09fa9425cec3a1550e22 Mon Sep 17 00:00:00 2001 From: Robert Hencke Date: Sat, 18 Feb 2017 15:30:49 -0500 Subject: [PATCH] Fix error in ANTLR grammar regarding duplicate '-~'. (#1602) --- pony.g | 8 ++++++-- src/libponyc/ast/bnfprint.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pony.g b/pony.g index 6b2d708ae7..4d9036002e 100644 --- a/pony.g +++ b/pony.g @@ -154,12 +154,12 @@ pattern ; nextparampattern - : ('not' | 'addressof' | MINUS_NEW | '-~' | 'digestof') parampattern + : ('not' | 'addressof' | MINUS_NEW | MINUS_TILDE_NEW | 'digestof') parampattern | nextpostfix ; parampattern - : ('not' | 'addressof' | '-' | '-~' | MINUS_NEW | '-~' | 'digestof') parampattern + : ('not' | 'addressof' | '-' | '-~' | MINUS_NEW | MINUS_TILDE_NEW | 'digestof') parampattern | postfix ; @@ -409,6 +409,10 @@ MINUS_NEW : NEWLINE '-' ; +MINUS_TILDE_NEW + : NEWLINE '-~' + ; + LINECOMMENT : '//' ~('\n')* {$channel = HIDDEN;} ; diff --git a/src/libponyc/ast/bnfprint.c b/src/libponyc/ast/bnfprint.c index de85daadbf..cec66c4c6c 100644 --- a/src/libponyc/ast/bnfprint.c +++ b/src/libponyc/ast/bnfprint.c @@ -85,6 +85,9 @@ static const char* antlr_post = "MINUS_NEW\n" " : NEWLINE '-'\n" " ;\n\n" + "MINUS_TILDE_NEW\n" + " : NEWLINE '-~'\n" + " ;\n\n" "LINECOMMENT\n" " : '//' ~('\\n')* {$channel = HIDDEN;}\n" " ;\n\n" @@ -379,6 +382,7 @@ static void bnf_token_set(bnf_t* bnf, token_id* tokens, bool clean) case TK_LPAREN_NEW: p->name = "LPAREN_NEW"; break; case TK_LSQUARE_NEW: p->name = "LSQUARE_NEW"; break; case TK_MINUS_NEW: p->name = "MINUS_NEW"; break; + case TK_MINUS_TILDE_NEW: p->name = "MINUS_TILDE_NEW"; break; default: // Fixed text tokens: keywords, symbols, etc