Class: AdLint::Cpp::PreprocessContext
- Inherits:
-
Object
- Object
- AdLint::Cpp::PreprocessContext
- Extended by:
- Forwardable
- Defined in:
- lib/adlint/cpp/eval.rb
Instance Attribute Summary collapse
-
#deferred_text_lines ⇒ Object
readonly
Returns the value of attribute deferred_text_lines.
-
#once_set ⇒ Object
readonly
Returns the value of attribute once_set.
Instance Method Summary collapse
- #branch_evaluated=(evaluated) ⇒ Object
- #branch_evaluated? ⇒ Boolean
- #include_depth ⇒ Object
-
#initialize(phase_ctxt) ⇒ PreprocessContext
constructor
A new instance of PreprocessContext.
- #macro_table ⇒ Object
- #next_token ⇒ Object
- #pop_branch ⇒ Object
- #push_branch ⇒ Object
- #push_lexer(lexer) ⇒ Object
- #skip_group ⇒ Object
- #source ⇒ Object
- #sources ⇒ Object
- #symbol_table ⇒ Object
- #top_token ⇒ Object
- #tunit_root_fpath ⇒ Object
Constructor Details
#initialize(phase_ctxt) ⇒ PreprocessContext
Returns a new instance of PreprocessContext.
840 841 842 843 844 845 846 |
# 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 |
Instance Attribute Details
#deferred_text_lines ⇒ Object (readonly)
Returns the value of attribute deferred_text_lines.
848 849 850 |
# File 'lib/adlint/cpp/eval.rb', line 848 def deferred_text_lines @deferred_text_lines end |
#once_set ⇒ Object (readonly)
Returns the value of attribute once_set.
849 850 851 |
# File 'lib/adlint/cpp/eval.rb', line 849 def once_set @once_set end |
Instance Method Details
#branch_evaluated=(evaluated) ⇒ Object
920 921 922 |
# File 'lib/adlint/cpp/eval.rb', line 920 def branch_evaluated=(evaluated) @branch_stack[-1] = evaluated end |
#branch_evaluated? ⇒ Boolean
924 925 926 |
# File 'lib/adlint/cpp/eval.rb', line 924 def branch_evaluated? @branch_stack.last end |
#include_depth ⇒ Object
928 929 930 |
# File 'lib/adlint/cpp/eval.rb', line 928 def include_depth @lexer_stack.size end |
#macro_table ⇒ Object
876 877 878 |
# File 'lib/adlint/cpp/eval.rb', line 876 def macro_table @phase_ctxt[:cpp_macro_table] end |
#next_token ⇒ Object
897 898 899 900 901 902 903 |
# 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 ⇒ Object
916 917 918 |
# File 'lib/adlint/cpp/eval.rb', line 916 def pop_branch @branch_stack.pop end |
#push_branch ⇒ Object
912 913 914 |
# File 'lib/adlint/cpp/eval.rb', line 912 def push_branch @branch_stack.push(false) end |
#push_lexer(lexer) ⇒ Object
880 881 882 |
# File 'lib/adlint/cpp/eval.rb', line 880 def push_lexer(lexer) @lexer_stack.push(lexer) end |
#skip_group ⇒ Object
905 906 907 908 909 910 |
# 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 ⇒ Object
864 865 866 |
# File 'lib/adlint/cpp/eval.rb', line 864 def source @phase_ctxt[:cc1_source] end |
#sources ⇒ Object
868 869 870 |
# File 'lib/adlint/cpp/eval.rb', line 868 def sources @phase_ctxt[:sources] end |
#symbol_table ⇒ Object
872 873 874 |
# File 'lib/adlint/cpp/eval.rb', line 872 def symbol_table @phase_ctxt[:symbol_table] end |
#top_token ⇒ Object
884 885 886 887 888 889 890 891 892 893 894 895 |
# 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 ⇒ Object
860 861 862 |
# File 'lib/adlint/cpp/eval.rb', line 860 def tunit_root_fpath @phase_ctxt[:sources].first.fpath end |