A new version of Compiler was added to project The Inbox:
http://source.squeak.org/inbox/Compiler.quasiquote-eem.250.mcz ==================== Summary ==================== Name: Compiler.quasiquote-eem.250 Author: eem Time: 8 February 2013, 2:13:35.099 pm UUID: 64840809-3e4b-4030-a224-cc2c05b8c18c Ancestors: Compiler.quasiquote-eem.249 Move quasi-quote to primaryExpression from expression. Merge with Compiler-eem.249: Simplify Parser>expression. braceExpression is handled in primaryExpression, as it should be. The extra invocation in expression is unnecessary, and harmlessly erroneous. Slightly less circuitous generation of methods with temp names. Since schematic temp names string is computed during generation, best to generate a method and copy it with the computed temp names than generate two separate methods. =============== Diff against Compiler.quasiquote-eem.249 =============== Item was changed: ----- Method: MethodNode>>generateWithTempNames (in category 'code generation') ----- generateWithTempNames + "Answer a CompiledMethod with temps names encoded in its trailer." + | methodSansTempNames | + "The encoder computes the schematic temp names during generation, so + generate a method without temp names first. If the method is quick there are + no temps and hence no temp names." + methodSansTempNames := self + generate: CompiledMethodTrailer empty + using: CompiledMethod. + ^methodSansTempNames + copyWithTrailerBytes: + ((CompiledMethodTrailer new tempNames: + (methodSansTempNames isQuick + ifTrue: [''] + ifFalse: [encoder schematicTempNamesString])))! - "Answer a CompiledMethod with temps names encoded in trailer" - ^self - generate: (CompiledMethodTrailer new tempNames: self schematicTempNamesString) - using: CompiledMethod! Item was changed: ----- Method: Parser>>expression (in category 'expression types') ----- expression + (hereType == #word + and: [tokenType == #leftArrow]) ifTrue: - - (hereType == #word and: [tokenType == #leftArrow]) ifTrue: [^self assignment: self variable]. + self primaryExpression ifFalse: + [^false]. + ((self messagePart: 3 repeat: true) + and: [hereType == #semicolon]) ifTrue: + [self cascade]. - hereType == #backQuote - ifTrue: [self quasiQuoteExpression] - ifFalse: - [hereType == #leftBrace - ifTrue: [self braceExpression] - ifFalse: - [self primaryExpression ifFalse: - [^false]]]. - (self messagePart: 3 repeat: true) ifTrue: - [hereType == #semicolon ifTrue: - [self cascade]]. ^true! Item was changed: ----- Method: Parser>>primaryExpression (in category 'expression types') ----- primaryExpression hereType == #word ifTrue: [parseNode := self variable. (parseNode isUndefTemp and: [self interactive]) ifTrue: [self queryUndefined]. parseNode nowHasRef. ^ true]. hereType == #leftBracket ifTrue: [self advance. self blockExpression. ^true]. hereType == #leftBrace ifTrue: [self braceExpression. ^true]. + hereType == #backQuote + ifTrue: + [self advance. + self quasiQuoteExpression. + ^true]. hereType == #leftParenthesis ifTrue: [self advance. self expression ifFalse: [^self expected: 'expression']. (self match: #rightParenthesis) ifFalse: [^self expected: 'right parenthesis']. ^true]. (hereType == #string or: [hereType == #number or: [hereType == #literal or: [hereType == #character]]]) ifTrue: [parseNode := encoder encodeLiteral: self advance. ^true]. (here == #- and: [tokenType == #number and: [1 + hereEnd = mark]]) ifTrue: [self advance. parseNode := encoder encodeLiteral: self advance negated. ^true]. ^false! |
Free forum by Nabble | Edit this page |