Sha256: fde2af4d3a98fc71e9de13cda9874eeca30e9f8c7a312600d588e8ebdc6d348a

Contents?: true

Size: 1017 Bytes

Versions: 1

Compression:

Stored size: 1017 Bytes

Contents

class LucidTDL::Parser

macro
  BLANK           [\ \t]+
  
rule
  {BLANK}         # no action
  \#.*$           # no action
  
  \n              { [:NEWLINE, text] }
  
  Feature:        { [:FEATURE,        text[0..-2]] }
  Ability:        { [:ABILITY,        text[0..-2]] }
  Responsibility: { [:RESPONSIBILITY, text[0..-2]] }
  
  Background:     { [:BACKGROUND,     text[0..-2]] }
  Context:        { [:CONTEXT,        text[0..-2]] }
  Scenario:       { [:SCENARIO,       text[0..-2]] }
  Test:           { [:TEST,           text[0..-2]] }
  
  @(\w|-)+        { [:TAG, text[1..-1]] }
  
  Given           { [:GIVEN, text]   }
  When            { [:WHEN, text]    }
  Then            { [:THEN, text]    }
  And             { [:AND, text]     }
  But             { [:BUT, text]     }
  \*              { [:GENERIC, text] }
  
  [^#\n]*         { [:TEXT, text.strip] }
  
inner
  def tokenize(code)
    scan_setup(code)
    tokens = []
    while token = next_token
      tokens << token
    end
    tokens
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lucid-tdl-1.1.0 lib/lucid-tdl/parser/lucid-tdl.rex