Hi Nicholas,<div><br></div><div> how about renaming scanLitByte to scanLitByteVec?<br><br><div class="gmail_quote">On Fri, Nov 27, 2009 at 3:54 AM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nicolas Cellier uploaded a new version of Compiler to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Compiler-nice.98.mcz" target="_blank">http://source.squeak.org/trunk/Compiler-nice.98.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Compiler-nice.98<br>
Author: nice<br>
Time: 27 November 2009, 12:54:16 pm<br>
UUID: 4853aa4f-5bcb-e242-a130-f41f2c4d09ae<br>
Ancestors: Compiler-cwp.97<br>
<br>
Add support for literal ByteArray #[1 2 3]<br>
<br>
=============== Diff against Compiler-cwp.97 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Scanner>>scanLitByte (in category 'expression types') -----<br>
+ scanLitByte<br>
+ | stream |<br>
+ stream := (ByteArray new: 16) writeStream.<br>
+ [ tokenType = #rightBracket or: [ tokenType = #doIt ] ] whileFalse: [<br>
+ tokenType = #word<br>
+ ifTrue: [ self scanLitWord ].<br>
+ (token isInteger and: [ token between: 0 and: 255 ])<br>
+ ifFalse: [ ^ self offEnd: '8-bit integer or right bracket expected' ].<br>
+ stream nextPut: token.<br>
+ self scanToken ].<br>
+ token := stream contents!<br>
<br>
Item was changed:<br>
+ ----- Method: Scanner class>>initialize (in category 'initialization') -----<br>
- ----- Method: Scanner class>>initialize (in category 'class initialization') -----<br>
initialize<br>
| newTable |<br>
+ newTable := Array new: 256 withAll: #xBinary. "default"<br>
- newTable _ Array new: 256 withAll: #xBinary. "default"<br>
newTable atAll: #(9 10 12 13 32 ) put: #xDelimiter. "tab lf ff cr space"<br>
newTable atAll: ($0 asciiValue to: $9 asciiValue) put: #xDigit.<br>
<br>
1 to: 255<br>
do: [:index |<br>
(Character value: index) isLetter<br>
ifTrue: [newTable at: index put: #xLetter]].<br>
<br>
newTable at: 30 put: #doIt.<br>
newTable at: $" asciiValue put: #xDoubleQuote.<br>
newTable at: $# asciiValue put: #xLitQuote.<br>
newTable at: $$ asciiValue put: #xDollar.<br>
newTable at: $' asciiValue put: #xSingleQuote.<br>
newTable at: $: asciiValue put: #xColon.<br>
newTable at: $( asciiValue put: #leftParenthesis.<br>
newTable at: $) asciiValue put: #rightParenthesis.<br>
newTable at: $. asciiValue put: #period.<br>
newTable at: $; asciiValue put: #semicolon.<br>
newTable at: $[ asciiValue put: #leftBracket.<br>
newTable at: $] asciiValue put: #rightBracket.<br>
newTable at: ${ asciiValue put: #leftBrace.<br>
newTable at: $} asciiValue put: #rightBrace.<br>
newTable at: $^ asciiValue put: #upArrow.<br>
newTable at: $_ asciiValue put: #leftArrow.<br>
newTable at: $| asciiValue put: #verticalBar.<br>
+ TypeTable := newTable "bon voyage!!"<br>
- TypeTable _ newTable "bon voyage!!"<br>
<br>
"Scanner initialize"!<br>
<br>
Item was changed:<br>
----- Method: Scanner>>xLitQuote (in category 'multi-character scans') -----<br>
xLitQuote<br>
"Symbols and vectors: #(1 (4 5) 2 3) #ifTrue:ifFalse: #'abc'."<br>
-<br>
| start |<br>
start := mark.<br>
self step. "litQuote"<br>
self scanToken.<br>
tokenType = #leftParenthesis<br>
+ ifTrue: [self scanToken; scanLitVec.<br>
+ mark := start + 1.<br>
- ifTrue:<br>
- [self scanToken; scanLitVec.<br>
- mark := start+1.<br>
tokenType == #doIt<br>
ifTrue: [self offEnd: 'Unmatched parenthesis']]<br>
+ ifFalse: [tokenType = #leftBracket<br>
+ ifTrue: [self scanToken; scanLitByte.<br>
+ mark := start + 1.<br>
+ tokenType == #doIt<br>
+ ifTrue: [self offEnd: 'Unmatched bracket']]<br>
+ ifFalse: [(#(#word #keyword #colon ) includes: tokenType)<br>
+ ifTrue: [self scanLitWord]<br>
+ ifFalse: [tokenType == #literal<br>
+ ifTrue: [token isSymbol<br>
+ ifTrue: ["##word"<br>
+ token := token<br>
+ "May want to move toward ANSI<br>
+ here "]]<br>
+ ifFalse: [tokenType == #string<br>
+ ifTrue: [token := token asSymbol]]]]].<br>
- ifFalse:<br>
- [(#(word keyword colon ) includes: tokenType)<br>
- ifTrue:<br>
- [self scanLitWord]<br>
- ifFalse:<br>
- [(tokenType==#literal)<br>
- ifTrue:<br>
- [(token isSymbol)<br>
- ifTrue: "##word"<br>
- [token := token "May want to move toward ANSI here"]]<br>
- ifFalse:<br>
- [tokenType==#string ifTrue: [token := token asSymbol]]]].<br>
mark := start.<br>
tokenType := #literal<br>
<br>
+ "#(Pen)<br>
- " #(Pen)<br>
#Pen<br>
#'Pen'<br>
##Pen<br>
###Pen<br>
+ "!<br>
- "!<br>
<br>
<br>
</blockquote></div><br>
</div>