aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-16 02:52:51 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2013-02-16 02:52:51 +0100
commit8811c358f8c82aea515051b508b26fbfacb61e24 (patch)
tree4acc9c426f9e83c9e5e66c10807af760be9830dd /src
parent7b16df057ce5b8cd5ad1870d5188ee11140e73b5 (diff)
downloadsciteco-8811c358f8c82aea515051b508b26fbfacb61e24.tar.gz
implemented command to query ASCII code of character (^^x)
Diffstat (limited to 'src')
-rw-r--r--src/parser.cpp17
-rw-r--r--src/parser.h9
2 files changed, 26 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 6e32d87..46bea77 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -45,6 +45,7 @@ gint macro_pc = 0;
namespace States {
StateStart start;
StateControl control;
+ StateASCII ascii;
StateFCommand fcommand;
StateCondCommand condcommand;
StateECommand ecommand;
@@ -1208,6 +1209,7 @@ StateControl::StateControl() : State()
{
transitions['\0'] = this;
transitions['U'] = &States::ctlucommand;
+ transitions['^'] = &States::ascii;
}
State *
@@ -1275,6 +1277,21 @@ StateControl::custom(gchar chr) throw (Error)
return &States::start;
}
+StateASCII::StateASCII() : State()
+{
+ transitions['\0'] = this;
+}
+
+State *
+StateASCII::custom(gchar chr) throw (Error)
+{
+ BEGIN_EXEC(&States::start);
+
+ expressions.push(chr);
+
+ return &States::start;
+}
+
StateECommand::StateECommand() : State()
{
transitions['\0'] = this;
diff --git a/src/parser.h b/src/parser.h
index 9908f31..da9bfee 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -218,6 +218,14 @@ private:
State *custom(gchar chr) throw (Error);
};
+class StateASCII : public State {
+public:
+ StateASCII();
+
+private:
+ State *custom(gchar chr) throw (Error);
+};
+
class StateFCommand : public State {
public:
StateFCommand();
@@ -268,6 +276,7 @@ protected:
namespace States {
extern StateStart start;
extern StateControl control;
+ extern StateASCII ascii;
extern StateFCommand fcommand;
extern StateCondCommand condcommand;
extern StateECommand ecommand;