aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-05-22 16:46:25 +0000
committerdos-reis <gdr@axiomatics.org>2012-05-22 16:46:25 +0000
commiteae4d54c648d019b9db583b4e8d2c432f8d7bb16 (patch)
tree2be3450270bde5e728ba1f2571b3a00c95aaf910 /src/interp
parentd5c006517a885094c5752f7f143c9a0e8cda4504 (diff)
downloadopen-axiom-eae4d54c648d019b9db583b4e8d2c432f8d7bb16.tar.gz
* interp/lexing.boot (%Token): Now an actual type defined as a
record structure. (copyToken): Adjust. (tokenSymbol): Remove as now automatically generated. (tokenType): Likewise. (tokenNonblank?): Likewise. * boot/ast.boot (bfRecordDef): Specify a name for a copier function.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/lexing.boot25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot
index aeaccf9d..5adc0678 100644
--- a/src/interp/lexing.boot
+++ b/src/interp/lexing.boot
@@ -152,27 +152,18 @@ nextChar() ==
--%
--% Token abstract datatype.
---% Operational semantics:
---% structure Token ==
---% Record(symbol: Identifier, type: TokenType, nonBlank?: Boolean)
---%
---% type in '(NUMBER IDENTIFIER SPECIAL_-CHAR)
---% nonBlank? if token is not preceded by a blank.
--%
+structure %Token ==
+ Record(sym: %Symbol, typ: %Thing, nb?: %Boolean) with
+ tokenSymbol == (.sym)
+ tokenType == (.typ) -- typ in '(NUMBER IDENTIFIER SPECIAL_-CHAR)
+ tokenNonblank? == (.nb?) -- true if token is not preceded by a blank.
+
makeToken(sym == nil, typ == nil, blnk? == true) ==
- [sym,typ,blnk?]
+ mk%Token(sym,typ,blnk?)
macro copyToken t ==
- copyList t
-
-macro tokenSymbol t ==
- first t
-
-macro tokenType t ==
- second t
-
-macro tokenNonblank? t ==
- third t
+ copy%Token t
++ Last seen token
$priorToken := makeToken()