aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@axiomatics.org>2017-01-15 08:42:04 -0800
committerGabriel Dos Reis <gdr@axiomatics.org>2017-01-15 08:42:04 -0800
commit77be242e6af75148771620fcbbaad191d1c11b60 (patch)
tree476cc4692d235e6f908152e3f12aac61449bebac /src
parentb56562693a88f88e7c290de9e1dc18d96a0da792 (diff)
downloadopen-axiom-77be242e6af75148771620fcbbaad191d1c11b60.tar.gz
TokenValue::Indent, TokenValue::Unindent, TokenValue::Justify
Classify them as formatting tokens. Remove TokenValue::Artificial.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/include/open-axiom/token4
-rw-r--r--src/include/open-axiom/token-value6
-rw-r--r--src/syntax/token.cxx11
4 files changed, 15 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b1302e3a..ac10c246 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-15 Gabriel Dos Reis <gdr@axiomatics.org>
+
+ * include/open-axiom/token (TokenValue::Indent,
+ TokenValue::Unindent, TokenValue::Justify): Move definition to..
+ * include/open-axiom/token-value: ...here.
+ * syntax/token.cxx (operator<<): Adjust.
+
2017-01-02 Gabriel Dos Reis <gdr@axiomatics.org>
* lib/Makefile.in (core_SOURCES): Include files for IO,
diff --git a/src/include/open-axiom/token b/src/include/open-axiom/token
index 1b4f78f0..da508a82 100644
--- a/src/include/open-axiom/token
+++ b/src/include/open-axiom/token
@@ -66,10 +66,6 @@ namespace OpenAxiom {
#define OPENAXIOM_DEFINE_TOKEN(T, ...) T,
#include <open-axiom/token-value>
#undef OPENAXIOM_DEFINE_TOKEN
- Artificial, // Tokens after this are artificial
- Indent, // new line indentation, greater than previous
- Unindent, // new line indentation, less than previous
- Justify, // align indentation with preceding line.
EndOfStream // end of token stream
};
diff --git a/src/include/open-axiom/token-value b/src/include/open-axiom/token-value
index aa8347d3..3becc318 100644
--- a/src/include/open-axiom/token-value
+++ b/src/include/open-axiom/token-value
@@ -1,5 +1,5 @@
// -*- C++ -*-
-// Copyright (C) 2014, Gabriel Dos Reis.
+// Copyright (C) 2014-2017, Gabriel Dos Reis.
// All rights reserved.
// Written by Gabriel Dos Reis.
//
@@ -144,3 +144,7 @@ OPENAXIOM_DEFINE_TOKEN(Until, "until", Keyword, Language::BootSpad)
OPENAXIOM_DEFINE_TOKEN(With, "with", Keyword, Language::Spad)
OPENAXIOM_DEFINE_TOKEN(Where, "where", Keyword, Language::BootSpad)
OPENAXIOM_DEFINE_TOKEN(While, "while", Keyword, Language::BootSpad)
+
+OPENAXIOM_DEFINE_TOKEN(Indent, "<indent>", Formatting, Language::All)
+OPENAXIOM_DEFINE_TOKEN(Unindent, "<unindent>", Formatting, Language::All)
+OPENAXIOM_DEFINE_TOKEN(Justify, "<justify>", Formatting, Language::All)
diff --git a/src/syntax/token.cxx b/src/syntax/token.cxx
index 74b58fa2..011520a8 100644
--- a/src/syntax/token.cxx
+++ b/src/syntax/token.cxx
@@ -101,15 +101,10 @@ namespace OpenAxiom {
std::ostream&
operator<<(std::ostream& os, TokenValue tv) {
- if (tv < TokenValue::Artificial)
+ if (tv < TokenValue::EndOfStream)
os << token_map[uint8_t(tv)].text;
- else switch (tv) {
- case TokenValue::Indent: os << "%INDENT"; break;
- case TokenValue::Unindent: os << "%UNIDENT"; break;
- case TokenValue::Justify: os << "%JUSTIFY"; break;
- default: os << "%ALIEN"; break;
- }
-
+ else
+ os << "%ALIEN";
return os;
}