PPExpressionParser.st
changeset 427 a7f5e6de19d2
parent 11 e6e33e8fe655
child 642 77d5fddb6462
equal deleted inserted replaced
426:2a65c972b937 427:a7f5e6de19d2
     1 "{ Package: 'stx:goodies/petitparser' }"
     1 "{ Package: 'stx:goodies/petitparser' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
     2 
     4 
     3 PPDelegateParser subclass:#PPExpressionParser
     5 PPDelegateParser subclass:#PPExpressionParser
     4 	instanceVariableNames:'operators'
     6 	instanceVariableNames:'operators'
     5 	classVariableNames:''
     7 	classVariableNames:''
     6 	poolDictionaries:''
     8 	poolDictionaries:''
    17 build: aParser postfix: aChoiceParser
    19 build: aParser postfix: aChoiceParser
    18 	^ aParser , aChoiceParser star map: [ :term :ops | ops inject: term into: [ :result :operator | operator first value: result value: operator second ] ]
    20 	^ aParser , aChoiceParser star map: [ :term :ops | ops inject: term into: [ :result :operator | operator first value: result value: operator second ] ]
    19 !
    21 !
    20 
    22 
    21 build: aParser prefix: aChoiceParser
    23 build: aParser prefix: aChoiceParser
    22 	^ aChoiceParser star , aParser map: [ :ops :term | ops reversed inject: term into: [ :result :operator | operator first value: operator second value: result ] ]
    24 	^ aChoiceParser star , aParser map: [ :ops :term | ops reverse inject: term into: [ :result :operator | operator first value: operator second value: result ] ]
    23 !
    25 !
    24 
    26 
    25 build: aParser right: aChoiceParser
    27 build: aParser right: aChoiceParser
    26 	^ (aParser separatedBy: aChoiceParser) foldRight: [ :a :op :b | op first value: a value: op second value: b ]
    28 	^ (aParser separatedBy: aChoiceParser) foldRight: [ :a :op :b | op first value: a value: op second value: b ]
    27 !
    29 !
   111 !
   113 !
   112 
   114 
   113 version_SVN
   115 version_SVN
   114     ^ '§Id: PPExpressionParser.st 2 2010-12-17 18:44:23Z vranyj1 §'
   116     ^ '§Id: PPExpressionParser.st 2 2010-12-17 18:44:23Z vranyj1 §'
   115 ! !
   117 ! !
       
   118