From: Jean Privat Date: Wed, 15 Apr 2015 04:49:59 +0000 (+0700) Subject: grammar: introduce n_op and operator in AAssignOp X-Git-Tag: v0.7.4~22^2~8 X-Git-Url: http://nitlanguage.org grammar: introduce n_op and operator in AAssignOp Signed-off-by: Jean Privat --- diff --git a/src/parser/nit.sablecc3xx b/src/parser/nit.sablecc3xx index 0e17804..50fc1cf 100644 --- a/src/parser/nit.sablecc3xx +++ b/src/parser/nit.sablecc3xx @@ -935,8 +935,8 @@ exprs | {bra} obra [exprs]:expr* cbra ; assign_op - = {plus} pluseq - | {minus} minuseq + = {plus} [op]:pluseq + | {minus}[op]:minuseq ; module_name = quad? [path]:id* id; diff --git a/src/parser/parser_nodes.nit b/src/parser/parser_nodes.nit index 508c739..5fa19ce 100644 --- a/src/parser/parser_nodes.nit +++ b/src/parser/parser_nodes.nit @@ -2551,22 +2551,26 @@ end # A complex assignment operator. (`+=` and `-=`) abstract class AAssignOp super Prod + + # The combined assignment operator + var n_op: Token is writable, noinit + + # The name of the operator without the `=` (eg '+') + fun operator: String is abstract end # The `+=` assignment operation class APlusAssignOp super AAssignOp - # The `+=` operator - var n_pluseq: TPluseq is writable, noinit + redef fun operator do return "+" end # The `-=` assignment operator class AMinusAssignOp super AAssignOp - # The `-=` operator - var n_minuseq: TMinuseq is writable, noinit + redef fun operator do return "-" end # A possibly fully-qualified module identifier