diff options
author | dos-reis <gdr@axiomatics.org> | 2012-02-20 05:19:56 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2012-02-20 05:19:56 +0000 |
commit | 9a7f3aa43e7241b28aeff60c1b8a914b9f5ddf4d (patch) | |
tree | 9b6f1207eb28a129870c359efeae8e9dd905dfb4 /src/interp/lexing.boot | |
parent | e4d42fad6ae663b5fdae7d6fae8f3aba51575849 (diff) | |
download | open-axiom-9a7f3aa43e7241b28aeff60c1b8a914b9f5ddf4d.tar.gz |
* interp/lexing.boot (getNumberToken): New.
(getArgumentDesignator): Likewise.
(getToken): Use it.
* interp/parsing.lisp (GET-NUMBER-TOKEN): Remove.
* interp/bootlex.lisp (INIT-BOOT/SPAD-READER): Move to spad.lisp.
(SPAD): Likewise.
(READ-SPAD1): Likewise.
(TEST): Remove.
(GET-ARGUMENT-DESIGNATOR-TOKEN): Likewise.
Diffstat (limited to 'src/interp/lexing.boot')
-rw-r--r-- | src/interp/lexing.boot | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot index 8b0e1b7e..e63a13cb 100644 --- a/src/interp/lexing.boot +++ b/src/interp/lexing.boot @@ -1,4 +1,4 @@ --- Copyright (C) 2011, Gabriel Dos Reis. +-- Copyright (C) 2011-2012, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -188,6 +188,22 @@ tokenInstall(sym,typ,tok,nonblank == true) == tokenNonblank?(tok) := nonblank tok +getNumberToken tok == + buf := nil + repeat + buf := [currentChar(),:buf] + digit? nextChar() => advanceChar!() + leave nil + advanceChar!() + sz := #buf -- keep track of digit count + tokenInstall(readIntegerIfCan listToString reverse! buf,'NUMBER,tok,sz) + +getArgumentDesignator tok == + advanceChar!() + getNumberToken tok + tokenInstall(makeSymbol strconc('"#",formatToString('"~D",tokenSymbol tok)), + 'ARGUMENT_-DESIGNATOR,tok,$nonblank) + getToken tok == not skipBlankChars() => nil tt := tokenLookaheadType currentChar() @@ -195,7 +211,7 @@ getToken tok == tt is 'ESCAPE => advanceChar!() getIdentifier(tok,true) - tt is 'ARGUMENT_-DESIGNATOR => GET_-ARGUMENT_-DESIGNATOR_-TOKEN tok + tt is 'ARGUMENT_-DESIGNATOR => getArgumentDesignator tok tt is 'ID => getIdentifier(tok,false) tt is 'NUM => GET_-SPAD_-INTEGER_-TOKEN tok tt is 'STRING => getSpadString tok |