aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/sciteco.7.template9
-rw-r--r--src/expressions.cpp3
-rw-r--r--src/expressions.h3
-rw-r--r--src/parser.cpp5
4 files changed, 16 insertions, 4 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template
index 42d1425..a86606e 100644
--- a/doc/sciteco.7.template
+++ b/doc/sciteco.7.template
@@ -429,15 +429,18 @@ Remainder of \fIa\fP divided by \fIb\fP.
It is actually a modulo operation conforming to the
host C compiler's modulo semantics.
.TP
-.IB a " - " b
-Subtract \fIb\fP from \fIa\fP.
-.TP
.IB a " + " b
Add \fIb\fP to \fIa\fP.
.TP
+.IB a " - " b
+Subtract \fIb\fP from \fIa\fP.
+.TP
.IB a " & " b
Binary AND.
.TP
+.IB a " ^# " b
+Binary exclusive OR (XOR).
+.TP
.IB a " # " b
Binary OR.
.LP
diff --git a/src/expressions.cpp b/src/expressions.cpp
index a528f16..5a389fd 100644
--- a/src/expressions.cpp
+++ b/src/expressions.cpp
@@ -170,6 +170,9 @@ Expressions::calc(void)
case OP_AND:
result = vleft & vright;
break;
+ case OP_XOR:
+ result = vleft ^ vright;
+ break;
case OP_OR:
result = vleft | vright;
break;
diff --git a/src/expressions.h b/src/expressions.h
index 8e690e8..730ddad 100644
--- a/src/expressions.h
+++ b/src/expressions.h
@@ -143,9 +143,10 @@ public:
OP_MUL, // *
OP_DIV, // /
OP_MOD, // ^/
- OP_SUB, // -
OP_ADD, // +
+ OP_SUB, // -
OP_AND, // &
+ OP_XOR, // ^#
OP_OR, // #
// pseudo operators:
OP_NEW,
diff --git a/src/parser.cpp b/src/parser.cpp
index 24d48c2..f839840 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1735,6 +1735,11 @@ StateControl::custom(gchar chr)
expressions.push_calc(Expressions::OP_MOD);
break;
+ case '#':
+ BEGIN_EXEC(&States::start);
+ expressions.push_calc(Expressions::OP_XOR);
+ break;
+
default:
throw Error("Unsupported command <^%c>", chr);
}