Sha256: 276126b2aa4a8bc5d2def9e4d88134e3aea653895e9a0d8e4fb6c2e0ad4d9324

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

#
# sample1.rex
# lexical definition sample for rex
#
# usage
#  rex  sample1.rex  --stub
#  ruby sample1.rex.rb  sample1.c
#

class Sample1
macro
  BLANK         \s+
  REM_IN        \/\*
  REM_OUT       \*\/
  REM           \/\/

rule

# [:state]  pattern  [actions]

# remark
                {REM_IN}        { state = :REMS; [:rem_in, text] }
  :REMS         {REM_OUT}       { state = nil;   [:rem_out, text] }
  :REMS         .*(?={REM_OUT}) {                [:remark, text] }
                {REM}           { state = :REM;  [:rem_in, text] }
  :REM          \n              { state = nil;   [:rem_out, text] }
  :REM          .*(?=$)         {                [:remark, text] }

# literal
                \"[^"]*\"       { [:string, text] } # "
                \'[^']\'        { [:character, text] } # '

# skip
                {BLANK}         # no action

# numeric
                \d+             { [:digit, text.to_i] }

# identifier
                \w+             { [:word, text] }
                .               { [text, text] }

end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
rexical-1.0.7 sample/sample1.rex
aaronp-frex-1.0.0 sample/sample1.rex
aaronp-frex-1.0.1 sample/sample1.rex
tenderlove-frex-1.0.1.20090313144615 sample/sample1.rex
rexical-1.0.5 sample/sample1.rex
rexical-1.0.5.beta2 sample/sample1.rex
rexical-1.0.5.beta1 sample/sample1.rex
rex-1.0.2 sample/sample1.rex
rexical-1.0.4 sample/sample1.rex
rexical-1.0.3 sample/sample1.rex