aboutsummaryrefslogtreecommitdiff
path: root/src/interp/lexing.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-05-06 22:02:12 +0000
committerdos-reis <gdr@axiomatics.org>2012-05-06 22:02:12 +0000
commitbaa2d50e5a11158ac998dfc0f3c8d5293666f77a (patch)
treefdd18c9db3f95045d14bf01200d42de63ac3a93f /src/interp/lexing.boot
parent3ca02c13b9f1cd5026ce2beec02b812a5e55baef (diff)
downloadopen-axiom-baa2d50e5a11158ac998dfc0f3c8d5293666f77a.tar.gz
* interp/lexing.boot (indentationLocation): New.
* interp/macros.lisp (expand-tabs): Use it in lieu of NDENT-POS. * interp/preparse.lisp (PREPARSE1): Likewise.
Diffstat (limited to 'src/interp/lexing.boot')
-rw-r--r--src/interp/lexing.boot16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/interp/lexing.boot b/src/interp/lexing.boot
index 4b357918..36b54fd5 100644
--- a/src/interp/lexing.boot
+++ b/src/interp/lexing.boot
@@ -44,6 +44,22 @@ module lexing where
matchString: %String -> %Maybe %Short
matchAdvanceString: %String -> %Maybe %Short
matchAdvanceKeyword: %Symbol -> %Thing
+ indentationLocation: %String -> %Maybe %Short
+
+--%
+
+++ Return the logical indentation position in the `line', after
+++ expansion of leading vertical tab characters.
+indentationLocation line ==
+ loc := 0
+ n := #line
+ for i in 0.. repeat
+ i >= n => return nil
+ spaceChar? line.i => loc := loc + 1
+ tabChar? line.i => loc := 8 * (loc quo 8 + 1)
+ return loc
+
+--%
--%
--% Line abstract datatype