Sha256: 70a307910ddc17f7ca8b724da5fea8fc50b31b7fff70ed0fe230698419f4d57e
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require_relative 'ast_node' module Rley module RGN # A syntax node for a grammar symbol occurring in rhs of a rule. # symbol nodes are leaf nodes of RRN parse trees. class SymbolNode < ASTNode # @return [Rley::Lexical::Position] Position of the entry in the input stream. attr_reader :position # @return [String] name of grammar symbol attr_reader :name # @param aPosition [Rley::Lexical::Position] Position of the entry in the input stream. # @param aName [String] name of grammar symbol def initialize(aPosition, aName) super() @position = aPosition @name = aName end # @return [String] name of grammar symbol def to_text annotation.empty? ? name : "#{name} #{annotation_to_text}" end # Abstract method (must be overriden in subclasses). # Part of the 'visitee' role in Visitor design pattern. # @param visitor [RGN::ASTVisitor] the visitor def accept(visitor) visitor.visit_symbol_node(self) end end # class end # module end # module
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rley-0.8.11 | lib/rley/rgn/symbol_node.rb |
rley-0.8.10 | lib/rley/rgn/symbol_node.rb |
rley-0.8.09 | lib/rley/rgn/symbol_node.rb |