Module: CType
- Defined in:
- lib/caphir/ctype.rb,
lib/caphir/ctype.rb
Overview
Defined Under Namespace
Modules: BaseReference, Qualifiers, Specifiers
Classes: Base, Enum, EvaluationError, List, Parser, Pointer, Primitive, Struct, StructUnion, Type, Union
Constant Summary
collapse
- @@typedefs =
{}
Class Method Summary
collapse
Class Method Details
.[](val) ⇒ Object
44
45
46
47
|
# File 'lib/caphir/ctype.rb', line 44
def CType.[](val)
t = @@typedefs[val]
t && t.at(1)
end
|
.[]=(name, tdef) ⇒ Object
57
58
59
60
|
# File 'lib/caphir/ctype.rb', line 57
def CType.[]=(name, tdef)
raise ParseError, "type #{name} already defined" if @@typedefs.include?(name)
@@typedefs[name.freeze] = [:TYPEDEF_NAME, tdef].freeze
end
|
.convert_token(t) ⇒ Object
49
50
51
|
# File 'lib/caphir/ctype.rb', line 49
def CType.convert_token(t)
@@typedefs.fetch(t.at(1), t)
end
|
.evaluation_error(part) ⇒ Object
38
39
40
|
# File 'lib/caphir/ctype.rb', line 38
def CType.evaluation_error(part)
raise EvaluationError, "cannot evaluate '#{part}'"
end
|
.include?(name) ⇒ Boolean
53
54
55
|
# File 'lib/caphir/ctype.rb', line 53
def CType.include?(name)
@@typedefs.include?(name)
end
|