Sha256: f8dcb3171e1bf1794a9dd4cc7ade1b1cb68f241d8a918e179f414e5533e424dd

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

class LucidTDL::Parser

macro
  BLANK           [\ \t]+
  
rule
  {BLANK}         # 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.0.0 lib/lucid-tdl/parser/lucid-tdl.rex