aboutsummaryrefslogtreecommitdiffstats
path: root/src/pprint.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-08-19 03:25:43 +0000
committerDavid Robillard <d@drobilla.net>2010-08-19 03:25:43 +0000
commit9a1c3c7cfc96cb6ee1c9f7bc103b99b89da43d6e (patch)
tree3c0f7348198b9c722c67ed6f2e819fa8e8150767 /src/pprint.cpp
parent1bc26254cf83449017b24afd90420916d8f512aa (diff)
downloadresp-9a1c3c7cfc96cb6ee1c9f7bc103b99b89da43d6e.tar.gz
resp-9a1c3c7cfc96cb6ee1c9f7bc103b99b89da43d6e.tar.bz2
resp-9a1c3c7cfc96cb6ee1c9f7bc103b99b89da43d6e.zip
Coherent AString and Lexeme implementation.
A Lexeme is any "token" read from input, a lexeme has not yet beeen parsed and could parse to anything, e.g. a string, an expression, a number, etc. Lexemes are not (yet?) exposed to the language or ever compiled. A String is a string literal, which can contain any character directly except " and \. There are two special escapes: \" and \\, any other character following a \ is a syntax error. Fix garbage collection of REPL objects, leading to type errors from type variable re-use because a type variable for a given AST's /address/ exists, but that address has actually been deleted and reused by new (i.e. make top level REPL expressions and types be GC roots). git-svn-id: http://svn.drobilla.net/resp/resp@261 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/pprint.cpp')
-rw-r--r--src/pprint.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pprint.cpp b/src/pprint.cpp
index 5ee5736..391609a 100644
--- a/src/pprint.cpp
+++ b/src/pprint.cpp
@@ -24,6 +24,10 @@
ostream&
operator<<(ostream& out, const AST* ast)
{
+ const ALexeme* lexeme = ast->to<const ALexeme*>();
+ if (lexeme)
+ return out << *lexeme;
+
const ALiteral<float>* flit = ast->to<const ALiteral<float>*>();
if (flit)
return out << showpoint << flit->val;
@@ -38,7 +42,7 @@ operator<<(ostream& out, const AST* ast)
const AString* str = ast->to<const AString*>();
if (str)
- return out << *str;
+ return out << '"' << *str << '"';
const ASymbol* sym = ast->to<const ASymbol*>();
if (sym)