From 77be242e6af75148771620fcbbaad191d1c11b60 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sun, 15 Jan 2017 08:42:04 -0800 Subject: TokenValue::Indent, TokenValue::Unindent, TokenValue::Justify Classify them as formatting tokens. Remove TokenValue::Artificial. --- src/ChangeLog | 7 +++++++ src/include/open-axiom/token | 4 ---- src/include/open-axiom/token-value | 6 +++++- src/syntax/token.cxx | 11 +++-------- 4 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src') 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 + + * 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 * 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 #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, "", Formatting, Language::All) +OPENAXIOM_DEFINE_TOKEN(Unindent, "", Formatting, Language::All) +OPENAXIOM_DEFINE_TOKEN(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; } -- cgit v1.2.3