Class: BaseVal

Inherits:
Node show all
Defined in:
lib/tecsgen/core/value.rb

Overview

BaseVal 整数、浮動小数などの値を扱うクラスの基底クラス

TECS の CDL で扱う値は、以下に分類される ・整数 ・浮動小数 ・文字列 ・ブール値 集成型(構造体、配列)と C_EXP はここでは扱わない

このクラスで定義済みの演算子は、エラーとなる 型により演算可能な場合、演算子をオーバーライドする

Direct Known Subclasses

BoolVal, FloatVal, IntegerVal, PointerVal, StringVal

Instance Method Summary collapse

Methods inherited from Node

#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #initialize, #locale_str, #set_locale

Constructor Details

This class inherits a constructor from Node

Instance Method Details

#%(val) ⇒ Object



76
77
78
# File 'lib/tecsgen/core/value.rb', line 76

def %(val)
  unsupport "%"
end

#&(val) ⇒ Object



120
121
122
# File 'lib/tecsgen/core/value.rb', line 120

def &(val)
  unsupport "&"
end

#*(val) ⇒ Object



68
69
70
# File 'lib/tecsgen/core/value.rb', line 68

def *(val)
  unsupport "*"
end

#+(val) ⇒ Object



80
81
82
# File 'lib/tecsgen/core/value.rb', line 80

def +(val)
  unsupport "+"
end

#+@Object



60
61
62
# File 'lib/tecsgen/core/value.rb', line 60

def +@
  unsupport "unary +"
end

#-(val) ⇒ Object



84
85
86
# File 'lib/tecsgen/core/value.rb', line 84

def -(val)
  unsupport "-"
end

#-@Object



56
57
58
# File 'lib/tecsgen/core/value.rb', line 56

def -@
  unsupport "unary -"
end

#/(val) ⇒ Object



72
73
74
# File 'lib/tecsgen/core/value.rb', line 72

def /(val)
  unsupport "/"
end

#<(val) ⇒ Object



100
101
102
# File 'lib/tecsgen/core/value.rb', line 100

def <(val)
  unsupport "<"
end

#<<(val) ⇒ Object



88
89
90
# File 'lib/tecsgen/core/value.rb', line 88

def <<(val)
  unsupport "<<"
end

#<=(val) ⇒ Object



108
109
110
# File 'lib/tecsgen/core/value.rb', line 108

def <=(val)
  unsupport "<="
end

#>(val) ⇒ Object



96
97
98
# File 'lib/tecsgen/core/value.rb', line 96

def >(val)
  unsupport ">"
end

#>=(val) ⇒ Object



104
105
106
# File 'lib/tecsgen/core/value.rb', line 104

def >=(val)
  unsupport ">="
end

#>>(val) ⇒ Object



92
93
94
# File 'lib/tecsgen/core/value.rb', line 92

def >>(val)
  unsupport ">>"
end

#^(val) ⇒ Object



124
125
126
# File 'lib/tecsgen/core/value.rb', line 124

def ^(val)
  unsupport "^"
end

#cast(type) ⇒ Object



140
141
142
# File 'lib/tecsgen/core/value.rb', line 140

def cast(type)
  unsupport "CAST"
end

#eq(val) ⇒ Object

val



112
113
114
# File 'lib/tecsgen/core/value.rb', line 112

def eq(val) # == val
  unsupport "=="
end

#lAND(val) ⇒ Object

&& val



132
133
134
# File 'lib/tecsgen/core/value.rb', line 132

def lAND(val)  # && val
  unsupport "&&"
end

#lOR(val) ⇒ Object

|| val



136
137
138
# File 'lib/tecsgen/core/value.rb', line 136

def lOR(val)   # || val
  unsupport "||"
end

#neq(val) ⇒ Object

!= val



116
117
118
# File 'lib/tecsgen/core/value.rb', line 116

def neq(val) # != val
  unsupport "!="
end

#notObject

! val



64
65
66
# File 'lib/tecsgen/core/value.rb', line 64

def not # ! val
  unsupport "!"
end

#to_bObject



152
153
154
155
# File 'lib/tecsgen/core/value.rb', line 152

def to_b
  cdl_error("V1002 $1: cannot cast to bool (implicitly)", self.class)
  false
end

#to_fObject



162
163
164
165
# File 'lib/tecsgen/core/value.rb', line 162

def to_f
  cdl_error("V1004 $1: cannot cast to float (implicitly)", self.class)
  1.0
end

#to_iObject



157
158
159
160
# File 'lib/tecsgen/core/value.rb', line 157

def to_i
  cdl_error("V1003 $1: cannot cast to integer (implicitly)", self.class)
  1
end

#to_sObject



148
149
150
# File 'lib/tecsgen/core/value.rb', line 148

def to_s
  raise "to_s not overridden"
end

#unsupport(op) ⇒ Object



144
145
146
# File 'lib/tecsgen/core/value.rb', line 144

def unsupport(op)
  cdl_error("V1001 $1: unable for $2", op, self.class)
end

#|(val) ⇒ Object



128
129
130
# File 'lib/tecsgen/core/value.rb', line 128

def |(val)
  unsupport "|"
end

#~@Object



52
53
54
# File 'lib/tecsgen/core/value.rb', line 52

def ~@
  unsupport "~"
end