Sha256: 2f0608647c17bc2a37caf629855ae44ea34f20dc938fd59b609ed7b89cbc3c44

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
basic101-0.4.0 lib/basic101/parser/statements.rb
basic101-0.2.0 lib/basic101/parser/statements.rb