Sha256: e1c3467b4a1d53e5e96a6bc45cf1e8dc5267d24efb8911b9b8d77637af01e754
Contents?: true
Size: 881 Bytes
Versions: 2
Compression:
Stored size: 881 Bytes
Contents
# frozen_string_literal: true require_relative 'lox_compound_expr' module Loxxy module Ast # This AST node represents a variable declaration class LoxVarStmt < LoxCompoundExpr # @return [String] variable name attr_reader :name # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream. # @param aName [String] name of the variable # @param aValue [Loxxy::Ast::LoxNode, NilClass] initial value for the variable def initialize(aPosition, aName, aValue) initial_value = aValue ? [aValue] : [] super(aPosition, initial_value) @name = aName end # Part of the 'visitee' role in Visitor design pattern. # @param visitor [Ast::ASTVisitor] the visitor def accept(visitor) visitor.visit_var_stmt(self) end end # class end # module end # module
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
loxxy-0.0.22 | lib/loxxy/ast/lox_var_stmt.rb |
loxxy-0.0.21 | lib/loxxy/ast/lox_var_stmt.rb |