hpi-swa / Gramada

Gramada is an interactive development environment for programming languages defined in Ohm. It is based on Vivide and implemented in Squeak/Smalltalk.
15 stars 2 forks source link

Move code for debugging capabilities in Ohm to Gramada #6

Closed codeZeilen closed 7 years ago

codeZeilen commented 7 years ago

The following method should be maintained by Gramada as Ohm does not require it:

OhmGrammar>>#skipSpaces: state

    | result originalPosition anInput originalFailures |
    anInput := state inputStream.
    originalPosition := anInput getState.
    state isSyntactic: false.
    originalFailures := state rightmostFailure.
    state rightmostFailure: OhmFailureDescriptor new.

    [ originalPosition := anInput getState.
      state pushBindings: OrderedCollection new.
      #ohmDebugging withoutLayerDo: [
      result := (self ruleNamed: #space)
                eval: state].
      state popBindings.
     ] doWhileTrue: [result].

    state rightmostFailure: originalFailures.
    state isSyntactic: true.
    anInput setState: originalPosition.