aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
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()