Sha256: 554a3b3cfa59aafaf6d719614a034d881dadf9313ed62d1166d5b7aca35dac98

Contents?: true

Size: 951 Bytes

Versions: 1

Compression:

Stored size: 951 Bytes

Contents

#
#       ActiveFacts CQL Parser.
#       Parse rules relating to definition context.
#
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
#
module ActiveFacts
  module CQL
    grammar Context
      rule context
        '('
        w:who_says? s context_type discussion agreed:(',' a:as_agreed_by)? s
        ')'
        { def value; [ w.empty? ? nil : w.value, context_type.value, discussion.text_value, agreed.empty? ? [] : agreed.a.value]; end }
      end

      rule who_says
        according_to agents s ','
        { def value; agents.value; end }
      end

      rule context_type
        because         { def value; 'because'; end } /
        as_opposed_to   { def value; 'as_opposed_to'; end } /
        so_that         { def value; 'so_that'; end } /
        to_avoid        { def value; 'to_avoid'; end }
      end

      rule discussion
        '(' discussion ')' / (!( [()] / ',' as_agreed_by) .)*
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activefacts-0.8.6 lib/activefacts/cql/Context.treetop