Class: Pione::Lang::DataExprSequence

Inherits:
OrdinalSequence show all
Defined in:
lib/pione/lang/data-expr.rb

Instance Method Summary collapse

Methods inherited from OrdinalSequence

#empty, #fold, fold, #fold2, fold2, #inspect, make_piece, #map, map, map2, #map2, map3, #map3, #map_by, of

Methods inherited from Sequence

#attribute, #concat, #each, #eval, index_type, inherited, piece_class, piece_classes, #push, #set_annotation_type, set_index_type, #update_pieces, void, #void?

Methods included from Callable

#call_pione_method

Methods included from Util::Positionable

#line_and_column, #pos, #set_source_position

Methods inherited from Expr

#eval, #eval!, inherited, pione_type, set_pione_type, #to_s

Instance Method Details

#accept_nonexistence?Boolean

Return true if the sequence accepts null.

Returns:

  • (Boolean)


99
100
101
# File 'lib/pione/lang/data-expr.rb', line 99

def accept_nonexistence?
  pieces.any?{|piece| piece.accept_nonexistence?}
end

#assertive?Boolean

Return true if the sequence has no null.

Returns:

  • (Boolean)


104
105
106
# File 'lib/pione/lang/data-expr.rb', line 104

def assertive?
  not(pieces.all?{|piece| piece.kind_of? DataExprNull})
end

#match(name) ⇒ Object Also known as: ===

Match if the name is matched one of elements.



109
110
111
# File 'lib/pione/lang/data-expr.rb', line 109

def match(name)
  pieces.inject(nil) {|res, piece| res ? res : piece.match(name)}
end

#match?(name) ⇒ Boolean Also known as: =~

Return true if the name matched.

Returns:

  • (Boolean)


115
116
117
# File 'lib/pione/lang/data-expr.rb', line 115

def match?(name)
  match(name) ? true : false
end

#textizeObject



121
122
123
# File 'lib/pione/lang/data-expr.rb', line 121

def textize
  "(<d>%s)" % pieces.map {|piece| "'%s'" % piece.pattern}.join("|")
end