diff -r 317a3bd63c65 -r fee7c3091f71 Scanner.st --- a/Scanner.st Sun Feb 26 19:21:00 1995 +0100 +++ b/Scanner.st Sun Feb 26 19:21:09 1995 +0100 @@ -33,7 +33,7 @@ COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.19 1995-02-24 15:22:21 claus Exp $ +$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.20 1995-02-26 18:20:55 claus Exp $ '! !Scanner class methodsFor:'documentation'! @@ -54,7 +54,7 @@ version " -$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.19 1995-02-24 15:22:21 claus Exp $ +$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.20 1995-02-26 18:20:55 claus Exp $ " ! @@ -244,6 +244,60 @@ currentComments add:comment ] ]. +! + +parseDirective + |directive packageName| + + source next. + source skipSeparatorsExceptCR. + hereChar := source peek. + hereChar isLetter ifTrue:[ + directive := source nextWord. + source peek == $: ifTrue:[ + source next. + source skipSeparatorsExceptCR. + hereChar := source peek. + + " + Package: 'name-of-package' + " + directive = 'Package' ifTrue:[ + hereChar == $' ifTrue:[ + self nextString. + tokenType == #String ifTrue:[ + packageName := tokenValue + ] + ]. + (requestor respondsTo:#setPackage:) ifTrue:[ + requestor setPackage:packageName + ]. + ]. + + " + Prerequisites: 'name-of-package', ... , 'name-of-package' + " + directive = 'Prerequisites' ifTrue:[ + [hereChar == $'] whileTrue:[ + self nextString. + tokenType == #String ifTrue:[ + packageName := tokenValue. + (requestor respondsTo:#requirePackage:) ifTrue:[ + requestor requirePackage:packageName + ]. + ]. + source skipSeparatorsExceptCR. + hereChar := source peek. + (hereChar == $,) ifTrue:[ + source next. + source skipSeparatorsExceptCR. + hereChar := source peek. + ]. + ]. + ]. + ] + ]. + hereChar := source peek. ! ! !Scanner methodsFor:'error handling'! @@ -391,7 +445,8 @@ source next. hereChar := source peek. - "special ST/X addition: + " + special ST/X addition: a $/ right after the initial double quote makes it an up-to-end-of-line comment, which is very useful to comment out parts of filed-in source code. Since this is non-standard, use it in very rare cases only. @@ -425,6 +480,14 @@ outCol := 1 ]. ] ifFalse:[ + hereChar == ${ ifTrue:[ + " + special ST/X addition: + a ${ right after the initial double quote starts a directive + " + self parseDirective + ]. + [hereChar notNil and:[hereChar ~~ (Character doubleQuote)]] whileTrue:[ hereChar == (Character cr) ifTrue:[ tokenLineNr := tokenLineNr + 1.