diff options
author | dos-reis <gdr@axiomatics.org> | 2011-10-17 14:41:00 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-10-17 14:41:00 +0000 |
commit | 16111656afaa94a382d61de6c3ec37a9bdca05ef (patch) | |
tree | 50b54aa78118b0e723246f6acc034da705f53d35 /src/interp/lexing.boot | |
parent | f699415cce3f73d0f2b63ecb3b1fdc7084ba4cea (diff) | |
download | open-axiom-16111656afaa94a382d61de6c3ec37a9bdca05ef.tar.gz |
* lisp/core.lisp.in: Add ref and deref to support references.
* interp/sys-constants.boot ($OperatorFunctionNames): Add "by" and
"..".
* interp/spad.lisp: Tidy.
* interp/spad-parser.boot: New parsers.
* interp/preparse.lisp: Remove dead codes.
* interp/parsing.lisp (MATCH-ADVANCE-KEYWORD): Remove.
* interp/parse.boot (doParseCategory): Rename from parseCategory.
* interp/newaux.lisp: Tidy.
* interp/lexing.boot (getSpadToken): New.
(Keywords): Remove 'when'.
(matchKeywordNext): New.
(matchSpecial): Likewise.
(matchAdvanceSpecial): Likewise.
(matchAdvanceGlyph): Likewise.
* interp/fnewmeta.lisp: Move variable definitions to preparse.lisp.
Remove Lisp based parsers.
Remove file.
* interp/c-doc.boot (recordAttributeDocumentation): Fix thinko.
* interp/bootlex.lisp (GET-BOOT-TOKEN): Remove.
* interp/Makefile.in: Adjust dependencies.
* boot/parser.boot (bpChar): New.
(bpPattern): Allow character constants.
Diffstat (limited to 'src/interp/lexing.boot')
-rw-r--r-- | src/interp/lexing.boot | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot index d0f1c065..325aa513 100644 --- a/src/interp/lexing.boot +++ b/src/interp/lexing.boot @@ -188,8 +188,22 @@ tokenInstall(sym,typ,tok,nonblank == true) == tokenNonblank?(tok) := nonblank tok +getSpadToken tok == + not skipBlankChars() => nil + tt := tokenLookaheadType currentChar() + tt is 'EOF => tokenInstall(nil,'_*EOF,tok,$nonblank) + tt is 'ESCAPE => + advanceChar!() + getIdentifier(tok,true) + tt is 'ARGUMENT_-DESIGNATOR => GET_-ARGUMENT_-DESIGNATOR_-TOKEN tok + tt is 'ID => getIdentifier(tok,false) + tt is 'NUM => GET_-SPAD_-INTEGER_-TOKEN tok + tt is 'STRING => getSpadString tok + tt is 'SPECIAL_-CHAR => getSpecial tok + getGliph(tok,tt) + tryGetToken tok == - GET_-BOOT_-TOKEN tok => + getSpadToken tok => $validTokens := $validTokens + 1 tok nil @@ -205,9 +219,10 @@ nextToken() == $validTokens > 1 => $nextToken tryGetToken $nextToken -matchToken(tok,typ,sym == false) == +matchToken(tok,typ,sym == nil) == tok ~= nil and symbolEq?(tokenType tok,typ) and - (sym = nil or symbolEq?(sym,tokenSymbol tok)) and tok + (sym = nil or sym = tokenSymbol tok) => tok + nil ++ Return the current token if it has type `typ', and possibly the ++ same spelling as `sym'. @@ -299,10 +314,10 @@ getGliph(tok,gliphs) == gliphs := rest gliphs advanceChar!() s := makeSymbol listToString reverse! buf - return tokenInstall(property(s,'RENAMETOK) or s,'GLIPH,tok,$nonblank) + return tokenInstall(s,'GLIPH,tok,$nonblank) Keywords == [ - "or", "and", "isnt", "is", "when", "where", "forall", "exist", "try", + "or", "and", "isnt", "is", "where", "forall", "exist", "try", "has", "with", "add", "case", "in", "by", "pretend", "mod", "finally", "exquo", "div", "quo", "else", "rem", "then", "suchthat", "catch", "throw", "if", "iterate", "break", "from", "exit", "leave", "return", @@ -409,6 +424,24 @@ matchAdvanceKeyword kwd == true false +matchKeywordNext kwd == + matchToken(nextToken(),'KEYWORD,kwd) + +matchSpecial c == + matchToken(currentToken(),'SPECIAL_-CHAR,c) + +matchAdvanceSpecial c == + matchSpecial c => + advanceToken() + true + false + +matchAdvanceGlyph s == + matchToken(currentToken(),'GLIPH,s) => + advanceToken() + true + false + --% --% Stack abstract datatype. --% Operational semantics: |