compiler/PPCGuard.st
changeset 414 0eaf09920532
parent 396 ec569977267a
child 422 116d2b2af905
equal deleted inserted replaced
413:5389e6fbb3bc 414:0eaf09920532
    14 		initializeFor: aPPCNode;
    14 		initializeFor: aPPCNode;
    15 		yourself
    15 		yourself
    16 ! !
    16 ! !
    17 
    17 
    18 !PPCGuard methodsFor:'accessing'!
    18 !PPCGuard methodsFor:'accessing'!
       
    19 
       
    20 classification
       
    21 	^ classification
       
    22 !
    19 
    23 
    20 id
    24 id
    21 	
    25 	
    22 	^ id
    26 	^ id
    23 !
    27 !
    50 compileAny: compiler
    54 compileAny: compiler
    51 	compiler add: '(context atEnd not)'.
    55 	compiler add: '(context atEnd not)'.
    52 !
    56 !
    53 
    57 
    54 compileCharacter: compiler
    58 compileCharacter: compiler
    55         self assert: (classification select: [ :e | e ]) size = 1.
    59 	self assert: (classification select: [ :e | e ]) size = 1.
    56         
    60 	
    57         classification keysAndValuesDo: [ :index :value | value ifTrue: [  
    61 	classification keysAndValuesDo: [ :index :value | value ifTrue: [  
    58                 (index > 32 and: [ index < 127 ]) ifTrue: [ 
    62 		(index > 32 and: [ index < 127 ]) ifTrue: [ 
    59                         compiler add: '(context peek = ', (Character value: index) storeString, ')'
    63 			compiler add: '(context peek = ', (Character value: index) storeString, ')'
    60                 ] ifFalse: [ 
    64 		] ifFalse: [ 
    61                         id := compiler idFor: (Character value: index) prefixed: #character.
    65 			id := compiler idFor: (Character value: index) prefixed: #character.
    62                         compiler addConstant: (Character value: index) as: id.
    66 			compiler addConstant: (Character value: index) as: id.
    63                         compiler add: '(context peek = ', id, ')'.
    67 			compiler add: '(context peek = ', id, ')'.
    64                 ] 
    68 	 	] 
    65         ] ].
    69 	] ].
    66 
    70 
    67     "Modified: / 26-10-2014 / 22:13:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    68 !
    71 !
    69 
    72 
    70 compileGuard: compiler id: symbol
    73 compileGuard: compiler id: symbol
    71 	self id: symbol.
    74 	self id: symbol.
    72 	^ self compileGuard: compiler
    75 	^ self compileGuard: compiler
    87 	].
    90 	].
    88 	(node acceptsEpsilon) ifTrue: [  
    91 	(node acceptsEpsilon) ifTrue: [  
    89 		^ self initializeForEpsilon
    92 		^ self initializeForEpsilon
    90 	].
    93 	].
    91 
    94 
    92 	self classificationOn: [:char | node firstSet anySatisfy: [:e | (e firstCharParser parse: char asString) isPetitFailure not ]]
    95 	self classificationOn: [:char | node firstSet anySatisfy: [:e | (e firstCharSetCached value: char) ]]
       
    96 
       
    97 "	self classificationOn: [ :char | node firstSet anySatisfy: [ :e |  (e firstCharParser parse: char asString) isPetitFailure not ] ]"
    93 !
    98 !
    94 
    99 
    95 initializeForEpsilon
   100 initializeForEpsilon
    96 	classification := nil
   101 	classification := nil
    97 	
   102