aboutsummaryrefslogtreecommitdiff
path: root/src/interp/lexing.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-10-11 02:31:54 +0000
committerdos-reis <gdr@axiomatics.org>2011-10-11 02:31:54 +0000
commit3d58c8ff9d2a29477d85828b0dd1c35fecbaab5b (patch)
tree5906e7563349f847b9284eada8693bc25cdf8ecb /src/interp/lexing.boot
parent5c9c9d744bf4f5c71b952f0ef0be9e04a6f92e49 (diff)
downloadopen-axiom-3d58c8ff9d2a29477d85828b0dd1c35fecbaab5b.tar.gz
* interp/lexing.boot (matchString): New.
* interp/fnewmeta.lisp: Use it. * interp/parsing.lisp: Likewise. (MATCH-STRING): Remove.
Diffstat (limited to 'src/interp/lexing.boot')
-rw-r--r--src/interp/lexing.boot12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot
index 992239e3..712b1927 100644
--- a/src/interp/lexing.boot
+++ b/src/interp/lexing.boot
@@ -372,6 +372,18 @@ ungetTokens() ==
coreError '"How many tokens do you think you have?"
+++ Returns length of X if X matches initial segment of IN-STREAM.
+++ Otherwise, return nil.
+matchString x ==
+ ungetTokens()
+ skipBlankChars()
+ not linePastEnd? $spadLine and currentChar() ~= nil =>
+ nx := #x
+ buf := lineBuffer $spadLine
+ idx := lineCurrentIndex $spadLine
+ nx + idx > #buf => nil
+ and/[stringChar(x,i) = stringChar(buf,idx + i) for i in 0..nx-1] and nx
+ nil
--%
--% Stack abstract datatype.