From 9a7f3aa43e7241b28aeff60c1b8a914b9f5ddf4d Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 20 Feb 2012 05:19:56 +0000 Subject: * 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. --- src/interp/lexing.boot | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/interp/lexing.boot') 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 -- cgit v1.2.3