diff options
author | dos-reis <gdr@axiomatics.org> | 2014-11-30 06:38:18 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2014-11-30 06:38:18 +0000 |
commit | 172e429ef0ca254a6711d66dbeb52eae09a6dfa9 (patch) | |
tree | 44ad89543dd4c06b481a7891ef75ccabbe1bf860 /src/include | |
parent | a436cd068c592428dc67217e427fa3b1b02fea81 (diff) | |
download | open-axiom-172e429ef0ca254a6711d66dbeb52eae09a6dfa9.tar.gz |
Misc cleanup.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/token.H | 18 |
1 files changed, 18 insertions, 0 deletions
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 |