class AdLint::Cpp::PreprocessContext

Attributes

deferred_text_lines[R]
once_set[R]

Public Class Methods

new(phase_ctxt) click to toggle source
# File lib/adlint/cpp/eval.rb, line 840
def initialize(phase_ctxt)
  @phase_ctxt          = phase_ctxt
  @deferred_text_lines = []
  @lexer_stack         = []
  @branch_stack        = []
  @once_set            = Set.new
end

Public Instance Methods

branch_evaluated=(evaluated) click to toggle source
# File lib/adlint/cpp/eval.rb, line 920
def branch_evaluated=(evaluated)
  @branch_stack[-1] = evaluated
end
branch_evaluated?() click to toggle source
# File lib/adlint/cpp/eval.rb, line 924
def branch_evaluated?
  @branch_stack.last
end
include_depth() click to toggle source
# File lib/adlint/cpp/eval.rb, line 928
def include_depth
  @lexer_stack.size
end
macro_table() click to toggle source
# File lib/adlint/cpp/eval.rb, line 876
def macro_table
  @phase_ctxt[:cpp_macro_table]
end
next_token() click to toggle source
# File lib/adlint/cpp/eval.rb, line 897
def next_token
  if top_token
    @lexer_stack.last.next_token
  else
    nil
  end
end
pop_branch() click to toggle source
# File lib/adlint/cpp/eval.rb, line 916
def pop_branch
  @branch_stack.pop
end
push_branch() click to toggle source
# File lib/adlint/cpp/eval.rb, line 912
def push_branch
  @branch_stack.push(false)
end
push_lexer(lexer) click to toggle source
# File lib/adlint/cpp/eval.rb, line 880
def push_lexer(lexer)
  @lexer_stack.push(lexer)
end
skip_group() click to toggle source
# File lib/adlint/cpp/eval.rb, line 905
def skip_group
  until @lexer_stack.last.skip_group
    @lexer_stack.pop
    break if @lexer_stack.empty?
  end
end
source() click to toggle source
# File lib/adlint/cpp/eval.rb, line 864
def source
  @phase_ctxt[:cc1_source]
end
sources() click to toggle source
# File lib/adlint/cpp/eval.rb, line 868
def sources
  @phase_ctxt[:sources]
end
symbol_table() click to toggle source
# File lib/adlint/cpp/eval.rb, line 872
def symbol_table
  @phase_ctxt[:symbol_table]
end
top_token() click to toggle source
# File lib/adlint/cpp/eval.rb, line 884
def top_token
  unless @lexer_stack.empty?
    unless tok = @lexer_stack.last.top_token
      @lexer_stack.pop
      top_token
    else
      tok
    end
  else
    nil
  end
end
tunit_root_fpath() click to toggle source
# File lib/adlint/cpp/eval.rb, line 860
def tunit_root_fpath
  @phase_ctxt[:sources].first.fpath
end