Class: Idl::StringLiteralAst
- Includes:
- Rvalue
- Defined in:
- lib/idl/ast.rb
Overview
represents a string literal
Instance Method Summary collapse
-
#initialize(input, interval) ⇒ StringLiteralAst
constructor
A new instance of StringLiteralAst.
- #to_idl ⇒ Object
- #type(symtab) ⇒ Object
-
#type_check(_symtab) ⇒ void
type check this node and all children.
-
#value(_symtab) ⇒ Object
Return the compile-time-known value of the node.
-
#values(symtab) ⇒ Array<Integer>, ...
included
from Rvalue
Return a complete list of possible compile-time-known values of the node, or raise a ValueError if the full list cannot be determined.
Constructor Details
#initialize(input, interval) ⇒ StringLiteralAst
Returns a new instance of StringLiteralAst.
4268 4269 4270 4271 |
# File 'lib/idl/ast.rb', line 4268 def initialize(input, interval) super(input, interval, EMPTY_ARRAY) @type = Type.new(:string, width: value(nil).length, qualifiers: [:const]) end |
Instance Method Details
#to_idl ⇒ Object
4285 |
# File 'lib/idl/ast.rb', line 4285 def to_idl = text_value |
#type(symtab) ⇒ Object
4276 4277 4278 |
# File 'lib/idl/ast.rb', line 4276 def type(symtab) @type end |
#type_check(_symtab) ⇒ void
4274 |
# File 'lib/idl/ast.rb', line 4274 def type_check(_symtab); end |
#value(_symtab) ⇒ Object
Return the compile-time-known value of the node
4281 4282 4283 |
# File 'lib/idl/ast.rb', line 4281 def value(_symtab) text_value.gsub('"', "") end |
#values(symtab) ⇒ Array<Integer>, ... Originally defined in module Rvalue
Return a complete list of possible compile-time-known values of the node, or raise a ValueError if the full list cannot be determined
For most AstNodes, this will just be a single-entry array