diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/interp/i-syscmd.boot | 2 | ||||
-rw-r--r-- | src/interp/incl.boot | 4 | ||||
-rw-r--r-- | src/interp/io.boot | 16 | ||||
-rw-r--r-- | src/interp/preparse.lisp | 2 |
5 files changed, 29 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 56f10878..370422dd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2012-05-09 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/io.boot (carriageRetChar?): New. + (trimCarriageReturn): Likewise. + (expandLeadingTabs): Likewise. + * interp/preparse.lisp: Use it. + * interp/incl.boot: Likewise. + * interp/i-syscmd.boot: Likewise. + +2012-05-09 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/preparse.lisp (PREPARSE): Move to spad-parser.boot. Rename as preparse. diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index 735e4681..611a3db6 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -2752,7 +2752,7 @@ processSynonyms() == -- common lisp dependent doSystemCommand string == - string := strconc('")", EXPAND_-TABS string) + string := strconc('")", expandLeadingTabs string) LINE: local := string processSynonyms() string := LINE diff --git a/src/interp/incl.boot b/src/interp/incl.boot index ae32e0bf..9d5e9173 100644 --- a/src/interp/incl.boot +++ b/src/interp/incl.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2011, Gabriel Dos Reis +-- Copyright (C) 2007-2012, Gabriel Dos Reis -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -270,7 +270,7 @@ incLude1(eb,ss,ln,ufos,states) == [xlPrematureEOF(eb, '")--premature end", lno,ufos), :StreamNil] StreamNil - str := EXPAND_-TABS first ss + str := expandLeadingTabs first ss info := incClassify str not info.0 => diff --git a/src/interp/io.boot b/src/interp/io.boot index c9fdb800..1e94a4be 100644 --- a/src/interp/io.boot +++ b/src/interp/io.boot @@ -55,6 +55,9 @@ macro tabChar? c == blankChar? c == spaceChar? c or tabChar? c +carriageRetChar? c == + c = abstractChar 13 + --% --% String manipulation routines. @@ -76,3 +79,16 @@ trimTrailingBlank line == n := n - 1 n = sz => line subString(line,0,n) + +trimCarriageReturn line == + carriageRetChar? line.maxIndex(line) => + subString(line,0,maxIndex line) + line + +expandLeadingTabs line == + not string? line or #line = 0 => line + line := trimCarriageReturn line + nbLoc := firstNonblankCharPosition line + indLoc := indentationLocation line + nbLoc = indLoc => line + strconc(makeString(indLoc,char " "), subString(line,nbLoc)) diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index 331aa3e3..0d9e7ff1 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -181,7 +181,7 @@ (PROG (LINE IND) (SETQ LINE (if $LINELIST (pop $LINELIST) - (expand-tabs (|readLine| in-stream)))) + (|expandLeadingTabs| (|readLine| in-stream)))) (setq |$preparseLastLine| LINE) (and (stringp line) (incf $INDEX)) (COND |