Class: Racc::Sym

### Home Classes Methods

### In Files

- lib/racc/grammar.rb

### Parent

Object

### Methods

- ::new
- ::once_writer
- #dummy?
- #inspect
- #nonterminal?
- #null=
- #nullable?
- #rule
- #self_null?
- #serialize
- #should_terminal
- #should_terminal?
- #string_symbol?
- #term=
- #terminal?
- #to_s
- #useless=
- #useless?
- #|

### Files

- Manifest.txt
- README.rdoc
- pre-setup
- NEWS.en.rdoc
- grammar.en.rdoc

### Class/Module Index

Quicksearch

- Racc
- Racc::Accept
- Racc::ActionTable
- Racc::CompileError
- Racc::DebugFlags
- Racc::Error
- Racc::Goto
- Racc::Grammar
- Racc::Grammar::DefinitionEnv
- Racc::Grammar::PrecedenceDefinitionEnv
- Racc::GrammarFileParser
- Racc::GrammarFileParser::Result
- Racc::GrammarFileScanner
- Racc::ISet
- Racc::Item
- Racc::LocationPointer
- Racc::LogFileGenerator
- Racc::OrMark
- Racc::ParseError
- Racc::ParseError
- Racc::Parser
- Racc::ParserClassGenerator
- Racc::ParserFileGenerator
- Racc::ParserFileGenerator::Params
- Racc::Prec
- Racc::RRconflict
- Racc::Reduce
- Racc::Rule
- Racc::SRconflict
- Racc::Shift
- Racc::SourceText
- Racc::State
- Racc::StateTransitionTable
- Racc::StateTransitionTableGenerator
- Racc::States
- Racc::Sym
- Racc::SymbolTable
- Racc::UserAction
- Object
- Object::ParseError
- Array

No matching classes.

# Racc::Sym

Stands terminal and nonterminal symbols.

### Attributes

assoc[RW]
expand[R]
hash[R]
heads[R]

cache

ident[R]
locate[R]
precedence[RW]
serialized[W]
value[R]

### Public Class Methods

new(value, dummyp) click to toggle source

    # File lib/racc/grammar.rb, line 971
    def initialize(value, dummyp)
      @ident = nil
      @value = value
      @dummyp = dummyp

      @term  = nil
      @nterm = nil
      @should_terminal = false
      @precedence = nil
      case value
      when Symbol
        @to_s = value.to_s
        @serialized = value.inspect
        @string = false
      when String
        @to_s = value.inspect
        @serialized = value.dump
        @string = true
      when false
        @to_s = '$end'
        @serialized = 'false'
        @string = false
      when ErrorSymbolValue
        @to_s = 'error'
        @serialized = 'Object.new'
        @string = false
      else
        raise ArgumentError, "unknown symbol value: #{value.class}"
      end

      @heads    = []
      @locate   = []
      @snull    = nil
      @null     = nil
      @expand   = nil
      @useless  = nil
    end

once_writer(nm) click to toggle source

    # File lib/racc/grammar.rb, line 1010
    def once_writer(nm)
      nm = nm.id2name
      module_eval(          def #{nm}=(v)            raise 'racc: fatal: @#{nm} != nil' unless @#{nm}.nil?            @#{nm} = v          end)
    end

### Public Instance Methods

dummy?() click to toggle source

    # File lib/racc/grammar.rb, line 1028
    def dummy?
      @dummyp
    end

inspect() click to toggle source
Alias for: to_s
nonterminal?() click to toggle source

    # File lib/racc/grammar.rb, line 1036
    def nonterminal?
      @nterm
    end

null=(n) click to toggle source

    # File lib/racc/grammar.rb, line 1098
    def null=(n)
      @null = n
    end

nullable?() click to toggle source

    # File lib/racc/grammar.rb, line 1094
    def nullable?
      @null
    end

rule() click to toggle source

    # File lib/racc/grammar.rb, line 1077
    def rule
      Rule.new(nil, [self], UserAction.empty)
    end

self_null?() click to toggle source

    # File lib/racc/grammar.rb, line 1088
    def self_null?
      @snull
    end

serialize() click to toggle source

    # File lib/racc/grammar.rb, line 1058
    def serialize
      @serialized
    end

should_terminal() click to toggle source

    # File lib/racc/grammar.rb, line 1046
    def should_terminal
      @should_terminal = true
    end

should_terminal?() click to toggle source

    # File lib/racc/grammar.rb, line 1050
    def should_terminal?
      @should_terminal
    end

string_symbol?() click to toggle source

    # File lib/racc/grammar.rb, line 1054
    def string_symbol?
      @string
    end

term=(t) click to toggle source

    # File lib/racc/grammar.rb, line 1040
    def term=(t)
      raise 'racc: fatal: term= called twice' unless @term.nil?
      @term = t
      @nterm = !t
    end

terminal?() click to toggle source

    # File lib/racc/grammar.rb, line 1032
    def terminal?
      @term
    end

to_s() click to toggle source

    # File lib/racc/grammar.rb, line 1067
    def to_s
      @to_s.dup
    end

Also aliased as: inspect
useless=(f) click to toggle source

    # File lib/racc/grammar.rb, line 1109
    def useless=(f)
      @useless = f
    end

useless?() click to toggle source

    # File lib/racc/grammar.rb, line 1105
    def useless?
      @useless
    end

|(x) click to toggle source

    # File lib/racc/grammar.rb, line 1073
    def |(x)
      rule() | x.rule
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.