equal
deleted
inserted
replaced
129 falseBlock value. |
129 falseBlock value. |
130 compiler dedent. |
130 compiler dedent. |
131 compiler addOnLine: '].'. |
131 compiler addOnLine: '].'. |
132 ]." |
132 ]." |
133 |
133 |
134 guard id: (compiler idFor: guard prefixed: #guard). |
134 guard id: (compiler idFor: guard defaultName: #guard). |
135 guard compileGuard: compiler. |
135 guard compileGuard: compiler. |
136 |
136 |
137 trueBlock isNil ifFalse: [ |
137 trueBlock isNil ifFalse: [ |
138 compiler addOnLine: ' ifTrue: ['. |
138 compiler addOnLine: ' ifTrue: ['. |
139 compiler indent. |
139 compiler indent. |
261 |
261 |
262 notCharSetPredicateBody: node |
262 notCharSetPredicateBody: node |
263 | classificationId classification | |
263 | classificationId classification | |
264 self error: 'deprecated.'. |
264 self error: 'deprecated.'. |
265 classification := node extendClassification: node predicate classification. |
265 classification := node extendClassification: node predicate classification. |
266 classificationId := (compiler idFor: classification prefixed: #classification). |
266 classificationId := (compiler idFor: classification defaultName: #classification). |
267 compiler addConstant: classification as: classificationId. |
267 compiler addConstant: classification as: classificationId. |
268 |
268 |
269 compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'. |
269 compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'. |
270 compiler indent. |
270 compiler indent. |
271 compiler add: ' ifTrue: [ self error: '' predicate not expected'' ]'. |
271 compiler add: ' ifTrue: [ self error: '' predicate not expected'' ]'. |
302 ! |
302 ! |
303 |
303 |
304 startMethodForNode:node |
304 startMethodForNode:node |
305 node isMarkedForInline ifTrue:[ |
305 node isMarkedForInline ifTrue:[ |
306 compiler startInline: (compiler idFor: node). |
306 compiler startInline: (compiler idFor: node). |
307 compiler addComment: 'BEGIN inlined code of ' , node printString. |
307 compiler codeComment: 'BEGIN inlined code of ' , node printString. |
308 compiler indent. |
308 compiler indent. |
309 ] ifFalse:[ |
309 ] ifFalse:[ |
310 compiler startMethod: (compiler idFor: node). |
310 compiler startMethod: (compiler idFor: node). |
311 compiler addComment: 'GENERATED by ' , node printString. |
311 compiler codeComment: 'GENERATED by ' , node printString. |
312 compiler allocateReturnVariable. |
312 compiler allocateReturnVariable. |
313 ]. |
313 ]. |
314 |
314 |
315 "Created: / 23-04-2015 / 15:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
315 "Created: / 23-04-2015 / 15:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
316 "Modified: / 23-04-2015 / 19:13:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
316 "Modified: / 23-04-2015 / 19:13:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
471 |
471 |
472 visitCharSetPredicateNode: node |
472 visitCharSetPredicateNode: node |
473 |
473 |
474 | classification classificationId | |
474 | classification classificationId | |
475 classification := node extendClassification: node predicate classification. |
475 classification := node extendClassification: node predicate classification. |
476 classificationId := compiler idFor: classification prefixed: #classification. |
476 classificationId := compiler idFor: classification defaultName: #classification. |
477 compiler addConstant: classification as: classificationId. |
477 compiler addConstant: classification as: classificationId. |
478 |
478 |
479 compiler add: '(', classificationId, ' at: context peek asInteger)'. |
479 compiler add: '(', classificationId, ' at: context peek asInteger)'. |
480 compiler indent. |
480 compiler indent. |
481 compiler add: 'ifFalse: ['. |
481 compiler add: 'ifFalse: ['. |
489 visitCharacterNode: node |
489 visitCharacterNode: node |
490 | chid | |
490 | chid | |
491 node character ppcPrintable ifTrue: [ |
491 node character ppcPrintable ifTrue: [ |
492 chid := node character storeString |
492 chid := node character storeString |
493 ] ifFalse: [ |
493 ] ifFalse: [ |
494 chid := compiler idFor: node character prefixed: #char. |
494 chid := compiler idFor: node character defaultName: #char. |
495 compiler addConstant: (Character value: node character asInteger) as: chid . |
495 compiler addConstant: (Character value: node character asInteger) as: chid . |
496 ]. |
496 ]. |
497 |
497 |
498 compiler add: '(context peek == ', chid, ')'. |
498 compiler add: '(context peek == ', chid, ')'. |
499 compiler indent. |
499 compiler indent. |
654 ! |
654 ! |
655 |
655 |
656 visitNotCharSetPredicateNode: node |
656 visitNotCharSetPredicateNode: node |
657 | classificationId classification | |
657 | classificationId classification | |
658 classification := node extendClassification: node predicate classification. |
658 classification := node extendClassification: node predicate classification. |
659 classificationId := (compiler idFor: classification prefixed: #classification). |
659 classificationId := (compiler idFor: classification defaultName: #classification). |
660 compiler addConstant: classification as: classificationId. |
660 compiler addConstant: classification as: classificationId. |
661 |
661 |
662 compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'. |
662 compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'. |
663 compiler indent. |
663 compiler indent. |
664 compiler add: ' ifTrue: ['. |
664 compiler add: ' ifTrue: ['. |
672 visitNotCharacterNode: node |
672 visitNotCharacterNode: node |
673 | chid | |
673 | chid | |
674 node character ppcPrintable ifTrue: [ |
674 node character ppcPrintable ifTrue: [ |
675 chid := node character storeString |
675 chid := node character storeString |
676 ] ifFalse: [ |
676 ] ifFalse: [ |
677 chid := compiler idFor: node character prefixed: #char. |
677 chid := compiler idFor: node character defaultName: #char. |
678 compiler addConstant: (Character value: node character asInteger) as: chid . |
678 compiler addConstant: (Character value: node character asInteger) as: chid . |
679 ]. |
679 ]. |
680 |
680 |
681 compiler add: '(context peek == ', chid, ')'. |
681 compiler add: '(context peek == ', chid, ')'. |
682 compiler indent. |
682 compiler indent. |
745 compiler codeReturn. |
745 compiler codeReturn. |
746 ! |
746 ! |
747 |
747 |
748 visitPluggableNode: node |
748 visitPluggableNode: node |
749 | blockId | |
749 | blockId | |
750 blockId := compiler idFor: node block prefixed: #block. |
750 blockId := compiler idFor: node block defaultName: #pluggableBlock. |
751 |
751 |
752 compiler addConstant: node block as: blockId. |
752 compiler addConstant: node block as: blockId. |
753 compiler codeReturn: blockId, ' value: context.'. |
753 compiler codeReturn: blockId, ' value: context.'. |
754 ! |
754 ! |
755 |
755 |
791 "Modified: / 26-05-2015 / 19:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
791 "Modified: / 26-05-2015 / 19:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
792 ! |
792 ! |
793 |
793 |
794 visitPredicateNode: node |
794 visitPredicateNode: node |
795 | pid | |
795 | pid | |
796 pid := (compiler idFor: node predicate prefixed: #predicate). |
796 pid := (compiler idFor: node predicate defaultName: #predicate). |
797 |
797 |
798 compiler addConstant: node predicate as: pid. |
798 compiler addConstant: node predicate as: pid. |
799 |
799 |
800 compiler add: '(context atEnd not and: [ ', pid , ' value: context uncheckedPeek])'. |
800 compiler add: '(context atEnd not and: [ ', pid , ' value: context uncheckedPeek])'. |
801 compiler indent. |
801 compiler indent. |
882 visitStarCharSetPredicateNode: node |
882 visitStarCharSetPredicateNode: node |
883 | classification classificationId | |
883 | classification classificationId | |
884 |
884 |
885 |
885 |
886 classification := node extendClassification: node predicate classification. |
886 classification := node extendClassification: node predicate classification. |
887 classificationId := compiler idFor: classification prefixed: #classification. |
887 classificationId := compiler idFor: classification defaultName: #classification. |
888 compiler addConstant: classification as: classificationId. |
888 compiler addConstant: classification as: classificationId. |
889 |
889 |
890 compiler codeAssign: 'OrderedCollection new.' to: self retvalVar. |
890 compiler codeAssign: 'OrderedCollection new.' to: self retvalVar. |
891 compiler add: '[ ', classificationId, ' at: context peek asInteger ] whileTrue: ['. |
891 compiler add: '[ ', classificationId, ' at: context peek asInteger ] whileTrue: ['. |
892 compiler indent. |
892 compiler indent. |
914 |
914 |
915 elementVar := compiler allocateTemporaryVariableNamed: 'element'. |
915 elementVar := compiler allocateTemporaryVariableNamed: 'element'. |
916 |
916 |
917 self addGuard: node child ifTrue: nil ifFalse: [ compiler codeReturn: '#()' ]. |
917 self addGuard: node child ifTrue: nil ifFalse: [ compiler codeReturn: '#()' ]. |
918 |
918 |
919 compiler codeAssign: 'OrderedCollection new.' to: self retvalVar. |
|
920 compiler codeAssignParsedValueOf:[ self visit:node child ] to:elementVar. |
919 compiler codeAssignParsedValueOf:[ self visit:node child ] to:elementVar. |
|
920 compiler codeIf: 'error' |
|
921 then: [ |
|
922 compiler codeClearError. |
|
923 compiler codeReturn: '#()'. |
|
924 ] else: [ |
|
925 compiler codeAssign: 'OrderedCollection new.' to: self retvalVar. |
|
926 ]. |
|
927 |
921 compiler add: '[ error ] whileFalse: ['. |
928 compiler add: '[ error ] whileFalse: ['. |
922 compiler indent. |
929 compiler indent. |
923 compiler add: self retvalVar, ' add: ', elementVar, '.'. |
930 compiler add: self retvalVar, ' add: ', elementVar, '.'. |
924 compiler codeAssignParsedValueOf:[ self visit:node child ] to:elementVar. |
931 compiler codeAssignParsedValueOf:[ self visit:node child ] to:elementVar. |
925 compiler dedent. |
932 compiler dedent. |