compiler/extensions.st
changeset 502 1e45d3c96ec5
parent 464 f6d77fee9811
child 503 ff58cd9f1f3c
child 515 b5316ef15274
equal deleted inserted replaced
464:f6d77fee9811 502:1e45d3c96ec5
     2 
     2 
     3 !Character methodsFor:'*petitcompiler'!
     3 !Character methodsFor:'*petitcompiler'!
     4 
     4 
     5 ppcPrintable
     5 ppcPrintable
     6     ^ self asInteger > 31 and: [ self asInteger < 127 ]
     6     ^ self asInteger > 31 and: [ self asInteger < 127 ]
       
     7 ! !
       
     8 
       
     9 !Object methodsFor:'*petitcompiler'!
       
    10 
       
    11 canHavePPCId
       
    12     ^ false
     7 ! !
    13 ! !
     8 
    14 
     9 !Object methodsFor:'*petitcompiler'!
    15 !Object methodsFor:'*petitcompiler'!
    10 
    16 
    11 isInlinedMethod
    17 isInlinedMethod
    89 
    95 
    90 !PPChoiceParser methodsFor:'*petitcompiler'!
    96 !PPChoiceParser methodsFor:'*petitcompiler'!
    91 
    97 
    92 compileWith: aPetitCompiler
    98 compileWith: aPetitCompiler
    93     ^ aPetitCompiler compileChoice: self
    99     ^ aPetitCompiler compileChoice: self
       
   100 ! !
       
   101 
       
   102 !PPCompositeParser methodsFor:'*petitcompiler'!
       
   103 
       
   104 asCompilerNode
       
   105     ^ PPCForwardNode new
       
   106         name: self name;
       
   107         child: parser;
       
   108         yourself
       
   109 
       
   110     "Modified: / 22-05-2015 / 21:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    94 ! !
   111 ! !
    95 
   112 
    96 !PPContext methodsFor:'*petitcompiler'!
   113 !PPContext methodsFor:'*petitcompiler'!
    97 
   114 
    98 asCompiledParserContext
   115 asCompiledParserContext
   187         ^ PPCForwardNode new
   204         ^ PPCForwardNode new
   188             name: self name;
   205             name: self name;
   189             child: parser;
   206             child: parser;
   190             yourself
   207             yourself
   191     ].
   208     ].
   192     ^ super asCompilerNode 
   209     ^ super asCompilerNode
       
   210 
       
   211     "Modified: / 22-05-2015 / 21:53:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   193 ! !
   212 ! !
   194 
   213 
   195 !PPDelegateParser methodsFor:'*petitcompiler'!
   214 !PPDelegateParser methodsFor:'*petitcompiler'!
   196 
   215 
   197 compileWith: aPetitCompiler
   216 compileWith: aPetitCompiler
   610         child acceptsEpsilon ifFalse: [ ^ aCollection ]
   629         child acceptsEpsilon ifFalse: [ ^ aCollection ]
   611     ].
   630     ].
   612     ^ aCollection
   631     ^ aCollection
   613 ! !
   632 ! !
   614 
   633 
       
   634 !PPSequenceParser methodsFor:'*petitcompiler'!
       
   635 
       
   636 map: aBlock
       
   637         ^ aBlock numArgs = self children size
       
   638                 ifTrue: [ PPMappedActionParser on: self block: aBlock ]
       
   639                 ifFalse: [ self error: aBlock numArgs asString , ' arguments expected.' ]
       
   640 
       
   641     "Modified: / 02-06-2015 / 17:16:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   642 ! !
       
   643 
   615 !PPSmalltalkGrammar methodsFor:'*petitcompiler'!
   644 !PPSmalltalkGrammar methodsFor:'*petitcompiler'!
   616 
   645 
   617 comment
   646 comment
   618  	^ $" asParser, $" asParser negate star, $" asParser.	
   647  		^ $" asParser, $" asParser negate star, $" asParser.	
   619 ! !
   648 ! !
   620 
   649 
   621 !PPSmalltalkGrammar methodsFor:'*petitcompiler'!
   650 !PPSmalltalkGrammar methodsFor:'*petitcompiler'!
   622 
   651 
   623 whitespace
   652 whitespace