Sha256: 9ddef83b45c0d3bc63d502dfa7a636e816a5f7bcaad16be8383de972cfa69f46

Contents?: true

Size: 418 Bytes

Versions: 3

Compression:

Stored size: 418 Bytes

Contents

# frozen_string_literal: true

module Basic101

  class Parser < Parslet::Parser

    rule(:for_statement) do
      str('FOR') >>
        space? >> scalar_reference.as(:reference) >>
        space? >> str('=') >>
        space? >> expression.as(:from) >>
        space? >> str('TO') >>
        space? >> expression.as(:to) >>
        (space? >> str('STEP') >> space? >> expression).maybe.as(:step)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-1.0.2 lib/basic101/parser/for_statement.rb
basic101-1.0.1 lib/basic101/parser/for_statement.rb
basic101-1.0.0 lib/basic101/parser/for_statement.rb