Sha256: 3a6b7330fe2eb77de19f5608db88195eb1597ad23fae805eefd3bc37d23d4638

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

module Basic101

  class Parser < Parslet::Parser

    rule(:statements) do
      statement >>
        (space? >> str(':') >>
         space? >> statement).repeat(0) >>
        space? >> str(':').maybe
    end

    rule(:statement) do
      (goto_statement |
       remark_statement |
       print_statement |
       if_statement |
       randomize_statement |
       input_statement |
       end_statement |
       dim_statement |
       for_statement |
       next_statement |
       on_goto_statement |
       data_statement |
       read_statement |
       gosub_statement |
       return_statement |
       stop_statement |
       restore_statement |
       define_function_statement |
       let_statement)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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