diff options
-rw-r--r-- | src/boot/Makefile.am | 2 | ||||
-rw-r--r-- | src/boot/Makefile.in | 4 | ||||
-rw-r--r-- | src/boot/bemol.cc | 26 | ||||
-rw-r--r-- | src/include/token.H | 18 | ||||
-rw-r--r-- | src/syntax/token.cc | 4 | ||||
-rw-r--r-- | src/utils/Makefile.am | 3 | ||||
-rw-r--r-- | src/utils/Makefile.in | 6 |
7 files changed, 33 insertions, 30 deletions
diff --git a/src/boot/Makefile.am b/src/boot/Makefile.am index a2bd1cf5..9a3b320a 100644 --- a/src/boot/Makefile.am +++ b/src/boot/Makefile.am @@ -74,7 +74,7 @@ bemol_SOURCES = \ bemol.cc bemol_LDADD = \ - -L$(oa_target_libdir) -lOpenAxiom + $(oa_target_libdir)/libOpenAxiom.a oa_target_bootdir = $(oa_targetdir)/boot if OA_ECL_RT diff --git a/src/boot/Makefile.in b/src/boot/Makefile.in index 6c136b1d..4d39139e 100644 --- a/src/boot/Makefile.in +++ b/src/boot/Makefile.in @@ -149,7 +149,7 @@ CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_bemol_OBJECTS = bemol.$(OBJEXT) bemol_OBJECTS = $(am_bemol_OBJECTS) -bemol_DEPENDENCIES = +bemol_DEPENDENCIES = $(oa_target_libdir)/libOpenAxiom.a AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -450,7 +450,7 @@ bemol_SOURCES = \ bemol.cc bemol_LDADD = \ - -L$(oa_target_libdir) -lOpenAxiom + $(oa_target_libdir)/libOpenAxiom.a oa_target_bootdir = $(oa_targetdir)/boot @OA_ECL_RT_FALSE@oa_bootsys_linkset = diff --git a/src/boot/bemol.cc b/src/boot/bemol.cc index b36b174d..64262e91 100644 --- a/src/boot/bemol.cc +++ b/src/boot/bemol.cc @@ -155,35 +155,13 @@ SourceInput::get() { // -- Decomposing source files into lexical units of information -- // -struct Locus { - OpenAxiom::LineNumber line; - OpenAxiom::ColumnIndex column; -}; - -static std::ostream& -operator<<(std::ostream& os, const Locus& l) -{ - os << '{' << l.line << ", " << l.column << '}'; - return os; -} - -struct BemolToken { - using Location = ::Locus; - OpenAxiom::TokenCategory category; - OpenAxiom::TokenValue value; - Locus start; - Locus end; - - explicit operator bool() const { return category != TokenCategory::EOS; } -}; - static std::ostream& -operator<<(std::ostream& os, const BemolToken& t) { +operator<<(std::ostream& os, const Token& t) { os << t.category << '{' << t.start << '-' << t.end << '}'; return os; } -using TokenSequence = OpenAxiom::TokenStream<BemolToken>; +using TokenSequence = OpenAxiom::TokenStream<Token>; // -- diff --git a/src/include/token.H b/src/include/token.H index 71d6cb10..b57b69d6 100644 --- a/src/include/token.H +++ b/src/include/token.H @@ -79,6 +79,19 @@ namespace OpenAxiom { using LineNumber = std::size_t; using ColumnIndex = std::size_t; + struct Locus { + LineNumber line; + ColumnIndex column; + }; + + std::ostream& operator<<(std::ostream&, const Locus&); + + // Program text region + struct Region { + Locus start; + Locus end; + }; + // Given a symbolic or alphabetic token, retrieve its category // and associated abstract value. struct TokenClassification { @@ -92,6 +105,11 @@ namespace OpenAxiom { TokenClassification classify(const std::string&); + // Token data structure: a region of text with a classification. + struct Token : TokenClassification, Region { + using Location = Locus; + }; + // Cursor into a fragment. struct FragmentCursor { std::size_t line; // index of a line in a fragment diff --git a/src/syntax/token.cc b/src/syntax/token.cc index fe3cd7a7..d66a849e 100644 --- a/src/syntax/token.cc +++ b/src/syntax/token.cc @@ -35,6 +35,10 @@ #include <iostream> namespace OpenAxiom { + std::ostream& operator<<(std::ostream& os, const Locus& l) { + return os << '{' << l.line << ", " << l.column << '}'; + } + std::ostream& operator<<(std::ostream& os, TokenCategory tc) { switch (tc) { diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am index 0febb681..7aba686e 100644 --- a/src/utils/Makefile.am +++ b/src/utils/Makefile.am @@ -31,7 +31,8 @@ noinst_PROGRAMS = hammer$(EXEEXT) hammer_SOURCES = hammer.cc -hammer_LDADD = -L. -lOpenAxiom +hammer_LDADD = \ + $(oa_target_libdir)/libOpenAxiom.a noinst_LIBRARIES = libOpenAxiom.a diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in index 97cd1a0b..b1d8f1f8 100644 --- a/src/utils/Makefile.in +++ b/src/utils/Makefile.in @@ -147,7 +147,7 @@ libOpenAxiom_a_OBJECTS = $(am_libOpenAxiom_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_hammer_OBJECTS = hammer.$(OBJEXT) hammer_OBJECTS = $(am_hammer_OBJECTS) -hammer_DEPENDENCIES = +hammer_DEPENDENCIES = $(oa_target_libdir)/libOpenAxiom.a AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -406,7 +406,9 @@ top_srcdir = @top_srcdir@ void_type = @void_type@ noinst_PROGRAMS = hammer$(EXEEXT) hammer_SOURCES = hammer.cc -hammer_LDADD = -L. -lOpenAxiom +hammer_LDADD = \ + $(oa_target_libdir)/libOpenAxiom.a + noinst_LIBRARIES = libOpenAxiom.a libOpenAxiom_a_SOURCES = \ storage.cc string-pool.cc command.cc \ |